summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2014-10-16 21:28:40 -0700
committerRasmus Lerdorf <rasmus@php.net>2014-10-16 21:28:40 -0700
commita9d6556971a435f71eabf142d8fb814382f3b6ac (patch)
tree4fecce88bbc1bc3259856eb0314d780184de85eb
parent86674b5837bffe4486714f9661620020ee498f3b (diff)
parent176b8d7ca3aef3a172d8e429627c98e0328d02d8 (diff)
downloadphp-git-a9d6556971a435f71eabf142d8fb814382f3b6ac.tar.gz
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: (1132 commits) Micro optimizations for isset/empty Micro optimization for zend_hash_next_index_insert_new() Fix array_keys() on $GLOBALS Fix procedural finfo calls in methods Fix allocator for 64bit zend_long with 32bit long Use intptr_t for zend_intptr_t typedef Fix format strings in zend_alloc Drop zend_long64 in favor of int64_t Removed deprecated fields NEWS cleanup NEWS removing the NEWS entry as we had to revert this fix for now Revert "Merge branch 'PHP-5.5' into PHP-5.6" Revert "fix TS build" Revert "Merge branch 'PHP-5.4' into PHP-5.5" Revert "Bug #67965: Fix blocking behavior in non-blocking crypto streams" Revert "Bug #41631: Fix regression from first attempt (6569db8)" NEWS Fixed Bug #65171 imagescale() fails Fixed bug #68234 ...
-rw-r--r--.gdbinit43
-rw-r--r--.gitignore34
-rw-r--r--EXTENSIONS31
-rw-r--r--INSTALL64
-rw-r--r--Makefile.global2
-rw-r--r--NEWS15
-rw-r--r--README.GIT-RULES6
-rw-r--r--README.PARAMETER_PARSING_API63
-rw-r--r--README.TESTING2
-rw-r--r--README.UNIX-BUILD-SYSTEM2
-rw-r--r--README.input_filter1
-rw-r--r--TSRM/TSRM.dsp178
-rw-r--r--TSRM/TSRM.h2
-rw-r--r--TSRM/tsrm_nw.c2
-rw-r--r--TSRM/tsrm_nw.h2
-rw-r--r--TSRM/tsrm_strtok_r.c2
-rw-r--r--TSRM/tsrm_strtok_r.h4
-rw-r--r--TSRM/tsrm_win32.c8
-rw-r--r--TSRM/tsrm_win32.h2
-rw-r--r--UPGRADING38
-rw-r--r--UPGRADING.INTERNALS68
-rw-r--r--Zend/Makefile.am2
-rw-r--r--Zend/Zend.dsp622
-rw-r--r--Zend/Zend.m42
-rw-r--r--Zend/ZendTS.dsp748
-rw-r--r--Zend/tests/024.phpt2
-rw-r--r--Zend/tests/034.phpt4
-rw-r--r--Zend/tests/bug27669.phpt2
-rw-r--r--Zend/tests/bug30080.phpt4
-rw-r--r--Zend/tests/bug39304.phpt4
-rw-r--r--Zend/tests/bug39304_2_4.phpt8
-rw-r--r--Zend/tests/bug43450.phpt6
-rw-r--r--Zend/tests/bug44414.phpt2
-rw-r--r--Zend/tests/bug55007.phpt2
-rw-r--r--Zend/tests/bug60099.phpt2
-rw-r--r--Zend/tests/bug67436/bug67436_nohandler.phpt2
-rw-r--r--Zend/tests/bug67633.phpt44
-rw-r--r--Zend/tests/bug67922.phpt19
-rw-r--r--Zend/tests/bug67938.phpt27
-rw-r--r--Zend/tests/bug67985.phpt16
-rw-r--r--Zend/tests/bug68118.phpt21
-rw-r--r--Zend/tests/bug68148.phpt17
-rw-r--r--Zend/tests/bug68162.phpt14
-rw-r--r--Zend/tests/bug68163.phpt13
-rw-r--r--Zend/tests/bug68191.phpt21
-rw-r--r--Zend/tests/bug68215.phpt91
-rw-r--r--Zend/tests/builtin_in_write_context_error1.phpt10
-rw-r--r--Zend/tests/builtin_in_write_context_error2.phpt10
-rw-r--r--Zend/tests/bw_or_assign_with_ref.phpt14
-rw-r--r--Zend/tests/class_name_as_scalar_error_007.phpt10
-rw-r--r--Zend/tests/closure_call.phpt65
-rw-r--r--Zend/tests/concat_002.phpt24
-rw-r--r--Zend/tests/constant_expressions_dynamic.phpt76
-rw-r--r--Zend/tests/constant_expressions_dynamic_class_name_error.phpt11
-rw-r--r--Zend/tests/constant_expressions_invalid_offset_type_error.phpt11
-rw-r--r--Zend/tests/constant_expressions_static_class_name_error.phpt10
-rw-r--r--Zend/tests/constants/dir-constant-includes.phpt8
-rw-r--r--Zend/tests/constants/dir-constant-nested_includes.phpt40
-rwxr-xr-xZend/tests/constants/fixtures/folder1/fixture.inc (renamed from Zend/tests/constants/fixtures/folder1/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder1/subfolder1/fixture.inc (renamed from Zend/tests/constants/fixtures/folder1/subfolder1/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder1/subfolder2/fixture.inc (renamed from Zend/tests/constants/fixtures/folder1/subfolder2/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder1/subfolder3/fixture.inc (renamed from Zend/tests/constants/fixtures/folder1/subfolder3/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder1/subfolder4/fixture.inc (renamed from Zend/tests/constants/fixtures/folder1/subfolder4/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder2/fixture.inc (renamed from Zend/tests/constants/fixtures/folder2/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder2/subfolder1/fixture.inc (renamed from Zend/tests/constants/fixtures/folder2/subfolder1/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder2/subfolder2/fixture.inc (renamed from Zend/tests/constants/fixtures/folder2/subfolder2/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder2/subfolder3/fixture.inc (renamed from Zend/tests/constants/fixtures/folder2/subfolder3/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder2/subfolder4/fixture.inc (renamed from Zend/tests/constants/fixtures/folder2/subfolder4/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder3/fixture.inc (renamed from Zend/tests/constants/fixtures/folder3/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder3/subfolder1/fixture.inc (renamed from Zend/tests/constants/fixtures/folder3/subfolder1/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder3/subfolder2/fixture.inc (renamed from Zend/tests/constants/fixtures/folder3/subfolder2/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder3/subfolder3/fixture.inc (renamed from Zend/tests/constants/fixtures/folder3/subfolder3/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder3/subfolder4/fixture.inc (renamed from Zend/tests/constants/fixtures/folder3/subfolder4/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder4/fixture.inc (renamed from Zend/tests/constants/fixtures/folder4/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder4/subfolder1/fixture.inc (renamed from Zend/tests/constants/fixtures/folder4/subfolder1/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder4/subfolder2/fixture.inc (renamed from Zend/tests/constants/fixtures/folder4/subfolder2/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder4/subfolder3/fixture.inc (renamed from Zend/tests/constants/fixtures/folder4/subfolder3/fixture.php)0
-rwxr-xr-xZend/tests/constants/fixtures/folder4/subfolder4/fixture.inc (renamed from Zend/tests/constants/fixtures/folder4/subfolder4/fixture.php)0
-rw-r--r--Zend/tests/debug_backtrace_with_include_and_this.phpt39
-rw-r--r--Zend/tests/declare_001.phpt5
-rw-r--r--Zend/tests/declare_003.phpt5
-rw-r--r--Zend/tests/dereference_002.phpt2
-rw-r--r--Zend/tests/double_array_cast.phpt18
-rw-r--r--Zend/tests/duplicate_label_error.phpt12
-rw-r--r--Zend/tests/errmsg_014.phpt17
-rw-r--r--Zend/tests/eval_parse_error_with_doc_comment.phpt15
-rw-r--r--Zend/tests/exception_with_by_ref_message.phpt21
-rw-r--r--Zend/tests/foreach_list_002.phpt10
-rw-r--r--Zend/tests/gc_029_zts.phpt2
-rw-r--r--Zend/tests/gc_033.phpt30
-rw-r--r--Zend/tests/incdec_ref_property.phpt27
-rw-r--r--Zend/tests/int_special_values.phpt37
-rw-r--r--Zend/tests/isset_003.phpt2
-rw-r--r--Zend/tests/isset_003_2_4.phpt2
-rw-r--r--Zend/tests/isset_func_error.phpt2
-rw-r--r--Zend/tests/line_const_in_array.phpt21
-rw-r--r--Zend/tests/list_005.phpt22
-rw-r--r--Zend/tests/list_006.phpt4
-rw-r--r--Zend/tests/list_007.phpt5
-rw-r--r--Zend/tests/list_destructuring_to_special_variables.phpt49
-rw-r--r--Zend/tests/magic_const_in_global_scope.phpt26
-rw-r--r--Zend/tests/methods-on-non-objects-args-catch.phpt18
-rwxr-xr-xZend/tests/methods-on-non-objects-array-access.phpt18
-rwxr-xr-xZend/tests/methods-on-non-objects-array-creation.phpt35
-rwxr-xr-xZend/tests/methods-on-non-objects-as-arg.phpt47
-rw-r--r--Zend/tests/methods-on-non-objects-call-user-func.phpt13
-rw-r--r--Zend/tests/methods-on-non-objects-catch.phpt18
-rw-r--r--Zend/tests/methods-on-non-objects-chain.phpt22
-rwxr-xr-xZend/tests/methods-on-non-objects-concat.phpt18
-rwxr-xr-xZend/tests/methods-on-non-objects-dynamic.phpt23
-rw-r--r--Zend/tests/methods-on-non-objects-eval.phpt18
-rwxr-xr-xZend/tests/methods-on-non-objects-in-echo.phpt18
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-dyn.phpt37
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-new.phpt37
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-nonct.phpt43
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-ns.phpt26
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-static.phpt33
-rw-r--r--Zend/tests/methods-on-non-objects-nested-calls.phpt47
-rwxr-xr-xZend/tests/methods-on-non-objects-nested.inc4
-rwxr-xr-xZend/tests/methods-on-non-objects-return-unused.phpt17
-rw-r--r--Zend/tests/methods-on-non-objects-throw.phpt29
-rw-r--r--Zend/tests/methods-on-non-objects-usort.phpt43
-rw-r--r--Zend/tests/methods-on-non-objects.phpt12
-rw-r--r--Zend/tests/object_array_cast.phpt47
-rw-r--r--Zend/tests/special_name_error1.phpt10
-rw-r--r--Zend/tests/special_name_error2.phpt10
-rw-r--r--Zend/tests/special_name_error3.phpt10
-rw-r--r--Zend/tests/strlen.phpt51
-rw-r--r--Zend/tests/this_as_lexical_var_error.phpt14
-rw-r--r--Zend/tests/use_const/no_global_fallback.phpt3
-rw-r--r--Zend/tests/varSyntax/globalNonSimpleVariableError.phpt10
-rw-r--r--Zend/tests/varSyntax/indirectFcall.phpt55
-rw-r--r--Zend/tests/varSyntax/issetOnTemp.phpt26
-rw-r--r--Zend/tests/varSyntax/newVariable.phpt39
-rw-r--r--Zend/tests/varSyntax/parenthesesDeref.phpt20
-rw-r--r--Zend/tests/varSyntax/propertyOfStringError.phpt10
-rw-r--r--Zend/tests/varSyntax/staticMember.phpt39
-rw-r--r--Zend/tests/varSyntax/tempDimFetchByRefError.phpt11
-rw-r--r--Zend/tests/varSyntax/tempPropFetchByRefError.phpt11
-rw-r--r--Zend/tests/varSyntax/writeToTempExpr.phpt10
-rw-r--r--Zend/tests/varvars_by_ref.phpt17
-rw-r--r--Zend/zend.c282
-rw-r--r--Zend/zend.h665
-rw-r--r--Zend/zend_API.c525
-rw-r--r--Zend/zend_API.h197
-rw-r--r--Zend/zend_alloc.c4066
-rw-r--r--Zend/zend_alloc.h191
-rw-r--r--Zend/zend_alloc_sizes.h46
-rw-r--r--Zend/zend_arena.h10
-rw-r--r--Zend/zend_ast.c526
-rw-r--r--Zend/zend_ast.h250
-rw-r--r--Zend/zend_builtin_functions.c385
-rw-r--r--Zend/zend_closures.c92
-rw-r--r--Zend/zend_compile.c10622
-rw-r--r--Zend/zend_compile.h449
-rw-r--r--Zend/zend_constants.c98
-rw-r--r--Zend/zend_constants.h14
-rw-r--r--Zend/zend_dynamic_array.c72
-rw-r--r--Zend/zend_exceptions.c445
-rw-r--r--Zend/zend_exceptions.h12
-rw-r--r--Zend/zend_execute.c885
-rw-r--r--Zend/zend_execute.h165
-rw-r--r--Zend/zend_execute_API.c212
-rw-r--r--Zend/zend_extensions.c10
-rw-r--r--Zend/zend_extensions.h2
-rw-r--r--Zend/zend_gc.c26
-rw-r--r--Zend/zend_gc.h19
-rw-r--r--Zend/zend_generators.c68
-rw-r--r--Zend/zend_generators.h2
-rw-r--r--Zend/zend_globals.h53
-rw-r--r--Zend/zend_hash.c562
-rw-r--r--Zend/zend_hash.h221
-rw-r--r--Zend/zend_highlight.c14
-rw-r--r--Zend/zend_indent.c8
-rw-r--r--Zend/zend_inheritance.c1559
-rw-r--r--Zend/zend_inheritance.h (renamed from Zend/zend_dynamic_array.h)31
-rw-r--r--Zend/zend_ini.c208
-rw-r--r--Zend/zend_ini.h51
-rw-r--r--Zend/zend_ini_parser.y62
-rw-r--r--Zend/zend_ini_scanner.c3669
-rw-r--r--Zend/zend_ini_scanner.h1
-rw-r--r--Zend/zend_ini_scanner.l69
-rw-r--r--Zend/zend_int.h145
-rw-r--r--Zend/zend_interfaces.c24
-rw-r--r--Zend/zend_interfaces.h8
-rw-r--r--Zend/zend_iterators.c27
-rw-r--r--Zend/zend_iterators.h11
-rw-r--r--Zend/zend_language_parser.y1471
-rw-r--r--Zend/zend_language_scanner.c7344
-rw-r--r--Zend/zend_language_scanner.l386
-rw-r--r--Zend/zend_list.c2
-rw-r--r--Zend/zend_llist.c38
-rw-r--r--Zend/zend_llist.h2
-rw-r--r--Zend/zend_long.h133
-rw-r--r--Zend/zend_multiply.h168
-rw-r--r--Zend/zend_object_handlers.c140
-rw-r--r--Zend/zend_object_handlers.h15
-rw-r--r--Zend/zend_objects.c4
-rw-r--r--Zend/zend_objects_API.c108
-rw-r--r--Zend/zend_objects_API.h24
-rw-r--r--Zend/zend_opcode.c161
-rw-r--r--Zend/zend_operators.c999
-rw-r--r--Zend/zend_operators.h511
-rw-r--r--Zend/zend_portability.h399
-rw-r--r--Zend/zend_ptr_stack.h2
-rw-r--r--Zend/zend_qsort.c2
-rw-r--r--Zend/zend_smart_str.h125
-rw-r--r--Zend/zend_smart_str_public.h (renamed from ext/standard/php_smart_str_public.h)10
-rw-r--r--Zend/zend_static_allocator.c84
-rw-r--r--Zend/zend_static_allocator.h55
-rw-r--r--Zend/zend_stream.c6
-rw-r--r--Zend/zend_stream.h6
-rw-r--r--Zend/zend_string.c30
-rw-r--r--Zend/zend_string.h114
-rw-r--r--Zend/zend_ts_hash.c10
-rw-r--r--Zend/zend_ts_hash.h20
-rw-r--r--Zend/zend_types.h304
-rw-r--r--Zend/zend_variables.c30
-rw-r--r--Zend/zend_variables.h8
-rw-r--r--Zend/zend_virtual_cwd.c70
-rw-r--r--Zend/zend_virtual_cwd.h22
-rw-r--r--Zend/zend_vm_def.h1677
-rw-r--r--Zend/zend_vm_execute.h13188
-rw-r--r--Zend/zend_vm_execute.skl7
-rw-r--r--Zend/zend_vm_gen.php62
-rw-r--r--Zend/zend_vm_opcodes.c15
-rw-r--r--Zend/zend_vm_opcodes.h8
-rw-r--r--acinclude.m42
-rw-r--r--build/build.mk4
-rw-r--r--build/build2.mk2
-rwxr-xr-xbuild/buildcheck.sh2
-rw-r--r--build/libtool.m412
-rw-r--r--build/mkdep.awk2
-rw-r--r--config.guess6
-rw-r--r--configure.in53
-rw-r--r--ext/bcmath/bcmath.c58
-rw-r--r--ext/bcmath/libbcmath/src/num2str.c4
-rw-r--r--ext/bcmath/php_bcmath.h4
-rw-r--r--ext/bz2/bz2.c47
-rw-r--r--ext/bz2/bz2.dsp112
-rw-r--r--ext/bz2/bz2_filter.c30
-rw-r--r--ext/bz2/php_bz2.h2
-rw-r--r--ext/calendar/cal_unix.c10
-rw-r--r--ext/calendar/calendar.c132
-rw-r--r--ext/calendar/dow.c2
-rw-r--r--ext/calendar/easter.c12
-rw-r--r--ext/calendar/french.c6
-rw-r--r--ext/calendar/gregor.c6
-rw-r--r--ext/calendar/jewish.c44
-rw-r--r--ext/calendar/julian.c10
-rw-r--r--ext/calendar/sdncal.h20
-rw-r--r--ext/com_dotnet/com_com.c49
-rw-r--r--ext/com_dotnet/com_dotnet.c6
-rw-r--r--ext/com_dotnet/com_extension.c10
-rw-r--r--ext/com_dotnet/com_handlers.c40
-rw-r--r--ext/com_dotnet/com_iterator.c8
-rw-r--r--ext/com_dotnet/com_misc.c4
-rw-r--r--ext/com_dotnet/com_olechar.c6
-rw-r--r--ext/com_dotnet/com_persist.c14
-rw-r--r--ext/com_dotnet/com_saproxy.c42
-rw-r--r--ext/com_dotnet/com_typeinfo.c17
-rw-r--r--ext/com_dotnet/com_variant.c72
-rw-r--r--ext/com_dotnet/com_wrapper.c56
-rw-r--r--ext/com_dotnet/php_com_dotnet.h2
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h12
-rw-r--r--ext/ctype/ctype.c20
-rw-r--r--ext/ctype/ctype.dsp107
-rw-r--r--ext/ctype/php_ctype.h2
-rw-r--r--ext/curl/curl.dsp190
-rw-r--r--ext/curl/curl_file.c6
-rw-r--r--ext/curl/interface.c201
-rw-r--r--ext/curl/multi.c40
-rw-r--r--ext/curl/php_curl.h6
-rw-r--r--ext/curl/share.c12
-rw-r--r--ext/curl/tests/bug68089.phpt18
-rw-r--r--ext/curl/tests/check_win_config.phpt4
-rw-r--r--ext/date/lib/astro.c2
-rw-r--r--ext/date/lib/dow.c2
-rw-r--r--ext/date/lib/interval.c2
-rw-r--r--ext/date/lib/parse_date.c24
-rw-r--r--ext/date/lib/parse_date.re22
-rw-r--r--ext/date/lib/parse_iso_intervals.c8
-rw-r--r--ext/date/lib/parse_iso_intervals.re6
-rw-r--r--ext/date/lib/parse_tz.c14
-rw-r--r--ext/date/lib/timelib.c15
-rw-r--r--ext/date/lib/timelib.h13
-rw-r--r--ext/date/lib/timelib_structs.h24
-rw-r--r--ext/date/lib/timezonedb.h1447
-rw-r--r--ext/date/lib/tm2unixtime.c2
-rw-r--r--ext/date/lib/unixtime2tm.c2
-rw-r--r--ext/date/php_date.c429
-rw-r--r--ext/date/php_date.h6
-rw-r--r--ext/date/tests/014.phpt4
-rw-r--r--ext/date/tests/68062.phpt13
-rw-r--r--ext/date/tests/DateTimeZone_getOffset_variation1.phpt56
-rw-r--r--ext/date/tests/bug67118.phpt5
-rw-r--r--ext/date/tests/bug67118_2.phpt11
-rw-r--r--ext/date/tests/timezone_offset_get_error.phpt46
-rw-r--r--ext/date/tests/timezone_offset_get_variation1.phpt92
-rw-r--r--ext/date/tests/timezone_offset_get_variation2.phpt92
-rw-r--r--ext/dba/dba.c38
-rw-r--r--ext/dba/dba.dsp213
-rw-r--r--ext/dba/dba_cdb.c2
-rw-r--r--ext/dba/dba_db1.c6
-rw-r--r--ext/dba/dba_db2.c6
-rw-r--r--ext/dba/dba_db3.c6
-rw-r--r--ext/dba/dba_db4.c6
-rw-r--r--ext/dba/dba_dbm.c6
-rw-r--r--ext/dba/dba_flatfile.c2
-rw-r--r--ext/dba/dba_gdbm.c6
-rw-r--r--ext/dba/dba_inifile.c2
-rw-r--r--ext/dba/dba_ndbm.c6
-rw-r--r--ext/dba/dba_qdbm.c2
-rw-r--r--ext/dba/dba_tcadb.c2
-rw-r--r--ext/dba/libcdb/cdb.c2
-rw-r--r--ext/dba/libcdb/cdb.h2
-rw-r--r--ext/dba/libcdb/cdb_make.c2
-rw-r--r--ext/dba/libcdb/cdb_make.h2
-rw-r--r--ext/dba/libcdb/uint32.c2
-rw-r--r--ext/dba/libcdb/uint32.h2
-rw-r--r--ext/dba/libflatfile/flatfile.c2
-rw-r--r--ext/dba/libflatfile/flatfile.h2
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dba/libinifile/inifile.h2
-rw-r--r--ext/dba/php_dba.h4
-rw-r--r--ext/dba/php_tcadb.h2
-rw-r--r--ext/dom/attr.c12
-rw-r--r--ext/dom/cdatasection.c4
-rw-r--r--ext/dom/characterdata.c42
-rw-r--r--ext/dom/comment.c4
-rw-r--r--ext/dom/document.c128
-rw-r--r--ext/dom/documentfragment.c6
-rw-r--r--ext/dom/documenttype.c4
-rw-r--r--ext/dom/dom.dsp250
-rw-r--r--ext/dom/dom_ce.h2
-rw-r--r--ext/dom/dom_fe.h2
-rw-r--r--ext/dom/dom_iterators.c10
-rw-r--r--ext/dom/dom_properties.h4
-rw-r--r--ext/dom/domconfiguration.c2
-rw-r--r--ext/dom/domerror.c2
-rw-r--r--ext/dom/domerrorhandler.c2
-rw-r--r--ext/dom/domexception.c2
-rw-r--r--ext/dom/domimplementation.c30
-rw-r--r--ext/dom/domimplementationlist.c2
-rw-r--r--ext/dom/domimplementationsource.c2
-rw-r--r--ext/dom/domlocator.c2
-rw-r--r--ext/dom/domstringlist.c2
-rw-r--r--ext/dom/element.c40
-rw-r--r--ext/dom/entity.c4
-rw-r--r--ext/dom/entityreference.c6
-rw-r--r--ext/dom/namednodemap.c26
-rw-r--r--ext/dom/namelist.c2
-rw-r--r--ext/dom/node.c93
-rw-r--r--ext/dom/nodelist.c9
-rw-r--r--ext/dom/notation.c2
-rw-r--r--ext/dom/php_dom.c136
-rw-r--r--ext/dom/php_dom.h4
-rw-r--r--ext/dom/processinginstruction.c11
-rw-r--r--ext/dom/string_extend.c2
-rw-r--r--ext/dom/tests/bug67949.phpt87
-rw-r--r--ext/dom/tests/node_textcontent.phpt29
-rw-r--r--ext/dom/text.c10
-rw-r--r--ext/dom/typeinfo.c2
-rw-r--r--ext/dom/userdatahandler.c2
-rw-r--r--ext/dom/xml_common.h5
-rw-r--r--ext/dom/xpath.c30
-rw-r--r--ext/enchant/enchant.c40
-rw-r--r--ext/ereg/ereg.c44
-rw-r--r--ext/ereg/php_ereg.h2
-rw-r--r--ext/ereg/php_regex.h2
-rw-r--r--ext/ereg/regex/regex.dsp106
-rw-r--r--ext/ereg/regex/regex.dsw29
-rw-r--r--ext/exif/exif.c59
-rw-r--r--ext/exif/exif.dsp113
-rw-r--r--ext/exif/php_exif.h2
-rwxr-xr-xext/exif/tests/bug68113.jpgbin0 -> 368 bytes
-rw-r--r--ext/exif/tests/bug68113.phpt17
-rwxr-xr-xext/ext_skel4
-rw-r--r--ext/ext_skel_win32.php17
-rw-r--r--ext/fileinfo/fileinfo.c54
-rw-r--r--ext/fileinfo/libmagic/apprentice.c8
-rw-r--r--ext/fileinfo/libmagic/cdf.c10
-rw-r--r--ext/fileinfo/libmagic/compress.c4
-rw-r--r--ext/fileinfo/libmagic/elfclass.h6
-rw-r--r--ext/fileinfo/libmagic/file.h3
-rw-r--r--ext/fileinfo/libmagic/fsmagic.c2
-rw-r--r--ext/fileinfo/libmagic/funcs.c11
-rw-r--r--ext/fileinfo/libmagic/magic.c6
-rw-r--r--ext/fileinfo/libmagic/readelf.c52
-rw-r--r--ext/fileinfo/libmagic/softmagic.c20
-rw-r--r--ext/fileinfo/php_fileinfo.h2
-rw-r--r--ext/fileinfo/tests/finfo_buffer_basic.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_buffer_variation1.phpt2
-rw-r--r--ext/fileinfo/tests/precedural_finfo_in_method.phpt18
-rw-r--r--ext/filter/callback_filter.c2
-rw-r--r--ext/filter/filter.c225
-rw-r--r--ext/filter/filter_private.h13
-rw-r--r--ext/filter/logical_filters.c104
-rw-r--r--ext/filter/php_filter.h8
-rw-r--r--ext/filter/sanitizing_filters.c48
-rw-r--r--ext/filter/tests/filter_var_array_with_ref.phpt23
-rw-r--r--ext/ftp/ftp.c40
-rw-r--r--ext/ftp/ftp.h18
-rw-r--r--ext/ftp/php_ftp.c170
-rw-r--r--ext/ftp/php_ftp.h2
-rw-r--r--ext/gd/gd.c699
-rw-r--r--ext/gd/gd.dsp600
-rw-r--r--ext/gd/gd_ctx.c10
-rw-r--r--ext/gd/libgd/xbm.c2
-rw-r--r--ext/gd/php_gd.h2
-rw-r--r--ext/gd/tests/bug48801_1.phpt4
-rw-r--r--ext/gd/tests/imagegd2_nullbyte_injection.phpt31
-rw-r--r--ext/gd/tests/imagegd_nullbyte_injection.phpt31
-rw-r--r--ext/gd/tests/imagegif_nullbyte_injection.phpt38
-rw-r--r--ext/gd/tests/imagejpeg_nullbyte_injection.phpt38
-rw-r--r--ext/gd/tests/imagepng_nullbyte_injection.phpt38
-rw-r--r--ext/gd/tests/imagewbmp_nullbyte_injection.phpt38
-rw-r--r--ext/gd/tests/imagewebp_nullbyte_injection.phpt38
-rw-r--r--ext/gettext/gettext.c36
-rw-r--r--ext/gettext/gettext.dsp113
-rw-r--r--ext/gettext/php_gettext.h2
-rw-r--r--ext/gmp/bug67917.phpt17
-rw-r--r--ext/gmp/config.m413
-rw-r--r--ext/gmp/gmp.c530
-rw-r--r--ext/gmp/php_gmp.h15
-rw-r--r--ext/gmp/tests/001.phpt21
-rw-r--r--ext/gmp/tests/bug50175.phpt18
-rw-r--r--ext/gmp/tests/bug50283.phpt1
-rw-r--r--ext/gmp/tests/gmp_abs.phpt (renamed from ext/gmp/tests/013.phpt)0
-rw-r--r--ext/gmp/tests/gmp_and.phpt (renamed from ext/gmp/tests/029.phpt)0
-rw-r--r--ext/gmp/tests/gmp_clrbit.phpt (renamed from ext/gmp/tests/034.phpt)5
-rw-r--r--ext/gmp/tests/gmp_cmp.phpt (renamed from ext/gmp/tests/026.phpt)0
-rw-r--r--ext/gmp/tests/gmp_com.phpt (renamed from ext/gmp/tests/031.phpt)0
-rw-r--r--ext/gmp/tests/gmp_div_q.phpt (renamed from ext/gmp/tests/009.phpt)0
-rw-r--r--ext/gmp/tests/gmp_div_qr.phpt (renamed from ext/gmp/tests/007.phpt)17
-rw-r--r--ext/gmp/tests/gmp_div_r.phpt (renamed from ext/gmp/tests/008.phpt)0
-rw-r--r--ext/gmp/tests/gmp_divexact.phpt (renamed from ext/gmp/tests/011.phpt)0
-rw-r--r--ext/gmp/tests/gmp_export.phpt80
-rw-r--r--ext/gmp/tests/gmp_fact.phpt (renamed from ext/gmp/tests/014.phpt)0
-rw-r--r--ext/gmp/tests/gmp_gcd.phpt (renamed from ext/gmp/tests/021.phpt)0
-rw-r--r--ext/gmp/tests/gmp_gcdext.phpt (renamed from ext/gmp/tests/022.phpt)0
-rw-r--r--ext/gmp/tests/gmp_hamdist.phpt (renamed from ext/gmp/tests/036.phpt)0
-rw-r--r--ext/gmp/tests/gmp_import.phpt91
-rw-r--r--ext/gmp/tests/gmp_init.phpt (renamed from ext/gmp/tests/040.phpt)0
-rw-r--r--ext/gmp/tests/gmp_intval.phpt (renamed from ext/gmp/tests/004.phpt)0
-rw-r--r--ext/gmp/tests/gmp_invert.phpt (renamed from ext/gmp/tests/023.phpt)0
-rw-r--r--ext/gmp/tests/gmp_jacobi.phpt (renamed from ext/gmp/tests/024.phpt)0
-rw-r--r--ext/gmp/tests/gmp_legendre.phpt (renamed from ext/gmp/tests/025.phpt)0
-rw-r--r--ext/gmp/tests/gmp_mod.phpt (renamed from ext/gmp/tests/010.phpt)0
-rw-r--r--ext/gmp/tests/gmp_neg.phpt (renamed from ext/gmp/tests/012.phpt)0
-rw-r--r--ext/gmp/tests/gmp_or.phpt (renamed from ext/gmp/tests/030.phpt)0
-rw-r--r--ext/gmp/tests/gmp_perfect_square.phpt (renamed from ext/gmp/tests/019.phpt)0
-rw-r--r--ext/gmp/tests/gmp_php_int_max.phpt29
-rw-r--r--ext/gmp/tests/gmp_popcount.phpt (renamed from ext/gmp/tests/035.phpt)0
-rw-r--r--ext/gmp/tests/gmp_pow.phpt (renamed from ext/gmp/tests/015.phpt)0
-rw-r--r--ext/gmp/tests/gmp_pown.phpt (renamed from ext/gmp/tests/016.phpt)9
-rw-r--r--ext/gmp/tests/gmp_prob_prime.phpt (renamed from ext/gmp/tests/020.phpt)0
-rw-r--r--ext/gmp/tests/gmp_random.phpt (renamed from ext/gmp/tests/028.phpt)0
-rw-r--r--ext/gmp/tests/gmp_random_bits.phpt45
-rw-r--r--ext/gmp/tests/gmp_random_range.phpt81
-rw-r--r--ext/gmp/tests/gmp_remroot.phpt (renamed from ext/gmp/tests/041.phpt)49
-rw-r--r--ext/gmp/tests/gmp_root.phpt58
-rw-r--r--ext/gmp/tests/gmp_scan0.phpt (renamed from ext/gmp/tests/037.phpt)0
-rw-r--r--ext/gmp/tests/gmp_scan1.phpt (renamed from ext/gmp/tests/038.phpt)0
-rw-r--r--ext/gmp/tests/gmp_setbit.phpt (renamed from ext/gmp/tests/033.phpt)5
-rw-r--r--ext/gmp/tests/gmp_sign.phpt (renamed from ext/gmp/tests/027.phpt)0
-rw-r--r--ext/gmp/tests/gmp_sqrt.phpt (renamed from ext/gmp/tests/017.phpt)0
-rw-r--r--ext/gmp/tests/gmp_sqrtrem.phpt (renamed from ext/gmp/tests/018.phpt)0
-rw-r--r--ext/gmp/tests/gmp_strval.phpt (renamed from ext/gmp/tests/005.phpt)0
-rw-r--r--ext/gmp/tests/gmp_sub.phpt (renamed from ext/gmp/tests/006.phpt)0
-rw-r--r--ext/gmp/tests/gmp_testbit.phpt (renamed from ext/gmp/tests/039.phpt)5
-rw-r--r--ext/gmp/tests/gmp_xor.phpt (renamed from ext/gmp/tests/032.phpt)0
-rw-r--r--ext/gmp/tests/overloading.phpt60
-rw-r--r--ext/hash/hash.c117
-rw-r--r--ext/hash/hash_adler32.c2
-rw-r--r--ext/hash/hash_crc32.c2
-rw-r--r--ext/hash/hash_fnv.c2
-rw-r--r--ext/hash/hash_gost.c6
-rw-r--r--ext/hash/hash_haval.c18
-rw-r--r--ext/hash/hash_joaat.c2
-rw-r--r--ext/hash/hash_md.c10
-rw-r--r--ext/hash/hash_ripemd.c18
-rw-r--r--ext/hash/hash_sha.c20
-rw-r--r--ext/hash/hash_snefru.c6
-rw-r--r--ext/hash/hash_tiger.c12
-rw-r--r--ext/hash/hash_whirlpool.c8
-rw-r--r--ext/hash/php_hash.h6
-rw-r--r--ext/hash/php_hash_adler32.h2
-rw-r--r--ext/hash/php_hash_crc32.h2
-rw-r--r--ext/hash/php_hash_crc32_tables.h2
-rw-r--r--ext/hash/php_hash_fnv.h2
-rw-r--r--ext/hash/php_hash_gost.h2
-rw-r--r--ext/hash/php_hash_haval.h2
-rw-r--r--ext/hash/php_hash_joaat.h2
-rw-r--r--ext/hash/php_hash_md.h2
-rw-r--r--ext/hash/php_hash_ripemd.h2
-rw-r--r--ext/hash/php_hash_sha.h2
-rw-r--r--ext/hash/php_hash_snefru.h2
-rw-r--r--ext/hash/php_hash_snefru_tables.h2
-rw-r--r--ext/hash/php_hash_tiger.h2
-rw-r--r--ext/hash/php_hash_tiger_tables.h2
-rw-r--r--ext/hash/php_hash_whirlpool.h2
-rw-r--r--ext/hash/php_hash_whirlpool_tables.h2
-rw-r--r--ext/iconv/iconv.c251
-rw-r--r--ext/iconv/iconv.dsp107
-rw-r--r--ext/iconv/php_iconv.h2
-rw-r--r--ext/imap/imap.dsp176
-rw-r--r--ext/imap/php_imap.c386
-rw-r--r--ext/imap/php_imap.h2
-rw-r--r--ext/interbase/ibase_blobs.c26
-rw-r--r--ext/interbase/ibase_events.c12
-rw-r--r--ext/interbase/ibase_query.c58
-rw-r--r--ext/interbase/ibase_service.c116
-rw-r--r--ext/interbase/interbase.c42
-rw-r--r--ext/interbase/interbase.dsp135
-rw-r--r--ext/interbase/php_ibase_includes.h5
-rw-r--r--ext/interbase/php_ibase_udf.c17
-rw-r--r--ext/interbase/php_interbase.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp54
-rw-r--r--ext/intl/breakiterator/breakiterator_class.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp14
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.cpp32
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.cpp4
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.cpp4
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp10
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.h2
-rw-r--r--ext/intl/calendar/calendar_class.cpp94
-rw-r--r--ext/intl/calendar/calendar_class.h2
-rw-r--r--ext/intl/calendar/calendar_methods.cpp94
-rw-r--r--ext/intl/calendar/calendar_methods.h2
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp10
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.h2
-rw-r--r--ext/intl/collator/collator.c8
-rw-r--r--ext/intl/collator/collator.h2
-rw-r--r--ext/intl/collator/collator_attr.c18
-rw-r--r--ext/intl/collator/collator_attr.h2
-rw-r--r--ext/intl/collator/collator_class.c2
-rw-r--r--ext/intl/collator/collator_class.h2
-rw-r--r--ext/intl/collator/collator_compare.c8
-rw-r--r--ext/intl/collator/collator_compare.h2
-rw-r--r--ext/intl/collator/collator_convert.c40
-rw-r--r--ext/intl/collator/collator_convert.h2
-rw-r--r--ext/intl/collator/collator_create.c4
-rw-r--r--ext/intl/collator/collator_create.h2
-rw-r--r--ext/intl/collator/collator_error.c4
-rw-r--r--ext/intl/collator/collator_error.h2
-rw-r--r--ext/intl/collator/collator_is_numeric.c24
-rw-r--r--ext/intl/collator/collator_is_numeric.h4
-rw-r--r--ext/intl/collator/collator_locale.c6
-rw-r--r--ext/intl/collator/collator_locale.h2
-rw-r--r--ext/intl/collator/collator_sort.c34
-rw-r--r--ext/intl/collator/collator_sort.h2
-rw-r--r--ext/intl/common/common_date.cpp16
-rw-r--r--ext/intl/common/common_date.h2
-rw-r--r--ext/intl/common/common_enum.cpp4
-rw-r--r--ext/intl/common/common_enum.h2
-rw-r--r--ext/intl/common/common_error.c14
-rw-r--r--ext/intl/common/common_error.h2
-rw-r--r--ext/intl/converter/converter.c100
-rw-r--r--ext/intl/converter/converter.h2
-rw-r--r--ext/intl/dateformat/dateformat.c12
-rw-r--r--ext/intl/dateformat/dateformat.h2
-rw-r--r--ext/intl/dateformat/dateformat_attr.c12
-rw-r--r--ext/intl/dateformat/dateformat_attr.h2
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.cpp6
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.h2
-rw-r--r--ext/intl/dateformat/dateformat_class.c2
-rw-r--r--ext/intl/dateformat/dateformat_class.h2
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp14
-rw-r--r--ext/intl/dateformat/dateformat_create.h2
-rw-r--r--ext/intl/dateformat/dateformat_data.c2
-rw-r--r--ext/intl/dateformat/dateformat_data.h2
-rw-r--r--ext/intl/dateformat/dateformat_format.c14
-rw-r--r--ext/intl/dateformat/dateformat_format.h2
-rw-r--r--ext/intl/dateformat/dateformat_format_object.cpp22
-rw-r--r--ext/intl/dateformat/dateformat_format_object.h2
-rw-r--r--ext/intl/dateformat/dateformat_helpers.cpp14
-rw-r--r--ext/intl/dateformat/dateformat_helpers.h4
-rw-r--r--ext/intl/dateformat/dateformat_parse.c36
-rw-r--r--ext/intl/dateformat/dateformat_parse.h2
-rw-r--r--ext/intl/formatter/formatter.c8
-rw-r--r--ext/intl/formatter/formatter.h2
-rw-r--r--ext/intl/formatter/formatter_attr.c40
-rw-r--r--ext/intl/formatter/formatter_attr.h2
-rw-r--r--ext/intl/formatter/formatter_class.c2
-rw-r--r--ext/intl/formatter/formatter_class.h2
-rw-r--r--ext/intl/formatter/formatter_data.c2
-rw-r--r--ext/intl/formatter/formatter_data.h2
-rw-r--r--ext/intl/formatter/formatter_format.c24
-rw-r--r--ext/intl/formatter/formatter_format.h2
-rw-r--r--ext/intl/formatter/formatter_main.c10
-rw-r--r--ext/intl/formatter/formatter_main.h2
-rw-r--r--ext/intl/formatter/formatter_parse.c30
-rw-r--r--ext/intl/formatter/formatter_parse.h2
-rw-r--r--ext/intl/grapheme/grapheme.h2
-rw-r--r--ext/intl/grapheme/grapheme_string.c83
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/grapheme/grapheme_util.h4
-rw-r--r--ext/intl/idn/idn.c64
-rw-r--r--ext/intl/idn/idn.h2
-rw-r--r--ext/intl/intl_common.h4
-rw-r--r--ext/intl/intl_convert.c2
-rw-r--r--ext/intl/intl_convert.h2
-rw-r--r--ext/intl/intl_convertcpp.cpp2
-rw-r--r--ext/intl/intl_convertcpp.h2
-rw-r--r--ext/intl/intl_cppshims.h2
-rw-r--r--ext/intl/intl_data.h2
-rw-r--r--ext/intl/intl_error.c6
-rw-r--r--ext/intl/intl_error.h4
-rw-r--r--ext/intl/locale/locale.c6
-rw-r--r--ext/intl/locale/locale.h2
-rw-r--r--ext/intl/locale/locale_class.c2
-rw-r--r--ext/intl/locale/locale_class.h2
-rw-r--r--ext/intl/locale/locale_methods.c58
-rw-r--r--ext/intl/locale/locale_methods.h2
-rw-r--r--ext/intl/msgformat/msgformat.c6
-rw-r--r--ext/intl/msgformat/msgformat.h2
-rw-r--r--ext/intl/msgformat/msgformat_attr.c4
-rw-r--r--ext/intl/msgformat/msgformat_attr.h2
-rw-r--r--ext/intl/msgformat/msgformat_class.c2
-rw-r--r--ext/intl/msgformat/msgformat_class.h2
-rw-r--r--ext/intl/msgformat/msgformat_data.c2
-rw-r--r--ext/intl/msgformat/msgformat_data.h4
-rw-r--r--ext/intl/msgformat/msgformat_format.c6
-rw-r--r--ext/intl/msgformat/msgformat_format.h2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp46
-rw-r--r--ext/intl/msgformat/msgformat_helpers.h2
-rw-r--r--ext/intl/msgformat/msgformat_parse.c12
-rw-r--r--ext/intl/msgformat/msgformat_parse.h2
-rw-r--r--ext/intl/normalizer/normalizer.c8
-rw-r--r--ext/intl/normalizer/normalizer.h2
-rw-r--r--ext/intl/normalizer/normalizer_class.c2
-rw-r--r--ext/intl/normalizer/normalizer_class.h2
-rw-r--r--ext/intl/normalizer/normalizer_normalize.c12
-rw-r--r--ext/intl/normalizer/normalizer_normalize.h2
-rw-r--r--ext/intl/php_intl.c4
-rw-r--r--ext/intl/php_intl.h4
-rw-r--r--ext/intl/resourcebundle/resourcebundle.c8
-rw-r--r--ext/intl/resourcebundle/resourcebundle.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c18
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.c4
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.h6
-rw-r--r--ext/intl/spoofchecker/spoofchecker.c4
-rw-r--r--ext/intl/spoofchecker/spoofchecker.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.c16
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.h2
-rw-r--r--ext/intl/timezone/timezone_class.cpp36
-rw-r--r--ext/intl/timezone/timezone_class.h2
-rw-r--r--ext/intl/timezone/timezone_methods.cpp62
-rw-r--r--ext/intl/timezone/timezone_methods.h2
-rw-r--r--ext/intl/transliterator/transliterator.c8
-rw-r--r--ext/intl/transliterator/transliterator.h4
-rw-r--r--ext/intl/transliterator/transliterator_class.c10
-rw-r--r--ext/intl/transliterator/transliterator_class.h2
-rw-r--r--ext/intl/transliterator/transliterator_methods.c30
-rw-r--r--ext/intl/transliterator/transliterator_methods.h2
-rw-r--r--ext/json/JSON_parser.c18
-rw-r--r--ext/json/JSON_parser.h2
-rw-r--r--ext/json/json.c169
-rw-r--r--ext/json/json.dsp135
-rw-r--r--ext/json/php_json.h8
-rw-r--r--ext/json/utf8_decode.h2
-rw-r--r--ext/ldap/LDAP_Win32_HOWTO.txt2
-rw-r--r--ext/ldap/ldap.c260
-rw-r--r--ext/ldap/ldap.dsp288
-rw-r--r--ext/ldap/ldap.mak2
-rw-r--r--ext/ldap/php_ldap.h6
-rw-r--r--ext/libxml/libxml.c74
-rw-r--r--ext/libxml/php_libxml.h4
-rw-r--r--ext/mbstring/libmbfl/NEWS1
-rw-r--r--ext/mbstring/mb_gpc.c8
-rw-r--r--ext/mbstring/mb_gpc.h10
-rw-r--r--ext/mbstring/mbstring.c291
-rw-r--r--ext/mbstring/mbstring.dsp1112
-rw-r--r--ext/mbstring/mbstring.h2
-rw-r--r--ext/mbstring/php_mbregex.c75
-rw-r--r--ext/mbstring/php_mbregex.h2
-rw-r--r--ext/mbstring/php_unicode.c2
-rw-r--r--ext/mbstring/php_unicode.h2
-rw-r--r--ext/mbstring/tests/zend_multibyte-02.phpt3
-rw-r--r--ext/mbstring/tests/zend_multibyte-06.phpt2
-rw-r--r--ext/mbstring/tests/zend_multibyte-07.phpt3
-rw-r--r--ext/mbstring/tests/zend_multibyte-09.phpt3
-rw-r--r--ext/mcrypt/mcrypt.c106
-rw-r--r--ext/mcrypt/mcrypt.dsp117
-rw-r--r--ext/mcrypt/mcrypt_filter.c10
-rw-r--r--ext/mcrypt/php_mcrypt.h2
-rw-r--r--ext/mcrypt/php_mcrypt_filter.h2
-rw-r--r--ext/mssql/mssql.dsp117
-rw-r--r--ext/mssql/mssql_win32_howto.txt2
-rw-r--r--ext/mssql/php_mssql.c98
-rw-r--r--ext/mssql/php_mssql.h2
-rw-r--r--ext/mysql/mysql.dsp171
-rw-r--r--ext/mysql/mysql_mysqlnd.h2
-rw-r--r--ext/mysql/php_mysql.c184
-rw-r--r--ext/mysql/php_mysql.h2
-rw-r--r--ext/mysql/php_mysql_structs.h20
-rw-r--r--ext/mysqli/mysqli.c250
-rwxr-xr-xext/mysqli/mysqli.dsp120
-rw-r--r--ext/mysqli/mysqli_api.c222
-rw-r--r--ext/mysqli/mysqli_driver.c14
-rw-r--r--ext/mysqli/mysqli_embedded.c6
-rw-r--r--ext/mysqli/mysqli_exception.c4
-rw-r--r--ext/mysqli/mysqli_fe.c2
-rw-r--r--ext/mysqli/mysqli_fe.h2
-rw-r--r--ext/mysqli/mysqli_libmysql.h2
-rw-r--r--ext/mysqli/mysqli_mysqlnd.h2
-rw-r--r--ext/mysqli/mysqli_nonapi.c74
-rw-r--r--ext/mysqli/mysqli_priv.h8
-rw-r--r--ext/mysqli/mysqli_prop.c78
-rw-r--r--ext/mysqli/mysqli_report.c6
-rw-r--r--ext/mysqli/mysqli_result_iterator.c4
-rw-r--r--ext/mysqli/mysqli_warning.c20
-rw-r--r--ext/mysqli/php_mysqli.h2
-rw-r--r--ext/mysqli/php_mysqli_structs.h40
-rw-r--r--ext/mysqli/tests/bug33491.phpt4
-rw-r--r--ext/mysqli/tests/mysqli_change_user_new.phpt2
-rw-r--r--ext/mysqlnd/config9.m47
-rw-r--r--ext/mysqlnd/mysqlnd.c38
-rw-r--r--ext/mysqlnd/mysqlnd.h30
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.c22
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_auth.c12
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.c2
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_charset.c6
-rw-r--r--ext/mysqlnd/mysqlnd_charset.h10
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c2
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h5
-rw-r--r--ext/mysqlnd/mysqlnd_driver.c2
-rw-r--r--ext/mysqlnd/mysqlnd_enum_n_def.h4
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.h2
-rw-r--r--ext/mysqlnd/mysqlnd_libmysql_compat.h2
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c2
-rw-r--r--ext/mysqlnd/mysqlnd_net.c8
-rw-r--r--ext/mysqlnd/mysqlnd_net.h2
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_portability.h16
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h4
-rw-r--r--ext/mysqlnd/mysqlnd_ps.c22
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c80
-rw-r--r--ext/mysqlnd/mysqlnd_result.c44
-rw-r--r--ext/mysqlnd/mysqlnd_result.h2
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.c8
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.h2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.c2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.h2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.h2
-rw-r--r--ext/mysqlnd/mysqlnd_structs.h78
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c62
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.h18
-rw-r--r--ext/mysqlnd/php_mysqlnd.c14
-rw-r--r--ext/mysqlnd/php_mysqlnd.h2
-rw-r--r--ext/oci8/oci8.c222
-rw-r--r--ext/oci8/oci8.dsp133
-rw-r--r--ext/oci8/oci8_collection.c36
-rw-r--r--ext/oci8/oci8_interface.c447
-rw-r--r--ext/oci8/oci8_lob.c28
-rw-r--r--ext/oci8/oci8_statement.c212
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h80
-rw-r--r--ext/odbc/birdstep.c80
-rw-r--r--ext/odbc/php_birdstep.h14
-rw-r--r--ext/odbc/php_odbc.c257
-rw-r--r--ext/odbc/php_odbc.h2
-rw-r--r--ext/odbc/php_odbc_includes.h24
-rw-r--r--ext/odbc/tests/bug68087.phpt57
-rw-r--r--ext/opcache/Optimizer/block_pass.c157
-rw-r--r--ext/opcache/Optimizer/compact_literals.c81
-rw-r--r--ext/opcache/Optimizer/nop_removal.c26
-rw-r--r--ext/opcache/Optimizer/optimize_func_calls.c24
-rw-r--r--ext/opcache/Optimizer/optimize_temp_vars_5.c10
-rw-r--r--ext/opcache/Optimizer/pass10.c24
-rw-r--r--ext/opcache/Optimizer/pass1_5.c138
-rw-r--r--ext/opcache/Optimizer/pass2.c24
-rw-r--r--ext/opcache/Optimizer/pass3.c29
-rw-r--r--ext/opcache/Optimizer/pass5.c24
-rw-r--r--ext/opcache/Optimizer/pass9.c29
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c200
-rw-r--r--ext/opcache/Optimizer/zend_optimizer_internal.h53
-rw-r--r--ext/opcache/ZendAccelerator.c181
-rw-r--r--ext/opcache/ZendAccelerator.h42
-rw-r--r--ext/opcache/config.m410
-rw-r--r--ext/opcache/config.w322
-rw-r--r--ext/opcache/zend_accelerator_debug.c2
-rw-r--r--ext/opcache/zend_accelerator_hash.c26
-rw-r--r--ext/opcache/zend_accelerator_hash.h20
-rw-r--r--ext/opcache/zend_accelerator_module.c125
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c151
-rw-r--r--ext/opcache/zend_persist.c99
-rw-r--r--ext/opcache/zend_persist_calc.c137
-rw-r--r--ext/opcache/zend_shared_alloc.c12
-rw-r--r--ext/opcache/zend_shared_alloc.h2
-rw-r--r--ext/openssl/config0.m46
-rwxr-xr-xext/openssl/openssl.c432
-rw-r--r--ext/openssl/openssl.dsp111
-rw-r--r--ext/openssl/openssl.mak2
-rw-r--r--ext/openssl/php_openssl.h2
-rw-r--r--ext/openssl/tests/bug65729.pem56
-rw-r--r--ext/openssl/xp_ssl.c129
-rw-r--r--ext/pcntl/pcntl.c340
-rw-r--r--ext/pcntl/php_pcntl.h6
-rw-r--r--ext/pcntl/php_signal.c2
-rw-r--r--ext/pcntl/php_signal.h2
-rw-r--r--ext/pcre/php_pcre.c134
-rw-r--r--ext/pcre/php_pcre.h2
-rw-r--r--ext/pdo/pdo.c14
-rw-r--r--ext/pdo/pdo_dbh.c296
-rw-r--r--ext/pdo/pdo_sql_parser.c36
-rw-r--r--ext/pdo/pdo_sql_parser.re34
-rw-r--r--ext/pdo/pdo_sqlstate.c2
-rw-r--r--ext/pdo/pdo_stmt.c168
-rw-r--r--ext/pdo/php_pdo.h10
-rw-r--r--ext/pdo/php_pdo_driver.h61
-rw-r--r--ext/pdo/php_pdo_error.h2
-rw-r--r--ext/pdo/php_pdo_int.h2
-rw-r--r--ext/pdo_dblib/dblib_driver.c12
-rw-r--r--ext/pdo_dblib/dblib_stmt.c18
-rw-r--r--ext/pdo_dblib/pdo_dblib.c2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib.h2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h2
-rw-r--r--ext/pdo_firebird/firebird_driver.c28
-rw-r--r--ext/pdo_firebird/firebird_statement.c38
-rw-r--r--ext/pdo_firebird/pdo_firebird.c8
-rw-r--r--ext/pdo_firebird/php_pdo_firebird.h2
-rw-r--r--ext/pdo_firebird/php_pdo_firebird_int.h6
-rw-r--r--ext/pdo_mysql/mysql_driver.c52
-rw-r--r--ext/pdo_mysql/mysql_statement.c44
-rw-r--r--ext/pdo_mysql/pdo_mysql.c34
-rw-r--r--ext/pdo_mysql/php_pdo_mysql.h2
-rw-r--r--ext/pdo_mysql/php_pdo_mysql_int.h12
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt2
-rw-r--r--ext/pdo_oci/oci_driver.c12
-rw-r--r--ext/pdo_oci/oci_statement.c14
-rw-r--r--ext/pdo_oci/pdo_oci.c2
-rw-r--r--ext/pdo_oci/php_pdo_oci.h2
-rw-r--r--ext/pdo_oci/php_pdo_oci_int.h2
-rw-r--r--ext/pdo_odbc/odbc_driver.c16
-rw-r--r--ext/pdo_odbc/odbc_stmt.c46
-rw-r--r--ext/pdo_odbc/pdo_odbc.c12
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h2
-rw-r--r--ext/pdo_odbc/php_pdo_odbc_int.h6
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c16
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c92
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c26
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql.h2
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql_int.h4
-rw-r--r--ext/pdo_pgsql/tests/getnotify.phpt6
-rw-r--r--ext/pdo_sqlite/pdo_sqlite.c2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite.h2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite_int.h2
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c70
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c20
-rw-r--r--ext/pgsql/pgsql.c662
-rw-r--r--ext/pgsql/pgsql.dsp167
-rw-r--r--ext/pgsql/php_pgsql.h20
-rw-r--r--ext/phar/dirstream.c10
-rw-r--r--ext/phar/dirstream.h2
-rw-r--r--ext/phar/func_interceptors.c94
-rw-r--r--ext/phar/phar.c98
-rw-r--r--ext/phar/phar_internal.h26
-rwxr-xr-xext/phar/phar_object.c264
-rw-r--r--ext/phar/stream.c34
-rw-r--r--ext/phar/stream.h2
-rw-r--r--ext/phar/tar.c10
-rw-r--r--ext/phar/tests/create_path_error.phpt10
-rw-r--r--ext/phar/util.c46
-rw-r--r--ext/phar/zip.c28
-rw-r--r--ext/posix/php_posix.h2
-rw-r--r--ext/posix/posix.c140
-rw-r--r--ext/pspell/php_pspell.h2
-rw-r--r--ext/pspell/pspell.c104
-rw-r--r--ext/pspell/pspell.dsp112
-rw-r--r--ext/readline/php_readline.h2
-rw-r--r--ext/readline/readline.c64
-rw-r--r--ext/readline/readline_cli.c37
-rw-r--r--ext/readline/readline_cli.h4
-rw-r--r--ext/recode/php_recode.h2
-rw-r--r--ext/recode/recode.c4
-rw-r--r--ext/reflection/php_reflection.c332
-rw-r--r--ext/reflection/php_reflection.h2
-rw-r--r--ext/session/mod_files.c28
-rw-r--r--ext/session/mod_files.h2
-rw-r--r--ext/session/mod_mm.c2
-rw-r--r--ext/session/mod_mm.h2
-rw-r--r--ext/session/mod_user.c18
-rw-r--r--ext/session/mod_user.h2
-rw-r--r--ext/session/mod_user_class.c10
-rw-r--r--ext/session/php_session.h28
-rw-r--r--ext/session/session.c308
-rw-r--r--ext/session/tests/bug67972.phpt10
-rw-r--r--ext/shmop/php_shmop.h4
-rw-r--r--ext/shmop/shmop.c34
-rw-r--r--ext/shmop/shmop.dsp107
-rw-r--r--ext/simplexml/php_simplexml.h2
-rw-r--r--ext/simplexml/php_simplexml_exports.h2
-rw-r--r--ext/simplexml/simplexml.c152
-rw-r--r--ext/simplexml/simplexml.dsp111
-rw-r--r--ext/simplexml/sxe.c2
-rw-r--r--ext/simplexml/sxe.h2
-rw-r--r--ext/simplexml/tests/bug62328.phpt (renamed from ext/xml/tests/bug62328.phpt)6
-rw-r--r--ext/skeleton/php_skeleton.h2
-rw-r--r--ext/skeleton/skeleton.c2
-rw-r--r--ext/skeleton/skeleton.dsp113
-rw-r--r--ext/skeleton/tests/001.phpt2
-rw-r--r--ext/snmp/php_snmp.h6
-rw-r--r--ext/snmp/snmp.c196
-rw-r--r--ext/snmp/snmp.dsp109
-rw-r--r--ext/soap/php_encoding.c139
-rw-r--r--ext/soap/php_encoding.h2
-rw-r--r--ext/soap/php_http.c212
-rw-r--r--ext/soap/php_http.h2
-rw-r--r--ext/soap/php_packet_soap.c6
-rw-r--r--ext/soap/php_packet_soap.h2
-rw-r--r--ext/soap/php_schema.c12
-rw-r--r--ext/soap/php_schema.h2
-rw-r--r--ext/soap/php_sdl.c52
-rw-r--r--ext/soap/php_sdl.h4
-rw-r--r--ext/soap/php_soap.dsp156
-rw-r--r--ext/soap/php_soap.h8
-rw-r--r--ext/soap/php_xml.c2
-rw-r--r--ext/soap/php_xml.h2
-rw-r--r--ext/soap/soap.c525
-rw-r--r--ext/sockets/conversions.c176
-rw-r--r--ext/sockets/multicast.c22
-rw-r--r--ext/sockets/multicast.h2
-rw-r--r--ext/sockets/php_sockets.h2
-rw-r--r--ext/sockets/sendrecvmsg.c56
-rw-r--r--ext/sockets/sockaddr_conv.c4
-rw-r--r--ext/sockets/sockets.c319
-rw-r--r--ext/sockets/sockets.dsp117
-rw-r--r--ext/sockets/tests/socket_import_stream-4-win.phpt8
-rw-r--r--ext/sockets/unix_socket_constants.h204
-rw-r--r--ext/sockets/win32_socket_constants.h106
-rw-r--r--ext/sockets/windows_common.h2
-rw-r--r--ext/spl/php_spl.c80
-rw-r--r--ext/spl/php_spl.h4
-rw-r--r--ext/spl/spl_array.c100
-rw-r--r--ext/spl/spl_array.h2
-rw-r--r--ext/spl/spl_directory.c214
-rw-r--r--ext/spl/spl_directory.h8
-rw-r--r--ext/spl/spl_dllist.c84
-rw-r--r--ext/spl/spl_dllist.h2
-rw-r--r--ext/spl/spl_engine.c12
-rw-r--r--ext/spl/spl_engine.h34
-rw-r--r--ext/spl/spl_exceptions.c2
-rw-r--r--ext/spl/spl_exceptions.h2
-rw-r--r--ext/spl/spl_fixedarray.c84
-rw-r--r--ext/spl/spl_fixedarray.h2
-rw-r--r--ext/spl/spl_functions.c9
-rw-r--r--ext/spl/spl_functions.h6
-rw-r--r--ext/spl/spl_heap.c98
-rw-r--r--ext/spl/spl_heap.h2
-rw-r--r--ext/spl/spl_iterators.c235
-rw-r--r--ext/spl/spl_iterators.h16
-rw-r--r--ext/spl/spl_observer.c72
-rw-r--r--ext/spl/spl_observer.h2
-rw-r--r--ext/spl/tests/bug54281.phpt4
-rw-r--r--ext/spl/tests/bug68128.phpt91
-rw-r--r--ext/spl/tests/heap_corruption.phpt10
-rw-r--r--ext/spl/tests/iterator_048.phpt5
-rw-r--r--ext/spl/tests/iterator_050.phpt4
-rw-r--r--ext/spl/tests/iterator_052.phpt146
-rw-r--r--ext/spl/tests/iterator_053.phpt125
-rw-r--r--ext/spl/tests/iterator_054.phpt2
-rw-r--r--ext/spl/tests/spl_pq_top_basic.phpt6
-rw-r--r--ext/sqlite3/php_sqlite3.h2
-rw-r--r--ext/sqlite3/php_sqlite3_structs.h8
-rw-r--r--ext/sqlite3/sqlite3.c150
-rw-r--r--ext/standard/array.c424
-rw-r--r--ext/standard/assert.c85
-rw-r--r--ext/standard/base64.c26
-rw-r--r--ext/standard/base64.h8
-rw-r--r--ext/standard/basic_functions.c280
-rw-r--r--ext/standard/basic_functions.h14
-rw-r--r--ext/standard/browscap.c66
-rw-r--r--ext/standard/config.m44
-rw-r--r--ext/standard/crc32.c6
-rw-r--r--ext/standard/crc32.h2
-rw-r--r--ext/standard/credits.c2
-rw-r--r--ext/standard/credits.h2
-rw-r--r--ext/standard/credits_ext.h6
-rw-r--r--ext/standard/credits_sapi.h6
-rw-r--r--ext/standard/crypt.c36
-rw-r--r--ext/standard/crypt_sha256.c19
-rw-r--r--ext/standard/crypt_sha512.c18
-rw-r--r--ext/standard/css.c2
-rw-r--r--ext/standard/css.h2
-rw-r--r--ext/standard/cyr_convert.c15
-rw-r--r--ext/standard/cyr_convert.h2
-rw-r--r--ext/standard/datetime.c22
-rw-r--r--ext/standard/datetime.h2
-rw-r--r--ext/standard/dir.c52
-rw-r--r--ext/standard/dl.c6
-rw-r--r--ext/standard/dl.h2
-rw-r--r--ext/standard/dns.c84
-rw-r--r--ext/standard/dns_win32.c38
-rw-r--r--ext/standard/exec.c26
-rw-r--r--ext/standard/exec.h2
-rw-r--r--ext/standard/file.c427
-rw-r--r--ext/standard/file.h16
-rw-r--r--ext/standard/filestat.c129
-rw-r--r--ext/standard/filters.c54
-rw-r--r--ext/standard/flock_compat.c2
-rw-r--r--ext/standard/flock_compat.h2
-rw-r--r--ext/standard/formatted_print.c114
-rw-r--r--ext/standard/fsock.c26
-rw-r--r--ext/standard/fsock.h2
-rw-r--r--ext/standard/ftok.c12
-rw-r--r--ext/standard/ftp_fopen_wrapper.c16
-rw-r--r--ext/standard/head.c42
-rw-r--r--ext/standard/head.h2
-rw-r--r--ext/standard/html.c75
-rw-r--r--ext/standard/html.h2
-rw-r--r--ext/standard/html_tables.h267
-rw-r--r--ext/standard/html_tables/html_table_gen.php23
-rw-r--r--ext/standard/http.c54
-rw-r--r--ext/standard/http_fopen_wrapper.c56
-rw-r--r--ext/standard/image.c78
-rw-r--r--ext/standard/incomplete_class.c8
-rw-r--r--ext/standard/info.c66
-rw-r--r--ext/standard/info.h2
-rw-r--r--ext/standard/iptc.c22
-rw-r--r--ext/standard/lcg.c6
-rw-r--r--ext/standard/levenshtein.c10
-rw-r--r--ext/standard/link.c16
-rw-r--r--ext/standard/link_win32.c16
-rw-r--r--ext/standard/mail.c24
-rw-r--r--ext/standard/math.c109
-rw-r--r--ext/standard/md5.c24
-rw-r--r--ext/standard/md5.h2
-rw-r--r--ext/standard/metaphone.c22
-rw-r--r--ext/standard/microtime.c16
-rw-r--r--ext/standard/microtime.h2
-rw-r--r--ext/standard/pack.c210
-rw-r--r--ext/standard/pack.h2
-rw-r--r--ext/standard/pageinfo.c26
-rw-r--r--ext/standard/pageinfo.h6
-rw-r--r--ext/standard/password.c98
-rw-r--r--ext/standard/php_array.h4
-rw-r--r--ext/standard/php_assert.h2
-rw-r--r--ext/standard/php_browscap.h2
-rw-r--r--ext/standard/php_crypt.h2
-rw-r--r--ext/standard/php_crypt_r.c6
-rw-r--r--ext/standard/php_crypt_r.h2
-rw-r--r--ext/standard/php_dir.h2
-rw-r--r--ext/standard/php_dns.h2
-rw-r--r--ext/standard/php_ext_syslog.h2
-rw-r--r--ext/standard/php_filestat.h2
-rw-r--r--ext/standard/php_fopen_wrapper.c16
-rw-r--r--ext/standard/php_fopen_wrappers.h2
-rw-r--r--ext/standard/php_ftok.h2
-rw-r--r--ext/standard/php_http.h4
-rw-r--r--ext/standard/php_image.h2
-rw-r--r--ext/standard/php_incomplete_class.h13
-rw-r--r--ext/standard/php_iptc.h2
-rw-r--r--ext/standard/php_lcg.h2
-rw-r--r--ext/standard/php_link.h2
-rw-r--r--ext/standard/php_mail.h2
-rw-r--r--ext/standard/php_math.h4
-rw-r--r--ext/standard/php_metaphone.h2
-rw-r--r--ext/standard/php_password.h2
-rw-r--r--ext/standard/php_rand.h14
-rw-r--r--ext/standard/php_smart_str.h173
-rw-r--r--ext/standard/php_smart_string.h26
-rw-r--r--ext/standard/php_smart_string_public.h2
-rw-r--r--ext/standard/php_standard.h2
-rw-r--r--ext/standard/php_string.h45
-rw-r--r--ext/standard/php_type.h2
-rw-r--r--ext/standard/php_uuencode.h6
-rw-r--r--ext/standard/php_var.h113
-rw-r--r--ext/standard/php_versioning.h2
-rw-r--r--ext/standard/proc_open.c32
-rw-r--r--ext/standard/proc_open.h2
-rw-r--r--ext/standard/quot_print.c14
-rw-r--r--ext/standard/quot_print.h2
-rw-r--r--ext/standard/rand.c44
-rw-r--r--ext/standard/scanf.c42
-rw-r--r--ext/standard/scanf.h2
-rw-r--r--ext/standard/sha1.c20
-rw-r--r--ext/standard/sha1.h4
-rw-r--r--ext/standard/soundex.c4
-rw-r--r--ext/standard/streamsfuncs.c162
-rw-r--r--ext/standard/streamsfuncs.h2
-rw-r--r--ext/standard/string.c960
-rw-r--r--ext/standard/strnatcmp.c5
-rw-r--r--ext/standard/syslog.c80
-rw-r--r--ext/standard/tests/array/array_keys_error.phpt2
-rw-r--r--ext/standard/tests/array/array_keys_on_GLOBALS.phpt12
-rw-r--r--ext/standard/tests/array/bug26458.phptbin408 -> 409 bytes
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt2
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt2
-rw-r--r--ext/standard/tests/file/bug41655_1-win32.phpt22
-rw-r--r--ext/standard/tests/file/bug41655_1.phpt8
-rw-r--r--ext/standard/tests/file/bug65701.phpt4
-rw-r--r--ext/standard/tests/file/file_put_contents_variation5.phpt1
-rw-r--r--ext/standard/tests/file/pathinfo_basic1-win32.phpt24
-rw-r--r--ext/standard/tests/file/pathinfo_basic2-win32.phpt10
-rw-r--r--ext/standard/tests/general_functions/bug41037.phpt9
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_003.phpt40
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation5.phpt1
-rw-r--r--ext/standard/tests/serialize/bug68044.phpt12
-rw-r--r--ext/standard/tests/serialize/counting_of_references.phpt14
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_002.phpt12
-rw-r--r--ext/standard/tests/serialize/serialization_objects_013.phpt12
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800.phpt95
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800_right.phpt78
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800_right2.phpt84
-rw-r--r--ext/standard/tests/streams/proc_open_bug60120.phpt71
-rw-r--r--ext/standard/tests/streams/proc_open_bug64438.phpt70
-rw-r--r--ext/standard/tests/strings/pack64.phpt115
-rw-r--r--ext/standard/tests/strings/pack64_32.phpt44
-rw-r--r--ext/standard/tests/strings/setlocale_variation2.phpt4
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_variation1.phpt4
-rw-r--r--ext/standard/tests/strings/url_t.phpt212
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt8
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt2
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt2
-rw-r--r--ext/standard/tests/versioning/phpversion.phpt12
-rw-r--r--ext/standard/type.c59
-rw-r--r--ext/standard/uniqid.c5
-rw-r--r--ext/standard/uniqid.h2
-rw-r--r--ext/standard/url.c58
-rw-r--r--ext/standard/url.h2
-rw-r--r--ext/standard/url_scanner_ex.c84
-rw-r--r--ext/standard/url_scanner_ex.h4
-rw-r--r--ext/standard/url_scanner_ex.re28
-rw-r--r--ext/standard/user_filters.c42
-rw-r--r--ext/standard/uuencode.c18
-rw-r--r--ext/standard/var.c288
-rw-r--r--ext/standard/var_unserializer.c120
-rw-r--r--ext/standard/var_unserializer.re88
-rw-r--r--ext/standard/versioning.c6
-rw-r--r--ext/sybase_ct/php_sybase_ct.c64
-rw-r--r--ext/sybase_ct/php_sybase_ct.h2
-rw-r--r--ext/sybase_ct/sybase_ct.dsp114
-rw-r--r--ext/sysvmsg/php_sysvmsg.h6
-rw-r--r--ext/sysvmsg/sysvmsg.c86
-rw-r--r--ext/sysvsem/php_sysvsem.h2
-rw-r--r--ext/sysvsem/sysvsem.c30
-rw-r--r--ext/sysvsem/tests/nowait.phpt103
-rw-r--r--ext/sysvsem/tests/sysv.phpt4
-rw-r--r--ext/sysvshm/php_sysvshm.h20
-rw-r--r--ext/sysvshm/sysvshm.c52
-rw-r--r--ext/tidy/examples/cleanhtml.php4
-rw-r--r--ext/tidy/examples/cleanhtml5.php4
-rw-r--r--ext/tidy/php_tidy.h2
-rw-r--r--ext/tidy/tidy.c80
-rwxr-xr-xext/tidy/tidy.dsp108
-rw-r--r--ext/tokenizer/php_tokenizer.h2
-rw-r--r--ext/tokenizer/tests/bug60097.phpt24
-rw-r--r--ext/tokenizer/tokenizer.c16
-rw-r--r--ext/tokenizer/tokenizer.dsp108
-rw-r--r--ext/tokenizer/tokenizer_data.c302
-rwxr-xr-xext/tokenizer/tokenizer_data_gen.sh6
-rw-r--r--ext/wddx/php_wddx.h2
-rw-r--r--ext/wddx/php_wddx_api.h6
-rw-r--r--ext/wddx/wddx.c87
-rw-r--r--ext/xml/compat.c19
-rw-r--r--ext/xml/expat_compat.h2
-rw-r--r--ext/xml/php_xml.h6
-rw-r--r--ext/xml/xml.c178
-rw-r--r--ext/xml/xml.mak2
-rw-r--r--ext/xmlreader/README2
-rw-r--r--ext/xmlreader/php_xmlreader.c113
-rw-r--r--ext/xmlreader/php_xmlreader.h6
-rw-r--r--ext/xmlreader/xmlreader.dsp114
-rw-r--r--ext/xmlrpc/libxmlrpc/encodings.c1
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.c13
-rw-r--r--ext/xmlrpc/php_xmlrpc.h2
-rw-r--r--ext/xmlrpc/tests/bug68027.phpt44
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c46
-rw-r--r--ext/xmlrpc/xmlrpc.dsp211
-rw-r--r--ext/xmlwriter/TODO2
-rw-r--r--ext/xmlwriter/php_xmlwriter.c53
-rw-r--r--ext/xmlwriter/php_xmlwriter.h2
-rw-r--r--ext/xmlwriter/xmlwriter.dsp113
-rw-r--r--ext/xsl/php_xsl.c26
-rw-r--r--ext/xsl/php_xsl.h4
-rw-r--r--ext/xsl/xsl.dsp120
-rw-r--r--ext/xsl/xsl_fe.h2
-rw-r--r--ext/xsl/xsltprocessor.c49
-rw-r--r--ext/zip/lib/config.h2
-rw-r--r--ext/zip/lib/zip_set_name.c2
-rw-r--r--ext/zip/php_zip.c423
-rw-r--r--ext/zip/php_zip.h6
-rw-r--r--ext/zip/zip_stream.c12
-rw-r--r--ext/zlib/php_zlib.h10
-rw-r--r--ext/zlib/zlib.c101
-rw-r--r--ext/zlib/zlib.dsp121
-rw-r--r--ext/zlib/zlib_filter.c40
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c8
-rw-r--r--ext/zlib/zlib_win32_howto.txt2
-rw-r--r--header2
-rw-r--r--main/SAPI.c22
-rw-r--r--main/SAPI.h18
-rw-r--r--main/build-defs.h.in2
-rw-r--r--main/fopen_wrappers.c28
-rw-r--r--main/fopen_wrappers.h2
-rw-r--r--main/getopt.c2
-rw-r--r--main/internal_functions.c.in2
-rw-r--r--main/internal_functions_nw.c2
-rw-r--r--main/internal_functions_win32.c2
-rw-r--r--main/main.c158
-rw-r--r--main/network.c20
-rw-r--r--main/output.c80
-rw-r--r--main/php.h17
-rw-r--r--main/php_compat.h2
-rw-r--r--main/php_content_types.c2
-rw-r--r--main/php_content_types.h2
-rw-r--r--main/php_getopt.h2
-rw-r--r--main/php_globals.h22
-rw-r--r--main/php_ini.c64
-rw-r--r--main/php_ini.h7
-rw-r--r--main/php_main.h2
-rw-r--r--main/php_memory_streams.h2
-rw-r--r--main/php_network.h4
-rw-r--r--main/php_open_temporary_file.c2
-rw-r--r--main/php_open_temporary_file.h2
-rw-r--r--main/php_output.h4
-rw-r--r--main/php_reentrancy.h2
-rw-r--r--main/php_scandir.c2
-rw-r--r--main/php_scandir.h2
-rw-r--r--main/php_sprintf.c2
-rw-r--r--main/php_stdint.h3
-rw-r--r--main/php_streams.h14
-rw-r--r--main/php_syslog.h2
-rw-r--r--main/php_ticks.c2
-rw-r--r--main/php_ticks.h2
-rw-r--r--main/php_variables.c62
-rw-r--r--main/php_variables.h4
-rw-r--r--main/reentrancy.c2
-rw-r--r--main/rfc1867.c54
-rw-r--r--main/rfc1867.h2
-rw-r--r--main/snprintf.c24
-rw-r--r--main/snprintf.h8
-rw-r--r--main/spprintf.c24
-rw-r--r--main/spprintf.h6
-rw-r--r--main/streams/cast.c4
-rw-r--r--main/streams/filter.c2
-rw-r--r--main/streams/glob_wrapper.c6
-rw-r--r--main/streams/memory.c4
-rw-r--r--main/streams/mmap.c2
-rw-r--r--main/streams/php_stream_context.h2
-rw-r--r--main/streams/php_stream_filter_api.h2
-rw-r--r--main/streams/php_stream_glob_wrapper.h6
-rw-r--r--main/streams/php_stream_mmap.h2
-rw-r--r--main/streams/php_stream_plain_wrapper.h2
-rw-r--r--main/streams/php_stream_transport.h20
-rw-r--r--main/streams/php_stream_userspace.h2
-rw-r--r--main/streams/php_streams_int.h2
-rw-r--r--main/streams/plain_wrapper.c40
-rw-r--r--main/streams/streams.c18
-rw-r--r--main/streams/transports.c8
-rw-r--r--main/streams/userspace.c138
-rw-r--r--main/streams/xp_socket.c10
-rw-r--r--main/strlcat.c2
-rw-r--r--main/strlcpy.c2
-rw-r--r--main/win32_internal_function_disabled.h2
-rw-r--r--main/win95nt.h2
-rw-r--r--makerpm10
-rw-r--r--netware/start.c2
-rw-r--r--php.ini-development10
-rw-r--r--php.ini-production10
-rw-r--r--php7.spec.in (renamed from php5.spec.in)0
-rwxr-xr-xrun-tests.php12
-rw-r--r--sapi/aolserver/README2
-rw-r--r--sapi/aolserver/aolserver.c2
-rw-r--r--sapi/aolserver/php5aolserver.dsp135
-rw-r--r--sapi/apache/apMakefile.tmpl26
-rw-r--r--sapi/apache/config.m440
-rw-r--r--sapi/apache/config.w324
-rw-r--r--sapi/apache/libphp7.module.in (renamed from sapi/apache/libphp5.module.in)2
-rw-r--r--sapi/apache/libpre.c2
-rw-r--r--sapi/apache/mod_php5.exp1
-rw-r--r--sapi/apache/mod_php7.c (renamed from sapi/apache/mod_php5.c)16
-rw-r--r--sapi/apache/mod_php7.exp1
-rw-r--r--sapi/apache/mod_php7.h (renamed from sapi/apache/mod_php5.h)8
-rw-r--r--sapi/apache/php.sym2
-rw-r--r--sapi/apache/php5apache.dsp151
-rw-r--r--sapi/apache/php_apache.c2
-rw-r--r--sapi/apache/php_apache_http.h4
-rw-r--r--sapi/apache/sapi_apache.c2
-rw-r--r--sapi/apache2filter/apache_config.c2
-rw-r--r--sapi/apache2filter/config.m46
-rw-r--r--sapi/apache2filter/php.sym2
-rw-r--r--sapi/apache2filter/php_apache.h4
-rw-r--r--sapi/apache2filter/php_functions.c4
-rw-r--r--sapi/apache2filter/sapi_apache2.c8
-rw-r--r--sapi/apache2handler/apache_config.c4
-rw-r--r--sapi/apache2handler/config.m414
-rw-r--r--sapi/apache2handler/config.w326
-rw-r--r--sapi/apache2handler/mod_php7.c (renamed from sapi/apache2handler/mod_php5.c)4
-rw-r--r--sapi/apache2handler/php.sym2
-rw-r--r--sapi/apache2handler/php5apache2.dsp146
-rw-r--r--sapi/apache2handler/php_apache.h6
-rw-r--r--sapi/apache2handler/php_functions.c16
-rw-r--r--sapi/apache2handler/sapi_apache2.c30
-rw-r--r--sapi/apache_hooks/apMakefile.tmpl24
-rw-r--r--sapi/apache_hooks/config.m440
-rw-r--r--sapi/apache_hooks/config.w324
-rw-r--r--sapi/apache_hooks/libphp7.module.in (renamed from sapi/apache_hooks/libphp5.module.in)2
-rw-r--r--sapi/apache_hooks/mod_php5.exp1
-rw-r--r--sapi/apache_hooks/mod_php7.c (renamed from sapi/apache_hooks/mod_php5.c)36
-rw-r--r--sapi/apache_hooks/mod_php7.exp1
-rw-r--r--sapi/apache_hooks/mod_php7.h (renamed from sapi/apache_hooks/mod_php5.h)8
-rw-r--r--sapi/apache_hooks/php.sym2
-rwxr-xr-xsapi/apache_hooks/php5apache_hooks.dsp151
-rw-r--r--sapi/apache_hooks/php_apache.c2
-rw-r--r--sapi/apache_hooks/php_apache_http.h2
-rw-r--r--sapi/apache_hooks/sapi_apache.c2
-rw-r--r--sapi/caudium/caudium.c8
-rw-r--r--sapi/caudium/config.m44
-rwxr-xr-xsapi/cgi/CHANGES1
-rw-r--r--sapi/cgi/README.FastCGI2
-rw-r--r--sapi/cgi/cgi_main.c80
-rw-r--r--sapi/cgi/fastcgi.c16
-rw-r--r--sapi/cgi/fastcgi.h2
-rw-r--r--sapi/cli/cli.h8
-rw-r--r--sapi/cli/config.m42
-rw-r--r--sapi/cli/generate_mime_type_map.php2
-rw-r--r--sapi/cli/mime_type_map.h2
-rw-r--r--sapi/cli/php_cli.c50
-rw-r--r--sapi/cli/php_cli_process_title.c4
-rw-r--r--sapi/cli/php_cli_process_title.h2
-rw-r--r--sapi/cli/php_cli_server.c88
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/php_http_parser.c7
-rw-r--r--sapi/cli/ps_title.c4
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/016.phpt2
-rw-r--r--sapi/continuity/capi.c2
-rw-r--r--sapi/embed/php5embed.dsp100
-rw-r--r--sapi/embed/php_embed.c10
-rw-r--r--sapi/embed/php_embed.h2
-rw-r--r--sapi/fpm/fpm/events/devpoll.c2
-rw-r--r--sapi/fpm/fpm/events/devpoll.h2
-rw-r--r--sapi/fpm/fpm/events/epoll.c2
-rw-r--r--sapi/fpm/fpm/events/epoll.h2
-rw-r--r--sapi/fpm/fpm/events/kqueue.c2
-rw-r--r--sapi/fpm/fpm/events/kqueue.h2
-rw-r--r--sapi/fpm/fpm/events/poll.c2
-rw-r--r--sapi/fpm/fpm/events/poll.h2
-rw-r--r--sapi/fpm/fpm/events/port.c2
-rw-r--r--sapi/fpm/fpm/events/port.h2
-rw-r--r--sapi/fpm/fpm/events/select.c2
-rw-r--r--sapi/fpm/fpm/events/select.h2
-rw-r--r--sapi/fpm/fpm/fastcgi.c8
-rw-r--r--sapi/fpm/fpm/fastcgi.h2
-rw-r--r--sapi/fpm/fpm/fpm_main.c22
-rw-r--r--sapi/fpm/fpm/fpm_php.c11
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c85
-rw-r--r--sapi/fpm/fpm/fpm_sockets.h6
-rw-r--r--sapi/fpm/fpm/fpm_status.c6
-rw-r--r--sapi/fpm/php-fpm.conf.in4
-rw-r--r--sapi/fpm/tests/003.phpt53
-rw-r--r--sapi/isapi/config.m42
-rw-r--r--sapi/isapi/config.w324
-rw-r--r--sapi/isapi/php5isapi.dsp165
-rw-r--r--sapi/isapi/php7isapi.c (renamed from sapi/isapi/php5isapi.c)2
-rw-r--r--sapi/isapi/php7isapi.def (renamed from sapi/isapi/php5isapi.def)0
-rw-r--r--sapi/isapi/stresstest/notes.txt2
-rw-r--r--sapi/isapi/stresstest/stresstest.cpp2
-rw-r--r--sapi/isapi/stresstest/stresstest.dsp108
-rw-r--r--sapi/litespeed/lsapi_main.c82
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c8
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/milter/php_milter.c4
-rw-r--r--sapi/nsapi/nsapi-readme.txt26
-rw-r--r--sapi/nsapi/nsapi.c38
-rw-r--r--sapi/nsapi/php5nsapi.dsp135
-rw-r--r--sapi/phpdbg/.travis.yml1
-rw-r--r--sapi/phpdbg/README.md2
-rw-r--r--sapi/phpdbg/phpdbg.12
-rw-r--r--sapi/phpdbg/phpdbg.c30
-rw-r--r--sapi/phpdbg/phpdbg.h4
-rw-r--r--sapi/phpdbg/phpdbg_bp.c29
-rw-r--r--sapi/phpdbg/phpdbg_bp.h2
-rw-r--r--sapi/phpdbg/phpdbg_break.c2
-rw-r--r--sapi/phpdbg/phpdbg_break.h2
-rw-r--r--sapi/phpdbg/phpdbg_btree.c2
-rw-r--r--sapi/phpdbg/phpdbg_btree.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c4
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h2
-rw-r--r--sapi/phpdbg/phpdbg_frame.c8
-rw-r--r--sapi/phpdbg/phpdbg_frame.h2
-rw-r--r--sapi/phpdbg/phpdbg_help.c2
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
-rw-r--r--sapi/phpdbg/phpdbg_info.c4
-rw-r--r--sapi/phpdbg/phpdbg_info.h2
-rw-r--r--sapi/phpdbg/phpdbg_lexer.h2
-rw-r--r--sapi/phpdbg/phpdbg_list.c2
-rw-r--r--sapi/phpdbg/phpdbg_list.h2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c18
-rw-r--r--sapi/phpdbg/phpdbg_opcode.h2
-rw-r--r--sapi/phpdbg/phpdbg_print.c4
-rw-r--r--sapi/phpdbg/phpdbg_print.h2
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c14
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_set.c2
-rw-r--r--sapi/phpdbg/phpdbg_set.h2
-rw-r--r--sapi/phpdbg/phpdbg_utils.c2
-rw-r--r--sapi/phpdbg/phpdbg_utils.h8
-rw-r--r--sapi/phpdbg/phpdbg_watch.c12
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_win.c2
-rw-r--r--sapi/phpdbg/phpdbg_win.h2
-rw-r--r--sapi/phttpd/php_phttpd.h2
-rw-r--r--sapi/phttpd/phttpd.c2
-rw-r--r--sapi/pi3web/README26
-rw-r--r--sapi/pi3web/config.m42
-rw-r--r--sapi/pi3web/config.w322
-rw-r--r--sapi/pi3web/php5pi3web.dsp136
-rw-r--r--sapi/pi3web/pi3web_sapi.c8
-rw-r--r--sapi/pi3web/pi3web_sapi.h8
-rw-r--r--sapi/roxen/README4
-rw-r--r--sapi/roxen/TODO12
-rw-r--r--sapi/roxen/config.m42
-rw-r--r--sapi/roxen/roxen.c10
-rw-r--r--sapi/thttpd/config.m44
-rw-r--r--sapi/thttpd/php_thttpd.h2
-rw-r--r--sapi/thttpd/thttpd.c12
-rw-r--r--sapi/thttpd/thttpd_patch4
-rw-r--r--sapi/tux/README16
-rw-r--r--sapi/tux/config.m42
-rw-r--r--sapi/tux/php_tux.c4
-rw-r--r--sapi/webjames/README2
-rw-r--r--sapi/webjames/php_webjames.h2
-rw-r--r--sapi/webjames/webjames.c2
-rw-r--r--scripts/dev/check_parameters.php2
-rwxr-xr-xscripts/dev/credits6
-rwxr-xr-xscripts/dev/search_underscores.php2
-rwxr-xr-xserver-tests.php2
-rw-r--r--tests/classes/constants_error_005.phpt3
-rw-r--r--tests/classes/inheritance_002.phpt12
-rw-r--r--tests/classes/interface_method.phpt2
-rw-r--r--tests/classes/method_call_variation_001.phpt36
-rw-r--r--tests/lang/bug24396.phpt2
-rw-r--r--tests/lang/engine_assignExecutionOrder_002.phpt8
-rw-r--r--tests/lang/engine_assignExecutionOrder_004.phpt16
-rw-r--r--tests/lang/foreachLoop.013.phpt2
-rw-r--r--tests/lang/foreachLoop.014.phpt4
-rw-r--r--tests/lang/foreachLoop.015.phpt2
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt355
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr.phpt398
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt396
-rw-r--r--tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt253
-rw-r--r--tests/lang/operators/bitwiseShiftRight_variationStr.phpt400
-rw-r--r--tests/lang/operators/coalesce.phpt79
-rw-r--r--tests/lang/operators/preinc_variationStr.phpt61
-rw-r--r--tests/lang/passByReference_005.phpt20
-rw-r--r--tests/lang/script_tag.phpt17
-rw-r--r--tests/lang/short_tags.003.phpt32
-rw-r--r--tests/lang/short_tags.004.phpt3
-rw-r--r--tests/run-test/test005.phpt3
-rw-r--r--tests/run-test/test008a.phpt3
-rw-r--r--win32/EngineSelect.dsp85
-rw-r--r--win32/build/DSP.README37
-rw-r--r--win32/build/Makefile8
-rw-r--r--win32/build/block.template.dsw15
-rw-r--r--win32/build/buildconf.js18
-rw-r--r--win32/build/config.w3219
-rw-r--r--win32/build/config.w32.h.in5
-rw-r--r--win32/build/config.w32.phpize.in14
-rw-r--r--win32/build/confutils.js38
-rw-r--r--win32/build/deplister.c2
-rw-r--r--win32/build/phpize.js.in18
-rw-r--r--win32/build/projectgen.js625
-rw-r--r--win32/build/template.dsp81
-rw-r--r--win32/build/template.dsw63
-rw-r--r--win32/build/template.rc2
-rw-r--r--win32/glob.c10
-rw-r--r--win32/glob.h6
-rw-r--r--win32/globals.c2
-rw-r--r--win32/grp.h2
-rw-r--r--win32/install.txt96
-rw-r--r--win32/php5.dsp134
-rw-r--r--win32/php5.dsw107
-rw-r--r--win32/php5dll.dsp1643
-rw-r--r--win32/php5dllts.dsp2719
-rw-r--r--win32/php5ts.dsp191
-rw-r--r--win32/php5ts.dsw227
-rw-r--r--win32/php5ts_cli.dsp175
-rw-r--r--win32/php7dllts.rc (renamed from win32/php5dllts.rc)4
-rw-r--r--win32/php7dllts.rc2 (renamed from win32/php5dllts.rc2)4
-rw-r--r--win32/php7ts.rc (renamed from win32/php5ts.rc)4
-rw-r--r--win32/php7ts.rc2 (renamed from win32/php5ts.rc2)2
-rw-r--r--win32/php7ts_cli.rc (renamed from win32/php5ts_cli.rc)4
-rw-r--r--win32/php7ts_cli.rc2 (renamed from win32/php5ts_cli.rc2)2
-rw-r--r--win32/php_modules.dsw473
-rw-r--r--win32/php_stdint.h9
-rw-r--r--win32/php_win32_globals.h2
-rw-r--r--win32/registry.c6
-rw-r--r--win32/resource.h2
-rw-r--r--win32/select.c2
-rw-r--r--win32/select.h2
-rw-r--r--win32/sendmail.c26
-rw-r--r--win32/sockets.c2
-rw-r--r--win32/sockets.h2
-rw-r--r--win32/syslog.h2
-rw-r--r--win32/syslog.reg2
-rw-r--r--win32/testsuite.dsp150
-rw-r--r--win32/winutil.c2
-rw-r--r--win32/winutil.h2
1520 files changed, 50725 insertions, 61041 deletions
diff --git a/.gdbinit b/.gdbinit
index 72d3085abf..498099a411 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -48,16 +48,16 @@ define print_cvs
end
define dump_bt
- set $ex = $arg0->prev_execute_data
+ set $ex = $arg0
while $ex
printf "[%p] ", $ex
set $func = $ex->func
if $func
- if $ex->object
+ if $ex->This->value.obj
if $func->common.scope
printf "%s->", $func->common.scope->name->val
else
- printf "%s->", $ex->object->ce.name->val
+ printf "%s->", $ex->This->value.obj->ce.name->val
end
else
if $func->common.scope
@@ -65,7 +65,11 @@ define dump_bt
end
end
- printf "%s(", $func->common.function_name->val
+ if $func->common.function_name
+ printf "%s(", $func->common.function_name->val
+ else
+ printf "(main"
+ end
set $callFrameSize = (sizeof(zend_execute_data) + sizeof(zval) - 1) / sizeof(zval)
@@ -119,7 +123,11 @@ define dump_bt
printf "??? "
end
if $func != 0
- printf "%s:%d ", $func->op_array.filename->val, $ex->opline->lineno
+ if $func->type == 2
+ printf "%s:%d ", $func->op_array.filename->val, $ex->opline->lineno
+ else
+ printf "[internal function]"
+ end
end
set $ex = $ex->prev_execute_data
printf "\n"
@@ -630,3 +638,28 @@ document zmemcheck
usage: zmemcheck [ptr].
if ptr is 0, all blocks will be listed.
end
+
+define lookup_root
+ set $found = 0
+ if gc_globals->roots
+ set $current = gc_globals->roots->next
+ printf "looking ref %p in roots\n", $arg0
+ while $current != &gc_globals->roots
+ if $current->ref == $arg0
+ set $found = $current
+ break
+ end
+ set $current = $current->next
+ end
+ if $found != 0
+ printf "found root %p\n", $found
+ else
+ printf "not found\n"
+ end
+ end
+end
+
+document lookup_root
+ lookup a refcounted in root
+ usage: lookup_root [ptr].
+end
diff --git a/.gitignore b/.gitignore
index b9dd252267..06dac174a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
*.gcno
*.la
*.lo
+*.loT
*.o
*.a
*.ncb
@@ -19,6 +20,7 @@
*.tgz
*.tar.gz
*.tar.bz2
+*.tar.xz
.FBCIndex
.FBCLockFolder
.deps
@@ -81,7 +83,7 @@ mkinstalldirs
modules
php
php-*.tar.gz
-php5.spec
+php7.spec
php_lcov.info
php_test_results_*.txt
php_version.h
@@ -117,6 +119,12 @@ tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
+tests/*/*/*.diff
+tests/*/*/*.out
+tests/*/*/*.php
+tests/*/*/*.exp
+tests/*/*/*.log
+tests/*/*/*.sh
*/tests/*.diff
*/tests/*.out
*/tests/*.php
@@ -129,6 +137,12 @@ tests/*/*.sh
*/tests/*/*.exp
*/tests/*/*.log
*/tests/*/*.sh
+*/tests/*/*/*.diff
+*/tests/*/*/*.out
+*/tests/*/*/*.php
+*/tests/*/*/*.exp
+*/tests/*/*/*.log
+*/tests/*/*/*.sh
*/*/tests/*.diff
*/*/tests/*.out
*/*/tests/*.php
@@ -141,6 +155,18 @@ tests/*/*.sh
*/*/tests/*/*.exp
*/*/tests/*/*.log
*/*/tests/*/*.sh
+*/*/tests/*/*/*.diff
+*/*/tests/*/*/*.out
+*/*/tests/*/*/*.php
+*/*/tests/*/*/*.exp
+*/*/tests/*/*/*.log
+*/*/tests/*/*/*.sh
+*/*/tests/*/*/*/*.diff
+*/*/tests/*/*/*/*.out
+*/*/tests/*/*/*/*.php
+*/*/tests/*/*/*/*.exp
+*/*/tests/*/*/*/*.log
+*/*/tests/*/*/*/*.sh
# Extension specifc ignores
ext/*/configure.in
@@ -235,9 +261,9 @@ pear/phpize
pear/run-tests
pear/php-config
pear/scripts
-sapi/apache/libphp5.module
-sapi/apache2handler/libphp5.module
-sapi/apache_hooks/libphp5.module
+sapi/apache/libphp7.module
+sapi/apache2handler/libphp7.module
+sapi/apache_hooks/libphp7.module
sapi/cgi/php-cgi
sapi/cgi/php-cgi.1
sapi/cli/php.1
diff --git a/EXTENSIONS b/EXTENSIONS
index 61a1688b3c..00a78ec163 100644
--- a/EXTENSIONS
+++ b/EXTENSIONS
@@ -228,13 +228,6 @@ MAINTENANCE: Maintained
STATUS: Working
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
-------------------------------------------------------------------------------
-EXTENSION: sqlite
-PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Wez Furlong <wez@php.net>, Ilia Alshanetsky <iliaa@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 5.0 (Since 4.3.2 in PECL)
-COMMENT: Integrates SQLite 2 embeddable SQL database engine.
--------------------------------------------------------------------------------
EXTENSION: sqlite3
PRIMARY MAINTAINER: Scott MacVicar <scottmac@php.net>
MAINTENANCE: Maintained
@@ -385,6 +378,12 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.4
-------------------------------------------------------------------------------
+EXTENSION: hash
+PRIMARY MAINTAINER: Sara Golemon <pollita@php.net>, Mike Wallner <mike@php.net>, Anatol Belski <ab@php.net>
+MAINTENANCE: Maintained
+STATUS: Working
+SINCE: 5.1.2
+-------------------------------------------------------------------------------
EXTENSION: iconv
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
MAINTENANCE: Maintained
@@ -422,21 +421,11 @@ PRIMARY MAINTAINER: Derick Rethans <derick@derickrethans.nl>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
-EXTENSION: mhash
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>, Scott MacVicar <scottmac@php.net>
-MAINTENANCE: Unknown
+EXTENSION: opcache
+PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>, Xinchen Hui <laruence@php.net>
+MAINTENANCE: Maintained
STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mime_magic
-PRIMARY MAINTAINER: Unknown
-MAINTENANCE: Deprecated
-STATUS: Experimental
-COMMENT: Use the fileinfo extension instead
--------------------------------------------------------------------------------
-EXTENSION: ming
-PRIMARY MAINTAINER: Frank M. Kromann
-MAINTENANCE: Unknown
-STATUS: Experimental
+SINCE: 5.5.0
-------------------------------------------------------------------------------
EXTENSION: openssl
PRIMARY MAINTAINER: Wez Furlong <wez@php.net>, Pierre-Alain Joye <pajoye@php.net>
diff --git a/INSTALL b/INSTALL
index 141e4f8312..3071f267ae 100644
--- a/INSTALL
+++ b/INSTALL
@@ -223,12 +223,12 @@ Apache 1.3.x on Unix systems
module on your system. The make install from above may have already
added this for you, but be sure to check.
- LoadModule php5_module libexec/libphp5.so
+ LoadModule php7_module libexec/libphp7.so
15. And in the AddModule section of httpd.conf, somewhere under the
ClearModuleList, add this:
- AddModule mod_php5.c
+ AddModule mod_php7.c
16. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
@@ -263,8 +263,8 @@ Apache 1.3.x on Unix systems
10. cd ../apache_1.3.x
-11. ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a
- (The above line is correct! Yes, we know libphp5.a does not exist at this
+11. ./configure --prefix=/www --activate-module=src/modules/php7/libphp7.a
+ (The above line is correct! Yes, we know libphp7.a does not exist at this
stage. It isn't supposed to. It will be created.)
12. make
@@ -309,24 +309,24 @@ stop and start:
Different examples of compiling PHP for apache are as follows:
./configure --with-apxs --with-pgsql
- This will create a libphp5.so shared library that is loaded into Apache
+ This will create a libphp7.so shared library that is loaded into Apache
using a LoadModule line in Apache's httpd.conf file. The PostgreSQL
support is embedded into this library.
./configure --with-apxs --with-pgsql=shared
- This will create a libphp5.so shared library for Apache, but it will
+ This will create a libphp7.so shared library for Apache, but it will
also create a pgsql.so shared library that is loaded into PHP either by
using the extension directive in php.ini file or by loading it
explicitly in a script using the dl() function.
./configure --with-apache=/path/to/apache_source --with-pgsql
- This will create a libmodphp5.a library, a mod_php5.c and some
- accompanying files and copy this into the src/modules/php5 directory in
+ This will create a libmodphp7.a library, a mod_php7.c and some
+ accompanying files and copy this into the src/modules/php7 directory in
the Apache source tree. Then you compile Apache using
- --activate-module=src/modules/php5/libphp5.a and the Apache build
- system will create libphp5.a and link it statically into the httpd
+ --activate-module=src/modules/php7/libphp7.a and the Apache build
+ system will create libphp7.a and link it statically into the httpd
binary. The PostgreSQL support is included directly into this httpd
binary, so the final result here is a single httpd binary that includes
all of Apache and all of PHP.
@@ -450,7 +450,7 @@ cp php.ini-development /usr/local/lib/php.ini
hand side of the LoadModule statement must point to the path of the
PHP module on your system. The make install from above may have
already added this for you, but be sure to check.
-LoadModule php5_module modules/libphp5.so
+LoadModule php7_module modules/libphp7.so
8. Tell Apache to parse certain extensions as PHP. For example, let's
have Apache parse .php files as PHP. Instead of only using the
Apache AddType directive, we want to avoid potentially dangerous
@@ -461,7 +461,7 @@ LoadModule php5_module modules/libphp5.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
- Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6,
+ Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php7,
and .phtml files to be executed as PHP, but nothing else, we'd use
this:
<FilesMatch "\.ph(p[2-6]?|tml)$">
@@ -1004,16 +1004,16 @@ Debian GNU/Linux installation notes
Using APT
First, note that other related packages may be desired like
- libapache2-mod-php5 to integrate with Apache 2, and php-pear for PEAR.
+ libapache2-mod-php7 to integrate with Apache 2, and php-pear for PEAR.
Second, before installing a package, it's wise to ensure the package
list is up to date. Typically, this is done by running the command
apt-get update.
Example #1 Debian Install Example with Apache 2
-# apt-get install php5-common libapache2-mod-php5 php5-cli
+# apt-get install php7-common libapache2-mod-php7 php7-cli
- APT will automatically install the PHP 5 module for Apache 2 and all of
+ APT will automatically install the PHP 7 module for Apache 2 and all of
its dependencies, and then activate it. Apache should be restarted in
order for the changes take place. For example:
@@ -1027,23 +1027,23 @@ Better control of configuration
very likely that additional modules will be desired, such as MySQL,
cURL, GD, etc. These may also be installed via the apt-get command.
- Example #3 Methods for listing additional PHP 5 packages
-# apt-cache search php5
-# aptitude search php5
-# aptitude search php5 |grep -i mysql
+ Example #3 Methods for listing additional PHP 7 packages
+# apt-cache search php7
+# aptitude search php7
+# aptitude search php7 |grep -i mysql
The examples will show a lot of packages including several PHP specific
- ones like php5-cgi, php5-cli and php5-dev. Determine which are needed
+ ones like php7-cgi, php7-cli and php7-dev. Determine which are needed
and install them like any other with either apt-get or aptitude. And
because Debian performs dependency checks, it'll prompt for those so
for example to install MySQL and cURL:
Example #4 Install PHP with MySQL, cURL
-# apt-get install php5-mysql php5-curl
+# apt-get install php7-mysql php7-curl
APT will automatically add the appropriate lines to the different
- php.ini related files like /etc/php5/apache2/php.ini,
- /etc/php5/conf.d/pdo.ini, etc. and depending on the extension will add
+ php.ini related files like /etc/php7/apache2/php.ini,
+ /etc/php7/conf.d/pdo.ini, etc. and depending on the extension will add
entries similar to extension=foo.so. However, restarting the web server
(like Apache) is required before these changes take affect.
@@ -1137,9 +1137,9 @@ Using the bundled PHP
2. With a text editor, uncomment the lines (by removing the #) that
look similar to the following (these two lines are often not
together, locate them both in the file):
-# LoadModule php5_module libexec/httpd/libphp5.so
+# LoadModule php7_module libexec/httpd/libphp7.so
-# AddModule mod_php5.c
+# AddModule mod_php7.c
Notice the location/path. When building PHP in the future, the
above files should be replaced or commented out.
@@ -1148,7 +1148,7 @@ Using the bundled PHP
Due to the following statement already existing in httpd.conf (as
of Mac Panther), once PHP is enabled the .php files will
automatically parse as PHP.
-<IfModule mod_php5.c>
+<IfModule mod_php7.c>
# If php is turned on, we respect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
@@ -1740,7 +1740,7 @@ Running PHP as an Apache module
php_admin_flag can not be overridden by .htaccess or ini_set().
Example #1 Apache configuration example
-<IfModule mod_php5.c>
+<IfModule mod_php7.c>
php_value include_path ".:/usr/local/lib/php"
php_admin_flag engine on
</IfModule>
@@ -1810,7 +1810,7 @@ Installation
script file via my browser, I get a server 500 error.
8. Some operating systems: I have installed PHP without errors, but
when I try to start Apache I get undefined symbol errors:
- [mybox:user /src/php5] root# apachectl configtest apachectl:
+ [mybox:user /src/php7] root# apachectl configtest apachectl:
/usr/local/apache/bin/httpd Undefined symbols: _compress
_uncompress
9. Windows: I have installed PHP, but when I try to access a PHP
@@ -1912,7 +1912,7 @@ AddModule mod_perl.c
# Extra Modules
LoadModule php_module modules/mod_php.so
-LoadModule php5_module modules/libphp5.so
+LoadModule php7_module modules/libphp7.so
LoadModule perl_module modules/libperl.so
And add:
@@ -1954,7 +1954,7 @@ AddType application/x-httpd-php .php
Some operating systems: I have installed PHP without errors, but when I
try to start Apache I get undefined symbol errors:
-[mybox:user /src/php5] root# apachectl configtest
+[mybox:user /src/php7] root# apachectl configtest
apachectl: /usr/local/apache/bin/httpd Undefined symbols:
_compress
_uncompress
@@ -1984,7 +1984,7 @@ cgi error:
script via the browser again. If it still fails then it could be
one of the following:
- + File permissions on your PHP script, php.exe, php5ts.dll,
+ + File permissions on your PHP script, php.exe, php7ts.dll,
php.ini or any PHP extensions you are trying to load are such
that the anonymous internet user ISUR_<machinename> cannot
access them.
@@ -2103,7 +2103,7 @@ cgi error:
to choose PHP files from URL with no extension. In this case,
replace the line AddType application/x-httpd-php .php with:
-AddHandler php5-script php
+AddHandler php7-script php
AddType text/html php
This solution doesn't work for Apache 1 as PHP module doesn't
diff --git a/Makefile.global b/Makefile.global
index bd82daf4d8..f833efa5e7 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -119,7 +119,7 @@ clean:
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
- rm -f php5.spec main/build-defs.h scripts/phpize
+ rm -f php7.spec main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
diff --git a/NEWS b/NEWS
index 16d8b26b2d..52af8e247c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 7.0.0
+-Fileinfo:
+ . Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
+
- CLI server:
. Refactor MIME type handling to use a hash table instead of linear search.
(Adam)
@@ -9,6 +12,11 @@ PHP NEWS
- Core:
. Added PHP_INT_MIN constant. (Andrea)
+ . Added Closure::apply() method. (Andrea)
+ . Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
+ . Fixed #67959 (Segfault when calling phpversion('spl')). (Florian)
+ . Implemented the RFC `Catchable "Call to a member function bar() on a
+ non-object"` (Timm)
- Reflection
. Fixed inheritance chain of Reflector interface (Tjerk)
@@ -34,4 +42,11 @@ PHP NEWS
- Session:
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)
+- SPL:
+ . Implemented #67886 (SplPriorityQueue/SplHeap doesn't expose extractFlags
+ nor curruption state). (Julien)
+
+- DOM:
+ . Made DOMNode::textContent writeable. (Tjerk)
+
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
diff --git a/README.GIT-RULES b/README.GIT-RULES
index d966093f25..843c61ea63 100644
--- a/README.GIT-RULES
+++ b/README.GIT-RULES
@@ -45,6 +45,9 @@ Currently we have the following branches in use::
master The active development branch.
+ PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
+ stable version and is open for bugfixes only.
+
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
stable version and is open for bugfixes only.
@@ -59,6 +62,9 @@ Currently we have the following branches in use::
PHP-4.4 This branch is closed.
+ PHP-X.Y.Z These branches are used for the release managers for tagging
+ the releases, hence they are closed to the general public.
+
The next few rules are more of a technical nature::
1. All changes should first go to the lowest branch (i.e. 5.4) and then
diff --git a/README.PARAMETER_PARSING_API b/README.PARAMETER_PARSING_API
index 25a41096cf..46e190efc1 100644
--- a/README.PARAMETER_PARSING_API
+++ b/README.PARAMETER_PARSING_API
@@ -50,7 +50,7 @@ Type specifiers
instance of that class.
a - array (zval*)
- A - array or object (zval *)
+ A - array or object (zval*)
b - boolean (zend_bool)
C - class (zend_class_entry*)
d - double (double)
@@ -58,15 +58,16 @@ Type specifiers
zend_fcall_info and zend_fcall_info_cache)
h - array (returned as HashTable*)
H - array or HASH_OF(object) (returned as HashTable*)
- l - long (long)
- L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
+ l - long (zend_long)
+ L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long)
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
- p - valid path (string without null bytes in the middle) and its length (char*, int)
+ p - valid path (string without null bytes in the middle) and its length (char*, size_t)
+ P - valid path (string without null bytes in the middle) as zend_string (zend_string)
r - resource (zval*)
- s - string (with possible null bytes) and its length (char*, int)
+ s - string (with possible null bytes) and its length (char*, size_t)
+ S - string (with possible null bytes) as zend_string (zend_string)
z - the actual zval (zval*)
- Z - the actual zval (zval**)
* - variable arguments list (0 or more)
+ - variable arguments list (1 or more)
@@ -80,28 +81,26 @@ Type specifiers
passed and the output for such type is a pointer, then the output
pointer is set to a native NULL pointer.
For 'b', 'l' and 'd', an extra argument of type zend_bool* must be
- passed after the corresponding bool*, long* or double* arguments,
- respectively. A non-zero value will be written to the zend_bool iif a
+ passed after the corresponding bool*, zend_long* or double* arguments,
+ respectively. A non-zero value will be written to the zend_bool if a
PHP NULL is passed.
Note on 64bit compatibility
---------------------------
-Please do not forget that int and long are two different things on 64bit
-OSes (int is 4 bytes and long is 8 bytes), so make sure you pass longs to "l"
-and ints to strings length (i.e. for "s" you need to pass char * and int),
+Please note that since version 7 PHP uses zend_long as integer type and
+zend_string with size_t as length, so make sure you pass zend_longs to "l"
+and size_t to strings length (i.e. for "s" you need to pass char * and int),
not the other way round!
-Remember: "l" is the only case when you need to pass long (and that's why
-it's "l", not "i" btw).
-Both mistakes cause memory corruptions and segfaults on 64bit OSes:
+Both mistakes might cause memory corruptions and segfaults:
1)
char *str;
- long str_len; /* XXX THIS IS WRONG!! Use int instead. */
+ long str_len; /* XXX THIS IS WRONG!! Use size_t instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
2)
- int num; /* XXX THIS IS WRONG!! Use long instead. */
+ int num; /* XXX THIS IS WRONG!! Use zend_long instead. */
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
If you're in doubt, use check_parameters.php script to the parameters
@@ -113,9 +112,9 @@ and their types (it can be found in ./scripts/dev/ directory of PHP sources):
Examples
--------
/* Gets a long, a string and its length, and a zval */
-long l;
+zend_long l;
char *s;
-int s_len;
+size_t s_len;
zval *param;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
&l, &s, &s_len, &param) == FAILURE) {
@@ -151,16 +150,16 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
}
/* Get either a set of 3 longs or a string. */
-long l1, l2, l3;
+zend_long l1, l2, l3;
char *s;
/*
- * The function expects a pointer to a integer in this case, not a long
+ * The function expects a pointer to a size_t in this case, not a long
* or any other type. If you specify a type which is larger
- * than a 'int', the upper bits might not be initialized
+ * than a 'size_t', the upper bits might not be initialized
* properly, leading to random crashes on platforms like
* Tru64 or Linux/Alpha.
*/
-int length;
+size_t length;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"lll", &l1, &l2, &l3) == SUCCESS) {
@@ -178,7 +177,7 @@ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
/* Function that accepts only varargs (0 or more) */
int i, num_varargs;
-zval ***varargs = NULL;
+zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
@@ -197,9 +196,9 @@ if (varargs) {
/* Function that accepts a string, followed by varargs (1 or more) */
char *str;
-int str_len;
+size_t str_len;
int i, num_varargs;
-zval ***varargs = NULL;
+zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
return;
@@ -209,16 +208,11 @@ for (i = 0; i < num_varargs; i++) {
/* do something with varargs[i] */
}
-if (varargs) {
- efree(varargs);
-}
-
-
/* Function that takes an array, followed by varargs, and ending with a long */
-long num;
+zend_long num;
zval *array;
int i, num_varargs;
-zval ***varargs = NULL;
+zval *varargs = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
return;
@@ -227,8 +221,3 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &n
for (i = 0; i < num_varargs; i++) {
/* do something with varargs[i] */
}
-
-if (varargs) {
- efree(varargs);
-}
-
diff --git a/README.TESTING b/README.TESTING
index 3ed5e6b2ab..1972f5f6f3 100644
--- a/README.TESTING
+++ b/README.TESTING
@@ -118,7 +118,7 @@ Example script to be run by cron(1):
========== qa-test.sh =============
#!/bin/sh
-CO_DIR=$HOME/cvs/php5
+CO_DIR=$HOME/cvs/php7
MYMAIL=qa-test@domain.com
TMPDIR=/var/tmp
TODAY=`date +"%Y%m%d"`
diff --git a/README.UNIX-BUILD-SYSTEM b/README.UNIX-BUILD-SYSTEM
index 9b49cb8bc8..54dcae3fc6 100644
--- a/README.UNIX-BUILD-SYSTEM
+++ b/README.UNIX-BUILD-SYSTEM
@@ -108,7 +108,7 @@ module, program, etc).
For example for APXS:
-PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php5.c php_apache.c)
+PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php7.c php_apache.c)
diff --git a/README.input_filter b/README.input_filter
index e2941d029e..78e2edd2ec 100644
--- a/README.input_filter
+++ b/README.input_filter
@@ -181,4 +181,3 @@ PHP_FUNCTION(my_get_raw)
RETVAL_FALSE;
}
}
-
diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp
deleted file mode 100644
index 8604bc0da8..0000000000
--- a/TSRM/TSRM.dsp
+++ /dev/null
@@ -1,178 +0,0 @@
-# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=TSRM - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "TSRM - Win32 Debug_TS"
-# Name "TSRM - Win32 Release_TS"
-# Name "TSRM - Win32 Release_TS_inline"
-# Name "TSRM - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\TSRM.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TSRM.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index 82e272db5b..b232429d4d 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -64,7 +64,7 @@ typedef int ts_rsrc_id;
/* Define THREAD_T and MUTEX_T */
#ifdef TSRM_WIN32
-# define THREAD_T UINT_PTR
+# define THREAD_T DWORD
# define MUTEX_T CRITICAL_SECTION *
#elif defined(GNUPTH)
# define THREAD_T pth_t
diff --git a/TSRM/tsrm_nw.c b/TSRM/tsrm_nw.c
index 8d591c0746..8defc4ed94 100644
--- a/TSRM/tsrm_nw.c
+++ b/TSRM/tsrm_nw.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/TSRM/tsrm_nw.h b/TSRM/tsrm_nw.h
index ba03744a30..02ac4be098 100644
--- a/TSRM/tsrm_nw.h
+++ b/TSRM/tsrm_nw.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/TSRM/tsrm_strtok_r.c b/TSRM/tsrm_strtok_r.c
index e9ad26a7ac..2522cf1d48 100644
--- a/TSRM/tsrm_strtok_r.c
+++ b/TSRM/tsrm_strtok_r.c
@@ -14,7 +14,7 @@ static inline int in_character_class(char ch, const char *delim)
return 0;
}
-char *tsrm_strtok_r(char *s, const char *delim, char **last)
+TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last)
{
char *token;
diff --git a/TSRM/tsrm_strtok_r.h b/TSRM/tsrm_strtok_r.h
index 8c9e8198e7..323b401d99 100644
--- a/TSRM/tsrm_strtok_r.h
+++ b/TSRM/tsrm_strtok_r.h
@@ -1,6 +1,8 @@
#ifndef TSRM_STRTOK_R
#define TSRM_STRTOK_R
-char *tsrm_strtok_r(char *s, const char *delim, char **last);
+#include "TSRM.h"
+
+TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last);
#endif
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index a116aaf457..faa186a1bb 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -457,7 +457,7 @@ TSRM_API FILE *popen(const char *command, const char *type)
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC)
{
FILE *stream = NULL;
- int fno, type_len = strlen(type), read, mode;
+ int fno, type_len, read, mode;
STARTUPINFO startup;
PROCESS_INFORMATION process;
SECURITY_ATTRIBUTES security;
@@ -605,13 +605,13 @@ TSRM_API int shmget(int key, int size, int flags)
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
- if ((!shm_handle && !info_handle)) {
+ if (!shm_handle && !info_handle) {
if (flags & IPC_CREAT) {
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
created = TRUE;
}
- if ((!shm_handle || !info_handle)) {
+ if (!shm_handle || !info_handle) {
return -1;
}
} else {
diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
index dc5a3999dd..5933b54ddf 100644
--- a/TSRM/tsrm_win32.h
+++ b/TSRM/tsrm_win32.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/UPGRADING b/UPGRADING
index 8b6f8cd3ce..5e2c33c7c6 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -21,16 +21,38 @@ PHP X.Y UPGRADE NOTES
1. Backward Incompatible Changes
========================================
+- Core
+ . Added null coalesce operator (??).
+ (RFC: https://wiki.php.net/rfc/isset_ternary)
+ . list() now always supports ArrayAccess and never supports strings.
+ Previously both were accepted in some situations and not in others.
+ (RFC: https://wiki.php.net/rfc/fix_list_behavior_inconsistency)
+ . Bitwise shifts by negative numbers of bits are disallowed (throws E_WARNING
+ and gives FALSE, like a division by zero).
+ . Left bitwise shifts by a number of bits beyond the bit width of an integer
+ will always result in 0, even on CPUs which wrap around.
+ . Right bitwise shifts by a number of bits beyond the bit width of an integer
+ will always result in 0 or -1 (depending on sign), even on CPUs which wrap
+ around.
+ . Removed ASP (<%) and script (<script language=php>) tags.
+ (RFC: https://wiki.php.net/rfc/remove_alternative_php_tags)
+
- DBA
- . dba_delete() now returns false if the key was not found for the inifile
+ . dba_delete() now returns false if the key was not found for the inifile
handler, too.
+- GMP
+ . Requires libgmp version 4.2 or newer now.
+ . gmp_setbit() and gmp_clrbit() now return FALSE for negative indices, making
+ them consistent with other GMP functions.
+
========================================
2. New Features
========================================
- Core
. Support for strings with length >= 2^31 bytes in 64 bit builds
+ . Closure::apply() method added
- Standard
. intdiv() function for integer division added.
@@ -51,6 +73,10 @@ PHP X.Y UPGRADE NOTES
5. Changed Functions
========================================
+- parse_ini_file():
+- parse_ini_string():
+ Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
+
========================================
6. New Functions
@@ -83,6 +109,10 @@ PHP X.Y UPGRADE NOTES
11. Changes to INI File Handling
========================================
+- Core
+ . Removed asp_tags ini directive. Trying to enable it will result in a fatal
+ error.
+
========================================
12. Windows Support
========================================
@@ -95,5 +125,11 @@ PHP X.Y UPGRADE NOTES
13. Other Changes
========================================
+- Core
+ . Instead of being undefined and platform-dependant, NaN and Infinity will
+ always be zero when casted to integer.
+ . Calling a method on a non-object no longer raises a fatal error; see
+ also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
+
- Standard
. call_user_method() and call_user_method_array() no longer exists.
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index e46581ac70..92cebc8db3 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -1,12 +1,8 @@
$Id$
-UPGRADE NOTES - PHP X.Y
+PHP 7.0 INTERNALS UPGRADE NOTES
1. Internal API changes
- a. Addition of do_operation and compare object handlers
- b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
- c. POST data handling
- d. Arginfo changes
e. New data types
f. zend_parse_parameters() specs
g. sprintf() formats
@@ -30,22 +26,17 @@ UPGRADE NOTES - PHP X.Y
Besides the old way of accepting the strings with 's', the new 'S' ZPP spec
was introduced. It expects an argument of the type zend_string *. String lengths
- in it do no more depend on the firm 'int' datatype. The replacement
- is a platform dependent size_t datatype called php_size_t.
-
- String length is defined as zend_size_t inside Zend and aliased as php_size_t
- anywhere else. The inclusion of php.h is necessary.
+ in it are bound to the size_t datatype.
Integer types
Integers do no more depend on the firm 'long' type. Instead a platform
- dependent integer type is used. That datatype is defined dynamically to
- guarantee the consistent 64 bit support. The zval field representing user
- land integer it bound to php_int_t.
+ dependent integer type is used, it is called zend_long. That datatype is
+ defined dynamically to guarantee the consistent 64 bit support. The zval
+ field representing user land integer it bound to zend_long.
- Signed integer is defined as zend_int_t, unsigned integer as zend_uint_t
- inside Zend. Both are aliased as php_int_t and php_uint_t anywhere else,
- respectively. The inclusion of php.h is necessary.
+ Signed integer is defined as zend_long, unsigned integer as zend_ulong
+ inside Zend.
Other datatypes
@@ -66,20 +57,25 @@ UPGRADE NOTES - PHP X.Y
f. zend_parse_parameters() specs
The new spec 'S' introduced, which expects an argument of type zend_string *.
- The new specs 'i' and 'I' introduced, which expect an argument of type php_int_t.
+ The 'l' spec expects a parameter of the type zend_long, not long anymore.
+ The 's' spec expects parameters of the type char * and size_t, no int anymore.
g. sprintf() formats
- New printf modifier 'p' was implemented to platform independently output php_int_t,
- php_uint_t and php_size_t datatypes. That modifier can be used with'd', 'u', 'x' and 'o'
+ New printf modifier 'p' was implemented to platform independently output zend_long,
+ zend_ulong and php_size_t datatypes. That modifier can be used with'd', 'u', 'x' and 'o'
printf format specs with spprintf, snprintf and the wrapping printf implementations.
- %pu is sufficient for both php_uint_t and php_size_t. the code using %p spec to output
+ %pu is sufficient for both zend_ulong and php_size_t. the code using %p spec to output
pointer address might need to be enclosed into #ifdef when it unlickily followed by 'd',
'u', 'x' or 'o'.
+ The only exceptions are the snprintf and zend_sprintf functions yet, because in some cases
+ they can use the implemenations available on the system, not the PHP one. Fro snprintf the
+ the macros ZEND_INT_FMT ZEND_UINT_FMT should be used.
+
h. HashTable API
- Datatype for array indexes was changed to php_uint_t, for string keys to zend_string *.
+ Datatype for array indexes was changed to zend_ulong, for string keys to zend_string *.
i. New portable macros for large file support
@@ -93,16 +89,26 @@ UPGRADE NOTES - PHP X.Y
j. New portable macros for integers
Function(s) Alias Comment
- snprintf with "%ld" or "%lld", _ltoa_s, _i64toa_s ZEND_ITOA for use with zend_int_t
- atol, atoll, _atoi64 ZEND_ATOI for use with zend_int_t
- strtol, strtoll, _strtoi64 ZEND_STRTOI for use with zend_int_t
- strtoul, strtoull, _strtoui64 ZEND_STRTOUI for use with zend_int_t
- abs, llabs, _abs64 ZEND_ABS for use with zend_int_t
- - ZEND_INT_MAX Aliased with PHP_INT_MAX in php.h, replaces LONG_MAX where appropriate
- - ZEND_INT_MIN Aliased with PHP_INT_MIN in php.h, replaces LONG_MIN where appropriate
- - ZEND_UINT_MAX ULONG_MAX
- - SIZEOF_ZEND_INT Replaces SIZEOF_ZEND_LONG where appropriate
- - ZEND_SIZE_MAX Max value of zend_size_t
+ snprintf with "%ld" or "%lld", _ltoa_s, _i64toa_s ZEND_LTOA for use with zend_long
+ atol, atoll, _atoi64 ZEND_ATOL for use with zend_long
+ strtol, strtoll, _strtoi64 ZEND_STRTOL for use with zend_long
+ strtoul, strtoull, _strtoui64 ZEND_STRTOUL for use with zend_long
+ abs, llabs, _abs64 ZEND_ABS for use with zend_long
+ - ZEND_LONG_MAX replaces LONG_MAX where appropriate
+ - ZEND_LONG_MIN replaces LONG_MIN where appropriate
+ - ZEND_ULONG_MAX replaces ULONG_MAX where appropriate
+ - SIZEOF_ZEND_LONG reworked SIZEOF_ZEND_LONG representing the size of zend_long datatype
+ - ZEND_SIZE_MAX Max value of size_t
+
+ k. The get_class_entry object handler is no longer available. Instead
+ zend_object.ce is always used.
+
+ l. The get_class_name object handler is now only used for displaying class
+ names in debugging functions like var_dump(). It is no longer used in
+ get_class(), get_parent_class() or similar.
+
+ The handler is now obligatory, no longer accepts a `parent` argument and
+ must return a non-NULL zend_string*, which will be released by the caller.
========================
2. Build system changes
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
index 65c4113497..2a76db36b1 100644
--- a/Zend/Makefile.am
+++ b/Zend/Makefile.am
@@ -8,7 +8,7 @@ noinst_LTLIBRARIES=libZend.la
libZend_la_SOURCES=\
zend_language_parser.y zend_language_scanner.l \
zend_ini_parser.y zend_ini_scanner.l \
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
+ zend_alloc.c zend_compile.c zend_constants.c \
zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
diff --git a/Zend/Zend.dsp b/Zend/Zend.dsp
deleted file mode 100644
index 98d368fb16..0000000000
--- a/Zend/Zend.dsp
+++ /dev/null
@@ -1,622 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Zend" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=Zend - Win32 Release_inline
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Zend.mak" CFG="Zend - Win32 Release_inline"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Zend - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "Zend - Win32 Release_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug"
-# ADD RSC /l 0x40d /d "_Debug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Zend___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "Zend___Win32_Release_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_inline"
-# PROP Intermediate_Dir "Release_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D ZEND_DEBUG=0 /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "Zend_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "Zend - Win32 Release"
-# Name "Zend - Win32 Debug"
-# Name "Zend - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ast.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_closures.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_float.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_generators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_interfaces.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_strtod.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_vm_opcodes.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_virtual_cwd.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_locks.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals_macros.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_interfaces.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_istdiostream.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_strtod.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "Zend - Win32 Release"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "Zend - Win32 Release_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_TODO
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index 8a676cba15..945409eb1e 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -130,7 +130,7 @@ int main()
exit(1);
}
], [
- AC_DEFINE([ZEND_DVAL_TO_IVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
+ AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
diff --git a/Zend/ZendTS.dsp b/Zend/ZendTS.dsp
deleted file mode 100644
index 21210f1087..0000000000
--- a/Zend/ZendTS.dsp
+++ /dev/null
@@ -1,748 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ZendTS" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=ZendTS - Win32 Release_TSDbg
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ZendTS.mak" CFG="ZendTS - Win32 Release_TSDbg"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ZendTS - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "ZendTS - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug_TS"
-# ADD RSC /l 0x40d /d "_Debug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "ZendTS___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDebug_TS" /D ZEND_DEBUG=0 /D _WIN32_WINNT=0x400 /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "ZendTS - Win32 Release_TS"
-# Name "ZendTS - Win32 Debug_TS"
-# Name "ZendTS - Win32 Release_TS_inline"
-# Name "ZendTS - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ast.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_closures.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_exceptions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.c
-# ADD CPP /I "..\TSRM"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_generators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_interfaces.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_iterators.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_opcode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_strtod.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_vm_opcodes.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_builtin_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_compile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_constants.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_default_classes.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_dynamic_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_errors.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_exceptions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_execute.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_extensions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_globals_macros.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_highlight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_indent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_interfaces.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_istdiostream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_iterators.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_llist.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_object_handlers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_objects_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_operators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ptr_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_qsort.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stack.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_strtod.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ts_hash.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_variables.h
-# End Source File
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter "y"
-# Begin Source File
-
-SOURCE=.\zend_ini_parser.y
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=.\zend_ini_parser.y
-
-BuildCmds= \
- bison --output=zend_ini_parser.c -v -d -p ini_ zend_ini_parser.y
-
-"$(InputDir)\zend_ini_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_ini_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_parser.y"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\zend_language_parser.y"
-
-BuildCmds= \
- bison --output=zend_language_parser.c -v -d -p zend zend_language_parser.y
-
-"$(InputDir)\zend_language_parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\zend_language_parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter "l"
-# Begin Source File
-
-SOURCE=.\flex.skl
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_ini_scanner.l
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=.\zend_ini_scanner.l
-
-"zend_ini_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pini_ -ozend_ini_scanner.c zend_ini_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend_language_scanner.l"
-
-!IF "$(CFG)" == "ZendTS - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ZendTS - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=".\zend_language_scanner.l"
-
-"zend_language_scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -B -i -Sflex.skl -Pzend -ozend_language_scanner.c zend_language_scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/tests/024.phpt b/Zend/tests/024.phpt
index ff35a5c895..f89c49e613 100644
--- a/Zend/tests/024.phpt
+++ b/Zend/tests/024.phpt
@@ -11,7 +11,7 @@ var_dump($a++);
var_dump(++$b);
var_dump($a->$b);
var_dump($a->$b);
-var_dump($a->$b->$c[1]);
+var_dump($a->$b->{$c[1]});
?>
--EXPECTF--
diff --git a/Zend/tests/034.phpt b/Zend/tests/034.phpt
index 6e46f2645e..0bcfa23f19 100644
--- a/Zend/tests/034.phpt
+++ b/Zend/tests/034.phpt
@@ -22,5 +22,5 @@ switch (1) {
}
?>
---EXPECT--
-3
+--EXPECTF--
+Fatal error: Switch statements may only contain one default clause in %s on line 13
diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt
index 4d513e91aa..43591a9386 100644
--- a/Zend/tests/bug27669.phpt
+++ b/Zend/tests/bug27669.phpt
@@ -10,7 +10,7 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
}
}
$y[0] = 'hello';
- A::$y[0]();
+ A::{$y[0]}();
?>
===DONE===
--EXPECTF--
diff --git a/Zend/tests/bug30080.phpt b/Zend/tests/bug30080.phpt
index bd8401e1be..8cac75ab8d 100644
--- a/Zend/tests/bug30080.phpt
+++ b/Zend/tests/bug30080.phpt
@@ -10,9 +10,9 @@ class foo {
new foo(array(new stdClass));
?>
---EXPECT--
+--EXPECTF--
array(1) {
[0]=>
- object(stdClass)#2 (0) {
+ object(stdClass)#%d (0) {
}
}
diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt
index 8303b82573..2e9ebcdee4 100644
--- a/Zend/tests/bug39304.phpt
+++ b/Zend/tests/bug39304.phpt
@@ -8,9 +8,5 @@ echo "I am alive";
?>
--EXPECTF--
Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
-
-Notice: Uninitialized string offset: 1 in %sbug39304.php on line %d
-
-Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
I am alive
diff --git a/Zend/tests/bug39304_2_4.phpt b/Zend/tests/bug39304_2_4.phpt
index b0e6ddc72c..917c64e2cd 100644
--- a/Zend/tests/bug39304_2_4.phpt
+++ b/Zend/tests/bug39304_2_4.phpt
@@ -10,9 +10,5 @@ Bug #39304 (Segmentation fault with list unpacking of string offset)
?>
--EXPECTF--
Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d
-
-Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line %d
-
-Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d
-string(0) ""
-string(0) ""
+NULL
+NULL
diff --git a/Zend/tests/bug43450.phpt b/Zend/tests/bug43450.phpt
index a94eba312e..f0cd4f75bc 100644
--- a/Zend/tests/bug43450.phpt
+++ b/Zend/tests/bug43450.phpt
@@ -18,15 +18,15 @@ class Foo
$num_repeats = 100000;
-$start = (memory_get_usage() / 1024) + 16;
+$start = memory_get_usage() / 1024;
for ($i=1;$i<$num_repeats;$i++)
{
$foo = new Foo();
md5($foo);
}
-$end = memory_get_peak_usage() / 1024;
+$end = memory_get_usage() / 1024;
-if ($start < $end) {
+if ($start + 16 < $end) {
echo 'FAIL';
} else {
echo 'PASS';
diff --git a/Zend/tests/bug44414.phpt b/Zend/tests/bug44414.phpt
index 1f3a2583d7..e9e6de7b45 100644
--- a/Zend/tests/bug44414.phpt
+++ b/Zend/tests/bug44414.phpt
@@ -12,4 +12,4 @@ class C extends A implements B {
}
?>
--EXPECTF--
-Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 9
+Fatal error: Class C contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (A::foo, B::bar) in %sbug44414.php on line 8
diff --git a/Zend/tests/bug55007.phpt b/Zend/tests/bug55007.phpt
index 12fbf120a8..425ce8f296 100644
--- a/Zend/tests/bug55007.phpt
+++ b/Zend/tests/bug55007.phpt
@@ -4,7 +4,7 @@ Bug #55007 (compiler fail after previous fail)
<?php
function __autoload($classname) {
- if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[] } }');
+ if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[]; } }');
if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }');
}
diff --git a/Zend/tests/bug60099.phpt b/Zend/tests/bug60099.phpt
index 13e2f54b09..8cca3440fb 100644
--- a/Zend/tests/bug60099.phpt
+++ b/Zend/tests/bug60099.phpt
@@ -7,4 +7,4 @@ namespace foo {
?>
--EXPECTF--
-Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %s on line %d
+Parse error: syntax error, unexpected end of file in %s on line %d
diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index 464f711532..f1760c6462 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -19,6 +19,6 @@ $b = new b();
$b->test();
--EXPECTF--
-Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s/bug67436/b.php on line %d
+Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67633.phpt b/Zend/tests/bug67633.phpt
new file mode 100644
index 0000000000..a9e05d10ab
--- /dev/null
+++ b/Zend/tests/bug67633.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #67633: A foreach on an array returned from a function not doing copy-on-write
+--FILE--
+<?php
+
+function id($x) {
+ return $x;
+}
+
+function &ref_id(&$x) {
+ return $x;
+}
+
+$c = 'c';
+$array = ['a', 'b', $c];
+
+foreach(id($array) as &$v) {
+ $v .= 'q';
+}
+var_dump($array);
+
+foreach(ref_id($array) as &$v) {
+ $v .= 'q';
+}
+var_dump($array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(2) "aq"
+ [1]=>
+ string(2) "bq"
+ [2]=>
+ &string(2) "cq"
+}
diff --git a/Zend/tests/bug67922.phpt b/Zend/tests/bug67922.phpt
new file mode 100644
index 0000000000..8be3f2eba0
--- /dev/null
+++ b/Zend/tests/bug67922.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #67922: Member function not found when dereferencing in write-context
+--FILE--
+<?php
+
+class C {
+ public function test() {
+ return new stdClass;
+ }
+}
+
+$b = new stdClass;
+$b->c = new C;
+$b->c->test()->d = 'str';
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug67938.phpt b/Zend/tests/bug67938.phpt
new file mode 100644
index 0000000000..6597c4895f
--- /dev/null
+++ b/Zend/tests/bug67938.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #67938: Segfault when extending interface method with variadic
+--FILE--
+<?php
+
+interface TestInterface {
+ public function foo();
+ public function bar(array $bar);
+}
+
+class Test implements TestInterface {
+ public function foo(...$args) {
+ echo __METHOD__, "\n";
+ }
+ public function bar(array $bar, ...$args) {
+ echo __METHOD__, "\n";
+ }
+}
+
+$obj = new Test;
+$obj->foo();
+$obj->bar([]);
+
+?>
+--EXPECT--
+Test::foo
+Test::bar
diff --git a/Zend/tests/bug67985.phpt b/Zend/tests/bug67985.phpt
new file mode 100644
index 0000000000..6f032643f4
--- /dev/null
+++ b/Zend/tests/bug67985.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #67985 - Last used array index not copied to new array at assignment
+--FILE--
+<?php
+
+$a = ['zero', 'one', 'two'];
+unset($a[2]);
+$b = $a;
+$a[] = 'three';
+$b[] = 'three';
+
+var_dump($a === $b);
+
+?>
+--EXPECT--
+bool(true)
diff --git a/Zend/tests/bug68118.phpt b/Zend/tests/bug68118.phpt
new file mode 100644
index 0000000000..c56e70a112
--- /dev/null
+++ b/Zend/tests/bug68118.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #68118: $a->foo .= 'test'; can leave $a->foo undefined
+--FILE--
+<?php
+
+set_error_handler(function() {
+ $obj = new stdClass;
+ $obj->test = 'meow';
+ return true;
+});
+
+$a = new stdClass;
+$a->undefined .= 'test';
+var_dump($a);
+
+?>
+--EXPECT--
+object(stdClass)#2 (1) {
+ ["undefined"]=>
+ string(4) "test"
+}
diff --git a/Zend/tests/bug68148.phpt b/Zend/tests/bug68148.phpt
new file mode 100644
index 0000000000..fcbf69bb87
--- /dev/null
+++ b/Zend/tests/bug68148.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #68148: $this is null inside include
+--FILE--
+<?php
+
+class Test {
+ public function method() {
+ eval('var_dump($this);');
+ }
+}
+
+(new Test)->method();
+
+?>
+--EXPECT--
+object(Test)#1 (0) {
+}
diff --git a/Zend/tests/bug68162.phpt b/Zend/tests/bug68162.phpt
new file mode 100644
index 0000000000..24e412f18d
--- /dev/null
+++ b/Zend/tests/bug68162.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #68162: isset($$varname) always true
+--FILE--
+<?php
+
+$name = 'var';
+var_dump(isset($$name));
+$var = 42;
+var_dump(isset($$name));
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
diff --git a/Zend/tests/bug68163.phpt b/Zend/tests/bug68163.phpt
new file mode 100644
index 0000000000..2ea0da33d6
--- /dev/null
+++ b/Zend/tests/bug68163.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #68163: Using reference as object property name
+--FILE--
+<?php
+
+$obj = (object) ['foo' => 'bar'];
+$foo = 'foo';
+$ref =& $foo;
+var_dump($obj->$foo);
+
+?>
+--EXPECT--
+string(3) "bar"
diff --git a/Zend/tests/bug68191.phpt b/Zend/tests/bug68191.phpt
new file mode 100644
index 0000000000..198c5c7dce
--- /dev/null
+++ b/Zend/tests/bug68191.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #68191: Broken reference across objects
+--FILE--
+<?php
+
+$obj = new stdClass;
+
+$obj->prop1 = 'abc';
+$obj->prop2 =& $obj->prop1;
+$obj->prop2 .= 'xyz';
+var_dump($obj->prop1);
+
+$obj->prop3 = 1;
+$obj->prop4 =& $obj->prop3;
+++$obj->prop4;
+var_dump($obj->prop3);
+
+?>
+--EXPECT--
+string(6) "abcxyz"
+int(2)
diff --git a/Zend/tests/bug68215.phpt b/Zend/tests/bug68215.phpt
new file mode 100644
index 0000000000..c4e8da8515
--- /dev/null
+++ b/Zend/tests/bug68215.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Bug #68215 (Behavior of foreach has changed)
+--FILE--
+<?php
+$arr = array(
+ 'a' => array(
+ 'a' => 'apple',
+ 'b' => 'banana',
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
+ ),
+ 'b' => array(
+ 'a' => 'apple',
+ 'b' => 'banana',
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
+ ),
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
+);
+
+function test(&$child, $entry)
+{
+ $i = 1;
+
+ foreach ($child AS $key => $fruit)
+ {
+ if (!is_numeric($key))
+ {
+ $child[$i] = $fruit;
+ unset($child[$key]);
+ $i++;
+ }
+ }
+}
+
+$i = 1;
+
+foreach ($arr AS $key => $fruit)
+{
+ $arr[$i] = $fruit;
+
+ if (is_array($fruit))
+ {
+ test($arr[$i], $fruit);
+ }
+
+ unset($arr[$key]);
+ $i++;
+}
+
+var_dump($arr);
+?>
+--EXPECT--
+array(5) {
+ [1]=>
+ array(5) {
+ [1]=>
+ string(5) "apple"
+ [2]=>
+ string(6) "banana"
+ [3]=>
+ string(9) "cranberry"
+ [4]=>
+ string(5) "mango"
+ [5]=>
+ string(9) "pineapple"
+ }
+ [2]=>
+ array(5) {
+ [1]=>
+ string(5) "apple"
+ [2]=>
+ string(6) "banana"
+ [3]=>
+ string(9) "cranberry"
+ [4]=>
+ string(5) "mango"
+ [5]=>
+ string(9) "pineapple"
+ }
+ [3]=>
+ string(9) "cranberry"
+ [4]=>
+ string(5) "mango"
+ [5]=>
+ string(9) "pineapple"
+}
diff --git a/Zend/tests/builtin_in_write_context_error1.phpt b/Zend/tests/builtin_in_write_context_error1.phpt
new file mode 100644
index 0000000000..eed03cc3c1
--- /dev/null
+++ b/Zend/tests/builtin_in_write_context_error1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use built-in functions in write context (assignment)
+--FILE--
+<?php
+
+strlen("foo")[0] = 1;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use result of built-in function in write context in %s on line %d
diff --git a/Zend/tests/builtin_in_write_context_error2.phpt b/Zend/tests/builtin_in_write_context_error2.phpt
new file mode 100644
index 0000000000..aac23e4f4e
--- /dev/null
+++ b/Zend/tests/builtin_in_write_context_error2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use built-in functions in write context (reference)
+--FILE--
+<?php
+
+$ref =& strlen("foo");
+
+?>
+--EXPECTF--
+Fatal error: Cannot use result of built-in function in write context in %s on line %d
diff --git a/Zend/tests/bw_or_assign_with_ref.phpt b/Zend/tests/bw_or_assign_with_ref.phpt
new file mode 100644
index 0000000000..27ccf6299b
--- /dev/null
+++ b/Zend/tests/bw_or_assign_with_ref.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bitwise or assign with referenced value
+--FILE--
+<?php
+
+$num1 = 1;
+$num2 = '2';
+$ref =& $num2;
+$num1 |= $num2;
+var_dump($num1);
+
+?>
+--EXPECT--
+int(3)
diff --git a/Zend/tests/class_name_as_scalar_error_007.phpt b/Zend/tests/class_name_as_scalar_error_007.phpt
new file mode 100644
index 0000000000..2bfa5f38f8
--- /dev/null
+++ b/Zend/tests/class_name_as_scalar_error_007.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot access self::class when no class scope is active
+--FILE--
+<?php
+
+var_dump(self::class);
+
+?>
+--EXPECTF--
+Fatal error: Cannot access self::class when no class scope is active in %s on line %d
diff --git a/Zend/tests/closure_call.phpt b/Zend/tests/closure_call.phpt
new file mode 100644
index 0000000000..d53b6077ee
--- /dev/null
+++ b/Zend/tests/closure_call.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Closure::call
+--FILE--
+<?php
+
+class Foo {
+ public $x = 0;
+ function bar() {
+ return function () {
+ return $this->x;
+ };
+ }
+}
+
+$foo = new Foo;
+$qux = $foo->bar();
+
+$foobar = new Foo;
+$foobar->x = 3;
+
+var_dump($qux());
+
+var_dump($qux->call($foo));
+
+// Try on an object other than the one already bound
+var_dump($qux->call($foobar));
+
+
+$bar = function () {
+ return $this->x;
+};
+
+$elePHPant = new StdClass;
+$elePHPant->x = 7;
+
+// Try on a StdClass
+var_dump($bar->call($elePHPant));
+
+
+$beta = function ($z) {
+ return $this->x * $z;
+};
+
+// Ensure argument passing works
+var_dump($beta->call($elePHPant, 3));
+
+// Ensure ->call calls with scope of passed object
+class FooBar {
+ private $x = 3;
+}
+
+$foo = function () {
+ var_dump($this->x);
+};
+
+$foo->call(new FooBar);
+
+?>
+--EXPECT--
+int(0)
+int(0)
+int(3)
+int(7)
+int(21)
+int(3) \ No newline at end of file
diff --git a/Zend/tests/concat_002.phpt b/Zend/tests/concat_002.phpt
new file mode 100644
index 0000000000..3cb182ee7d
--- /dev/null
+++ b/Zend/tests/concat_002.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Stress test $x .= $x
+--FILE--
+<?php
+
+/*
+ * Test case for a concat_function() change that broke a test outside of Zend
+ *
+ * @see https://github.com/php/php-src/commit/29397f8fd2b4bc8d95e18448ca2d27a62241a407
+**/
+
+$result = 'f';
+
+for ($i = 0; $i < 25; ++$i) {
+ $result .= $result;
+}
+
+var_dump(strlen($result));
+echo "Done\n";
+?>
+--EXPECT--
+int(33554432)
+Done
+
diff --git a/Zend/tests/constant_expressions_dynamic.phpt b/Zend/tests/constant_expressions_dynamic.phpt
index 21c9216cc1..d4e06ee258 100644
--- a/Zend/tests/constant_expressions_dynamic.phpt
+++ b/Zend/tests/constant_expressions_dynamic.phpt
@@ -2,10 +2,76 @@
Dynamic Constant Expressions
--FILE--
<?php
-const FOO = 1;
-const BAR = FOO | 2;
-echo BAR;
+const C_0 = 0;
+const C_1 = 1;
+const C_foo = "foo";
+const C_arr = [0 => 0, "foo" => "foo"];
+
+const T_1 = C_1 | 2;
+const T_2 = C_1 . "foo";
+const T_3 = C_1 > 1;
+const T_4 = C_1 >= 1;
+const T_5 = -C_1;
+const T_6 = +C_1;
+const T_7 = +C_foo;
+const T_8 = !C_1;
+const T_9 = C_0 || 0;
+const T_10 = C_1 || 0;
+const T_11 = C_0 && 1;
+const T_12 = C_1 && 1;
+const T_13 = C_0 ? "foo" : "bar";
+const T_14 = C_1 ? "foo" : "bar";
+const T_15 = C_0 ?: "bar";
+const T_16 = C_1 ?: "bar";
+const T_17 = C_arr[0];
+const T_18 = C_arr["foo"];
+const T_19 = [
+ C_0,
+ "foo" => "foo",
+ 42 => 42,
+ 3.14 => 3.14,
+ null => null,
+ false => false,
+ true => true,
+];
+
+var_dump(
+ T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9, T_10,
+ T_11, T_12, T_13, T_14, T_15, T_16, T_17, T_18, T_19
+);
+
?>
---EXPECTF--
-3
+--EXPECT--
+int(3)
+string(4) "1foo"
+bool(false)
+bool(true)
+int(-1)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+string(3) "bar"
+string(3) "foo"
+string(3) "bar"
+int(1)
+int(0)
+string(3) "foo"
+array(6) {
+ [0]=>
+ bool(false)
+ ["foo"]=>
+ string(3) "foo"
+ [42]=>
+ int(42)
+ [3]=>
+ float(3.14)
+ [""]=>
+ NULL
+ [1]=>
+ bool(true)
+}
diff --git a/Zend/tests/constant_expressions_dynamic_class_name_error.phpt b/Zend/tests/constant_expressions_dynamic_class_name_error.phpt
new file mode 100644
index 0000000000..3ce5844649
--- /dev/null
+++ b/Zend/tests/constant_expressions_dynamic_class_name_error.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Dynamic class names can't be used in compile-time constant refs
+--FILE--
+<?php
+
+$foo = 'test';
+const C = $foo::BAR;
+
+?>
+--EXPECTF--
+Fatal error: Dynamic class names are not allowed in compile-time class constant references in %s on line %d
diff --git a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
new file mode 100644
index 0000000000..440eabc652
--- /dev/null
+++ b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Can't use arrays as key for constant array
+--FILE--
+<?php
+
+const C1 = 1; // force dynamic evaluation
+const C2 = [C1, [] => 1];
+
+?>
+--EXPECTF--
+Fatal error: Illegal offset type in %s on line %d
diff --git a/Zend/tests/constant_expressions_static_class_name_error.phpt b/Zend/tests/constant_expressions_static_class_name_error.phpt
new file mode 100644
index 0000000000..f03a88b87e
--- /dev/null
+++ b/Zend/tests/constant_expressions_static_class_name_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use static::FOO in constant expressions
+--FILE--
+<?php
+
+const C = static::FOO;
+
+?>
+--EXPECTF--
+Fatal error: "static::" is not allowed in compile-time constants in %s on line %d
diff --git a/Zend/tests/constants/dir-constant-includes.phpt b/Zend/tests/constants/dir-constant-includes.phpt
index 8ea65292de..c004cbb6a4 100644
--- a/Zend/tests/constants/dir-constant-includes.phpt
+++ b/Zend/tests/constants/dir-constant-includes.phpt
@@ -4,10 +4,10 @@ __DIR__ constant test with includes
<?php
echo __DIR__ . "\n";
echo dirname(__FILE__) . "\n";
-include 'fixtures/folder1/fixture.php';
-include 'fixtures/folder2/fixture.php';
-include 'fixtures/folder3/fixture.php';
-include 'fixtures/folder4/fixture.php';
+include 'fixtures/folder1/fixture.inc';
+include 'fixtures/folder2/fixture.inc';
+include 'fixtures/folder3/fixture.inc';
+include 'fixtures/folder4/fixture.inc';
?>
--EXPECTF--
%stests%sconstants
diff --git a/Zend/tests/constants/dir-constant-nested_includes.phpt b/Zend/tests/constants/dir-constant-nested_includes.phpt
index 18bdfa8912..c67fbf85e4 100644
--- a/Zend/tests/constants/dir-constant-nested_includes.phpt
+++ b/Zend/tests/constants/dir-constant-nested_includes.phpt
@@ -4,26 +4,26 @@ __DIR__ constant test with nested includes
<?php
echo __DIR__ . "\n";
echo dirname(__FILE__) . "\n";
-include 'fixtures/folder1/fixture.php';
-include 'fixtures/folder1/subfolder1/fixture.php';
-include 'fixtures/folder1/subfolder2/fixture.php';
-include 'fixtures/folder1/subfolder3/fixture.php';
-include 'fixtures/folder1/subfolder4/fixture.php';
-include 'fixtures/folder2/fixture.php';
-include 'fixtures/folder2/subfolder1/fixture.php';
-include 'fixtures/folder2/subfolder2/fixture.php';
-include 'fixtures/folder2/subfolder3/fixture.php';
-include 'fixtures/folder2/subfolder4/fixture.php';
-include 'fixtures/folder3/fixture.php';
-include 'fixtures/folder3/subfolder1/fixture.php';
-include 'fixtures/folder3/subfolder2/fixture.php';
-include 'fixtures/folder3/subfolder3/fixture.php';
-include 'fixtures/folder3/subfolder4/fixture.php';
-include 'fixtures/folder4/fixture.php';
-include 'fixtures/folder4/subfolder1/fixture.php';
-include 'fixtures/folder4/subfolder2/fixture.php';
-include 'fixtures/folder4/subfolder3/fixture.php';
-include 'fixtures/folder4/subfolder4/fixture.php';
+include 'fixtures/folder1/fixture.inc';
+include 'fixtures/folder1/subfolder1/fixture.inc';
+include 'fixtures/folder1/subfolder2/fixture.inc';
+include 'fixtures/folder1/subfolder3/fixture.inc';
+include 'fixtures/folder1/subfolder4/fixture.inc';
+include 'fixtures/folder2/fixture.inc';
+include 'fixtures/folder2/subfolder1/fixture.inc';
+include 'fixtures/folder2/subfolder2/fixture.inc';
+include 'fixtures/folder2/subfolder3/fixture.inc';
+include 'fixtures/folder2/subfolder4/fixture.inc';
+include 'fixtures/folder3/fixture.inc';
+include 'fixtures/folder3/subfolder1/fixture.inc';
+include 'fixtures/folder3/subfolder2/fixture.inc';
+include 'fixtures/folder3/subfolder3/fixture.inc';
+include 'fixtures/folder3/subfolder4/fixture.inc';
+include 'fixtures/folder4/fixture.inc';
+include 'fixtures/folder4/subfolder1/fixture.inc';
+include 'fixtures/folder4/subfolder2/fixture.inc';
+include 'fixtures/folder4/subfolder3/fixture.inc';
+include 'fixtures/folder4/subfolder4/fixture.inc';
?>
--EXPECTF--
%stests%sconstants
diff --git a/Zend/tests/constants/fixtures/folder1/fixture.php b/Zend/tests/constants/fixtures/folder1/fixture.inc
index 3406c998ac..3406c998ac 100755
--- a/Zend/tests/constants/fixtures/folder1/fixture.php
+++ b/Zend/tests/constants/fixtures/folder1/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.php b/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.php
+++ b/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.php b/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.php
+++ b/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.php b/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.php
+++ b/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.php b/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.php
+++ b/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder2/fixture.php b/Zend/tests/constants/fixtures/folder2/fixture.inc
index 3406c998ac..3406c998ac 100755
--- a/Zend/tests/constants/fixtures/folder2/fixture.php
+++ b/Zend/tests/constants/fixtures/folder2/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.php b/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.php
+++ b/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.php b/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.php
+++ b/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.php b/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.php
+++ b/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.php b/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.php
+++ b/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder3/fixture.php b/Zend/tests/constants/fixtures/folder3/fixture.inc
index 3406c998ac..3406c998ac 100755
--- a/Zend/tests/constants/fixtures/folder3/fixture.php
+++ b/Zend/tests/constants/fixtures/folder3/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.php b/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.php
+++ b/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.php b/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.php
+++ b/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.php b/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.php
+++ b/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.php b/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.php
+++ b/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder4/fixture.php b/Zend/tests/constants/fixtures/folder4/fixture.inc
index 3406c998ac..3406c998ac 100755
--- a/Zend/tests/constants/fixtures/folder4/fixture.php
+++ b/Zend/tests/constants/fixtures/folder4/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.php b/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.php
+++ b/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.php b/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.php
+++ b/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.php b/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.php
+++ b/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc
diff --git a/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.php b/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc
index 86e6859363..86e6859363 100755
--- a/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.php
+++ b/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc
diff --git a/Zend/tests/debug_backtrace_with_include_and_this.phpt b/Zend/tests/debug_backtrace_with_include_and_this.phpt
new file mode 100644
index 0000000000..171ad9f451
--- /dev/null
+++ b/Zend/tests/debug_backtrace_with_include_and_this.phpt
@@ -0,0 +1,39 @@
+--TEST--
+debug_backtrace segmentation fault with include and error handler
+--FILE--
+<?php
+class CLWrapper {
+ function stream_open($path, $mode, $options, $opened_path) {
+ return false;
+ }
+}
+
+class CL {
+ public function load($class) {
+ if (!include($class)) {
+ throw new Exception('Failed loading '.$class);
+ }
+ }
+}
+
+stream_wrapper_register('class', 'CLWrapper');
+set_error_handler(function($code, $msg, $file, $line) {
+ $bt= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
+ echo "ERR#$code: $msg @ ", $bt[1]['function'], "\n";
+});
+
+try {
+ (new CL())->load('class://non.existant.Class');
+} catch (CLException $e) {
+ echo $e."\n";
+}
+--EXPECTF--
+ERR#2: include(class://non.existant.Class): failed to open stream: "CLWrapper::stream_open" call failed @ include
+ERR#2: include(): Failed opening 'class://non.existant.Class' for inclusion (include_path='%s') @ include
+
+Fatal error: Uncaught exception 'Exception' with message 'Failed loading class://non.existant.Class' in %s
+Stack trace:
+#0 %s(%d): CL->load('class://non.exi...')
+#1 {main}
+ thrown in %s on line %d
+
diff --git a/Zend/tests/declare_001.phpt b/Zend/tests/declare_001.phpt
index 21d797880e..4eff18045c 100644
--- a/Zend/tests/declare_001.phpt
+++ b/Zend/tests/declare_001.phpt
@@ -13,7 +13,6 @@ zend.multibyte=1
declare(encoding = 1);
declare(encoding = 112313123213131232100);
-declare(encoding = NULL);
declare(encoding = 'utf-8');
declare(encoding = M_PI);
@@ -25,6 +24,4 @@ Warning: Unsupported encoding [1] in %sdeclare_001.php on line %d
Warning: Unsupported encoding [1.1231312321313E+20] in %sdeclare_001.php on line %d
-Warning: Unsupported encoding [] in %sdeclare_001.php on line %d
-
-Fatal error: Cannot use constants as encoding in %sdeclare_001.php on line %d
+Fatal error: Encoding must be a literal in %s on line %d
diff --git a/Zend/tests/declare_003.phpt b/Zend/tests/declare_003.phpt
index 2980f7589b..2f3e887380 100644
--- a/Zend/tests/declare_003.phpt
+++ b/Zend/tests/declare_003.phpt
@@ -8,7 +8,6 @@ zend.multibyte=1
declare(encoding = 1);
declare(encoding = 11111111111111);
-declare(encoding = NULL);
declare(encoding = M_PI);
print 'DONE';
@@ -19,6 +18,4 @@ Warning: Unsupported encoding [1] in %sdeclare_003.php on line %d
Warning: Unsupported encoding [11111111111111] in %sdeclare_003.php on line %d
-Warning: Unsupported encoding [] in %sdeclare_003.php on line %d
-
-Fatal error: Cannot use constants as encoding in %sdeclare_003.php on line %d
+Fatal error: Encoding must be a literal in %s on line %d
diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt
index da13decc39..cc0f27d534 100644
--- a/Zend/tests/dereference_002.phpt
+++ b/Zend/tests/dereference_002.phpt
@@ -76,4 +76,4 @@ NULL
Notice: Undefined offset: 3 in %s on line %d
-Fatal error: Call to a member function bar() on null in %s on line %d
+Catchable fatal error: Call to a member function bar() on null in %s on line %d
diff --git a/Zend/tests/double_array_cast.phpt b/Zend/tests/double_array_cast.phpt
new file mode 100644
index 0000000000..aaee8cd919
--- /dev/null
+++ b/Zend/tests/double_array_cast.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Double array cast
+--FILE--
+<?php
+
+$array = [1, 2, $x = 3];
+var_dump((array) (array) $array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/tests/duplicate_label_error.phpt b/Zend/tests/duplicate_label_error.phpt
new file mode 100644
index 0000000000..c89d7a6991
--- /dev/null
+++ b/Zend/tests/duplicate_label_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Duplicate labels are not allowed
+--FILE--
+<?php
+
+foo:
+foo:
+goto foo;
+
+?>
+--EXPECTF--
+Fatal error: Label 'foo' already defined in %s on line %d
diff --git a/Zend/tests/errmsg_014.phpt b/Zend/tests/errmsg_014.phpt
deleted file mode 100644
index 77e12b05e9..0000000000
--- a/Zend/tests/errmsg_014.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-errmsg: cannot call __clone() method on objects
---FILE--
-<?php
-
-class test {
- function __clone() {
- }
-}
-
-$t = new test;
-$t->__clone();
-
-echo "Done\n";
-?>
---EXPECTF--
-Fatal error: Cannot call __clone() method on objects - use 'clone $obj' instead in %s on line %d
diff --git a/Zend/tests/eval_parse_error_with_doc_comment.phpt b/Zend/tests/eval_parse_error_with_doc_comment.phpt
new file mode 100644
index 0000000000..62561aaa79
--- /dev/null
+++ b/Zend/tests/eval_parse_error_with_doc_comment.phpt
@@ -0,0 +1,15 @@
+--TEST--
+eval() parse error on function with doc comment
+--FILE--
+<?php
+
+eval(
+<<<EOC
+/** doc comment */
+function f() {
+EOC
+);
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected end of file in %s(%d) : eval()'d code on line %d
diff --git a/Zend/tests/exception_with_by_ref_message.phpt b/Zend/tests/exception_with_by_ref_message.phpt
new file mode 100644
index 0000000000..f15c3e2719
--- /dev/null
+++ b/Zend/tests/exception_with_by_ref_message.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Exception with by-ref message
+--FILE--
+<?php
+
+class MyException extends Exception
+{
+ public function __construct(&$msg) {
+ $this->message =& $msg;
+ }
+}
+
+$msg = 'Message';
+throw new MyException($msg);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'MyException' with message 'Message' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt
index 251870ba09..1a7be521b2 100644
--- a/Zend/tests/foreach_list_002.phpt
+++ b/Zend/tests/foreach_list_002.phpt
@@ -9,7 +9,7 @@ foreach (array(array(1,2), array(3,4)) as list($a, )) {
$array = [['a', 'b'], 'c', 'd'];
-foreach($array as list(list(), $a)) {
+foreach($array as list(, $a)) {
var_dump($a);
}
@@ -18,9 +18,5 @@ foreach($array as list(list(), $a)) {
int(1)
int(3)
string(1) "b"
-
-Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
-string(0) ""
-
-Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d
-string(0) ""
+NULL
+NULL
diff --git a/Zend/tests/gc_029_zts.phpt b/Zend/tests/gc_029_zts.phpt
index fc77e1f3bd..5d16e83348 100644
--- a/Zend/tests/gc_029_zts.phpt
+++ b/Zend/tests/gc_029_zts.phpt
@@ -34,4 +34,4 @@ unset($bar);
var_dump(gc_collect_cycles());
?>
--EXPECT--
-int(3)
+int(6)
diff --git a/Zend/tests/gc_033.phpt b/Zend/tests/gc_033.phpt
new file mode 100644
index 0000000000..dee426a385
--- /dev/null
+++ b/Zend/tests/gc_033.phpt
@@ -0,0 +1,30 @@
+--TEST--
+GC 033: Crash in GC while run with phpspec
+--XFAIL--
+Full GC root buffer not handled correctly yet
+--FILE--
+<?php
+$a = new stdClass();
+$a->a = array();
+$a->a[0] = new Stdclass();
+$a->a[0]->a = $a;
+$a->a[1] = &$a->a;
+
+/* remove the self-reference array out of roots */
+gc_collect_cycles();
+
+/* do unset */
+unset($a);
+
+/* let's full the gc roots */
+for ($i=0; $i<9999; $i++) {
+ $b = range(0, 1);
+ $b[0] = &$b;
+ unset($b);
+}
+
+/* then $a will be freed, but $a->a[0] is not. reference to a freed $a */
+var_dump(gc_collect_cycles());
+?>
+--EXPECT--
+int(20001)
diff --git a/Zend/tests/incdec_ref_property.phpt b/Zend/tests/incdec_ref_property.phpt
new file mode 100644
index 0000000000..a73b2912ab
--- /dev/null
+++ b/Zend/tests/incdec_ref_property.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Incrementing and decrementing a referenced property
+--FILE--
+<?php
+
+$obj = new stdClass;
+$obj->prop = 1;
+$ref =& $obj->prop;
+var_dump(++$obj->prop);
+var_dump($obj->prop);
+var_dump($obj->prop++);
+var_dump($obj->prop);
+var_dump(--$obj->prop);
+var_dump($obj->prop);
+var_dump($obj->prop--);
+var_dump($obj->prop);
+
+?>
+--EXPECT--
+int(2)
+int(2)
+int(2)
+int(3)
+int(2)
+int(2)
+int(2)
+int(1)
diff --git a/Zend/tests/int_special_values.phpt b/Zend/tests/int_special_values.phpt
new file mode 100644
index 0000000000..e1a50b6ecb
--- /dev/null
+++ b/Zend/tests/int_special_values.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Conversion of special float values to int
+--FILE--
+<?php
+$values = [
+ 0.0,
+ INF,
+ -INF,
+ 1 / INF,
+ -1 / INF, // Negative zero,
+ NAN
+];
+
+foreach($values as $value) {
+ var_dump($value);
+ var_dump((int)$value);
+ echo PHP_EOL;
+}
+?>
+--EXPECT--
+float(0)
+int(0)
+
+float(INF)
+int(0)
+
+float(-INF)
+int(0)
+
+float(0)
+int(0)
+
+float(-0)
+int(0)
+
+float(NAN)
+int(0) \ No newline at end of file
diff --git a/Zend/tests/isset_003.phpt b/Zend/tests/isset_003.phpt
index 4db42a933b..92225b5906 100644
--- a/Zend/tests/isset_003.phpt
+++ b/Zend/tests/isset_003.phpt
@@ -14,7 +14,7 @@ var_dump(isset($a[0]->a));
var_dump(isset($c[0][1][2]->a->b->c->d));
-var_dump(isset(${$a}->{$b->$c[$d]}));
+var_dump(isset(${$a}->{$b->{$c[$d]}}));
var_dump(isset($GLOBALS));
diff --git a/Zend/tests/isset_003_2_4.phpt b/Zend/tests/isset_003_2_4.phpt
index c05f3e26f4..42d8cc6a08 100644
--- a/Zend/tests/isset_003_2_4.phpt
+++ b/Zend/tests/isset_003_2_4.phpt
@@ -16,7 +16,7 @@ var_dump(isset($a[0]->a));
var_dump(isset($c[0][1][2]->a->b->c->d));
-var_dump(isset(${$a}->{$b->$c[$d]}));
+var_dump(isset(${$a}->{$b->{$c[$d]}}));
var_dump(isset($GLOBALS));
diff --git a/Zend/tests/isset_func_error.phpt b/Zend/tests/isset_func_error.phpt
index 7d1036def8..7d6616b96d 100644
--- a/Zend/tests/isset_func_error.phpt
+++ b/Zend/tests/isset_func_error.phpt
@@ -5,4 +5,4 @@ Error message for isset(func())
isset(abc());
?>
--EXPECTF--
-Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in %s on line %d
+Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in %s on line %d
diff --git a/Zend/tests/line_const_in_array.phpt b/Zend/tests/line_const_in_array.phpt
new file mode 100644
index 0000000000..181f67e3da
--- /dev/null
+++ b/Zend/tests/line_const_in_array.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Use of __LINE__ in arrays
+--FILE--
+<?php
+
+var_dump([
+ __LINE__,
+ __LINE__,
+ __LINE__,
+]);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+}
diff --git a/Zend/tests/list_005.phpt b/Zend/tests/list_005.phpt
index 4afc353b2f..a3b0d57434 100644
--- a/Zend/tests/list_005.phpt
+++ b/Zend/tests/list_005.phpt
@@ -3,41 +3,41 @@ Testing list() with several variables
--FILE--
<?php
-$a = "foo";
+$str = "foo";
-list($a, $b, $c) = $a;
+list($a, $b, $c) = $str;
var_dump($a, $b, $c);
print "----\n";
-$a = 1;
+$int = 1;
-list($a, $b, $c) = $a;
+list($a, $b, $c) = $int;
var_dump($a, $b, $c);
print "----\n";
-$a = new stdClass;
+$obj = new stdClass;
-list($a, $b, $c) = $a;
+list($a, $b, $c) = $obj;
var_dump($a, $b, $c);
print "----\n";
-$a = array(1, 2, 3);
+$arr = array(1, 2, 3);
-list($a, $b, $c) = $a;
+list($a, $b, $c) = $arr;
var_dump($a, $b, $c);
?>
--EXPECTF--
-string(1) "f"
-string(1) "o"
-string(1) "o"
+NULL
+NULL
+NULL
----
NULL
NULL
diff --git a/Zend/tests/list_006.phpt b/Zend/tests/list_006.phpt
index f5f5970be4..d380235d25 100644
--- a/Zend/tests/list_006.phpt
+++ b/Zend/tests/list_006.phpt
@@ -7,8 +7,6 @@ list($a, list($b, list(list($d)))) = array();
?>
--EXPECTF--
-Notice: Undefined offset: 1 in %s on line %d
+Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined offset: 1 in %s on line %d
-
-Notice: Undefined offset: 0 in %s on line %d
diff --git a/Zend/tests/list_007.phpt b/Zend/tests/list_007.phpt
index 35a25bce65..cc712406ec 100644
--- a/Zend/tests/list_007.phpt
+++ b/Zend/tests/list_007.phpt
@@ -8,6 +8,5 @@ list($x, $y) = function() { };
var_dump($x, $y);
?>
---EXPECT--
-NULL
-NULL
+--EXPECTF--
+Fatal error: Cannot use object of type Closure as array in %slist_007.php on line 3
diff --git a/Zend/tests/list_destructuring_to_special_variables.phpt b/Zend/tests/list_destructuring_to_special_variables.phpt
new file mode 100644
index 0000000000..4418c967c2
--- /dev/null
+++ b/Zend/tests/list_destructuring_to_special_variables.phpt
@@ -0,0 +1,49 @@
+--TEST--
+list() can be used to destructure to string offsets, __set and ArrayAccess::offsetSet
+--FILE--
+<?php
+
+class Obj {
+ public $values = [];
+ public function __set($name, $value) {
+ $this->values[$name] = $value;
+ }
+}
+
+class Arr implements ArrayAccess {
+ public $values = [];
+ public function offsetSet($name, $value) {
+ $this->values[$name] = $value;
+ }
+ public function offsetGet($name) {}
+ public function offsetExists($name) {}
+ public function offsetUnset($name) {}
+}
+
+$str = 'ab';
+list($str[0], $str[1]) = ['x', 'y'];
+var_dump($str);
+
+$obj = new Obj;
+list($obj->foo, $obj->bar) = ['foo', 'bar'];
+var_dump($obj->values);
+
+$arr = new Arr;
+list($arr['foo'], $arr['bar']) = ['foo', 'bar'];
+var_dump($arr->values);
+
+?>
+--EXPECT--
+string(2) "xy"
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
+array(2) {
+ ["foo"]=>
+ string(3) "foo"
+ ["bar"]=>
+ string(3) "bar"
+}
diff --git a/Zend/tests/magic_const_in_global_scope.phpt b/Zend/tests/magic_const_in_global_scope.phpt
new file mode 100644
index 0000000000..31f7eae6d7
--- /dev/null
+++ b/Zend/tests/magic_const_in_global_scope.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test use of magic constants in the global scope
+--FILE--
+<?php
+
+var_dump(
+ __LINE__,
+ __FILE__,
+ __DIR__,
+ __FUNCTION__,
+ __METHOD__,
+ __CLASS__,
+ __TRAIT__,
+ __NAMESPACE__
+);
+
+?>
+--EXPECTF--
+int(4)
+string(%d) "%s"
+string(%d) "%s"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
diff --git a/Zend/tests/methods-on-non-objects-args-catch.phpt b/Zend/tests/methods-on-non-objects-args-catch.phpt
new file mode 100644
index 0000000000..853d2d5602
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-args-catch.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Catch method calls on non-objects raise recoverable errors
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump($x->method(1, 2, 3));
+echo "Alive\n";
+?>
+--EXPECTF--
+
+int(4096)
+string(%d) "Call to a member function method() on null"
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-array-access.phpt b/Zend/tests/methods-on-non-objects-array-access.phpt
new file mode 100755
index 0000000000..be87457c6c
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-array-access.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Catch method calls on non-objects inside array access
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+$a= [null => 'OK'];
+var_dump($a[$x->method()]);
+echo "Alive\n";
+?>
+--EXPECTF--
+int(4096)
+string(%d) "Call to a member function method() on null"
+string(2) "OK"
+Alive \ No newline at end of file
diff --git a/Zend/tests/methods-on-non-objects-array-creation.phpt b/Zend/tests/methods-on-non-objects-array-creation.phpt
new file mode 100755
index 0000000000..74cbb9c179
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-array-creation.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Catch method calls on non-objects inside array creation
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump([$x->method() => 'OK']);
+var_dump([$x->method(), $x->method(), $x->method()]);
+echo "Alive\n";
+?>
+--EXPECTF--
+int(4096)
+string(%d) "Call to a member function method() on null"
+array(1) {
+ [""]=>
+ string(2) "OK"
+}
+int(4096)
+string(%d) "Call to a member function method() on null"
+int(4096)
+string(%d) "Call to a member function method() on null"
+int(4096)
+string(%d) "Call to a member function method() on null"
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+Alive \ No newline at end of file
diff --git a/Zend/tests/methods-on-non-objects-as-arg.phpt b/Zend/tests/methods-on-non-objects-as-arg.phpt
new file mode 100755
index 0000000000..13b83cb06e
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-as-arg.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Catch method calls on non-objects as argument
+--FILE--
+<?php
+function nesting() {
+ return func_get_args();
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+var_dump(nesting($x->method()));
+var_dump(nesting(nesting($x->method())));
+var_dump(nesting($x->method(nesting($x->method()))));
+var_dump(nesting($x->method(), $x->method()));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+array(1) {
+ [0]=>
+ NULL
+}
+Called #2
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+Called #3
+array(1) {
+ [0]=>
+ NULL
+}
+Called #4
+Called #5
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+Alive
diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt
new file mode 100644
index 0000000000..f76b7d43a0
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt
@@ -0,0 +1,13 @@
+--TEST--
+call_user_func() in combination with "Call to a member function method() on a non-object"
+--FILE--
+<?php
+$comparator= null;
+var_dump(call_user_func([$comparator, 'compare'], 1, 2));
+echo "Alive\n";
+?>
+--EXPECTF--
+Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+NULL
+Alive
+
diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt
new file mode 100644
index 0000000000..bbfadac107
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-catch.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Catch method calls on non-objects raise recoverable errors
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump($x->method());
+echo "Alive\n";
+?>
+--EXPECTF--
+
+int(4096)
+string(%d) "Call to a member function method() on null"
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-chain.phpt b/Zend/tests/methods-on-non-objects-chain.phpt
new file mode 100644
index 0000000000..30da254cd5
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-chain.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Catch chained method calls on non-objects raise recoverable errors
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump($x->method()->chained()->invocations());
+echo "Alive\n";
+?>
+--EXPECTF--
+
+int(4096)
+string(%d) "Call to a member function method() on null"
+int(4096)
+string(%d) "Call to a member function chained() on null"
+int(4096)
+string(%d) "Call to a member function invocations() on null"
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-concat.phpt b/Zend/tests/methods-on-non-objects-concat.phpt
new file mode 100755
index 0000000000..4ff47aa454
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-concat.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Catch method calls on non-objects inside concatenation
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+echo "Before\n".$x->method()."After\n";
+echo "Alive\n";
+?>
+--EXPECTF--
+int(4096)
+string(%d) "Call to a member function method() on null"
+Before
+After
+Alive \ No newline at end of file
diff --git a/Zend/tests/methods-on-non-objects-dynamic.phpt b/Zend/tests/methods-on-non-objects-dynamic.phpt
new file mode 100755
index 0000000000..11c5c9f44b
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-dynamic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Catch method calls on non-objects with dynamic lookups
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$arr= [null, 'method'];
+var_dump($arr[0]->{$arr[1]}());
+
+$fun= function() { return null; };
+var_dump($fun()->{'method'}());
+
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-eval.phpt b/Zend/tests/methods-on-non-objects-eval.phpt
new file mode 100644
index 0000000000..8ee494c434
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-eval.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Indirect call inside eval to member function on non-object
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump(eval('$x->method(1, 2, 3);'));
+echo "Alive\n";
+?>
+--EXPECTF--
+
+int(4096)
+string(%d) "Call to a member function method() on null"
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-in-echo.phpt b/Zend/tests/methods-on-non-objects-in-echo.phpt
new file mode 100755
index 0000000000..a0267c0ea5
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-in-echo.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Catch method calls on non-objects inside echo
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+echo "Before\n", $x->method(), "After\n";
+echo "Alive\n";
+?>
+--EXPECTF--
+Before
+int(4096)
+string(%d) "Call to a member function method() on null"
+After
+Alive \ No newline at end of file
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
new file mode 100755
index 0000000000..267104f1b3
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Catch method calls on non-objects with nested dynamic calls
+--FILE--
+<?php
+function nested() {
+ throw new LogicException('Should not be called');
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+
+$closure= function() { return nested(); };
+var_dump($x->method($closure()));
+
+$lambda= create_function('', 'return nested();');
+var_dump($x->method($lambda()));
+
+$func= 'nested';
+var_dump($x->method($func()));
+
+var_dump($x->method(call_user_func('nested')));
+
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-new.phpt b/Zend/tests/methods-on-non-objects-nested-calls-new.phpt
new file mode 100755
index 0000000000..d8e3dd21bf
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-new.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Catch method calls on non-objects with nested calls to new
+--FILE--
+<?php
+class Nesting {
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+var_dump($x->method(new Nesting()));
+var_dump($x->method(new Nesting(), new Nesting()));
+var_dump($x->method(new Nesting(new Nesting())));
+var_dump($x->method(new Nesting($x->nested())));
+var_dump($x->method(new Nesting($x->nested(new Nesting()))));
+var_dump($x->method($x->nested(new Nesting($x->deep()))));
+var_dump($x->method([new Nesting()]));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Called #5
+NULL
+Called #6
+NULL
+Called #7
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt
new file mode 100755
index 0000000000..a4529eecdc
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Catch method calls on non-objects with nested non-compile-time-resolveable calls
+--FILE--
+<?php
+require('methods-on-non-objects-nested.inc');
+
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+
+var_dump($x->method(nested()));
+
+$closure= function() { return nested(); };
+var_dump($x->method($closure()));
+
+$lambda= create_function('', 'return nested();');
+var_dump($x->method($lambda()));
+
+$func= 'nested';
+var_dump($x->method($func()));
+
+var_dump($x->method(call_user_func('nested')));
+var_dump($x->method(call_user_func_array('nested', [])));
+
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Called #5
+NULL
+Called #6
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-ns.phpt b/Zend/tests/methods-on-non-objects-nested-calls-ns.phpt
new file mode 100755
index 0000000000..b16f579fa9
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-ns.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Catch method calls on non-objects with nested calls to namespaced functions with core counterparts
+--FILE--
+<?php namespace test;
+function strlen($str) {
+ throw new LogicException('Should not be called');
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+var_dump($x->method(strlen('Test')));
+var_dump($x->method(strlen('Test'), strlen('Test')));
+var_dump($x->method([strlen('Test')]));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-static.phpt b/Zend/tests/methods-on-non-objects-nested-calls-static.phpt
new file mode 100755
index 0000000000..64972ee871
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-static.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Catch method calls on non-objects with nested calls to static methods
+--FILE--
+<?php
+class Nesting {
+ static function nested() {
+ throw new LogicException('Should not be called');
+ }
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+$class= 'Nesting';
+$method= 'nested';
+var_dump($x->method(Nesting::nested()));
+var_dump($x->method($class::nested()));
+var_dump($x->method($class::{$method}()));
+var_dump($x->method([Nesting::nested()]));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested-calls.phpt b/Zend/tests/methods-on-non-objects-nested-calls.phpt
new file mode 100644
index 0000000000..b25aeafd9c
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Catch method calls on non-objects with nested function and method calls
+--FILE--
+<?php
+function nested() {
+ throw new LogicException('Should not be called');
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+var_dump($x->method(nested()));
+var_dump($x->method(nested(), nested()));
+var_dump($x->method(nested(nested())));
+var_dump($x->method($x->nested()));
+var_dump($x->method($x->nested(), $x->nested()));
+var_dump($x->method($x->nested(nested())));
+var_dump($x->method($x->nested($x->deep())));
+var_dump($x->method($x->nested(nested($x->deep()))));
+var_dump($x->method(nested(nested($x->nested()))));
+var_dump($x->method([nested()]));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Called #5
+NULL
+Called #6
+NULL
+Called #7
+NULL
+Called #8
+NULL
+Called #9
+NULL
+Called #10
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested.inc b/Zend/tests/methods-on-non-objects-nested.inc
new file mode 100755
index 0000000000..8511414b82
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested.inc
@@ -0,0 +1,4 @@
+<?php
+function nested() {
+ throw new LogicException('Should not be called');
+} \ No newline at end of file
diff --git a/Zend/tests/methods-on-non-objects-return-unused.phpt b/Zend/tests/methods-on-non-objects-return-unused.phpt
new file mode 100755
index 0000000000..ab2951f94f
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-return-unused.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Catch method calls on non-objects without using return value
+--INI--
+report_memleaks=1
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ echo "Caught\n";
+});
+
+$x= null;
+$x->method();
+echo "Alive\n";
+?>
+--EXPECTF--
+Caught
+Alive
diff --git a/Zend/tests/methods-on-non-objects-throw.phpt b/Zend/tests/methods-on-non-objects-throw.phpt
new file mode 100644
index 0000000000..874f57cb24
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-throw.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Convert errors to exceptions from method calls on non-objects raise recoverable errors
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ echo "Raising...\n";
+ if (0 === strncmp('Call', $message, 4)) {
+ throw new BadMethodCallException($message);
+ } else if (0 === strncmp('Argument', $message, 8)) {
+ throw new InvalidArgumentException($message);
+ } else {
+ trigger_error($message, E_USER_ERROR);
+ }
+}, E_RECOVERABLE_ERROR);
+
+$x= null;
+echo "Calling...\n";
+try {
+ $x->method();
+} catch (BadMethodCallException $e) {
+ echo "Caught expected ", $e->getMessage(), "!\n";
+}
+echo "Alive\n";
+?>
+--EXPECTF--
+Calling...
+Raising...
+Caught expected Call to a member function method() on null!
+Alive
diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt
new file mode 100644
index 0000000000..760d481b27
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-usort.phpt
@@ -0,0 +1,43 @@
+--TEST--
+usort() in combination with "Call to a member function method() on null"
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$comparator= null;
+$list= [1, 4, 2, 3, -1];
+usort($list, function($a, $b) use ($comparator) {
+ return $comparator->compare($a, $b);
+});
+var_dump($list);
+echo "Alive\n";
+?>
+--EXPECTF--
+int(4096)
+string(43) "Call to a member function compare() on null"
+int(4096)
+string(43) "Call to a member function compare() on null"
+int(4096)
+string(43) "Call to a member function compare() on null"
+int(4096)
+string(43) "Call to a member function compare() on null"
+int(4096)
+string(43) "Call to a member function compare() on null"
+int(4096)
+string(43) "Call to a member function compare() on null"
+array(5) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(4)
+ [4]=>
+ int(1)
+}
+Alive
+
diff --git a/Zend/tests/methods-on-non-objects.phpt b/Zend/tests/methods-on-non-objects.phpt
new file mode 100644
index 0000000000..01031b8b1d
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Method calls on non-objects raise recoverable errors
+--FILE--
+<?php
+
+$x= null;
+$x->method();
+echo "Should not get here!\n";
+?>
+--EXPECTF--
+
+Catchable fatal error: Call to a member function method() on null in %s on line %d
diff --git a/Zend/tests/object_array_cast.phpt b/Zend/tests/object_array_cast.phpt
new file mode 100644
index 0000000000..1cf3dbbd9c
--- /dev/null
+++ b/Zend/tests/object_array_cast.phpt
@@ -0,0 +1,47 @@
+--TEST--
+(object) (array) and (array) (object) casts
+--FILE--
+<?php
+
+$arr = [1, 2, 3];
+var_dump((object) (array) $arr);
+var_dump($arr);
+
+$obj = (object) [1, 2, 3];
+var_dump((array) (object) $obj);
+var_dump($obj);
+
+?>
+--EXPECT--
+object(stdClass)#1 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+object(stdClass)#1 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/tests/special_name_error1.phpt b/Zend/tests/special_name_error1.phpt
new file mode 100644
index 0000000000..63bf5a63fd
--- /dev/null
+++ b/Zend/tests/special_name_error1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use special class name as namespace
+--FILE--
+<?php
+
+namespace self;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'self' as namespace name in %s on line %d
diff --git a/Zend/tests/special_name_error2.phpt b/Zend/tests/special_name_error2.phpt
new file mode 100644
index 0000000000..08122b3249
--- /dev/null
+++ b/Zend/tests/special_name_error2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use special class name as alias
+--FILE--
+<?php
+
+use Foo\Bar as self;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use Foo\Bar as self because 'self' is a special class name in %s on line %d
diff --git a/Zend/tests/special_name_error3.phpt b/Zend/tests/special_name_error3.phpt
new file mode 100644
index 0000000000..74e69f1938
--- /dev/null
+++ b/Zend/tests/special_name_error3.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use special class name as trait name
+--FILE--
+<?php
+
+trait self {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'self' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/strlen.phpt b/Zend/tests/strlen.phpt
new file mode 100644
index 0000000000..ddf0141386
--- /dev/null
+++ b/Zend/tests/strlen.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Fixed execute_data corruption with __toString()
+--FILE--
+<?php
+
+class Test
+{
+ public $something = 'hello';
+
+ public function __toString()
+ {
+ return $this->something;
+ }
+}
+
+$t = new Test;
+var_dump(strlen($t));
+var_dump($t->something);
+
+class Test2
+{
+ public $something;
+
+ public function __construct(&$a)
+ {
+ $this->something = &$a;
+ }
+
+ public function __toString()
+ {
+ return $this->something;
+ }
+}
+
+$a = 'world';
+$t2 = new Test2($a);
+var_dump(strlen($t2));
+var_dump($t2->something);
+var_dump($a);
+
+$a = 'foobar';
+var_dump(strlen($t2));
+var_dump($t2->something);
+--EXPECT--
+int(5)
+string(5) "hello"
+int(5)
+string(5) "world"
+string(5) "world"
+int(6)
+string(6) "foobar"
diff --git a/Zend/tests/this_as_lexical_var_error.phpt b/Zend/tests/this_as_lexical_var_error.phpt
new file mode 100644
index 0000000000..d0e0106dae
--- /dev/null
+++ b/Zend/tests/this_as_lexical_var_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Cannot use $this as lexical variable
+--FILE--
+<?php
+
+class Foo {
+ public function fn() {
+ return function() use ($this) {};
+ }
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use $this as lexical variable in %s on line %d
diff --git a/Zend/tests/use_const/no_global_fallback.phpt b/Zend/tests/use_const/no_global_fallback.phpt
index a128f353ed..64e2a154ce 100644
--- a/Zend/tests/use_const/no_global_fallback.phpt
+++ b/Zend/tests/use_const/no_global_fallback.phpt
@@ -10,5 +10,4 @@ var_dump(baz);
?>
--EXPECTF--
-Notice: Use of undefined constant baz - assumed 'baz' in %s on line %d
-string(3) "baz"
+Fatal error: Undefined constant 'foo\bar\baz' in %s on line %d
diff --git a/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt b/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt
new file mode 100644
index 0000000000..ed04921f89
--- /dev/null
+++ b/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Global keyword only accepts simple variables
+--FILE--
+<?php
+
+global $$foo->bar;
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';' in %s on line %d
diff --git a/Zend/tests/varSyntax/indirectFcall.phpt b/Zend/tests/varSyntax/indirectFcall.phpt
new file mode 100644
index 0000000000..5d616d59a2
--- /dev/null
+++ b/Zend/tests/varSyntax/indirectFcall.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Indirect function calls
+--FILE--
+<?php
+
+function id($x = 'id') { return $x; }
+
+var_dump(0);
+
+id('var_dump')(1);
+id('id')('var_dump')(2);
+id('id')('id')('var_dump')(3);
+id()()('var_dump')(4);
+
+id(['udef', 'id'])[1]()('var_dump')(5);
+(id((object) ['a' => 'id', 'b' => 'udef'])->a)()()()()('var_dump')(6);
+
+$id = function($x) { return $x; };
+
+$id($id)('var_dump')(7);
+
+(function($x) { return $x; })('id')('var_dump')(8);
+
+($f = function($x = null) use (&$f) {
+ return $x ?: $f;
+})()()()('var_dump')(9);
+
+class Test {
+ public static function id($x = [__CLASS__, 'id']) { return $x; }
+}
+
+$obj = new Test;
+[$obj, 'id']()('id')($id)('var_dump')(10);
+['Test', 'id']()()('var_dump')(11);
+'id'()('id')('var_dump')(12);
+('i' . 'd')()('var_dump')(13);
+'\id'('var_dump')(14);
+
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
diff --git a/Zend/tests/varSyntax/issetOnTemp.phpt b/Zend/tests/varSyntax/issetOnTemp.phpt
new file mode 100644
index 0000000000..cd7bc006cd
--- /dev/null
+++ b/Zend/tests/varSyntax/issetOnTemp.phpt
@@ -0,0 +1,26 @@
+--TEST--
+isset() can be used on dereferences of temporary expressions
+--FILE--
+<?php
+
+var_dump(isset([0, 1][0]));
+var_dump(isset(([0, 1] + [])[0]));
+var_dump(isset([[0, 1]][0][0]));
+var_dump(isset(([[0, 1]] + [])[0][0]));
+var_dump(isset(((object) ['a' => 'b'])->a));
+var_dump(isset(['a' => 'b']->a));
+var_dump(isset("str"->a));
+var_dump(isset((['a' => 'b'] + [])->a));
+var_dump(isset((['a' => 'b'] + [])->a->b));
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/Zend/tests/varSyntax/newVariable.phpt b/Zend/tests/varSyntax/newVariable.phpt
new file mode 100644
index 0000000000..360f99ac36
--- /dev/null
+++ b/Zend/tests/varSyntax/newVariable.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Variable as class name for new expression
+--FILE--
+<?php
+
+$className = 'stdClass';
+$array = ['className' => 'stdClass'];
+$obj = (object) ['className' => 'stdClass'];
+
+class Test {
+ public static $className = 'stdClass';
+}
+$test = 'Test';
+$weird = [0 => (object) ['foo' => 'Test']];
+
+var_dump(new $className);
+var_dump(new $array['className']);
+var_dump(new $array{'className'});
+var_dump(new $obj->className);
+var_dump(new Test::$className);
+var_dump(new $test::$className);
+var_dump(new $weird[0]->foo::$className);
+
+?>
+--EXPECTF--
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
+object(stdClass)#%d (0) {
+}
diff --git a/Zend/tests/varSyntax/parenthesesDeref.phpt b/Zend/tests/varSyntax/parenthesesDeref.phpt
new file mode 100644
index 0000000000..0ebfe9c5d7
--- /dev/null
+++ b/Zend/tests/varSyntax/parenthesesDeref.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Dereferencing expression parentheses
+--FILE--
+<?php
+
+$array = [&$array, 1];
+var_dump(($array)[1]);
+var_dump((($array[0][0])[0])[1]);
+
+var_dump(((object) ['a' => 0, 'b' => 1])->b);
+
+$obj = (object) ['a' => 0, 'b' => ['var_dump', 1]];
+(clone $obj)->b[0](1);
+
+?>
+--EXPECT--
+int(1)
+int(1)
+int(1)
+int(1)
diff --git a/Zend/tests/varSyntax/propertyOfStringError.phpt b/Zend/tests/varSyntax/propertyOfStringError.phpt
new file mode 100644
index 0000000000..85abc5849a
--- /dev/null
+++ b/Zend/tests/varSyntax/propertyOfStringError.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot take property of a string
+--FILE--
+<?php
+
+"foo"->bar;
+
+?>
+--EXPECTF--
+Notice: Trying to get property of non-object in %s on line %d
diff --git a/Zend/tests/varSyntax/staticMember.phpt b/Zend/tests/varSyntax/staticMember.phpt
new file mode 100644
index 0000000000..e32417771a
--- /dev/null
+++ b/Zend/tests/varSyntax/staticMember.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Static member access
+--FILE--
+<?php
+
+class A {
+ public static $b = 0;
+ public static $c = [0, 1];
+ public static $A_str = 'A';
+}
+
+$A_str = 'A';
+$A_obj = new A;
+$b_str = 'b';
+$c_str = 'c';
+
+var_dump(A::$b);
+var_dump($A_str::$b);
+var_dump($A_obj::$b);
+var_dump(('A' . '')::$b);
+var_dump('A'::$b);
+var_dump('\A'::$b);
+var_dump('A'[0]::$b);
+var_dump(A::$$b_str);
+var_dump(A::$$c_str[1]);
+var_dump(A::$A_str::$b);
+
+?>
+--EXPECT--
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
diff --git a/Zend/tests/varSyntax/tempDimFetchByRefError.phpt b/Zend/tests/varSyntax/tempDimFetchByRefError.phpt
new file mode 100644
index 0000000000..dbcac75ea9
--- /dev/null
+++ b/Zend/tests/varSyntax/tempDimFetchByRefError.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Passing a dimention fetch on a temporary by reference is not allowed
+--FILE--
+<?php
+
+$fn = function(&$ref) {};
+$fn([0, 1][0]);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use temporary expression in write context in %s on line %d
diff --git a/Zend/tests/varSyntax/tempPropFetchByRefError.phpt b/Zend/tests/varSyntax/tempPropFetchByRefError.phpt
new file mode 100644
index 0000000000..f8298a936d
--- /dev/null
+++ b/Zend/tests/varSyntax/tempPropFetchByRefError.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Passing a property fetch on a temporary by reference is not allowed
+--FILE--
+<?php
+
+$fn = function(&$ref) {};
+$fn([0, 1]->prop);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use temporary expression in write context in %s on line %d
diff --git a/Zend/tests/varSyntax/writeToTempExpr.phpt b/Zend/tests/varSyntax/writeToTempExpr.phpt
new file mode 100644
index 0000000000..daeaf24938
--- /dev/null
+++ b/Zend/tests/varSyntax/writeToTempExpr.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Writing to a temporary expression is not allowed
+--FILE--
+<?php
+
+[0, 1][0] = 1;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use temporary expression in write context in %s on line %d
diff --git a/Zend/tests/varvars_by_ref.phpt b/Zend/tests/varvars_by_ref.phpt
new file mode 100644
index 0000000000..3ee4776aba
--- /dev/null
+++ b/Zend/tests/varvars_by_ref.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Accessing variable variables using referenced names
+--FILE--
+<?php
+
+$name = 'var';
+$ref =& $name;
+
+$$name = 42;
+var_dump(isset($$name));
+unset($$name);
+var_dump(isset($$name));
+
+?>
+--EXPECT--
+bool(true)
+bool(false)
diff --git a/Zend/zend.c b/Zend/zend.c
index 9b2c7e3477..d5a933b47c 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -46,7 +46,7 @@
/* true multithread-shared globals */
ZEND_API zend_class_entry *zend_standard_class_def = NULL;
-ZEND_API zend_size_t (*zend_printf)(const char *format, ...);
+ZEND_API size_t (*zend_printf)(const char *format, ...);
ZEND_API zend_write_func_t zend_write;
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
@@ -54,22 +54,22 @@ ZEND_API void (*zend_block_interruptions)(void);
ZEND_API void (*zend_unblock_interruptions)(void);
ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
-zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
+size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap);
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
void (*zend_on_timeout)(int seconds TSRMLS_DC);
-static void (*zend_message_dispatcher_p)(zend_int_t message, const void *data TSRMLS_DC);
-static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
+static void (*zend_message_dispatcher_p)(zend_long message, const void *data TSRMLS_DC);
+static zval *(*zend_get_configuration_directive_p)(zend_string *name);
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
{
if (!new_value) {
EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
} else {
- EG(error_reporting) = atoi(new_value);
+ EG(error_reporting) = atoi(new_value->val);
}
return SUCCESS;
}
@@ -77,7 +77,7 @@ static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
{
- OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
if (GC_G(gc_enabled)) {
gc_init(TSRMLS_C);
@@ -95,7 +95,7 @@ static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
if (!zend_multibyte_get_functions(TSRMLS_C)) {
return SUCCESS;
}
- return zend_multibyte_set_script_encoding_by_string(new_value, new_value_length TSRMLS_CC);
+ return zend_multibyte_set_script_encoding_by_string(new_value->val, new_value->len TSRMLS_CC);
}
/* }}} */
@@ -134,7 +134,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
{
zval *tmp;
zend_string *string_key;
- zend_uint_t num_key;
+ zend_ulong num_key;
int i;
for (i = 0; i < indent; i++) {
@@ -156,8 +156,8 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
if (string_key) {
if (is_object) {
const char *prop_name, *class_name;
- int prop_len;
- int mangled = zend_unmangle_property_name_ex(string_key->val, string_key->len, &class_name, &prop_name, &prop_len);
+ size_t prop_len;
+ int mangled = zend_unmangle_property_name_ex(string_key, &class_name, &prop_name, &prop_len);
ZEND_WRITE_EX(prop_name, prop_len);
if (class_name && mangled == SUCCESS) {
@@ -174,7 +174,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
}
} else {
char key[25];
- snprintf(key, sizeof(key), "%ld", num_key);
+ snprintf(key, sizeof(key), ZEND_LONG_FMT, num_key);
ZEND_PUTS_EX(key);
}
ZEND_PUTS_EX("] => ");
@@ -193,7 +193,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
{
zval *tmp;
zend_string *string_key;
- zend_uint_t num_key;
+ zend_ulong num_key;
int i = 0;
ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
@@ -204,7 +204,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
if (string_key) {
ZEND_WRITE(string_key->val, string_key->len);
} else {
- zend_printf(ZEND_UINT_FMT, num_key);
+ zend_printf(ZEND_ULONG_FMT, num_key);
}
ZEND_PUTS("] => ");
zend_print_flat_zval_r(tmp TSRMLS_CC);
@@ -216,79 +216,10 @@ ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy TSRMLS_DC) /*
{
if (Z_TYPE_P(expr) == IS_STRING) {
return 0;
+ } else {
+ ZVAL_STR(expr_copy, _zval_get_string_func(expr TSRMLS_CC));
+ return 1;
}
-
-again:
- switch (Z_TYPE_P(expr)) {
- case IS_NULL:
- case IS_FALSE:
- ZVAL_EMPTY_STRING(expr_copy);
- break;
- case IS_TRUE:
- if (CG(one_char_string)['1']) {
- ZVAL_INT_STR(expr_copy, CG(one_char_string)['1']);
- } else {
- ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
- }
- break;
- case IS_RESOURCE: {
- char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT];
- int len;
-
- len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(expr));
- ZVAL_NEW_STR(expr_copy, STR_INIT(buf, len, 0));
- }
- break;
- case IS_ARRAY:
- zend_error(E_NOTICE, "Array to string conversion");
- // TODO: use interned string ???
- ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0));
- break;
- case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(expr, cast_object)) {
- Z_ADDREF_P(expr);
- if (Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
- zval_ptr_dtor(expr);
- break;
- }
- zval_ptr_dtor(expr);
- }
- if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) {
- zval rv;
- zval *z = Z_OBJ_HANDLER_P(expr, get)(expr, &rv TSRMLS_CC);
-
- Z_ADDREF_P(z);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- if (zend_make_printable_zval(z, expr_copy TSRMLS_CC)) {
- zval_ptr_dtor(z);
- } else {
- ZVAL_ZVAL(expr_copy, z, 0, 1);
- }
- return 1;
- }
- zval_ptr_dtor(z);
- }
- zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name->val);
- ZVAL_EMPTY_STRING(expr_copy);
- break;
- case IS_DOUBLE:
- ZVAL_DUP(expr_copy, expr);
- zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);
- break;
- case IS_REFERENCE:
- expr = Z_REFVAL_P(expr);
- if (Z_TYPE_P(expr) == IS_STRING) {
- ZVAL_STR(expr_copy, STR_COPY(Z_STR_P(expr)));
- return 1;
- }
- goto again;
- break;
- default:
- ZVAL_DUP(expr_copy, expr);
- convert_to_string(expr_copy);
- break;
- }
- return 1;
}
/* }}} */
@@ -301,13 +232,13 @@ ZEND_API int zend_print_zval(zval *expr, int indent TSRMLS_DC) /* {{{ */
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */
{
zend_string *str = zval_get_string(expr);
- int len = str->len;
+ size_t len = str->len;
if (len != 0) {
write_func(str->val, len);
}
- STR_RELEASE(str);
+ zend_string_release(str);
return len;
}
/* }}} */
@@ -332,19 +263,10 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
case IS_OBJECT:
{
HashTable *properties = NULL;
- zend_string *class_name = NULL;
+ zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr) TSRMLS_CC);
+ zend_printf("%s Object (", class_name->val);
+ zend_string_release(class_name);
- if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr), 0 TSRMLS_CC);
- }
- if (class_name) {
- zend_printf("%s Object (", class_name->val);
- } else {
- zend_printf("%s Object (", "Unknown Class");
- }
- if (class_name) {
- STR_RELEASE(class_name);
- }
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
properties = Z_OBJPROP_P(expr);
}
@@ -393,21 +315,13 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
case IS_OBJECT:
{
HashTable *properties;
- zend_string *class_name = NULL;
int is_temp;
- if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr), 0 TSRMLS_CC);
- }
- if (class_name) {
- ZEND_PUTS_EX(class_name->val);
- } else {
- ZEND_PUTS_EX("Unknown Class");
- }
+ zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr) TSRMLS_CC);
+ ZEND_PUTS_EX(class_name->val);
+ zend_string_release(class_name);
+
ZEND_PUTS_EX(" Object\n");
- if (class_name) {
- STR_RELEASE(class_name);
- }
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
break;
}
@@ -441,11 +355,9 @@ static FILE *zend_fopen_wrapper(const char *filename, char **opened_path TSRMLS_
/* }}} */
#ifdef ZTS
-static zend_bool asp_tags_default = 0;
-static zend_bool short_tags_default = 1;
-static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT;
+static zend_bool short_tags_default = 1;
+static uint32_t compiler_options_default = ZEND_COMPILE_DEFAULT;
#else
-# define asp_tags_default 0
# define short_tags_default 1
# define compiler_options_default ZEND_COMPILE_DEFAULT
#endif
@@ -453,7 +365,6 @@ static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT;
static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */
{
/* default compile-time values */
- CG(asp_tags) = asp_tags_default;
CG(short_tags) = short_tags_default;
CG(compiler_options) = compiler_options_default;
}
@@ -503,19 +414,23 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
zend_set_default_compile_time_values(TSRMLS_C);
- CG(interactive) = 0;
-
compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL /* empty element */);
compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
if (compiler_globals->last_static_member) {
- compiler_globals->static_members_table = calloc(compiler_globals->last_static_member, sizeof(zval**));
+ compiler_globals->static_members_table = calloc(compiler_globals->last_static_member, sizeof(zval*));
} else {
compiler_globals->static_members_table = NULL;
}
compiler_globals->script_encoding_list = NULL;
+
+#ifdef ZTS
+ zend_interned_empty_string_init(&compiler_globals->empty_string TSRMLS_CC);
+
+ memset(compiler_globals->one_char_string, 0, sizeof(compiler_globals->one_char_string));
+#endif
}
/* }}} */
@@ -540,6 +455,10 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
pefree((char*)compiler_globals->script_encoding_list, 1);
}
compiler_globals->last_static_member = 0;
+
+#ifdef ZTS
+ zend_interned_empty_string_free(&compiler_globals->empty_string TSRMLS_CC);
+#endif
}
/* }}} */
@@ -739,7 +658,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
zend_interned_strings_init(TSRMLS_C);
zend_startup_builtin_functions(TSRMLS_C);
zend_register_standard_constants(TSRMLS_C);
- zend_register_auto_global(STR_INIT("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals TSRMLS_CC);
#ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C);
@@ -779,7 +698,6 @@ void zend_post_startup(TSRMLS_D) /* {{{ */
*GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
*GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
- asp_tags_default = CG(asp_tags);
short_tags_default = CG(short_tags);
compiler_options_default = CG(compiler_options);
@@ -814,10 +732,35 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
zend_shutdown_timeout_thread();
#endif
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
+ if (EG(active))
+ {
+ /*
+ * The order of destruction is important here.
+ * See bugs #65463 and 66036.
+ */
+ zend_function *func;
+ zend_class_entry *ce;
+
+ ZEND_HASH_REVERSE_FOREACH_PTR(GLOBAL_FUNCTION_TABLE, func) {
+ if (func->type == ZEND_USER_FUNCTION) {
+ zend_cleanup_op_array_data((zend_op_array *) func);
+ }
+ } ZEND_HASH_FOREACH_END();
+ ZEND_HASH_REVERSE_FOREACH_PTR(GLOBAL_CLASS_TABLE, ce) {
+ if (ce->type == ZEND_USER_CLASS) {
+ zend_cleanup_user_class_data(ce TSRMLS_CC);
+ } else {
+ break;
+ }
+ } ZEND_HASH_FOREACH_END();
+ zend_cleanup_internal_classes(TSRMLS_C);
+ zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
+ zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
+ }
zend_destroy_modules();
- virtual_cwd_deactivate(TSRMLS_C);
- virtual_cwd_shutdown();
+ virtual_cwd_deactivate(TSRMLS_C);
+ virtual_cwd_shutdown();
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
zend_hash_destroy(GLOBAL_CLASS_TABLE);
@@ -879,7 +822,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
/* }}} */
END_EXTERN_C()
-void zend_append_version_info(const zend_extension *extension) /* {{{ */
+ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ */
{
char *new_info;
uint new_info_length;
@@ -972,7 +915,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
/* }}} */
BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC) /* {{{ */
+ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC) /* {{{ */
{
if (zend_message_dispatcher_p) {
zend_message_dispatcher_p(message, data TSRMLS_CC);
@@ -981,12 +924,12 @@ ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRML
/* }}} */
END_EXTERN_C()
-ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */
+ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
{
if (zend_get_configuration_directive_p) {
- return zend_get_configuration_directive_p(name, name_length, contents);
+ return zend_get_configuration_directive_p(name);
} else {
- return FAILURE;
+ return NULL;
}
}
/* }}} */
@@ -1008,11 +951,17 @@ ZEND_API int zend_get_configuration_directive(const char *name, uint name_length
} \
} while (0)
+#if !defined(ZEND_WIN32) && !defined(DARWIN)
ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
+#else
+static void zend_error_va_list(int type, const char *format, va_list args)
+#endif
{
char *str;
int len;
+#if !defined(ZEND_WIN32) && !defined(DARWIN)
va_list args;
+#endif
va_list usr_copy;
zval params[5];
zval retval;
@@ -1021,13 +970,8 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
zval orig_user_error_handler;
zend_bool in_compilation;
zend_class_entry *saved_class_entry;
- zend_stack bp_stack;
- zend_stack function_call_stack;
- zend_stack switch_cond_stack;
- zend_stack foreach_copy_stack;
- zend_stack object_stack;
- zend_stack declare_stack;
- zend_stack list_stack;
+ zend_stack loop_var_stack;
+ zend_stack delayed_oplines_stack;
zend_stack context_stack;
zend_array *symbol_table;
TSRMLS_FETCH();
@@ -1035,7 +979,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
zend_execute_data *ex;
- zend_op *opline;
+ const zend_op *opline;
switch (type) {
case E_CORE_ERROR:
@@ -1120,7 +1064,9 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
}
#endif /* HAVE_DTRACE */
+#if !defined(ZEND_WIN32) && !defined(DARWIN)
va_start(args, format);
+#endif
/* if we don't have a user defined error handler */
if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
@@ -1152,13 +1098,13 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
#endif
va_copy(usr_copy, args);
len = zend_vspprintf(&str, 0, format, usr_copy);
- ZVAL_NEW_STR(&params[1], STR_INIT(str, len, 0));
+ ZVAL_NEW_STR(&params[1], zend_string_init(str, len, 0));
efree(str);
#ifdef va_copy
va_end(usr_copy);
#endif
- ZVAL_INT(&params[0], type);
+ ZVAL_LONG(&params[0], type);
if (error_filename) {
ZVAL_STRING(&params[2], error_filename);
@@ -1166,7 +1112,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
ZVAL_NULL(&params[2]);
}
- ZVAL_INT(&params[3], error_lineno);
+ ZVAL_LONG(&params[3], error_lineno);
symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
@@ -1190,13 +1136,8 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
if (in_compilation) {
saved_class_entry = CG(active_class_entry);
CG(active_class_entry) = NULL;
- SAVE_STACK(bp_stack);
- SAVE_STACK(function_call_stack);
- SAVE_STACK(switch_cond_stack);
- SAVE_STACK(foreach_copy_stack);
- SAVE_STACK(object_stack);
- SAVE_STACK(declare_stack);
- SAVE_STACK(list_stack);
+ SAVE_STACK(loop_var_stack);
+ SAVE_STACK(delayed_oplines_stack);
SAVE_STACK(context_stack);
CG(in_compilation) = 0;
}
@@ -1216,13 +1157,8 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
if (in_compilation) {
CG(active_class_entry) = saved_class_entry;
- RESTORE_STACK(bp_stack);
- RESTORE_STACK(function_call_stack);
- RESTORE_STACK(switch_cond_stack);
- RESTORE_STACK(foreach_copy_stack);
- RESTORE_STACK(object_stack);
- RESTORE_STACK(declare_stack);
- RESTORE_STACK(list_stack);
+ RESTORE_STACK(loop_var_stack);
+ RESTORE_STACK(delayed_oplines_stack);
RESTORE_STACK(context_stack);
CG(in_compilation) = 1;
}
@@ -1241,7 +1177,9 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
break;
}
+#if !defined(ZEND_WIN32) && !defined(DARWIN)
va_end(args);
+#endif
if (type == E_PARSE) {
/* eval() errors do not affect exit_status */
@@ -1252,13 +1190,31 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
EG(exit_status) = 255;
}
- zend_init_compiler_data_structures(TSRMLS_C);
}
}
/* }}} */
-#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
+#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
+#elif defined(ZEND_WIN32) || defined(DARWIN)
+ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
+{
+ va_list va;
+
+ va_start(va, format);
+ zend_error_va_list(type, format, va);
+ va_end(va);
+}
+
+ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
+{
+ va_list va;
+
+ va_start(va, format);
+ zend_error_va_list(type, format, va);
+ va_end(va);
+}
+/* }}} */
#endif
ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */
@@ -1293,7 +1249,6 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
int i;
zend_file_handle *file_handle;
zend_op_array *op_array;
- zend_int_t orig_interactive = CG(interactive);
va_start(files, file_count);
for (i = 0; i < file_count; i++) {
@@ -1301,14 +1256,6 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
if (!file_handle) {
continue;
}
-
- if (orig_interactive) {
- if (file_handle->filename[0] != '-' || file_handle->filename[1]) {
- CG(interactive) = 0;
- } else {
- CG(interactive) = 1;
- }
- }
op_array = zend_compile_file(file_handle, type TSRMLS_CC);
if (file_handle->opened_path) {
@@ -1344,15 +1291,13 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou
}
}
destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
+ efree_size(op_array, sizeof(zend_op_array));
} else if (type==ZEND_REQUIRE) {
va_end(files);
- CG(interactive) = orig_interactive;
return FAILURE;
}
}
va_end(files);
- CG(interactive) = orig_interactive;
return SUCCESS;
}
@@ -1386,11 +1331,12 @@ void free_estring(char **str_p) /* {{{ */
{
efree(*str_p);
}
+/* }}} */
void free_string_zval(zval *zv) /* {{{ */
{
zend_string *str = Z_PTR_P(zv);
- STR_RELEASE(str);
+ zend_string_release(str);
}
/* }}} */
diff --git a/Zend/zend.h b/Zend/zend.h
index 731a8e5a81..969fa5e71b 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -26,433 +26,76 @@
#define ZEND_ENGINE_2
-#ifdef __cplusplus
-#define BEGIN_EXTERN_C() extern "C" {
-#define END_EXTERN_C() }
-#else
-#define BEGIN_EXTERN_C()
-#define END_EXTERN_C()
-#endif
-
-/*
- * general definitions
- */
-
-#ifdef ZEND_WIN32
-# include "zend_config.w32.h"
-# define ZEND_PATHS_SEPARATOR ';'
-#elif defined(NETWARE)
-# include <zend_config.h>
-# define ZEND_PATHS_SEPARATOR ';'
-#elif defined(__riscos__)
-# include <zend_config.h>
-# define ZEND_PATHS_SEPARATOR ';'
-#else
-# include <zend_config.h>
-# define ZEND_PATHS_SEPARATOR ':'
-#endif
-
-/* Only use this macro if you know for sure that all of the switches values
- are covered by its case statements */
-#if ZEND_DEBUG
-# define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSERT(0); break;
-#elif defined(ZEND_WIN32)
-# define EMPTY_SWITCH_DEFAULT_CASE() default: __assume(0); break;
-#else
-# define EMPTY_SWITCH_DEFAULT_CASE()
-#endif
-
-/* all HAVE_XXX test have to be after the include of zend_config above */
-
-#include <stdio.h>
-#include <assert.h>
-
-#ifdef HAVE_UNIX_H
-# include <unix.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-
-#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
-#endif
-
-#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
-
-# ifndef RTLD_LAZY
-# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
-# endif
-
-# ifndef RTLD_GLOBAL
-# define RTLD_GLOBAL 0
-# endif
-
-# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
-# elif defined(RTLD_DEEPBIND)
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
-# else
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
-# endif
-# define DL_UNLOAD dlclose
-# if defined(DLSYM_NEEDS_UNDERSCORE)
-# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
-# else
-# define DL_FETCH_SYMBOL dlsym
-# endif
-# define DL_ERROR dlerror
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#elif defined(ZEND_WIN32)
-# define DL_LOAD(libname) LoadLibrary(libname)
-# define DL_FETCH_SYMBOL GetProcAddress
-# define DL_UNLOAD FreeLibrary
-# define DL_HANDLE HMODULE
-# define ZEND_EXTENSIONS_SUPPORT 1
-#else
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 0
-#endif
-
-#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
-# include <alloca.h>
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifndef HAVE_ALLOCA_H
-# ifdef _AIX
-#pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#endif
-
-/* Compatibility with non-clang compilers */
-#ifndef __has_attribute
-# define __has_attribute(x) 0
-#endif
-
-/* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
-#ifdef __GNUC__
-# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
-#else
-# define ZEND_GCC_VERSION 0
-#endif
-
-#if ZEND_GCC_VERSION >= 2096
-# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-#else
-# define ZEND_ATTRIBUTE_MALLOC
-#endif
-
-#if ZEND_GCC_VERSION >= 4003 || __has_attribute(alloc_size)
-# define ZEND_ATTRIBUTE_ALLOC_SIZE(X) __attribute__ ((alloc_size(X)))
-# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y) __attribute__ ((alloc_size(X,Y)))
-#else
-# define ZEND_ATTRIBUTE_ALLOC_SIZE(X)
-# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y)
-#endif
-
-#if ZEND_GCC_VERSION >= 2007
-# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
-#else
-# define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
-#endif
-
-#if ZEND_GCC_VERSION >= 3001 && !defined(__INTEL_COMPILER)
-# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
-#else
-# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
-#endif
-
-#if ZEND_GCC_VERSION >= 3001
-# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#elif defined(ZEND_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1300
-# define ZEND_ATTRIBUTE_DEPRECATED __declspec(deprecated)
-#else
-# define ZEND_ATTRIBUTE_DEPRECATED
-#endif
-
-#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
-# define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
-# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused));
-#else
-# define ZEND_ATTRIBUTE_UNUSED
-# define ZEND_ATTRIBUTE_UNUSED_LABEL
-#endif
-
-#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
-# define ZEND_FASTCALL __attribute__((fastcall))
-#elif defined(_MSC_VER) && defined(_M_IX86)
-# define ZEND_FASTCALL __fastcall
-#else
-# define ZEND_FASTCALL
-#endif
-
-#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
-#else
-# define __restrict__
-#endif
-#define restrict __restrict__
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
-# define ZEND_ALLOCA_MAX_SIZE (32 * 1024)
-# define ALLOCA_FLAG(name) \
- zend_bool name;
-# define SET_ALLOCA_FLAG(name) \
- name = 1
-# define do_alloca_ex(size, limit, use_heap) \
- ((use_heap = (UNEXPECTED((size) > (limit)))) ? emalloc(size) : alloca(size))
-# define do_alloca(size, use_heap) \
- do_alloca_ex(size, ZEND_ALLOCA_MAX_SIZE, use_heap)
-# define free_alloca(p, use_heap) \
- do { if (UNEXPECTED(use_heap)) efree(p); } while (0)
-#else
-# define ALLOCA_FLAG(name)
-# define SET_ALLOCA_FLAG(name)
-# define do_alloca(p, use_heap) emalloc(p)
-# define free_alloca(p, use_heap) efree(p)
-#endif
-
-#if ZEND_DEBUG
-#define ZEND_FILE_LINE_D const char *__zend_filename, const uint __zend_lineno
-#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_ORIG_D const char *__zend_orig_filename, const uint __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
-#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_C __FILE__, __LINE__
-#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_EMPTY_C NULL, 0
-#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
-#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
-#define ZEND_ASSERT(c) assert(c)
-#else
-#define ZEND_FILE_LINE_D
-#define ZEND_FILE_LINE_DC
-#define ZEND_FILE_LINE_ORIG_D
-#define ZEND_FILE_LINE_ORIG_DC
-#define ZEND_FILE_LINE_RELAY_C
-#define ZEND_FILE_LINE_RELAY_CC
-#define ZEND_FILE_LINE_C
-#define ZEND_FILE_LINE_CC
-#define ZEND_FILE_LINE_EMPTY_C
-#define ZEND_FILE_LINE_EMPTY_CC
-#define ZEND_FILE_LINE_ORIG_RELAY_C
-#define ZEND_FILE_LINE_ORIG_RELAY_CC
-#define ZEND_ASSERT(c)
-#endif /* ZEND_DEBUG */
-
-#ifdef ZTS
-#define ZTS_V 1
-#else
-#define ZTS_V 0
-#endif
+#define ZEND_MAX_RESERVED_RESOURCES 4
+#include "zend_types.h"
#include "zend_errors.h"
#include "zend_alloc.h"
+#include "zend_hash.h"
+#include "zend_llist.h"
+#include "zend_string.h"
+#include "zend_ast.h"
+#include "zend_gc.h"
+#include "zend_variables.h"
+#include "zend_iterators.h"
+#include "zend_stream.h"
-#include "zend_types.h"
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
+#ifdef ZEND_SIGNALS
+# include "zend_signal.h"
#endif
-#if SIZEOF_ZEND_INT == 4
-#define MAX_LENGTH_OF_ZEND_INT 11
-static const char int_min_digits[] = "2147483648";
-#elif SIZEOF_ZEND_INT == 8
-#define MAX_LENGTH_OF_ZEND_INT 20
-static const char int_min_digits[] = "9223372036854775808";
+#ifndef ZEND_SIGNALS
+# define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
+# define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
#else
-#error "Unknown SIZEOF_ZEND_INT"
+# define HANDLE_BLOCK_INTERRUPTIONS() ZEND_SIGNAL_BLOCK_INTERRUPUTIONS()
+# define HANDLE_UNBLOCK_INTERRUPTIONS() ZEND_SIGNAL_UNBLOCK_INTERRUPTIONS()
#endif
-#define MAX_LENGTH_OF_DOUBLE 32
-
-typedef enum {
- SUCCESS = 0,
- FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */
-} ZEND_RESULT_CODE;
-
-#include "zend_hash.h"
-#include "zend_llist.h"
-
-#define INTERNAL_FUNCTION_PARAMETERS zend_uint param_count, zval *return_value TSRMLS_DC
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU param_count, return_value TSRMLS_CC
+#define INTERNAL_FUNCTION_PARAMETERS zend_execute_data *execute_data, zval *return_value TSRMLS_DC
+#define INTERNAL_FUNCTION_PARAM_PASSTHRU execute_data, return_value TSRMLS_CC
#define USED_RET() \
- (!EG(current_execute_data) || \
- !EG(current_execute_data)->prev_execute_data || \
- !ZEND_USER_CODE(EG(current_execute_data)->prev_execute_data->func->common.type) || \
- !(EG(current_execute_data)->prev_execute_data->opline->result_type & EXT_TYPE_UNUSED))
-
-#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
-void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
+ (!EX(prev_execute_data) || \
+ !ZEND_USER_CODE(EX(prev_execute_data)->func->common.type) || \
+ !(EX(prev_execute_data)->opline->result_type & EXT_TYPE_UNUSED))
+
+#ifdef HAVE_NORETURN
+# if defined(ZEND_WIN32)
+ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);
+# else
+void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN;
+# endif
#else
-# define zend_error_noreturn zend_error
+# define zend_error_noreturn zend_error
#endif
-#include "zend_object_handlers.h"
-#include "zend_ast.h"
-
/* overloaded elements data types */
#define OE_IS_ARRAY (1<<0)
#define OE_IS_OBJECT (1<<1)
#define OE_IS_METHOD (1<<2)
-#define Z_REFCOUNT_P(pz) zval_refcount_p(pz)
-#define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc)
-#define Z_ADDREF_P(pz) zval_addref_p(pz)
-#define Z_DELREF_P(pz) zval_delref_p(pz)
-
-#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z))
-#define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc)
-#define Z_ADDREF(z) Z_ADDREF_P(&(z))
-#define Z_DELREF(z) Z_DELREF_P(&(z))
-
-#define Z_TRY_ADDREF_P(pz) do { \
- if (Z_REFCOUNTED_P((pz))) { \
- Z_ADDREF_P((pz)); \
- } \
-} while (0)
-
-#define Z_TRY_DELREF_P(pz) do { \
- if (Z_REFCOUNTED_P((pz))) { \
- Z_DELREF_P((pz)); \
- } \
-} while (0)
-
-#define Z_TRY_ADDREF(z) Z_TRY_ADDREF_P(&(z))
-#define Z_TRY_DELREF(z) Z_TRY_DELREF_P(&(z))
-
-#if ZEND_DEBUG
-#define zend_always_inline inline
-#define zend_never_inline
-#else
-#if defined(__GNUC__)
-#if __GNUC__ >= 3
-#define zend_always_inline inline __attribute__((always_inline))
-#define zend_never_inline __attribute__((noinline))
-#else
-#define zend_always_inline inline
-#define zend_never_inline
-#endif
-#elif defined(_MSC_VER)
-#define zend_always_inline __forceinline
-#define zend_never_inline
-#else
-#define zend_always_inline inline
-#define zend_never_inline
-#endif
-#endif /* ZEND_DEBUG */
-
-#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
-# define EXPECTED(condition) __builtin_expect(!(!(condition)), 1)
-# define UNEXPECTED(condition) __builtin_expect(!(!(condition)), 0)
-#else
-# define EXPECTED(condition) (condition)
-# define UNEXPECTED(condition) (condition)
-#endif
-
-#ifndef XtOffsetOf
-# if defined(CRAY) || (defined(__ARMCC_VERSION) && !defined(LINUX))
-# ifdef __STDC__
-# define XtOffset(p_type, field) _Offsetof(p_type, field)
-# else
-# ifdef CRAY2
-# define XtOffset(p_type, field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-# else /* !CRAY2 */
-
-# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
-
-# endif /* !CRAY2 */
-# endif /* __STDC__ */
-# else /* ! (CRAY || __arm) */
-
-# define XtOffset(p_type, field) \
- ((zend_int_t) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-# endif /* !CRAY */
-
-# ifdef offsetof
-# define XtOffsetOf(s_type, field) offsetof(s_type, field)
-# else
-# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
-# endif
-
-#endif
-
-#include "zend_string.h"
-
-static zend_always_inline zend_uint zval_refcount_p(zval* pz) {
- ZEND_ASSERT(Z_REFCOUNTED_P(pz) || Z_IMMUTABLE_P(pz));
- return GC_REFCOUNT(Z_COUNTED_P(pz));
-}
-
-static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) {
- ZEND_ASSERT(Z_REFCOUNTED_P(pz));
- return GC_REFCOUNT(Z_COUNTED_P(pz)) = rc;
-}
-
-static zend_always_inline zend_uint zval_addref_p(zval* pz) {
- ZEND_ASSERT(Z_REFCOUNTED_P(pz));
- return ++GC_REFCOUNT(Z_COUNTED_P(pz));
-}
-
-static zend_always_inline zend_uint zval_delref_p(zval* pz) {
- ZEND_ASSERT(Z_REFCOUNTED_P(pz));
- return --GC_REFCOUNT(Z_COUNTED_P(pz));
-}
-
-/* excpt.h on Digital Unix 4.0 defines function_table */
-#undef function_table
-
-/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
-union _zend_function;
-
-#include "zend_iterators.h"
-
struct _zend_serialize_data;
struct _zend_unserialize_data;
typedef struct _zend_serialize_data zend_serialize_data;
typedef struct _zend_unserialize_data zend_unserialize_data;
-struct _zend_trait_method_reference {
+typedef struct _zend_trait_method_reference {
zend_string *method_name;
zend_class_entry *ce;
zend_string *class_name;
-};
-typedef struct _zend_trait_method_reference zend_trait_method_reference;
+} zend_trait_method_reference;
-struct _zend_trait_precedence {
+typedef struct _zend_trait_precedence {
zend_trait_method_reference *trait_method;
union {
zend_class_entry *ce;
zend_string *class_name;
} *exclude_from_classes;
-};
-typedef struct _zend_trait_precedence zend_trait_precedence;
+} zend_trait_precedence;
-struct _zend_trait_alias {
+typedef struct _zend_trait_alias {
zend_trait_method_reference *trait_method;
/**
@@ -463,25 +106,24 @@ struct _zend_trait_alias {
/**
* modifiers to be set on trait method
*/
- zend_uint modifiers;
-};
-typedef struct _zend_trait_alias zend_trait_alias;
+ uint32_t modifiers;
+} zend_trait_alias;
struct _zend_class_entry {
char type;
zend_string *name;
struct _zend_class_entry *parent;
int refcount;
- zend_uint ce_flags;
+ uint32_t ce_flags;
- HashTable function_table;
- HashTable properties_info;
+ int default_properties_count;
+ int default_static_members_count;
zval *default_properties_table;
zval *default_static_members_table;
zval *static_members_table;
+ HashTable function_table;
+ HashTable properties_info;
HashTable constants_table;
- int default_properties_count;
- int default_static_members_count;
union _zend_function *constructor;
union _zend_function *destructor;
@@ -506,22 +148,22 @@ struct _zend_class_entry {
union _zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method TSRMLS_DC);
/* serializer callbacks */
- int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
- int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ int (*serialize)(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
+ int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
+ uint32_t num_interfaces;
+ uint32_t num_traits;
zend_class_entry **interfaces;
- zend_uint num_interfaces;
zend_class_entry **traits;
- zend_uint num_traits;
zend_trait_alias **trait_aliases;
zend_trait_precedence **trait_precedences;
union {
struct {
zend_string *filename;
- zend_uint line_start;
- zend_uint line_end;
+ uint32_t line_start;
+ uint32_t line_end;
zend_string *doc_comment;
} user;
struct {
@@ -531,20 +173,19 @@ struct _zend_class_entry {
} info;
};
-#include "zend_stream.h"
typedef struct _zend_utility_functions {
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
- zend_size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
- zend_size_t (*write_function)(const char *str, zend_size_t str_length);
+ size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
+ size_t (*write_function)(const char *str, size_t str_length);
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
- void (*message_handler)(long message, const void *data TSRMLS_DC);
+ void (*message_handler)(zend_long message, const void *data TSRMLS_DC);
void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
- int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
+ zval *(*get_configuration_directive)(zend_string *name);
void (*ticks_function)(int ticks TSRMLS_DC);
void (*on_timeout)(int seconds TSRMLS_DC);
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
- zend_size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
+ size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
zend_string *(*vstrpprintf_function)(size_t max_len, const char *format, va_list ap);
char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC);
@@ -558,39 +199,8 @@ typedef struct _zend_utility_values {
typedef int (*zend_write_func_t)(const char *str, uint str_length);
-#undef MIN
-#undef MAX
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#define MIN(a, b) (((a)<(b))?(a):(b))
-#define ZEND_STRL(str) (str), (sizeof(str)-1)
-#define ZEND_STRS(str) (str), (sizeof(str))
-#define ZEND_NORMALIZE_BOOL(n) \
- ((n) ? (((n)>0) ? 1 : -1) : 0)
-#define ZEND_TRUTH(x) ((x) ? 1 : 0)
-#define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC);
-void zend_shutdown(TSRMLS_D);
-void zend_register_standard_ini_entries(TSRMLS_D);
-void zend_post_startup(TSRMLS_D);
-void zend_set_utility_values(zend_utility_values *utility_values);
-
-BEGIN_EXTERN_C()
-ZEND_API void _zend_bailout(char *filename, uint lineno);
-END_EXTERN_C()
-
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
-#ifdef HAVE_SIGSETJMP
-# define SETJMP(a) sigsetjmp(a, 0)
-# define LONGJMP(a,b) siglongjmp(a, b)
-# define JMP_BUF sigjmp_buf
-#else
-# define SETJMP(a) setjmp(a)
-# define LONGJMP(a,b) longjmp(a, b)
-# define JMP_BUF jmp_buf
-#endif
-
#define zend_try \
{ \
JMP_BUF *__orig_bailout = EG(bailout); \
@@ -608,6 +218,14 @@ END_EXTERN_C()
#define zend_first_try EG(bailout)=NULL; zend_try
BEGIN_EXTERN_C()
+int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC);
+void zend_shutdown(TSRMLS_D);
+void zend_register_standard_ini_entries(TSRMLS_D);
+void zend_post_startup(TSRMLS_D);
+void zend_set_utility_values(zend_utility_values *utility_values);
+
+ZEND_API void _zend_bailout(char *filename, uint lineno);
+
ZEND_API char *get_zend_version(void);
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy TSRMLS_DC);
ZEND_API int zend_print_zval(zval *expr, int indent TSRMLS_DC);
@@ -616,24 +234,14 @@ ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
-END_EXTERN_C()
-BEGIN_EXTERN_C()
ZEND_API void zend_activate(TSRMLS_D);
ZEND_API void zend_deactivate(TSRMLS_D);
ZEND_API void zend_call_destructors(TSRMLS_D);
ZEND_API void zend_activate_modules(TSRMLS_D);
ZEND_API void zend_deactivate_modules(TSRMLS_D);
ZEND_API void zend_post_deactivate_modules(TSRMLS_D);
-END_EXTERN_C()
-
-#if ZEND_DEBUG
-#define Z_DBG(expr) (expr)
-#else
-#define Z_DBG(expr)
-#endif
-BEGIN_EXTERN_C()
ZEND_API void free_estring(char **str_p);
ZEND_API void free_string_zval(zval *zv);
END_EXTERN_C()
@@ -646,7 +254,7 @@ END_EXTERN_C()
#define ZEND_PUTC(c) zend_write(&(c), 1)
BEGIN_EXTERN_C()
-extern ZEND_API zend_size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
+extern ZEND_API size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
extern ZEND_API zend_write_func_t zend_write;
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
extern ZEND_API void (*zend_block_interruptions)(void);
@@ -655,8 +263,8 @@ extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
-extern zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
-extern zend_string *(*zend_vstrpprintf)(zend_size_t max_len, const char *format, va_list ap);
+extern size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
+extern zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap);
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
@@ -674,20 +282,10 @@ END_EXTERN_C()
#define ZEND_UV(name) (zend_uv.name)
-#ifndef ZEND_SIGNALS
-#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
-#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
-#else
-#include "zend_signal.h"
-
-#define HANDLE_BLOCK_INTERRUPTIONS() ZEND_SIGNAL_BLOCK_INTERRUPUTIONS()
-#define HANDLE_UNBLOCK_INTERRUPTIONS() ZEND_SIGNAL_UNBLOCK_INTERRUPTIONS()
-#endif
-
BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC);
+ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC);
-ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
+ZEND_API zval *zend_get_configuration_directive(zend_string *name);
END_EXTERN_C()
/* Messages for applications of Zend */
@@ -699,134 +297,6 @@ END_EXTERN_C()
#define ZMSG_LOG_SCRIPT_NAME 6L
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
-#define ZVAL_COPY_VALUE(z, v) \
- do { \
- zval *_z1 = (z); \
- zval *_z2 = (v); \
- (_z1)->value = (_z2)->value; \
- Z_TYPE_INFO_P(_z1) = Z_TYPE_INFO_P(_z2); \
- } while (0)
-
-#define ZVAL_COPY(z, v) \
- do { \
- zval *__z1 = (z); \
- zval *__z2 = (v); \
- ZVAL_COPY_VALUE(__z1, __z2); \
- if (Z_OPT_REFCOUNTED_P(__z1)) { \
- Z_ADDREF_P(__z1); \
- } \
- } while (0)
-
-#define ZVAL_DUP(z, v) \
- do { \
- zval *__z1 = (z); \
- zval *__z2 = (v); \
- ZVAL_COPY_VALUE(__z1, __z2); \
- zval_opt_copy_ctor(__z1); \
- } while (0)
-
-#define ZVAL_DEREF(z) do { \
- if (UNEXPECTED(Z_ISREF_P(z))) { \
- (z) = Z_REFVAL_P(z); \
- } \
- } while (0)
-
-#define ZVAL_MAKE_REF(zv) do { \
- zval *__zv = (zv); \
- if (!Z_ISREF_P(__zv)) { \
- ZVAL_NEW_REF(__zv, __zv); \
- } \
- } while (0)
-
-#define ZVAL_UNREF(z) do { \
- zval *_z = (z); \
- zend_reference *ref; \
- ZEND_ASSERT(Z_ISREF_P(_z)); \
- ref = Z_REF_P(_z); \
- ZVAL_COPY_VALUE(_z, &ref->val); \
- efree(ref); \
- } while (0)
-
-#define SEPARATE_STRING(zv) do { \
- zval *_zv = (zv); \
- if (Z_REFCOUNTED_P(_zv) && \
- Z_REFCOUNT_P(_zv) > 1) { \
- Z_DELREF_P(_zv); \
- zval_copy_ctor_func(_zv); \
- } \
- } while (0)
-
-#define SEPARATE_ARRAY(zv) do { \
- zval *_zv = (zv); \
- if (Z_REFCOUNT_P(_zv) > 1) { \
- if (!Z_IMMUTABLE_P(_zv)) { \
- Z_DELREF_P(_zv); \
- } \
- zval_copy_ctor_func(_zv); \
- } \
- } while (0)
-
-#define SEPARATE_ZVAL_NOREF(zv) do { \
- zval *_zv = (zv); \
- if (Z_COPYABLE_P(_zv) || \
- Z_IMMUTABLE_P(_zv)) { \
- if (Z_REFCOUNT_P(_zv) > 1) { \
- if (!Z_IMMUTABLE_P(_zv)) { \
- Z_DELREF_P(_zv); \
- } \
- zval_copy_ctor_func(_zv); \
- } \
- } \
- } while (0)
-
-#define SEPARATE_ZVAL(zv) do { \
- zval *_zv = (zv); \
- if (Z_REFCOUNTED_P(_zv) || \
- Z_IMMUTABLE_P(_zv)) { \
- if (Z_REFCOUNT_P(_zv) > 1) { \
- if (Z_COPYABLE_P(_zv) || \
- Z_IMMUTABLE_P(_zv)) { \
- if (!Z_IMMUTABLE_P(_zv)) { \
- Z_DELREF_P(_zv); \
- } \
- zval_copy_ctor_func(_zv); \
- } else if (Z_ISREF_P(_zv)) { \
- Z_DELREF_P(_zv); \
- ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \
- } \
- } \
- } \
- } while (0)
-
-#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
- zval *_zv = (zv); \
- if (Z_COPYABLE_P(_zv) || \
- Z_IMMUTABLE_P(_zv)) { \
- if (Z_REFCOUNT_P(_zv) > 1) { \
- if (!Z_IMMUTABLE_P(_zv)) { \
- Z_DELREF_P(_zv); \
- } \
- zval_copy_ctor_func(_zv); \
- } \
- } \
- } while (0)
-
-#define SEPARATE_ARG_IF_REF(varptr) do { \
- ZVAL_DEREF(varptr); \
- if (Z_REFCOUNTED_P(varptr)) { \
- Z_ADDREF_P(varptr); \
- } \
- } while (0)
-
-#define READY_TO_DESTROY(zv) \
- (Z_REFCOUNTED_P(zv) && Z_REFCOUNT_P(zv) == 1)
-
-#define ZEND_MAX_RESERVED_RESOURCES 4
-
-#include "zend_gc.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-
typedef enum {
EH_NORMAL = 0,
EH_SUPPRESS,
@@ -846,6 +316,9 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC);
#define DEBUG_BACKTRACE_PROVIDE_OBJECT (1<<0)
#define DEBUG_BACKTRACE_IGNORE_ARGS (1<<1)
+#include "zend_object_handlers.h"
+#include "zend_operators.h"
+
#endif /* ZEND_H */
/*
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 35b3c8ac7a..41214865f4 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -27,6 +27,7 @@
#include "zend_constants.h"
#include "zend_exceptions.h"
#include "zend_closures.h"
+#include "zend_inheritance.h"
#ifdef HAVE_STDARG_H
#include <stdarg.h>
@@ -166,7 +167,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
case IS_FALSE:
case IS_TRUE:
return "boolean";
- case IS_INT:
+ case IS_LONG:
return "integer";
case IS_DOUBLE:
return "double";
@@ -195,40 +196,14 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
}
/* }}} */
-ZEND_API zend_class_entry *zend_get_class_entry(const zend_object *zobject TSRMLS_DC) /* {{{ */
-{
- if (zobject->handlers->get_class_entry) {
- return zobject->handlers->get_class_entry(zobject TSRMLS_CC);
- } else {
- zend_error(E_ERROR, "Class entry requested for an object without PHP class");
- return NULL;
- }
-}
-/* }}} */
-
-/* returns 1 if you need to copy result, 0 if it's already a copy */
-ZEND_API zend_string *zend_get_object_classname(const zend_object *object TSRMLS_DC) /* {{{ */
-{
- zend_string *ret;
-
- if (object->handlers->get_class_name != NULL) {
- ret = object->handlers->get_class_name(object, 0 TSRMLS_CC);
- if (ret) {
- return ret;
- }
- }
- return zend_get_class_entry(object TSRMLS_CC)->name;
-}
-/* }}} */
-
-static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */
+static int parse_arg_object_to_string(zval *arg, char **p, size_t *pl, int type TSRMLS_DC) /* {{{ */
{
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
zval obj;
if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type TSRMLS_CC) == SUCCESS) {
zval_ptr_dtor(arg);
ZVAL_COPY_VALUE(arg, &obj);
- *pl = Z_STRSIZE_P(arg);
+ *pl = Z_STRLEN_P(arg);
*p = Z_STRVAL_P(arg);
return SUCCESS;
}
@@ -237,7 +212,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR
if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) {
SEPARATE_ZVAL_NOREF(arg);
if (zend_std_cast_object_tostring(arg, arg, type TSRMLS_CC) == SUCCESS) {
- *pl = Z_STRSIZE_P(arg);
+ *pl = Z_STRLEN_P(arg);
*p = Z_STRVAL_P(arg);
return SUCCESS;
}
@@ -252,7 +227,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR
if (!zend_make_printable_zval(z, arg TSRMLS_CC)) {
ZVAL_ZVAL(arg, z, 1, 1);
}
- *pl = Z_STRSIZE_P(arg);
+ *pl = Z_STRLEN_P(arg);
*p = Z_STRVAL_P(arg);
return SUCCESS;
}
@@ -413,7 +388,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
case 'l':
case 'L':
{
- long *p = va_arg(*va, long *);
+ zend_long *p = va_arg(*va, zend_long *);
if (check_null) {
zend_bool *p = va_arg(*va, zend_bool *);
@@ -426,101 +401,40 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
double d;
int type;
- if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), (zend_int_t *)p, &d, -1)) == 0) {
+ if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) {
return "long";
} else if (type == IS_DOUBLE) {
if (c == 'L') {
- if (d > LONG_MAX) {
- *p = LONG_MAX;
+ if (d > ZEND_LONG_MAX) {
+ *p = ZEND_LONG_MAX;
break;
- } else if (d < LONG_MIN) {
- *p = LONG_MIN;
+ } else if (d < ZEND_LONG_MIN) {
+ *p = ZEND_LONG_MIN;
break;
}
}
- *p = zend_dval_to_ival(d);
+ *p = zend_dval_to_lval(d);
}
}
break;
case IS_DOUBLE:
if (c == 'L') {
- if (Z_DVAL_P(arg) > LONG_MAX) {
- *p = LONG_MAX;
+ if (Z_DVAL_P(arg) > ZEND_LONG_MAX) {
+ *p = ZEND_LONG_MAX;
break;
- } else if (Z_DVAL_P(arg) < LONG_MIN) {
- *p = LONG_MIN;
+ } else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) {
+ *p = ZEND_LONG_MIN;
break;
}
}
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
- case IS_INT:
- convert_to_int_ex(arg);
- *p = Z_IVAL_P(arg);
- break;
-
- case IS_ARRAY:
- case IS_OBJECT:
- case IS_RESOURCE:
- default:
- return "long";
- }
- }
- break;
-
- case 'i':
- case 'I':
- {
- zend_int_t *p = va_arg(*va, zend_int_t *);
-
- if (check_null) {
- zend_bool *p = va_arg(*va, zend_bool *);
- *p = (Z_TYPE_P(arg) == IS_NULL);
- }
-
- switch (Z_TYPE_P(arg)) {
- case IS_STRING:
- {
- double d;
- int type;
-
- if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), p, &d, -1)) == 0) {
- return "long";
- } else if (type == IS_DOUBLE) {
- if (c == 'I') {
- if (d > ZEND_INT_MAX) {
- *p = ZEND_INT_MAX;
- break;
- } else if (d < ZEND_INT_MIN) {
- *p = ZEND_INT_MIN;
- break;
- }
- }
-
- *p = zend_dval_to_ival(d);
- }
- }
- break;
-
- case IS_DOUBLE:
- if (c == 'I') {
- if (Z_DVAL_P(arg) > ZEND_INT_MAX) {
- *p = ZEND_INT_MAX;
- break;
- } else if (Z_DVAL_P(arg) < ZEND_INT_MIN) {
- *p = ZEND_INT_MIN;
- break;
- }
- }
- case IS_NULL:
- case IS_FALSE:
- case IS_TRUE:
- case IS_INT:
- convert_to_int_ex(arg);
- *p = Z_IVAL_P(arg);
+ case IS_LONG:
+ convert_to_long_ex(arg);
+ *p = Z_LVAL_P(arg);
break;
case IS_ARRAY:
@@ -544,12 +458,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
switch (Z_TYPE_P(arg)) {
case IS_STRING:
{
- zend_int_t l;
+ zend_long l;
int type;
- if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &l, p, -1)) == 0) {
+ if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &l, p, -1)) == 0) {
return "double";
- } else if (type == IS_INT) {
+ } else if (type == IS_LONG) {
*p = (double) l;
}
}
@@ -558,7 +472,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
convert_to_double_ex(arg);
*p = Z_DVAL_P(arg);
@@ -577,7 +491,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
case 's':
{
char **p = va_arg(*va, char **);
- int *pl = va_arg(*va, int *);
+ size_t *pl = va_arg(*va, size_t *);
switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (check_null) {
@@ -587,14 +501,14 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
/* break omitted intentionally */
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
convert_to_string_ex(arg);
case IS_STRING:
*p = Z_STRVAL_P(arg);
- *pl = Z_STRSIZE_P(arg);
+ *pl = Z_STRLEN_P(arg);
if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) {
return "a valid path";
}
@@ -628,7 +542,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
/* break omitted intentionally */
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
@@ -668,7 +582,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
switch (Z_TYPE_P(arg)) {
case IS_NULL:
case IS_STRING:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
@@ -932,7 +846,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
case 'f': case 'A':
case 'H': case 'p':
case 'S': case 'P':
- case 'i':
+ case 'L':
max_num_args++;
break;
@@ -1205,9 +1119,8 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC)
if (key) {
zval member;
- ZVAL_STR(&member, STR_COPY(key));
+ ZVAL_STR(&member, key);
obj_ht->write_property(obj, &member, value, NULL TSRMLS_CC);
- zval_ptr_dtor(&member);
}
} ZEND_HASH_FOREACH_END();
EG(scope) = old_scope;
@@ -1329,13 +1242,12 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
{
object->properties = properties;
if (object->ce->default_properties_count) {
- zval *prop, tmp;
+ zval *prop;
zend_string *key;
zend_property_info *property_info;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
- ZVAL_STR(&tmp, key);
- property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
+ property_info = zend_get_property_info(object->ce, key, 1 TSRMLS_CC);
if (property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0 &&
property_info->offset >= 0) {
@@ -1354,8 +1266,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
zend_property_info *property_info;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
- ZVAL_STR(&tmp, key);
- property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
+ property_info = zend_get_property_info(object->ce, key, 1 TSRMLS_CC);
if (property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0 &&
property_info->offset >= 0) {
@@ -1364,7 +1275,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
zval_add_ref(&object->properties_table[property_info->offset]);
if (object->properties) {
ZVAL_INDIRECT(&tmp, &object->properties_table[property_info->offset]);
- prop = zend_hash_update(object->properties, key, &tmp);
+ zend_hash_update(object->properties, key, &tmp);
}
} else {
if (!object->properties) {
@@ -1425,11 +1336,11 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)
}
/* }}} */
-ZEND_API int add_assoc_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n) /* {{{ */
+ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, zend_long n) /* {{{ */
{
zval *ret, tmp;
- ZVAL_INT(&tmp, n);
+ ZVAL_LONG(&tmp, n);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
}
@@ -1495,7 +1406,7 @@ ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char
}
/* }}} */
-ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length) /* {{{ */
+ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, size_t length) /* {{{ */
{
zval *ret, tmp;
@@ -1514,16 +1425,16 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
}
/* }}} */
-ZEND_API int add_index_int(zval *arg, zend_uint_t index, zend_int_t n) /* {{{ */
+ZEND_API int add_index_long(zval *arg, zend_ulong index, zend_long n) /* {{{ */
{
zval tmp;
- ZVAL_INT(&tmp, n);
+ ZVAL_LONG(&tmp, n);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_index_null(zval *arg, zend_uint_t index) /* {{{ */
+ZEND_API int add_index_null(zval *arg, zend_ulong index) /* {{{ */
{
zval tmp;
@@ -1532,7 +1443,7 @@ ZEND_API int add_index_null(zval *arg, zend_uint_t index) /* {{{ */
}
/* }}} */
-ZEND_API int add_index_bool(zval *arg, zend_uint_t index, int b) /* {{{ */
+ZEND_API int add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */
{
zval tmp;
@@ -1541,7 +1452,7 @@ ZEND_API int add_index_bool(zval *arg, zend_uint_t index, int b) /* {{{ */
}
/* }}} */
-ZEND_API int add_index_resource(zval *arg, zend_uint_t index, zend_resource *r) /* {{{ */
+ZEND_API int add_index_resource(zval *arg, zend_ulong index, zend_resource *r) /* {{{ */
{
zval tmp;
@@ -1550,7 +1461,7 @@ ZEND_API int add_index_resource(zval *arg, zend_uint_t index, zend_resource *r)
}
/* }}} */
-ZEND_API int add_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */
+ZEND_API int add_index_double(zval *arg, zend_ulong index, double d) /* {{{ */
{
zval tmp;
@@ -1559,7 +1470,7 @@ ZEND_API int add_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */
}
/* }}} */
-ZEND_API int add_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{{ */
+ZEND_API int add_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */
{
zval tmp;
@@ -1568,7 +1479,7 @@ ZEND_API int add_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{
}
/* }}} */
-ZEND_API int add_index_string(zval *arg, zend_uint_t index, const char *str) /* {{{ */
+ZEND_API int add_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */
{
zval tmp;
@@ -1577,7 +1488,7 @@ ZEND_API int add_index_string(zval *arg, zend_uint_t index, const char *str) /*
}
/* }}} */
-ZEND_API int add_index_stringl(zval *arg, zend_uint_t index, const char *str, uint length) /* {{{ */
+ZEND_API int add_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length) /* {{{ */
{
zval tmp;
@@ -1586,17 +1497,17 @@ ZEND_API int add_index_stringl(zval *arg, zend_uint_t index, const char *str, ui
}
/* }}} */
-ZEND_API int add_index_zval(zval *arg, zend_uint_t index, zval *value) /* {{{ */
+ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value) /* {{{ */
{
return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_next_index_int(zval *arg, zend_int_t n) /* {{{ */
+ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */
{
zval tmp;
- ZVAL_INT(&tmp, n);
+ ZVAL_LONG(&tmp, n);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
@@ -1655,7 +1566,7 @@ ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */
}
/* }}} */
-ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length) /* {{{ */
+ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) /* {{{ */
{
zval tmp;
@@ -1680,7 +1591,7 @@ ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len,
}
/* }}} */
-ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length) /* {{{ */
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, size_t length) /* {{{ */
{
zval tmp, *ret;
@@ -1690,16 +1601,16 @@ ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len
}
/* }}} */
-ZEND_API zval *add_get_index_int(zval *arg, zend_uint_t index, zend_int_t l) /* {{{ */
+ZEND_API zval *add_get_index_long(zval *arg, zend_ulong index, zend_long l) /* {{{ */
{
zval tmp;
- ZVAL_INT(&tmp, l);
+ ZVAL_LONG(&tmp, l);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */
+ZEND_API zval *add_get_index_double(zval *arg, zend_ulong index, double d) /* {{{ */
{
zval tmp;
@@ -1708,7 +1619,7 @@ ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t index, double d) /* {
}
/* }}} */
-ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{{ */
+ZEND_API zval *add_get_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */
{
zval tmp;
@@ -1717,7 +1628,7 @@ ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str)
}
/* }}} */
-ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t index, const char *str) /* {{{ */
+ZEND_API zval *add_get_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */
{
zval tmp;
@@ -1726,7 +1637,7 @@ ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t index, const char *st
}
/* }}} */
-ZEND_API zval *add_get_index_stringl(zval *arg, zend_uint_t index, const char *str, uint length) /* {{{ */
+ZEND_API zval *add_get_index_stringl(zval *arg, zend_ulong index, const char *str, size_t length) /* {{{ */
{
zval tmp;
@@ -1747,7 +1658,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
result = zend_symtable_update(ht, STR_EMPTY_ALLOC(), value);
break;
case IS_RESOURCE:
- zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
+ zend_error(E_STRICT, "Resource ID#" ZEND_LONG_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value);
break;
case IS_FALSE:
@@ -1756,11 +1667,11 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
case IS_TRUE:
result = zend_hash_index_update(ht, 1, value);
break;
- case IS_INT:
- result = zend_hash_index_update(ht, Z_IVAL_P(key), value);
+ case IS_LONG:
+ result = zend_hash_index_update(ht, Z_LVAL_P(key), value);
break;
case IS_DOUBLE:
- result = zend_hash_index_update(ht, zend_dval_to_ival(Z_DVAL_P(key)), value);
+ result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
@@ -1778,12 +1689,12 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
}
/* }}} */
-ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, zend_long n TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
- ZVAL_INT(&tmp, n);
+ ZVAL_LONG(&tmp, n);
ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, NULL TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
@@ -1792,7 +1703,7 @@ ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_
}
/* }}} */
-ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_int_t b TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_long b TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
@@ -1876,7 +1787,7 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co
}
/* }}} */
-ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, size_t length TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
@@ -1920,17 +1831,17 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{
zend_module_entry *req_mod;
name_len = strlen(dep->name);
- lcname = STR_ALLOC(name_len, 0);
+ lcname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lcname->val, dep->name, name_len);
if ((req_mod = zend_hash_find_ptr(&module_registry, lcname)) == NULL || !req_mod->module_started) {
- STR_FREE(lcname);
+ zend_string_free(lcname);
/* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name);
module->module_started = 0;
return FAILURE;
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
}
++dep;
}
@@ -2109,31 +2020,31 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS
while (dep->name) {
if (dep->type == MODULE_DEP_CONFLICTS) {
name_len = strlen(dep->name);
- lcname = STR_ALLOC(name_len, 0);
+ lcname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lcname->val, dep->name, name_len);
if (zend_hash_exists(&module_registry, lcname)) {
- STR_FREE(lcname);
+ zend_string_free(lcname);
/* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name);
return NULL;
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
}
++dep;
}
}
name_len = strlen(module->name);
- lcname = STR_ALLOC(name_len, 1);
+ lcname = zend_string_alloc(name_len, 1);
zend_str_tolower_copy(lcname->val, module->name, name_len);
if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) {
zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
- STR_RELEASE(lcname);
+ zend_string_release(lcname);
return NULL;
}
- STR_RELEASE(lcname);
+ zend_string_release(lcname);
module = module_ptr;
EG(current_module) = module;
@@ -2261,7 +2172,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
while (ptr->fname) {
fname_len = strlen(ptr->fname);
internal_function->handler = ptr->handler;
- internal_function->function_name = zend_new_interned_string(STR_INIT(ptr->fname, fname_len, 1) TSRMLS_CC);
+ internal_function->function_name = zend_new_interned_string(zend_string_init(ptr->fname, fname_len, 1) TSRMLS_CC);
internal_function->scope = scope;
internal_function->prototype = NULL;
if (ptr->flags) {
@@ -2327,7 +2238,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
return FAILURE;
}
}
- lowercase_name = STR_ALLOC(fname_len, 1);
+ lowercase_name = zend_string_alloc(fname_len, 1);
zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
reg_function = malloc(sizeof(zend_internal_function));
@@ -2335,13 +2246,13 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (zend_hash_add_ptr(target_function_table, lowercase_name, reg_function) == NULL) {
unload=1;
free(reg_function);
- STR_RELEASE(lowercase_name);
+ zend_string_release(lowercase_name);
break;
}
/* If types of arguments have to be checked */
if (reg_function->common.arg_info && reg_function->common.num_args) {
- int i;
+ uint32_t i;
for (i = 0; i < reg_function->common.num_args; i++) {
if (reg_function->common.arg_info[i].class_name ||
reg_function->common.arg_info[i].type_hint) {
@@ -2358,30 +2269,30 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
*/
if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name->val, lc_class_name, class_name_len+1)) {
ctor = reg_function;
- } else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME)) {
ctor = reg_function;
- } else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME)) {
dtor = reg_function;
if (internal_function->num_args) {
zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name->val, ptr->fname);
}
- } else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_CLONE_FUNC_NAME)) {
clone = reg_function;
- } else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_CALL_FUNC_NAME)) {
__call = reg_function;
- } else if ((fname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_CALLSTATIC_FUNC_NAME)) {
__callstatic = reg_function;
- } else if ((fname_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_TOSTRING_FUNC_NAME)) {
__tostring = reg_function;
- } else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_GET_FUNC_NAME)) {
__get = reg_function;
- } else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_SET_FUNC_NAME)) {
__set = reg_function;
- } else if ((fname_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_UNSET_FUNC_NAME)) {
__unset = reg_function;
- } else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_ISSET_FUNC_NAME)) {
__isset = reg_function;
- } else if ((fname_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) {
+ } else if (zend_string_equals_literal(lowercase_name, ZEND_DEBUGINFO_FUNC_NAME)) {
__debugInfo = reg_function;
} else {
reg_function = NULL;
@@ -2392,7 +2303,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
ptr++;
count++;
- STR_RELEASE(lowercase_name);
+ zend_string_release(lowercase_name);
}
if (unload) { /* before unloading, display all remaining bad function in the module */
if (scope) {
@@ -2400,12 +2311,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
while (ptr->fname) {
fname_len = strlen(ptr->fname);
- lowercase_name = STR_ALLOC(fname_len, 0);
+ lowercase_name = zend_string_alloc(fname_len, 0);
zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
if (zend_hash_exists(target_function_table, lowercase_name)) {
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname);
}
- STR_FREE(lowercase_name);
+ zend_string_free(lowercase_name);
ptr++;
}
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
@@ -2516,10 +2427,10 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
break;
}
fname_len = strlen(ptr->fname);
- lowercase_name = STR_ALLOC(fname_len, 0);
+ lowercase_name = zend_string_alloc(fname_len, 0);
zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
zend_hash_del(target_function_table, lowercase_name);
- STR_FREE(lowercase_name);
+ zend_string_free(lowercase_name);
ptr++;
i++;
}
@@ -2712,16 +2623,16 @@ ZEND_API void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */
/* }}} */
/* return the next free module number */
-int zend_next_free_module(void) /* {{{ */
+ZEND_API int zend_next_free_module(void) /* {{{ */
{
return zend_hash_num_elements(&module_registry) + 1;
}
/* }}} */
-static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */
+static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, uint32_t ce_flags TSRMLS_DC) /* {{{ */
{
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
- zend_string *lowercase_name = STR_ALLOC(orig_class_entry->name->len, 1);
+ zend_string *lowercase_name = zend_string_alloc(orig_class_entry->name->len, 1);
*class_entry = *orig_class_entry;
class_entry->type = ZEND_INTERNAL_CLASS;
@@ -2736,7 +2647,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
zend_str_tolower_copy(lowercase_name->val, orig_class_entry->name->val, class_entry->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
- STR_RELEASE(lowercase_name);
+ zend_string_release(lowercase_name);
return class_entry;
}
/* }}} */
@@ -2793,14 +2704,14 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
zend_string *lcname;
if (name[0] == '\\') {
- lcname = STR_ALLOC(name_len-1, 1);
+ lcname = zend_string_alloc(name_len-1, 1);
zend_str_tolower_copy(lcname->val, name+1, name_len-1);
} else {
- lcname = STR_ALLOC(name_len, 1);
+ lcname = zend_string_alloc(name_len, 1);
zend_str_tolower_copy(lcname->val, name, name_len);
}
ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
- STR_RELEASE(lcname);
+ zend_string_release(lcname);
if (ce) {
ce->refcount++;
return SUCCESS;
@@ -2886,7 +2797,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
zend_class_entry *disabled_class;
zend_string *key;
- key = STR_ALLOC(class_name_length, 0);
+ key = zend_string_alloc(class_name_length, 0);
zend_str_tolower_copy(key->val, class_name, class_name_length);
disabled_class = zend_hash_find_ptr(CG(class_table), key);
if (!disabled_class) {
@@ -2911,20 +2822,18 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
zend_str_tolower_copy(lcname->val, name->val, name_len);
*strict_class = 0;
- if (name_len == sizeof("self") - 1 &&
- !memcmp(lcname->val, "self", sizeof("self") - 1)) {
+ if (zend_string_equals_literal(lcname, "self")) {
if (!EG(scope)) {
if (error) *error = estrdup("cannot access self:: when no class scope is active");
} else {
fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope);
- if (!fcc->object && Z_OBJ(EG(This))) {
- fcc->object = Z_OBJ(EG(This));
+ if (!fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This)) {
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
}
ret = 1;
}
- } else if (name_len == sizeof("parent") - 1 &&
- !memcmp(lcname->val, "parent", sizeof("parent") - 1)) {
+ } else if (zend_string_equals_literal(lcname, "parent")) {
if (!EG(scope)) {
if (error) *error = estrdup("cannot access parent:: when no class scope is active");
} else if (!EG(scope)->parent) {
@@ -2932,21 +2841,20 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
} else {
fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope)->parent;
- if (!fcc->object && Z_OBJ(EG(This))) {
- fcc->object = Z_OBJ(EG(This));
+ if (!fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This)) {
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
}
*strict_class = 1;
ret = 1;
}
- } else if (name_len == sizeof("static") - 1 &&
- !memcmp(lcname->val, "static", sizeof("static") - 1)) {
+ } else if (zend_string_equals_literal(lcname, "static")) {
if (!EG(current_execute_data) || !EG(current_execute_data)->called_scope) {
if (error) *error = estrdup("cannot access static:: when no class scope is active");
} else {
fcc->called_scope = EG(current_execute_data)->called_scope;
fcc->calling_scope = EG(current_execute_data)->called_scope;
- if (!fcc->object && Z_OBJ(EG(This))) {
- fcc->object = Z_OBJ(EG(This));
+ if (!fcc->object && Z_OBJ(EG(current_execute_data)->This)) {
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
}
*strict_class = 1;
ret = 1;
@@ -2960,13 +2868,13 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
}
scope = ex ? ex->func->common.scope : NULL;
fcc->calling_scope = ce;
- if (scope && !fcc->object && Z_OBJ(EG(This)) &&
- instanceof_function(Z_OBJCE(EG(This)), scope TSRMLS_CC) &&
+ if (scope && !fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This) &&
+ instanceof_function(Z_OBJCE(EG(current_execute_data)->This), scope TSRMLS_CC) &&
instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) {
- fcc->object = Z_OBJ(EG(This));
- fcc->called_scope = Z_OBJCE(EG(This));
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
+ fcc->called_scope = Z_OBJCE(EG(current_execute_data)->This);
} else {
- fcc->called_scope = fcc->object ? zend_get_class_entry(fcc->object TSRMLS_CC) : fcc->calling_scope;
+ fcc->called_scope = fcc->object ? fcc->object->ce : fcc->calling_scope;
}
*strict_class = 1;
ret = 1;
@@ -3003,7 +2911,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
/* Skip leading \ */
if (UNEXPECTED(Z_STRVAL_P(callable)[0] == '\\')) {
- STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRSIZE_P(callable) - 1, use_heap);
+ STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1, use_heap);
} else {
lmname = Z_STR_P(callable);
}
@@ -3016,9 +2924,9 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
return 1;
} else {
if (lmname == Z_STR_P(callable)) {
- STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRSIZE_P(callable), use_heap);
+ STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRLEN_P(callable), use_heap);
} else {
- STR_FORGET_HASH_VAL(lmname);
+ zend_string_forget_hash_val(lmname);
}
zend_str_tolower(lmname->val, lmname->len);
if ((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL) {
@@ -3032,13 +2940,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
}
/* Split name into class/namespace and method/function names */
- if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRSIZE_P(callable))) != NULL &&
+ if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRLEN_P(callable))) != NULL &&
colon > Z_STRVAL_P(callable) &&
*(colon-1) == ':'
) {
colon--;
clen = colon - Z_STRVAL_P(callable);
- mlen = Z_STRSIZE_P(callable) - clen - 2;
+ mlen = Z_STRLEN_P(callable) - clen - 2;
if (colon == Z_STRVAL_P(callable)) {
if (error) zend_spprintf(error, 0, "invalid function name");
@@ -3052,13 +2960,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
EG(scope) = ce_org;
}
- cname = STR_INIT(Z_STRVAL_P(callable), clen, 0);
+ cname = zend_string_init(Z_STRVAL_P(callable), clen, 0);
if (!zend_is_callable_check_class(cname, fcc, &strict_class, error TSRMLS_CC)) {
- STR_RELEASE(cname);
+ zend_string_release(cname);
EG(scope) = last_scope;
return 0;
}
- STR_RELEASE(cname);
+ zend_string_release(cname);
EG(scope) = last_scope;
ftable = &fcc->calling_scope->function_table;
@@ -3066,12 +2974,12 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ce_org->name->val, fcc->calling_scope->name->val);
return 0;
}
- mname = STR_INIT(Z_STRVAL_P(callable) + clen + 2, mlen, 0);
+ mname = zend_string_init(Z_STRVAL_P(callable) + clen + 2, mlen, 0);
} else if (ce_org) {
/* Try to fetch find static method of given class. */
- mlen = Z_STRSIZE_P(callable);
+ mlen = Z_STRLEN_P(callable);
mname = Z_STR_P(callable);
- STR_ADDREF(mname);
+ zend_string_addref(mname);
ftable = &ce_org->function_table;
fcc->calling_scope = ce_org;
} else {
@@ -3082,12 +2990,11 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
return 0;
}
- lmname = STR_ALLOC(mlen, 0);
+ lmname = zend_string_alloc(mlen, 0);
zend_str_tolower_copy(lmname->val, mname->val, mlen);
if (strict_class &&
fcc->calling_scope &&
- mlen == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1 &&
- !memcmp(lmname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
+ zend_string_equals_literal(lmname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
fcc->function_handler = fcc->calling_scope->constructor;
if (fcc->function_handler) {
retval = 1;
@@ -3110,7 +3017,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
((fcc->object && fcc->calling_scope->__call) ||
(!fcc->object && fcc->calling_scope->__callstatic)))) {
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- if (!zend_check_private(fcc->function_handler, fcc->object ? zend_get_class_entry(fcc->object TSRMLS_CC) : EG(scope), lmname TSRMLS_CC)) {
+ if (!zend_check_private(fcc->function_handler, fcc->object ? fcc->object->ce : EG(scope), lmname TSRMLS_CC)) {
retval = 0;
fcc->function_handler = NULL;
goto get_function_via_handler;
@@ -3136,7 +3043,7 @@ get_function_via_handler:
fcc->function_handler->internal_function.scope = ce_org;
fcc->function_handler->internal_function.fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
fcc->function_handler->internal_function.function_name = mname;
- STR_ADDREF(mname);
+ zend_string_addref(mname);
call_via_handler = 1;
retval = 1;
} else if (fcc->object->handlers->get_method) {
@@ -3147,7 +3054,7 @@ get_function_via_handler:
!instanceof_function(ce_org, fcc->function_handler->common.scope TSRMLS_CC))) {
if ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fcc->function_handler->common.function_name);
+ zend_string_release(fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -3166,10 +3073,9 @@ get_function_via_handler:
if (fcc->function_handler) {
retval = 1;
call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
- if (call_via_handler && !fcc->object && Z_OBJ(EG(This)) &&
- Z_OBJ_HT(EG(This))->get_class_entry &&
- instanceof_function(Z_OBJCE(EG(This)), fcc->calling_scope TSRMLS_CC)) {
- fcc->object = Z_OBJ(EG(This));
+ if (call_via_handler && !fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This) &&
+ instanceof_function(Z_OBJCE(EG(current_execute_data)->This), fcc->calling_scope TSRMLS_CC)) {
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
}
}
}
@@ -3198,15 +3104,15 @@ get_function_via_handler:
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
retval = 0;
}
- if (Z_OBJ(EG(This)) && instanceof_function(Z_OBJCE(EG(This)), fcc->calling_scope TSRMLS_CC)) {
- fcc->object = Z_OBJ(EG(This));
+ if (EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This) && instanceof_function(Z_OBJCE(EG(current_execute_data)->This), fcc->calling_scope TSRMLS_CC)) {
+ fcc->object = Z_OBJ(EG(current_execute_data)->This);
if (error) {
- zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(This))->name->val);
+ zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(current_execute_data)->This)->name->val);
if (severity == E_ERROR) {
retval = 0;
}
} else if (retval) {
- zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(This))->name->val);
+ zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(current_execute_data)->This)->name->val);
}
} else {
if (error) {
@@ -3221,7 +3127,7 @@ get_function_via_handler:
}
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- if (!zend_check_private(fcc->function_handler, fcc->object ? zend_get_class_entry(fcc->object TSRMLS_CC) : EG(scope), lmname TSRMLS_CC)) {
+ if (!zend_check_private(fcc->function_handler, fcc->object ? fcc->object->ce : EG(scope), lmname TSRMLS_CC)) {
if (error) {
if (*error) {
efree(*error);
@@ -3250,11 +3156,11 @@ get_function_via_handler:
if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname->val);
}
}
- STR_FREE(lmname);
- STR_RELEASE(mname);
+ zend_string_free(lmname);
+ zend_string_release(mname);
if (fcc->object) {
- fcc->called_scope = zend_get_class_entry(fcc->object TSRMLS_CC);
+ fcc->called_scope = fcc->object->ce;
}
if (retval) {
fcc->initialized = 1;
@@ -3295,20 +3201,20 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
case IS_STRING:
if (object) {
fcc->object = object;
- fcc->calling_scope = zend_get_class_entry(object TSRMLS_CC);
+ fcc->calling_scope = object->ce;
if (callable_name) {
char *ptr;
- *callable_name = STR_ALLOC(fcc->calling_scope->name->len + Z_STRSIZE_P(callable) + sizeof("::") - 1, 0);
+ *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(callable) + sizeof("::") - 1, 0);
ptr = (*callable_name)->val;
memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len);
ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_P(callable), Z_STRSIZE_P(callable) + 1);
+ memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1);
}
} else if (callable_name) {
- *callable_name = STR_COPY(Z_STR_P(callable));
+ *callable_name = zend_string_copy(Z_STR_P(callable));
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
fcc->called_scope = fcc->calling_scope;
@@ -3323,7 +3229,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fcc->function_handler->common.function_name);
+ zend_string_release(fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -3356,13 +3262,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
char *ptr;
- *callable_name = STR_ALLOC(Z_STRSIZE_P(obj) + Z_STRSIZE_P(method) + sizeof("::") - 1, 0);
+ *callable_name = zend_string_alloc(Z_STRLEN_P(obj) + Z_STRLEN_P(method) + sizeof("::") - 1, 0);
ptr = (*callable_name)->val;
- memcpy(ptr, Z_STRVAL_P(obj), Z_STRSIZE_P(obj));
- ptr += Z_STRSIZE_P(obj);
+ memcpy(ptr, Z_STRVAL_P(obj), Z_STRLEN_P(obj));
+ ptr += Z_STRLEN_P(obj);
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_P(method), Z_STRSIZE_P(method) + 1);
+ memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
@@ -3386,13 +3292,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
if (callable_name) {
char *ptr;
- *callable_name = STR_ALLOC(fcc->calling_scope->name->len + Z_STRSIZE_P(method) + sizeof("::") - 1, 0);
+ *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(method) + sizeof("::") - 1, 0);
ptr = (*callable_name)->val;
memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len);
ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_P(method), Z_STRSIZE_P(method) + 1);
+ memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
@@ -3411,7 +3317,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fcc->function_handler->common.function_name);
+ zend_string_release(fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -3430,7 +3336,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
if (error) zend_spprintf(error, 0, "array must have exactly two members");
}
if (callable_name) {
- *callable_name = STR_INIT("Array", sizeof("Array")-1, 0);
+ *callable_name = zend_string_init("Array", sizeof("Array")-1, 0);
}
}
return 0;
@@ -3441,7 +3347,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
if (callable_name) {
zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */
- *callable_name = STR_ALLOC(ce->name->len + sizeof("::__invoke") - 1, 0);
+ *callable_name = zend_string_alloc(ce->name->len + sizeof("::__invoke") - 1, 0);
memcpy((*callable_name)->val, ce->name->val, ce->name->len);
memcpy((*callable_name)->val + ce->name->len, "::__invoke", sizeof("::__invoke"));
}
@@ -3473,8 +3379,8 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_dtor(callable);
array_init(callable);
- add_next_index_str(callable, STR_COPY(fcc.calling_scope->name));
- add_next_index_str(callable, STR_COPY(fcc.function_handler->common.function_name));
+ add_next_index_str(callable, zend_string_copy(fcc.calling_scope->name));
+ add_next_index_str(callable, zend_string_copy(fcc.function_handler->common.function_name));
}
if (fcc.function_handler &&
((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
@@ -3482,7 +3388,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fcc.function_handler->common.function_name);
+ zend_string_release(fcc.function_handler->common.function_name);
}
efree(fcc.function_handler);
}
@@ -3515,7 +3421,7 @@ ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_i
ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) /* {{{ */
{
if (fci->params) {
- int i;
+ uint32_t i;
for (i = 0; i < fci->param_count; i++) {
zval_ptr_dtor(&fci->params[i]);
@@ -3549,7 +3455,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count
ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args TSRMLS_DC) /* {{{ */
{
zval *arg, *params;
- int n = 1;
+ uint32_t n = 1;
zend_fcall_info_args_clear(fci, !args);
@@ -3676,10 +3582,10 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
int name_len = strlen(module_name);
zend_module_entry *module;
- lname = STR_ALLOC(name_len, 0);
+ lname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lname->val, module_name, name_len);
module = zend_hash_find_ptr(&module_registry, lname);
- STR_FREE(lname);
+ zend_string_free(lname);
return module ? module->version : NULL;
}
/* }}} */
@@ -3747,7 +3653,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
}
break;
case ZEND_ACC_PUBLIC:
- property_info->name = STR_COPY(name);
+ property_info->name = zend_string_copy(name);
break;
}
@@ -3763,9 +3669,9 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */
{
- zend_string *key = STR_INIT(name, name_length, ce->type & ZEND_INTERNAL_CLASS);
+ zend_string *key = zend_string_init(name, name_length, ce->type & ZEND_INTERNAL_CLASS);
int ret = zend_declare_property_ex(ce, key, property, access_type, NULL TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
/* }}} */
@@ -3779,7 +3685,7 @@ ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name,
}
/* }}} */
-ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC) /* {{{ */
{
zval property;
@@ -3788,11 +3694,11 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name,
}
/* }}} */
-ZEND_API int zend_declare_property_int(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC) /* {{{ */
{
zval property;
- ZVAL_INT(&property, value);
+ ZVAL_LONG(&property, value);
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
@@ -3810,16 +3716,16 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name
{
zval property;
- ZVAL_NEW_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS));
+ ZVAL_NEW_STR(&property, zend_string_init(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS));
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
-ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, size_t value_len, int access_type TSRMLS_DC) /* {{{ */
{
zval property;
- ZVAL_NEW_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS));
+ ZVAL_NEW_STR(&property, zend_string_init(value, value_len, ce->type & ZEND_INTERNAL_CLASS));
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
@@ -3843,11 +3749,11 @@ ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *
}
/* }}} */
-ZEND_API int zend_declare_class_constant_int(zend_class_entry *ce, const char *name, size_t name_length, zend_int_t value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value TSRMLS_DC) /* {{{ */
{
zval constant;
- ZVAL_INT(&constant, value);
+ ZVAL_LONG(&constant, value);
return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
@@ -3874,7 +3780,7 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha
{
zval constant;
- ZVAL_NEW_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS));
+ ZVAL_NEW_STR(&constant, zend_string_init(value, value_length, ce->type & ZEND_INTERNAL_CLASS));
return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
@@ -3893,8 +3799,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->write_property) {
- zend_string *class_name = zend_get_object_classname(Z_OBJ_P(object) TSRMLS_CC);
- zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name->val);
+ zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, Z_OBJCE_P(object)->name->val);
}
ZVAL_STRINGL(&property, name, name_length);
Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL TSRMLS_CC);
@@ -3913,7 +3818,7 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
}
/* }}} */
-ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */
{
zval tmp;
@@ -3922,11 +3827,11 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c
}
/* }}} */
-ZEND_API void zend_update_property_int(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */
{
zval tmp;
- ZVAL_INT(&tmp, value);
+ ZVAL_LONG(&tmp, value);
zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
@@ -3959,7 +3864,7 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object,
}
/* }}} */
-ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, size_t value_len TSRMLS_DC) /* {{{ */
{
zval tmp;
@@ -3973,12 +3878,12 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
{
zval *property;
zend_class_entry *old_scope = EG(scope);
- zend_string *key = STR_INIT(name, name_length, 0);
+ zend_string *key = zend_string_init(name, name_length, 0);
EG(scope) = scope;
property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC);
EG(scope) = old_scope;
- STR_FREE(key);
+ zend_string_free(key);
if (!property) {
return FAILURE;
} else {
@@ -3993,9 +3898,11 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
zval garbage;
ZVAL_COPY_VALUE(&garbage, property);
- Z_ADDREF_P(value);
- if (Z_ISREF_P(value)) {
- SEPARATE_ZVAL(value);
+ if (Z_REFCOUNTED_P(value)) {
+ Z_ADDREF_P(value);
+ if (Z_ISREF_P(value)) {
+ SEPARATE_ZVAL(value);
+ }
}
ZVAL_COPY_VALUE(property, value);
zval_ptr_dtor(&garbage);
@@ -4015,7 +3922,7 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const cha
}
/* }}} */
-ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */
{
zval tmp;
@@ -4024,11 +3931,11 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha
}
/* }}} */
-ZEND_API int zend_update_static_property_int(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */
{
zval tmp;
- ZVAL_INT(&tmp, value);
+ ZVAL_LONG(&tmp, value);
return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
@@ -4052,7 +3959,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const c
}
/* }}} */
-ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, size_t value_len TSRMLS_DC) /* {{{ */
{
zval tmp;
@@ -4071,8 +3978,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->read_property) {
- zend_string *class_name = zend_get_object_classname(Z_OBJ_P(object) TSRMLS_CC);
- zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name->val);
+ zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, Z_OBJCE_P(object)->name->val);
}
ZVAL_STRINGL(&property, name, name_length);
@@ -4088,12 +3994,12 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *na
{
zval *property;
zend_class_entry *old_scope = EG(scope);
- zend_string *key = STR_INIT(name, name_length, 0);
+ zend_string *key = zend_string_init(name, name_length, 0);
EG(scope) = scope;
property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC);
EG(scope) = old_scope;
- STR_FREE(key);
+ zend_string_free(key);
return property;
}
@@ -4132,10 +4038,10 @@ static int same_zval(zval *zv1, zval *zv2) /* {{{ */
case IS_FALSE:
case IS_TRUE:
return 1;
- case IS_INT:
- return Z_IVAL_P(zv1) == Z_IVAL_P(zv2);
+ case IS_LONG:
+ return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_DOUBLE:
- return Z_IVAL_P(zv1) == Z_IVAL_P(zv2);
+ return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_STRING:
case IS_ARRAY:
case IS_OBJECT:
@@ -4212,6 +4118,39 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
}
/* }}} */
+ZEND_API void zend_ctor_make_null(zend_execute_data *execute_data) /* {{{ */
+{
+ if (EX(return_value)) {
+/*
+ if (Z_TYPE_P(EX(return_value)) == IS_OBJECT) {
+ zend_object *object = Z_OBJ_P(EX(return_value));
+ zend_execute_data *ex = EX(prev_execute_data);
+
+ while (ex && Z_OBJ(ex->This) == object) {
+ if (ex->func) {
+ if (ZEND_USER_CODE(ex->func->type)) {
+ if (ex->func->op_array.this_var != -1) {
+ zval *this_var = EX_VAR_2(ex, ex->func->op_array.this_var);
+ if (this_var != EX(return_value)) {
+ zval_ptr_dtor(this_var);
+ ZVAL_NULL(this_var);
+ }
+ }
+ }
+ }
+ Z_OBJ(ex->This) = NULL;
+ ZVAL_NULL(&ex->This);
+ ex = ex->prev_execute_data;
+ }
+ }
+*/
+ zval_ptr_dtor(EX(return_value));
+ Z_OBJ_P(EX(return_value)) = NULL;
+ ZVAL_NULL(EX(return_value));
+ }
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 7f61431e2f..b2faf7e253 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -36,8 +36,8 @@ typedef struct _zend_function_entry {
const char *fname;
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
const struct _zend_arg_info *arg_info;
- zend_uint num_args;
- zend_uint flags;
+ uint32_t num_args;
+ uint32_t flags;
} zend_function_entry;
typedef struct _zend_fcall_info {
@@ -46,10 +46,10 @@ typedef struct _zend_fcall_info {
zval function_name;
zend_array *symbol_table;
zval *retval;
- zend_uint param_count;
zval *params;
zend_object *object;
zend_bool no_separation;
+ uint32_t param_count;
} zend_fcall_info;
typedef struct _zend_fcall_info_cache {
@@ -68,9 +68,9 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
#define ZEND_METHOD(classname, name) ZEND_NAMED_FUNCTION(ZEND_MN(classname##_##name))
-#define ZEND_FENTRY(zend_name, name, arg_info, flags) { #zend_name, name, arg_info, (zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
+#define ZEND_FENTRY(zend_name, name, arg_info, flags) { #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
-#define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags) { zend_name, name, arg_info, (zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
+#define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
#define ZEND_RAW_NAMED_FE(zend_name, name, arg_info) ZEND_RAW_FENTRY(#zend_name, name, arg_info, 0)
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_FENTRY(zend_name, name, arg_info, 0)
@@ -171,7 +171,7 @@ typedef struct _zend_fcall_info_cache {
#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
{ \
zend_string *cl_name; \
- cl_name = STR_INIT(class_name, class_name_len, 1); \
+ cl_name = zend_string_init(class_name, class_name_len, 1); \
class_container.name = zend_new_interned_string(cl_name TSRMLS_CC); \
INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
}
@@ -229,7 +229,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_FCI_INITIALIZED(fci) ((fci).size != 0)
-int zend_next_free_module(void);
+ZEND_API int zend_next_free_module(void);
BEGIN_EXTERN_C()
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
@@ -303,15 +303,15 @@ ZEND_API int zend_get_module_started(const char *module_name);
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment TSRMLS_DC);
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_int(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, size_t value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC);
-ZEND_API int zend_declare_class_constant_int(zend_class_entry *ce, const char *name, size_t name_length, zend_int_t value TSRMLS_DC);
+ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC);
@@ -320,35 +320,34 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC);
-ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC);
-ZEND_API void zend_update_property_int(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC);
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC);
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC);
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC);
ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_string *value TSRMLS_DC);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC);
-ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, size_t value_length TSRMLS_DC);
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC);
-ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC);
-ZEND_API int zend_update_static_property_int(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC);
+ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC);
+ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC);
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC);
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC);
-ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
+ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, size_t value_length TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC);
-ZEND_API zend_class_entry *zend_get_class_entry(const zend_object *object TSRMLS_DC);
-ZEND_API zend_string *zend_get_object_classname(const zend_object *object TSRMLS_DC);
ZEND_API char *zend_get_type_by_const(int type);
-#define getThis() (Z_OBJ(EG(This)) ? &EG(This) : NULL)
+#define getThis() (Z_OBJ(EX(This)) ? &EX(This) : NULL)
+#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
-#define ARG_COUNT(dummy) (param_count)
-#define ZEND_NUM_ARGS() (param_count)
+#define ARG_COUNT(dummy) EX(num_args)
+#define ZEND_NUM_ARGS() EX(num_args)
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
@@ -374,17 +373,17 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC);
/* no longer supported */
ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
-ZEND_API int add_assoc_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n);
+ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, zend_long n);
ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len);
ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r);
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_string *str);
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str);
-ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length);
+ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, size_t length);
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
-#define add_assoc_int(__arg, __key, __n) add_assoc_int_ex(__arg, __key, strlen(__key), __n)
+#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n)
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key))
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key), __b)
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r)
@@ -400,51 +399,51 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
#define add_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
-ZEND_API int add_index_int(zval *arg, zend_uint_t idx, zend_int_t n);
-ZEND_API int add_index_null(zval *arg, zend_uint_t idx);
-ZEND_API int add_index_bool(zval *arg, zend_uint_t idx, int b);
-ZEND_API int add_index_resource(zval *arg, zend_uint_t idx, zend_resource *r);
-ZEND_API int add_index_double(zval *arg, zend_uint_t idx, double d);
-ZEND_API int add_index_str(zval *arg, zend_uint_t idx, zend_string *str);
-ZEND_API int add_index_string(zval *arg, zend_uint_t idx, const char *str);
-ZEND_API int add_index_stringl(zval *arg, zend_uint_t idx, const char *str, uint length);
-ZEND_API int add_index_zval(zval *arg, zend_uint_t index, zval *value);
-
-ZEND_API int add_next_index_int(zval *arg, zend_int_t n);
+ZEND_API int add_index_long(zval *arg, zend_ulong idx, zend_long n);
+ZEND_API int add_index_null(zval *arg, zend_ulong idx);
+ZEND_API int add_index_bool(zval *arg, zend_ulong idx, int b);
+ZEND_API int add_index_resource(zval *arg, zend_ulong idx, zend_resource *r);
+ZEND_API int add_index_double(zval *arg, zend_ulong idx, double d);
+ZEND_API int add_index_str(zval *arg, zend_ulong idx, zend_string *str);
+ZEND_API int add_index_string(zval *arg, zend_ulong idx, const char *str);
+ZEND_API int add_index_stringl(zval *arg, zend_ulong idx, const char *str, size_t length);
+ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value);
+
+ZEND_API int add_next_index_long(zval *arg, zend_long n);
ZEND_API int add_next_index_null(zval *arg);
ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, zend_resource *r);
ZEND_API int add_next_index_double(zval *arg, double d);
ZEND_API int add_next_index_str(zval *arg, zend_string *str);
ZEND_API int add_next_index_string(zval *arg, const char *str);
-ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length);
+ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length);
ZEND_API int add_next_index_zval(zval *arg, zval *value);
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str);
-ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length);
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, size_t length);
#define add_get_assoc_string(__arg, __key, __str) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str)
#define add_get_assoc_stringl(__arg, __key, __str, __length) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
-ZEND_API zval *add_get_index_int(zval *arg, zend_uint_t idx, zend_int_t l);
-ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t idx, double d);
-ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str);
-ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t idx, const char *str);
-ZEND_API zval *add_get_index_stringl(zval *arg, zend_uint_t idx, const char *str, uint length);
+ZEND_API zval *add_get_index_long(zval *arg, zend_ulong idx, zend_long l);
+ZEND_API zval *add_get_index_double(zval *arg, zend_ulong idx, double d);
+ZEND_API zval *add_get_index_str(zval *arg, zend_ulong index, zend_string *str);
+ZEND_API zval *add_get_index_string(zval *arg, zend_ulong idx, const char *str);
+ZEND_API zval *add_get_index_stringl(zval *arg, zend_ulong idx, const char *str, size_t length);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC);
-ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_int_t l TSRMLS_DC);
+ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, zend_long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC);
-ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_int_t b TSRMLS_DC);
+ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_long b TSRMLS_DC);
ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
ZEND_API int add_property_str_ex(zval *arg, const char *key, uint key_len, zend_string *str TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC);
-ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC);
+ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, size_t length TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
-#define add_property_int(__arg, __key, __n) add_property_int_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
+#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) TSRMLS_CC)
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
@@ -455,8 +454,8 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
-ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[] TSRMLS_DC);
-ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC);
+ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[] TSRMLS_DC);
+ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC);
ZEND_API extern const zend_fcall_info empty_fcall_info;
ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
@@ -531,6 +530,8 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int
ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name);
ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
+ZEND_API void zend_ctor_make_null(zend_execute_data *execute_data);
+
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
ZEND_API ZEND_FUNCTION(display_disabled_function);
@@ -547,11 +548,11 @@ END_EXTERN_C()
#define CHECK_ZVAL_STRING_REL(z)
#endif
-#define CHECK_ZVAL_NULL_PATH(p) (Z_STRSIZE_P(p) != strlen(Z_STRVAL_P(p)))
+#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p)))
#define CHECK_NULL_PATH(p, l) (strlen(p) != l)
#define ZVAL_STRINGL(z, s, l) do { \
- ZVAL_NEW_STR(z, STR_INIT(s, l, 0)); \
+ ZVAL_NEW_STR(z, zend_string_init(s, l, 0)); \
} while (0)
#define ZVAL_STRING(z, s) do { \
@@ -560,11 +561,11 @@ END_EXTERN_C()
} while (0)
#define ZVAL_EMPTY_STRING(z) do { \
- ZVAL_INT_STR(z, STR_EMPTY_ALLOC()); \
+ ZVAL_INTERNED_STR(z, STR_EMPTY_ALLOC()); \
} while (0)
#define ZVAL_PSTRINGL(z, s, l) do { \
- ZVAL_NEW_STR(z, STR_INIT(s, l, 1)); \
+ ZVAL_NEW_STR(z, zend_string_init(s, l, 1)); \
} while (0)
#define ZVAL_PSTRING(z, s) do { \
@@ -598,10 +599,10 @@ END_EXTERN_C()
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
#define RETVAL_NULL() ZVAL_NULL(return_value)
-#define RETVAL_INT(l) ZVAL_INT(return_value, l)
+#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
#define RETVAL_STR(s) ZVAL_STR(return_value, s)
-#define RETVAL_INT_STR(s) ZVAL_INT_STR(return_value, s)
+#define RETVAL_LONG_STR(s) ZVAL_INTERNED_STR(return_value, s)
#define RETVAL_NEW_STR(s) ZVAL_NEW_STR(return_value, s)
#define RETVAL_STRING(s) ZVAL_STRING(return_value, s)
#define RETVAL_STRINGL(s, l) ZVAL_STRINGL(return_value, s, l)
@@ -614,10 +615,10 @@ END_EXTERN_C()
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
#define RETURN_NULL() { RETVAL_NULL(); return;}
-#define RETURN_INT(l) { RETVAL_INT(l); return; }
+#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
#define RETURN_STR(s) { RETVAL_STR(s); return; }
-#define RETURN_INT_STR(s) { RETVAL_INT_STR(s); return; }
+#define RETURN_LONG_STR(s) { RETVAL_LONG_STR(s); return; }
#define RETURN_NEW_STR(s) { RETVAL_NEW_STR(s); return; }
#define RETURN_STRING(s) { RETVAL_STRING(s); return; }
#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; }
@@ -639,26 +640,8 @@ END_EXTERN_C()
} while (0)
/* May be used in internal constructors to make them return NULL */
-#if 1 // support for directly called constructors only ???
-#define ZEND_CTOR_MAKE_NULL() do { \
- if (EG(current_execute_data)->return_value) { \
- zval_ptr_dtor(EG(current_execute_data)->return_value); \
- ZVAL_NULL(EG(current_execute_data)->return_value); \
- } \
- } while (0)
-#else // attempt to support calls to parent::__construct() ???
- // see: ext/date/tests/bug67118.phpt
-#define ZEND_CTOR_MAKE_NULL() do { \
- if (EG(current_execute_data)->return_value) { \
- zval_ptr_dtor(EG(current_execute_data)->return_value); \
- ZVAL_NULL(EG(current_execute_data)->return_value); \
- } else if (EG(current_execute_data)->prev_execute_data && \
- EG(current_execute_data)->prev_execute_data->object == \
- EG(current_execute_data)->object) { \
- EG(current_execute_data)->prev_execute_data->object = NULL; \
- } \
- } while (0)
-#endif
+#define ZEND_CTOR_MAKE_NULL() \
+ zend_ctor_make_null(execute_data)
#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; }
@@ -729,7 +712,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
const int _flags = (flags); \
int _min_num_args = (min_num_args); \
int _max_num_args = (max_num_args); \
- int _num_args = EG(current_execute_data)->num_args; \
+ int _num_args = EX(num_args); \
int _i; \
zval *_real_arg, *_arg = NULL; \
zend_expected_type _expected_type = IS_UNDEF; \
@@ -756,7 +739,7 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
break; \
} \
_i = 0; \
- _real_arg = ZEND_CALL_ARG(EG(current_execute_data), 0);
+ _real_arg = ZEND_CALL_ARG(execute_data, 0);
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args) \
ZEND_PARSE_PARAMETERS_START_EX(0, min_num_args, max_num_args)
@@ -899,28 +882,28 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec
Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, 0, 0)
/* old "l" */
-#define Z_PARAM_INT_EX(dest, is_null, check_null, separate) \
+#define Z_PARAM_LONG_EX(dest, is_null, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
- if (UNEXPECTED(!_z_param_int(_arg, &dest, &is_null, check_null, 0))) { \
+ if (UNEXPECTED(!_z_param_long(_arg, &dest, &is_null, check_null, 0))) { \
_expected_type = Z_EXPECTED_LONG; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
}
-#define Z_PARAM_INT(dest) \
- Z_PARAM_INT_EX(dest, _dummy, 0, 0)
+#define Z_PARAM_LONG(dest) \
+ Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
/* old "L" */
-#define Z_PARAM_STRICT_INT_EX(dest, is_null, check_null, separate) \
+#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) \
Z_PARAM_PROLOGUE(separate); \
- if (UNEXPECTED(!_z_param_int(_arg, &dest, &is_null, check_null, 1))) { \
+ if (UNEXPECTED(!_z_param_long(_arg, &dest, &is_null, check_null, 1))) { \
_expected_type = Z_EXPECTED_LONG; \
error_code = ZPP_ERROR_WRONG_ARG; \
break; \
}
-#define Z_PARAM_STRICT_INT(dest) \
- Z_PARAM_STRICT_INT_EX(dest, _dummy, 0, 0)
+#define Z_PARAM_STRICT_LONG(dest) \
+ Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
/* old "o" */
#define Z_PARAM_OBJECT_EX(dest, check_null, separate) \
@@ -1073,33 +1056,33 @@ static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_boo
return 1;
}
-static zend_always_inline int _z_param_int(zval *arg, zend_int_t *dest, zend_bool *is_null, int check_null, int strict)
+static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null, int strict)
{
if (check_null) {
*is_null = 0;
}
- if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) {
- *dest = Z_IVAL_P(arg);
+ if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
+ *dest = Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
- if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) {
- *dest = ZEND_INT_MAX;
- } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) {
- *dest = ZEND_INT_MIN;
+ if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) {
+ *dest = ZEND_LONG_MAX;
+ } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) {
+ *dest = ZEND_LONG_MIN;
} else {
- *dest = zend_dval_to_ival(Z_DVAL_P(arg));
+ *dest = zend_dval_to_lval(Z_DVAL_P(arg));
}
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
double d;
int type;
- if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_INT)) {
+ if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
if (EXPECTED(type != 0)) {
- if (strict && UNEXPECTED(d > ZEND_INT_MAX)) {
- *dest = ZEND_INT_MAX;
- } else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) {
- *dest = ZEND_INT_MIN;
+ if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) {
+ *dest = ZEND_LONG_MAX;
+ } else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) {
+ *dest = ZEND_LONG_MIN;
} else {
- *dest = zend_dval_to_ival(d);
+ *dest = zend_dval_to_lval(d);
}
} else {
return 0;
@@ -1125,10 +1108,10 @@ static zend_always_inline int _z_param_double(zval *arg, double *dest, zend_bool
}
if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
*dest = Z_DVAL_P(arg);
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) {
- *dest = (double)Z_IVAL_P(arg);
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
+ *dest = (double)Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
- zend_int_t l;
+ zend_long l;
int type;
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) {
@@ -1173,7 +1156,7 @@ static zend_always_inline int _z_param_str(zval *arg, zend_string **dest, int ch
return 1;
}
-static zend_always_inline int _z_param_string(zval *arg, char **dest, int *dest_len, int check_null TSRMLS_DC)
+static zend_always_inline int _z_param_string(zval *arg, char **dest, size_t *dest_len, int check_null TSRMLS_DC)
{
zend_string *str;
@@ -1193,14 +1176,14 @@ static zend_always_inline int _z_param_string(zval *arg, char **dest, int *dest_
static zend_always_inline int _z_param_path_str(zval *arg, zend_string **dest, int check_null TSRMLS_DC)
{
if (!_z_param_str(arg, dest, check_null TSRMLS_CC) ||
- (check_null && UNEXPECTED(!(*dest)->val)) ||
+ (check_null && UNEXPECTED(!(*dest)->val[0])) ||
UNEXPECTED(CHECK_NULL_PATH((*dest)->val, (*dest)->len))) {
return 0;
}
return 1;
}
-static zend_always_inline int _z_param_path(zval *arg, char **dest, int *dest_len, int check_null TSRMLS_DC)
+static zend_always_inline int _z_param_path(zval *arg, char **dest, size_t *dest_len, int check_null TSRMLS_DC)
{
zend_string *str;
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 195235ffd9..bae723f278 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -20,10 +20,44 @@
/* $Id$ */
+/*
+ * zend_alloc is designed to be a modern CPU cache friendly memory manager
+ * for PHP. Most ideas are taken from jemalloc and tcmalloc implementations.
+ *
+ * All allocations are split into 3 categories:
+ *
+ * Huge - the size is greater than CHUNK size (~2M by default), allocation is
+ * performed using mmap(). The result is aligned on 2M boundary.
+ *
+ * Large - a number of 4096K pages inside a CHUNK. Large blocks
+ * are always alligned on page boundary.
+ *
+ * Small - less than 3/4 of page size. Small sizes are rounded up to nearest
+ * greater predefined small size (there are 30 predefined sizes:
+ * 8, 16, 24, 32, ... 3072). Small blocks are allocated from
+ * RUNs. Each RUN is allocated as a single or few following pages.
+ * Allocation inside RUNs implemented using linked list of free
+ * elements. The result is aligned to 8 bytes.
+ *
+ * zend_alloc allocates memory from OS by CHUNKs, these CHUNKs and huge memory
+ * blocks are always aligned to CHUNK boundary. So it's very easy to determine
+ * the CHUNK owning the certain pointer. Regular CHUNKs reserve a single
+ * page at start for special purpose. It contains bitset of free pages,
+ * few bitset for available runs of predefined small sizes, map of pages that
+ * keeps information about usage of each page in this CHUNK, etc.
+ *
+ * zend_alloc provides familiar emalloc/efree/erealloc API, but in addition it
+ * provides specialized and optimized routines to allocate blocks of predefined
+ * sizes (e.g. emalloc_2(), emallc_4(), ..., emalloc_large(), etc)
+ * The library uses C preprocessor tricks that substitute calls to emalloc()
+ * with more specialized routines when the requested size is known.
+ */
+
#include "zend.h"
#include "zend_alloc.h"
#include "zend_globals.h"
#include "zend_operators.h"
+#include "zend_multiply.h"
#ifdef HAVE_SIGNAL_H
# include <signal.h>
@@ -37,71 +71,9 @@
# include <process.h>
#endif
-#ifndef ZEND_MM_HEAP_PROTECTION
-# define ZEND_MM_HEAP_PROTECTION ZEND_DEBUG
-#endif
-
-#ifndef ZEND_MM_SAFE_UNLINKING
-# define ZEND_MM_SAFE_UNLINKING 1
-#endif
-
-#ifndef ZEND_MM_COOKIES
-# define ZEND_MM_COOKIES ZEND_DEBUG
-#endif
-
-#ifdef _WIN64
-# define PTR_FMT "0x%0.16I64x"
-/*
-#elif sizeof(long) == 8
-# define PTR_FMT "0x%0.16lx"
-*/
-#else
-# define PTR_FMT "0x%0.8lx"
-#endif
-
-#if ZEND_DEBUG
-void zend_debug_alloc_output(char *format, ...)
-{
- char output_buf[256];
- va_list args;
-
- va_start(args, format);
- vsprintf(output_buf, format, args);
- va_end(args);
-
-#ifdef ZEND_WIN32
- OutputDebugString(output_buf);
-#else
- fprintf(stderr, "%s", output_buf);
-#endif
-}
-#endif
-
-#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
-static void zend_mm_panic(const char *message) __attribute__ ((noreturn));
-#endif
-
-static void zend_mm_panic(const char *message)
-{
- fprintf(stderr, "%s\n", message);
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
-#endif
-#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
- kill(getpid(), SIGSEGV);
-#endif
- exit(1);
-}
-
-/*******************/
-/* Storage Manager */
-/*******************/
-
-#ifdef ZEND_WIN32
-# define HAVE_MEM_WIN32 /* use VirtualAlloc() to allocate memory */
-#endif
-#define HAVE_MEM_MALLOC /* use malloc() to allocate segments */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -111,7 +83,7 @@ static void zend_mm_panic(const char *message)
#include <fcntl.h>
#include <errno.h>
-#if defined(HAVE_MEM_MMAP_ANON) || defined(HAVE_MEM_MMAP_ZERO)
+#ifndef _WIN32
# ifdef HAVE_MREMAP
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
@@ -132,2281 +104,1960 @@ static void zend_mm_panic(const char *message)
# ifndef MAP_FAILED
# define MAP_FAILED ((void*)-1)
# endif
+# ifndef MAP_POPULATE
+# define MAP_POPULATE 0
+#endif
#endif
-static zend_mm_storage* zend_mm_mem_dummy_init(void *params)
-{
- return malloc(sizeof(zend_mm_storage));
-}
-
-static void zend_mm_mem_dummy_dtor(zend_mm_storage *storage)
-{
- free(storage);
-}
-
-static void zend_mm_mem_dummy_compact(zend_mm_storage *storage)
-{
-}
-
-#if defined(HAVE_MEM_MMAP_ANON) || defined(HAVE_MEM_MMAP_ZERO)
-
-static zend_mm_segment* zend_mm_mem_mmap_realloc(zend_mm_storage *storage, zend_mm_segment* segment, size_t size)
-{
- zend_mm_segment *ret;
-#ifdef HAVE_MREMAP
-#if defined(__NetBSD__)
- /* NetBSD 5 supports mremap but takes an extra newp argument */
- ret = (zend_mm_segment*)mremap(segment, segment->size, segment, size, MREMAP_MAYMOVE);
-#else
- ret = (zend_mm_segment*)mremap(segment, segment->size, size, MREMAP_MAYMOVE);
+#ifndef ZEND_MM_STAT
+# define ZEND_MM_STAT 1 /* track current and peak memory usage */
#endif
- if (ret == MAP_FAILED) {
+#ifndef ZEND_MM_LIMIT
+# define ZEND_MM_LIMIT 1 /* support for user-defined memory limit */
#endif
- ret = storage->handlers->_alloc(storage, size);
- if (ret) {
- memcpy(ret, segment, size > segment->size ? segment->size : size);
- storage->handlers->_free(storage, segment);
- }
-#ifdef HAVE_MREMAP
- }
+#ifndef ZEND_MM_CUSTOM
+# define ZEND_MM_CUSTOM 1 /* support for custom memory allocator */
+ /* USE_ZEND_ALLOC=0 may switch to system malloc() */
#endif
- return ret;
-}
-
-static void zend_mm_mem_mmap_free(zend_mm_storage *storage, zend_mm_segment* segment)
-{
- munmap((void*)segment, segment->size);
-}
-
+#ifndef ZEND_MM_STORAGE
+# define ZEND_MM_STORAGE 1 /* support for custom memory storage */
#endif
-
-#ifdef HAVE_MEM_MMAP_ANON
-
-static zend_mm_segment* zend_mm_mem_mmap_anon_alloc(zend_mm_storage *storage, size_t size)
-{
- zend_mm_segment *ret = (zend_mm_segment*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
- if (ret == MAP_FAILED) {
- ret = NULL;
- }
- return ret;
-}
-
-# define ZEND_MM_MEM_MMAP_ANON_DSC {"mmap_anon", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_mmap_anon_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free}
-
+#ifndef ZEND_MM_ERROR
+# define ZEND_MM_ERROR 1 /* report system errors */
#endif
-#ifdef HAVE_MEM_MMAP_ZERO
-
-static int zend_mm_dev_zero_fd = -1;
-
-static zend_mm_storage* zend_mm_mem_mmap_zero_init(void *params)
-{
- if (zend_mm_dev_zero_fd == -1) {
- zend_mm_dev_zero_fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
- }
- if (zend_mm_dev_zero_fd >= 0) {
- return malloc(sizeof(zend_mm_storage));
- } else {
- return NULL;
- }
-}
-
-static void zend_mm_mem_mmap_zero_dtor(zend_mm_storage *storage)
-{
- close(zend_mm_dev_zero_fd);
- free(storage);
-}
-
-static zend_mm_segment* zend_mm_mem_mmap_zero_alloc(zend_mm_storage *storage, size_t size)
-{
- zend_mm_segment *ret = (zend_mm_segment*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, zend_mm_dev_zero_fd, 0);
- if (ret == MAP_FAILED) {
- ret = NULL;
- }
- return ret;
-}
-
-# define ZEND_MM_MEM_MMAP_ZERO_DSC {"mmap_zero", zend_mm_mem_mmap_zero_init, zend_mm_mem_mmap_zero_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_mmap_zero_alloc, zend_mm_mem_mmap_realloc, zend_mm_mem_mmap_free}
-
+#ifndef ZEND_MM_CHECK
+# define ZEND_MM_CHECK(condition, message) do { \
+ if (UNEXPECTED(!(condition))) { \
+ zend_mm_panic(message); \
+ } \
+ } while (0)
#endif
-#ifdef HAVE_MEM_WIN32
-
-static zend_mm_storage* zend_mm_mem_win32_init(void *params)
-{
- HANDLE heap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
- zend_mm_storage* storage;
-
- if (heap == NULL) {
- return NULL;
- }
- storage = (zend_mm_storage*)malloc(sizeof(zend_mm_storage));
- if (storage == NULL) {
- HeapDestroy(heap);
- return NULL;
- }
- storage->data = (void*) heap;
- return storage;
-}
+typedef uint32_t zend_mm_page_info; /* 4-byte integer */
+typedef zend_ulong zend_mm_bitset; /* 4-byte or 8-byte integer */
-static void zend_mm_mem_win32_dtor(zend_mm_storage *storage)
-{
- HeapDestroy((HANDLE)storage->data);
- free(storage);
-}
+#define ZEND_MM_ALIGNED_OFFSET(size, alignment) \
+ (((size_t)(size)) & ((alignment) - 1))
+#define ZEND_MM_ALIGNED_BASE(size, alignment) \
+ (((size_t)(size)) & ~((alignment) - 1))
+#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment) \
+ (((size_t)(size) + ((alignment) - 1)) & ~((alignment) - 1))
+#define ZEND_MM_SIZE_TO_NUM(size, alignment) \
+ (((size_t)(size) + ((alignment) - 1)) / (alignment))
-static void zend_mm_mem_win32_compact(zend_mm_storage *storage)
-{
- HeapDestroy((HANDLE)storage->data);
- storage->data = (void*)HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
-}
+#define ZEND_MM_BITSET_LEN (sizeof(zend_mm_bitset) * 8) /* 32 or 64 */
+#define ZEND_MM_PAGE_MAP_LEN (ZEND_MM_PAGES / ZEND_MM_BITSET_LEN) /* 16 or 8 */
-static zend_mm_segment* zend_mm_mem_win32_alloc(zend_mm_storage *storage, size_t size)
-{
- return (zend_mm_segment*) HeapAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, size);
-}
+typedef zend_mm_bitset zend_mm_page_map[ZEND_MM_PAGE_MAP_LEN]; /* 64B */
-static void zend_mm_mem_win32_free(zend_mm_storage *storage, zend_mm_segment* segment)
-{
- HeapFree((HANDLE)storage->data, HEAP_NO_SERIALIZE, segment);
-}
+#define ZEND_MM_IS_FRUN 0x00000000
+#define ZEND_MM_IS_LRUN 0x40000000
+#define ZEND_MM_IS_SRUN 0x80000000
-static zend_mm_segment* zend_mm_mem_win32_realloc(zend_mm_storage *storage, zend_mm_segment* segment, size_t size)
-{
- return (zend_mm_segment*) HeapReAlloc((HANDLE)storage->data, HEAP_NO_SERIALIZE, segment, size);
-}
+#define ZEND_MM_LRUN_PAGES_MASK 0x000003ff
+#define ZEND_MM_LRUN_PAGES_OFFSET 0
-# define ZEND_MM_MEM_WIN32_DSC {"win32", zend_mm_mem_win32_init, zend_mm_mem_win32_dtor, zend_mm_mem_win32_compact, zend_mm_mem_win32_alloc, zend_mm_mem_win32_realloc, zend_mm_mem_win32_free}
+#define ZEND_MM_SRUN_BIN_NUM_MASK 0x0000001f
+#define ZEND_MM_SRUN_BIN_NUM_OFFSET 0
-#endif
+#define ZEND_MM_LRUN_PAGES(info) (((info) & ZEND_MM_LRUN_PAGES_MASK) >> ZEND_MM_LRUN_PAGES_OFFSET)
+#define ZEND_MM_SRUN_BIN_NUM(info) (((info) & ZEND_MM_SRUN_BIN_NUM_MASK) >> ZEND_MM_SRUN_BIN_NUM_OFFSET)
-#ifdef HAVE_MEM_MALLOC
+#define ZEND_MM_FRUN() ZEND_MM_IS_FRUN
+#define ZEND_MM_LRUN(count) (ZEND_MM_IS_LRUN | ((count) << ZEND_MM_LRUN_PAGES_OFFSET))
+#define ZEND_MM_SRUN(bin_num) (ZEND_MM_IS_SRUN | ((bin_num) << ZEND_MM_SRUN_BIN_NUM_OFFSET))
-static zend_mm_segment* zend_mm_mem_malloc_alloc(zend_mm_storage *storage, size_t size)
-{
- return (zend_mm_segment*)malloc(size);
-}
+#define ZEND_MM_BINS 30
-static zend_mm_segment* zend_mm_mem_malloc_realloc(zend_mm_storage *storage, zend_mm_segment *ptr, size_t size)
-{
- return (zend_mm_segment*)realloc(ptr, size);
-}
+typedef struct _zend_mm_page zend_mm_page;
+typedef struct _zend_mm_bin zend_mm_bin;
+typedef struct _zend_mm_free_slot zend_mm_free_slot;
+typedef struct _zend_mm_chunk zend_mm_chunk;
+typedef struct _zend_mm_huge_list zend_mm_huge_list;
-static void zend_mm_mem_malloc_free(zend_mm_storage *storage, zend_mm_segment *ptr)
-{
- free(ptr);
-}
+#ifdef _WIN64
+# define PTR_FMT "0x%0.16I64x"
+#elif SIZEOF_LONG == 8
+# define PTR_FMT "0x%0.16lx"
+#else
+# define PTR_FMT "0x%0.8lx"
+#endif
-# define ZEND_MM_MEM_MALLOC_DSC {"malloc", zend_mm_mem_dummy_init, zend_mm_mem_dummy_dtor, zend_mm_mem_dummy_compact, zend_mm_mem_malloc_alloc, zend_mm_mem_malloc_realloc, zend_mm_mem_malloc_free}
+/*
+ * Memory is retrived from OS by chunks of fixed size 2MB.
+ * Inside chunk it's managed by pages of fixed size 4096B.
+ * So each chunk consists from 512 pages.
+ * The first page of each chunk is reseved for chunk header.
+ * It contains service information about all pages.
+ *
+ * free_pages - current number of free pages in this chunk
+ *
+ * free_tail - number of continuous free pages at the end of chunk
+ *
+ * free_map - bitset (a bit for each page). The bit is set if the corresponding
+ * page is allocated. Allocator for "lage sizes" may easily find a
+ * free page (or a continuous number of pages) searching for zero
+ * bits.
+ *
+ * map - contains service information for each page. (32-bits for each
+ * page).
+ * usage:
+ * (2 bits)
+ * FRUN - free page,
+ * LRUN - first page of "large" allocation
+ * SRUN - first page of a bin used for "small" allocation
+ *
+ * lrun_pages:
+ * (10 bits) number of allocated pages
+ *
+ * srun_bin_num:
+ * (5 bits) bin number (e.g. 0 for sizes 0-2, 1 for 3-4,
+ * 2 for 5-8, 3 for 9-16 etc) see zend_alloc_sizes.h
+ */
+struct _zend_mm_heap {
+#if ZEND_MM_CUSTOM
+ int use_custom_heap;
#endif
-
-static const zend_mm_mem_handlers mem_handlers[] = {
-#ifdef HAVE_MEM_WIN32
- ZEND_MM_MEM_WIN32_DSC,
+#if ZEND_MM_STORAGE
+ zend_mm_storage *storage;
#endif
-#ifdef HAVE_MEM_MALLOC
- ZEND_MM_MEM_MALLOC_DSC,
+#if ZEND_MM_STAT
+ size_t size; /* current memory usage */
+ size_t peak; /* peak memory usage */
#endif
-#ifdef HAVE_MEM_MMAP_ANON
- ZEND_MM_MEM_MMAP_ANON_DSC,
+ zend_mm_free_slot *free_slot[ZEND_MM_BINS]; /* free lists for small sizes */
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ size_t real_size; /* current size of allocated pages */
#endif
-#ifdef HAVE_MEM_MMAP_ZERO
- ZEND_MM_MEM_MMAP_ZERO_DSC,
+#if ZEND_MM_STAT
+ size_t real_peak; /* peak size of allocated pages */
#endif
- {NULL, NULL, NULL, NULL, NULL, NULL}
-};
-
-# define ZEND_MM_STORAGE_DTOR() heap->storage->handlers->dtor(heap->storage)
-# define ZEND_MM_STORAGE_ALLOC(size) heap->storage->handlers->_alloc(heap->storage, size)
-# define ZEND_MM_STORAGE_REALLOC(ptr, size) heap->storage->handlers->_realloc(heap->storage, ptr, size)
-# define ZEND_MM_STORAGE_FREE(ptr) heap->storage->handlers->_free(heap->storage, ptr)
-
-/****************/
-/* Heap Manager */
-/****************/
-
-#define MEM_BLOCK_VALID 0x7312F8DC
-#define MEM_BLOCK_FREED 0x99954317
-#define MEM_BLOCK_CACHED 0xFB8277DC
-#define MEM_BLOCK_GUARD 0x2A8FCC84
-#define MEM_BLOCK_LEAK 0x6C5E8F2D
-
-/* mm block type */
-typedef struct _zend_mm_block_info {
-#if ZEND_MM_COOKIES
- size_t _cookie;
+#if ZEND_MM_LIMIT
+ size_t limit; /* memory limit */
+ int overflow; /* memory overflow flag */
#endif
- size_t _size;
- size_t _prev;
-} zend_mm_block_info;
-#if ZEND_DEBUG
+ zend_mm_huge_list *huge_list; /* list of huge allocated blocks */
-typedef struct _zend_mm_debug_info {
- const char *filename;
- uint lineno;
- const char *orig_filename;
- uint orig_lineno;
- size_t size;
-#if ZEND_MM_HEAP_PROTECTION
- unsigned int start_magic;
+ zend_mm_chunk *main_chunk;
+ zend_mm_chunk *cached_chunks; /* list of unused chunks */
+ int chunks_count; /* number of alocated chunks */
+ int peak_chunks_count; /* peak number of allocated chunks for current request */
+ int cached_chunks_count; /* number of cached chunks */
+ double avg_chunks_count; /* average number of chunks allocated per request */
+#if ZEND_MM_CUSTOM
+ void *(*_malloc)(size_t);
+ void (*_free)(void*);
+ void *(*_realloc)(void*, size_t);
#endif
-} zend_mm_debug_info;
+};
-#elif ZEND_MM_HEAP_PROTECTION
+struct _zend_mm_chunk {
+ zend_mm_heap *heap;
+ zend_mm_chunk *next;
+ zend_mm_chunk *prev;
+ int free_pages; /* number of free pages */
+ int free_tail; /* number of free pages at the end of chunk */
+ int num;
+ char reserve[64 - (sizeof(void*) * 3 + sizeof(int) * 3)];
+ zend_mm_heap heap_slot; /* used only in main chunk */
+ zend_mm_page_map free_map; /* 512 bits or 64 bytes */
+ zend_mm_page_info map[ZEND_MM_PAGES]; /* 2 KB = 512 * 4 */
+};
-typedef struct _zend_mm_debug_info {
- size_t size;
- unsigned int start_magic;
-} zend_mm_debug_info;
+struct _zend_mm_page {
+ char bytes[ZEND_MM_PAGE_SIZE];
+};
-#endif
+/*
+ * bin - is one or few continuous pages (up to 8) used for alocation of
+ * a particular "small size".
+ */
+struct _zend_mm_bin {
+ char bytes[ZEND_MM_PAGE_SIZE * 8];
+};
-typedef struct _zend_mm_block {
- zend_mm_block_info info;
#if ZEND_DEBUG
- unsigned int magic;
-# ifdef ZTS
- THREAD_T thread_id;
-# endif
- zend_mm_debug_info debug;
-#elif ZEND_MM_HEAP_PROTECTION
- zend_mm_debug_info debug;
+typedef struct _zend_mm_debug_info {
+ size_t size;
+ const char *filename;
+ const char *orig_filename;
+ uint lineno;
+ uint orig_lineno;
+} zend_mm_debug_info;
#endif
-} zend_mm_block;
-typedef struct _zend_mm_small_free_block {
- zend_mm_block_info info;
-#if ZEND_DEBUG
- unsigned int magic;
-# ifdef ZTS
- THREAD_T thread_id;
-# endif
-#endif
- struct _zend_mm_free_block *prev_free_block;
- struct _zend_mm_free_block *next_free_block;
-} zend_mm_small_free_block;
+struct _zend_mm_free_slot {
+ zend_mm_free_slot *next_free_slot;
+};
-typedef struct _zend_mm_free_block {
- zend_mm_block_info info;
+struct _zend_mm_huge_list {
+ void *ptr;
+ size_t size;
+ zend_mm_huge_list *next;
#if ZEND_DEBUG
- unsigned int magic;
-# ifdef ZTS
- THREAD_T thread_id;
-# endif
-#endif
- struct _zend_mm_free_block *prev_free_block;
- struct _zend_mm_free_block *next_free_block;
-
- struct _zend_mm_free_block **parent;
- struct _zend_mm_free_block *child[2];
-} zend_mm_free_block;
-
-#define ZEND_MM_NUM_BUCKETS (sizeof(size_t) << 3)
-
-#define ZEND_MM_CACHE 1
-#define ZEND_MM_CACHE_SIZE (ZEND_MM_NUM_BUCKETS * 4 * 1024)
-
-#ifndef ZEND_MM_CACHE_STAT
-# define ZEND_MM_CACHE_STAT 0
-#endif
-
-struct _zend_mm_heap {
- int use_zend_alloc;
- void *(*_malloc)(size_t);
- void (*_free)(void*);
- void *(*_realloc)(void*, size_t);
- size_t free_bitmap;
- size_t large_free_bitmap;
- size_t block_size;
- size_t compact_size;
- zend_mm_segment *segments_list;
- zend_mm_storage *storage;
- size_t real_size;
- size_t real_peak;
- size_t limit;
- size_t size;
- size_t peak;
- size_t reserve_size;
- void *reserve;
- int overflow;
- int internal;
-#if ZEND_MM_CACHE
- unsigned int cached;
- zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS];
-#endif
- zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2];
- zend_mm_free_block *large_free_buckets[ZEND_MM_NUM_BUCKETS];
- zend_mm_free_block *rest_buckets[2];
- int rest_count;
-#if ZEND_MM_CACHE_STAT
- struct {
- int count;
- int max_count;
- int hit;
- int miss;
- } cache_stat[ZEND_MM_NUM_BUCKETS+1];
+ zend_mm_debug_info dbg;
#endif
};
-#define ZEND_MM_SMALL_FREE_BUCKET(heap, index) \
- (zend_mm_free_block*) ((char*)&heap->free_buckets[index * 2] + \
- sizeof(zend_mm_free_block*) * 2 - \
- sizeof(zend_mm_small_free_block))
+#define ZEND_MM_PAGE_ADDR(chunk, page_num) \
+ ((void*)(((zend_mm_page*)(chunk)) + (page_num)))
-#define ZEND_MM_REST_BUCKET(heap) \
- (zend_mm_free_block*)((char*)&heap->rest_buckets[0] + \
- sizeof(zend_mm_free_block*) * 2 - \
- sizeof(zend_mm_small_free_block))
+#define _BIN_DATA_SIZE(num, size, elements, pages, x, y) size,
+static const unsigned int bin_data_size[] = {
+ ZEND_MM_BINS_INFO(_BIN_DATA_SIZE, x, y)
+};
-#define ZEND_MM_REST_BLOCK ((zend_mm_free_block**)(zend_uintptr_t)(1))
+#define _BIN_DATA_ELEMENTS(num, size, elements, pages, x, y) elements,
+static const int bin_elements[] = {
+ ZEND_MM_BINS_INFO(_BIN_DATA_ELEMENTS, x, y)
+};
-#define ZEND_MM_MAX_REST_BLOCKS 16
+#define _BIN_DATA_PAGES(num, size, elements, pages, x, y) pages,
+static const int bin_pages[] = {
+ ZEND_MM_BINS_INFO(_BIN_DATA_PAGES, x, y)
+};
-#if ZEND_MM_COOKIES
+#if ZEND_DEBUG
+void zend_debug_alloc_output(char *format, ...)
+{
+ char output_buf[256];
+ va_list args;
-static unsigned int _zend_mm_cookie = 0;
+ va_start(args, format);
+ vsprintf(output_buf, format, args);
+ va_end(args);
-# define ZEND_MM_COOKIE(block) \
- (((size_t)(block)) ^ _zend_mm_cookie)
-# define ZEND_MM_SET_COOKIE(block) \
- (block)->info._cookie = ZEND_MM_COOKIE(block)
-# define ZEND_MM_CHECK_COOKIE(block) \
- if (UNEXPECTED((block)->info._cookie != ZEND_MM_COOKIE(block))) { \
- zend_mm_panic("zend_mm_heap corrupted"); \
- }
+#ifdef ZEND_WIN32
+ OutputDebugString(output_buf);
#else
-# define ZEND_MM_SET_COOKIE(block)
-# define ZEND_MM_CHECK_COOKIE(block)
+ fprintf(stderr, "%s", output_buf);
#endif
-
-/* Default memory segment size */
-#define ZEND_MM_SEG_SIZE (256 * 1024)
-
-/* Reserved space for error reporting in case of memory overflow */
-#define ZEND_MM_RESERVE_SIZE (8*1024)
-
-#ifdef _WIN64
-# define ZEND_MM_INT_CONST(x) (x##i64)
-#else
-# define ZEND_MM_INT_CONST(x) (x##L)
+}
#endif
-#define ZEND_MM_TYPE_MASK ZEND_MM_INT_CONST(0x3)
-
-#define ZEND_MM_FREE_BLOCK ZEND_MM_INT_CONST(0x0)
-#define ZEND_MM_USED_BLOCK ZEND_MM_INT_CONST(0x1)
-#define ZEND_MM_GUARD_BLOCK ZEND_MM_INT_CONST(0x3)
-
-#define ZEND_MM_BLOCK(b, type, size) do { \
- size_t _size = (size); \
- (b)->info._size = (type) | _size; \
- ZEND_MM_BLOCK_AT(b, _size)->info._prev = (type) | _size; \
- ZEND_MM_SET_COOKIE(b); \
- } while (0);
-#define ZEND_MM_LAST_BLOCK(b) do { \
- (b)->info._size = ZEND_MM_GUARD_BLOCK | ZEND_MM_ALIGNED_HEADER_SIZE; \
- ZEND_MM_SET_MAGIC(b, MEM_BLOCK_GUARD); \
- } while (0);
-#define ZEND_MM_BLOCK_SIZE(b) ((b)->info._size & ~ZEND_MM_TYPE_MASK)
-#define ZEND_MM_IS_FREE_BLOCK(b) (!((b)->info._size & ZEND_MM_USED_BLOCK))
-#define ZEND_MM_IS_USED_BLOCK(b) ((b)->info._size & ZEND_MM_USED_BLOCK)
-#define ZEND_MM_IS_GUARD_BLOCK(b) (((b)->info._size & ZEND_MM_TYPE_MASK) == ZEND_MM_GUARD_BLOCK)
-
-#define ZEND_MM_NEXT_BLOCK(b) ZEND_MM_BLOCK_AT(b, ZEND_MM_BLOCK_SIZE(b))
-#define ZEND_MM_PREV_BLOCK(b) ZEND_MM_BLOCK_AT(b, -(ssize_t)((b)->info._prev & ~ZEND_MM_TYPE_MASK))
-
-#define ZEND_MM_PREV_BLOCK_IS_FREE(b) (!((b)->info._prev & ZEND_MM_USED_BLOCK))
-
-#define ZEND_MM_MARK_FIRST_BLOCK(b) ((b)->info._prev = ZEND_MM_GUARD_BLOCK)
-#define ZEND_MM_IS_FIRST_BLOCK(b) ((b)->info._prev == ZEND_MM_GUARD_BLOCK)
-
-/* optimized access */
-#define ZEND_MM_FREE_BLOCK_SIZE(b) (b)->info._size
-
-/* Aligned header size */
-#define ZEND_MM_ALIGNED_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_block))
-#define ZEND_MM_ALIGNED_FREE_HEADER_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_small_free_block))
-#define ZEND_MM_MIN_ALLOC_BLOCK_SIZE ZEND_MM_ALIGNED_SIZE(ZEND_MM_ALIGNED_HEADER_SIZE + END_MAGIC_SIZE)
-#define ZEND_MM_ALIGNED_MIN_HEADER_SIZE (ZEND_MM_MIN_ALLOC_BLOCK_SIZE>ZEND_MM_ALIGNED_FREE_HEADER_SIZE?ZEND_MM_MIN_ALLOC_BLOCK_SIZE:ZEND_MM_ALIGNED_FREE_HEADER_SIZE)
-#define ZEND_MM_ALIGNED_SEGMENT_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_segment))
-
-#define ZEND_MM_MIN_SIZE ((ZEND_MM_ALIGNED_MIN_HEADER_SIZE>(ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE))?(ZEND_MM_ALIGNED_MIN_HEADER_SIZE-(ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE)):0)
-
-#define ZEND_MM_MAX_SMALL_SIZE ((ZEND_MM_NUM_BUCKETS<<ZEND_MM_ALIGNMENT_LOG2)+ZEND_MM_ALIGNED_MIN_HEADER_SIZE)
-
-#define ZEND_MM_TRUE_SIZE(size) ((size<ZEND_MM_MIN_SIZE)?(ZEND_MM_ALIGNED_MIN_HEADER_SIZE):(ZEND_MM_ALIGNED_SIZE(size+ZEND_MM_ALIGNED_HEADER_SIZE+END_MAGIC_SIZE)))
-
-#define ZEND_MM_BUCKET_INDEX(true_size) ((true_size>>ZEND_MM_ALIGNMENT_LOG2)-(ZEND_MM_ALIGNED_MIN_HEADER_SIZE>>ZEND_MM_ALIGNMENT_LOG2))
-
-#define ZEND_MM_SMALL_SIZE(true_size) (true_size < ZEND_MM_MAX_SMALL_SIZE)
-
-/* Memory calculations */
-#define ZEND_MM_BLOCK_AT(blk, offset) ((zend_mm_block *) (((char *) (blk))+(offset)))
-#define ZEND_MM_DATA_OF(p) ((void *) (((char *) (p))+ZEND_MM_ALIGNED_HEADER_SIZE))
-#define ZEND_MM_HEADER_OF(blk) ZEND_MM_BLOCK_AT(blk, -(int)ZEND_MM_ALIGNED_HEADER_SIZE)
+static ZEND_NORETURN void zend_mm_panic(const char *message)
+{
+ fprintf(stderr, "%s\n", message);
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
+#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
+ kill(getpid(), SIGSEGV);
+#endif
+ exit(1);
+}
-/* Debug output */
+static ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap,
+ const char *format,
+ size_t limit,
#if ZEND_DEBUG
+ const char *filename,
+ uint lineno,
+#endif
+ size_t size)
+{
+ TSRMLS_FETCH();
-# ifdef ZTS
-# define ZEND_MM_SET_THREAD_ID(block) \
- ((zend_mm_block*)(block))->thread_id = tsrm_thread_id()
-# define ZEND_MM_BAD_THREAD_ID(block) ((block)->thread_id != tsrm_thread_id())
-# else
-# define ZEND_MM_SET_THREAD_ID(block)
-# define ZEND_MM_BAD_THREAD_ID(block) 0
-# endif
-
-# define ZEND_MM_VALID_PTR(block) \
- zend_mm_check_ptr(heap, block, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)
+ heap->overflow = 1;
+ zend_try {
+ zend_error_noreturn(E_ERROR,
+ format,
+ limit,
+#if ZEND_DEBUG
+ filename,
+ lineno,
+#endif
+ size);
+ } zend_catch {
+ } zend_end_try();
+ heap->overflow = 0;
+ zend_bailout();
+ exit(1);
+}
-# define ZEND_MM_SET_MAGIC(block, val) do { \
- (block)->magic = (val); \
- } while (0)
+#ifdef _WIN32
+void
+stderr_last_error(char *msg)
+{
+ LPSTR buf = NULL;
+ DWORD err = GetLastError();
-# define ZEND_MM_CHECK_MAGIC(block, val) do { \
- if ((block)->magic != (val)) { \
- zend_mm_panic("zend_mm_heap corrupted"); \
- } \
- } while (0)
+ if (!FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPSTR)&buf,
+ 0, NULL)) {
+ fprintf(stderr, "\n%s: [0x%08x]\n", msg, err);
+ }
+ else {
+ fprintf(stderr, "\n%s: [0x%08x] %s\n", msg, err, buf);
+ }
+}
+#endif
-# define ZEND_MM_SET_DEBUG_INFO(block, __size, set_valid, set_thread) do { \
- ((zend_mm_block*)(block))->debug.filename = __zend_filename; \
- ((zend_mm_block*)(block))->debug.lineno = __zend_lineno; \
- ((zend_mm_block*)(block))->debug.orig_filename = __zend_orig_filename; \
- ((zend_mm_block*)(block))->debug.orig_lineno = __zend_orig_lineno; \
- ZEND_MM_SET_BLOCK_SIZE(block, __size); \
- if (set_valid) { \
- ZEND_MM_SET_MAGIC(block, MEM_BLOCK_VALID); \
- } \
- if (set_thread) { \
- ZEND_MM_SET_THREAD_ID(block); \
- } \
- } while (0)
+/*****************/
+/* OS Allocation */
+/*****************/
+static void *zend_mm_mmap_fixed(void *addr, size_t size)
+{
+#ifdef _WIN32
+ return VirtualAlloc(addr, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#else
+ /* MAP_FIXED leads to discarding of the old mapping, so it can't be used. */
+ void *ptr = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON /*| MAP_POPULATE | MAP_HUGETLB*/, -1, 0);
-# define ZEND_MM_VALID_PTR(ptr) EXPECTED(ptr != NULL)
-
-# define ZEND_MM_SET_MAGIC(block, val)
-
-# define ZEND_MM_CHECK_MAGIC(block, val)
-
-# define ZEND_MM_SET_DEBUG_INFO(block, __size, set_valid, set_thread) ZEND_MM_SET_BLOCK_SIZE(block, __size)
-
+ if (ptr == MAP_FAILED) {
+#if ZEND_MM_ERROR
+ fprintf(stderr, "\nmmap() failed: [%d] %s\n", errno, strerror(errno));
#endif
+ return NULL;
+ } else if (ptr != addr) {
+ if (munmap(ptr, size) != 0) {
+#if ZEND_MM_ERROR
+ fprintf(stderr, "\nmunmap() failed: [%d] %s\n", errno, strerror(errno));
+#endif
+ }
+ return NULL;
+ }
+ return ptr;
+#endif
+}
+static void *zend_mm_mmap(size_t size)
+{
+#ifdef _WIN32
+ void *ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
-#if ZEND_MM_HEAP_PROTECTION
-
-# define ZEND_MM_CHECK_PROTECTION(block) \
- do { \
- if ((block)->debug.start_magic != _mem_block_start_magic || \
- memcmp(ZEND_MM_END_MAGIC_PTR(block), &_mem_block_end_magic, END_MAGIC_SIZE) != 0) { \
- zend_mm_panic("zend_mm_heap corrupted"); \
- } \
- } while (0)
-
-# define ZEND_MM_END_MAGIC_PTR(block) \
- (((char*)(ZEND_MM_DATA_OF(block))) + ((zend_mm_block*)(block))->debug.size)
-
-# define END_MAGIC_SIZE sizeof(unsigned int)
-
-# define ZEND_MM_SET_BLOCK_SIZE(block, __size) do { \
- char *p; \
- ((zend_mm_block*)(block))->debug.size = (__size); \
- p = ZEND_MM_END_MAGIC_PTR(block); \
- ((zend_mm_block*)(block))->debug.start_magic = _mem_block_start_magic; \
- memcpy(p, &_mem_block_end_magic, END_MAGIC_SIZE); \
- } while (0)
-
-static unsigned int _mem_block_start_magic = 0;
-static unsigned int _mem_block_end_magic = 0;
-
+ if (ptr == NULL) {
+#if ZEND_MM_ERROR
+ stderr_last_error("VirtualAlloc() failed");
+#endif
+ return NULL;
+ }
+ return ptr;
#else
+ void *ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON /*| MAP_POPULATE | MAP_HUGETLB*/, -1, 0);
-# if ZEND_DEBUG
-# define ZEND_MM_SET_BLOCK_SIZE(block, _size) \
- ((zend_mm_block*)(block))->debug.size = (_size)
-# else
-# define ZEND_MM_SET_BLOCK_SIZE(block, _size)
-# endif
-
-# define ZEND_MM_CHECK_PROTECTION(block)
-
-# define END_MAGIC_SIZE 0
-
+ if (ptr == MAP_FAILED) {
+#if ZEND_MM_ERROR
+ fprintf(stderr, "\nmmap() failed: [%d] %s\n", errno, strerror(errno));
#endif
-
-#if ZEND_MM_SAFE_UNLINKING
-# define ZEND_MM_CHECK_BLOCK_LINKAGE(block) \
- if (UNEXPECTED((block)->info._size != ZEND_MM_BLOCK_AT(block, ZEND_MM_FREE_BLOCK_SIZE(block))->info._prev) || \
- UNEXPECTED(!UNEXPECTED(ZEND_MM_IS_FIRST_BLOCK(block)) && \
- UNEXPECTED(ZEND_MM_PREV_BLOCK(block)->info._size != (block)->info._prev))) { \
- zend_mm_panic("zend_mm_heap corrupted"); \
+ return NULL;
}
-#define ZEND_MM_CHECK_TREE(block) \
- if (UNEXPECTED(*((block)->parent) != (block))) { \
- zend_mm_panic("zend_mm_heap corrupted"); \
+ return ptr;
+#endif
+}
+
+static void zend_mm_munmap(void *addr, size_t size)
+{
+#ifdef _WIN32
+ if (VirtualFree(addr, 0, MEM_RELEASE) == 0) {
+#if ZEND_MM_ERROR
+ stderr_last_error("VirtualFree() failed");
+#endif
}
#else
-# define ZEND_MM_CHECK_BLOCK_LINKAGE(block)
-# define ZEND_MM_CHECK_TREE(block)
+ if (munmap(addr, size) != 0) {
+#if ZEND_MM_ERROR
+ fprintf(stderr, "\nmunmap() failed: [%d] %s\n", errno, strerror(errno));
#endif
+ }
+#endif
+}
-#define ZEND_MM_LARGE_BUCKET_INDEX(S) zend_mm_high_bit(S)
-
-static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(2);
-static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(3);
+/***********/
+/* Bitmask */
+/***********/
-static inline unsigned int zend_mm_high_bit(size_t _size)
+/* number of trailing set (1) bits */
+static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
{
-#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
- unsigned int n;
-
- __asm__("bsrl %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc");
- return n;
-#elif defined(__GNUC__) && defined(__x86_64__)
- unsigned long n;
+#if defined(__GNUC__)
+# if SIZEOF_ZEND_LONG == SIZEOF_LONG
+ return __builtin_ctzl(~bitset);
+# else
+ return __builtin_ctzll(~bitset);
+# endif
+#elif defined(_WIN32)
+ unsigned long index;
- __asm__("bsr %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc");
- return (unsigned int)n;
-#elif defined(_MSC_VER) && defined(_M_IX86)
- __asm {
- bsr eax, _size
+#if defined(_WIN64)
+ if (!BitScanForward64(&index, ~bitset)) {
+#else
+ if (!BitScanForward(&index, ~bitset)) {
+#endif
+ /* undefined behavior */
+ return 32;
}
-#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
- return (8 * SIZEOF_SIZE_T - 1) - __builtin_clzl(_size);
+
+ return (int)index;
#else
- unsigned int n = 0;
- while (_size != 0) {
- _size = _size >> 1;
- n++;
+ int n;
+
+ if (bitset == (zend_mm_bitset)-1) return ZEND_MM_BITSET_LEN;
+
+ n = 0;
+#if SIZEOF_ZEND_LONG == 8
+ if (sizeof(zend_mm_bitset) == 8) {
+ if ((bitset & 0xffffffff) == 0xffffffff) {n += 32; bitset = bitset >> Z_UL(32);}
}
- return n-1;
+#endif
+ if ((bitset & 0x0000ffff) == 0x0000ffff) {n += 16; bitset = bitset >> 16;}
+ if ((bitset & 0x000000ff) == 0x000000ff) {n += 8; bitset = bitset >> 8;}
+ if ((bitset & 0x0000000f) == 0x0000000f) {n += 4; bitset = bitset >> 4;}
+ if ((bitset & 0x00000003) == 0x00000003) {n += 2; bitset = bitset >> 2;}
+ return n + (bitset & 1);
#endif
}
-static inline unsigned int zend_mm_low_bit(size_t _size)
+/* number of trailing zero bits (0x01 -> 1; 0x40 -> 6; 0x00 -> LEN) */
+static zend_always_inline int zend_mm_bitset_ntz(zend_mm_bitset bitset)
{
-#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
- unsigned int n;
+#if defined(__GNUC__)
+# if SIZEOF_ZEND_LONG == SIZEOF_LONG
+ return __builtin_ctzl(bitset);
+# else
+ return __builtin_ctzll(bitset);
+# endif
+#elif defined(_WIN32)
+ unsigned long index;
- __asm__("bsfl %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc");
- return n;
-#elif defined(__GNUC__) && defined(__x86_64__)
- unsigned long n;
-
- __asm__("bsf %1,%0\n\t" : "=r" (n) : "rm" (_size) : "cc");
- return (unsigned int)n;
-#elif defined(_MSC_VER) && defined(_M_IX86)
- __asm {
- bsf eax, _size
- }
-#elif defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
- return __builtin_ctzl(_size);
+#if defined(_WIN64)
+ if (!BitScanForward64(&index, bitset)) {
#else
- static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
- unsigned int n;
- unsigned int index = 0;
-
- n = offset[_size & 15];
- while (n == 4) {
- _size >>= 4;
- index += n;
- n = offset[_size & 15];
+ if (!BitScanForward(&index, bitset)) {
+#endif
+ /* undefined behavior */
+ return 32;
}
- return index + n;
+ return (int)index;
+#else
+ int n;
+
+ if (bitset == (zend_mm_bitset)0) return ZEND_MM_BITSET_LEN;
+
+ n = 1;
+#if SIZEOF_ZEND_LONG == 8
+ if (sizeof(zend_mm_bitset) == 8) {
+ if ((bitset & 0xffffffff) == 0) {n += 32; bitset = bitset >> Z_UL(32);}
+ }
+#endif
+ if ((bitset & 0x0000ffff) == 0) {n += 16; bitset = bitset >> 16;}
+ if ((bitset & 0x000000ff) == 0) {n += 8; bitset = bitset >> 8;}
+ if ((bitset & 0x0000000f) == 0) {n += 4; bitset = bitset >> 4;}
+ if ((bitset & 0x00000003) == 0) {n += 2; bitset = bitset >> 2;}
+ return n - (bitset & 1);
#endif
}
-static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
+static zend_always_inline int zend_mm_bitset_find_zero(zend_mm_bitset *bitset, int size)
{
- size_t size;
- size_t index;
-
- ZEND_MM_SET_MAGIC(mm_block, MEM_BLOCK_FREED);
-
- size = ZEND_MM_FREE_BLOCK_SIZE(mm_block);
- if (EXPECTED(!ZEND_MM_SMALL_SIZE(size))) {
- zend_mm_free_block **p;
-
- index = ZEND_MM_LARGE_BUCKET_INDEX(size);
- p = &heap->large_free_buckets[index];
- mm_block->child[0] = mm_block->child[1] = NULL;
- if (!*p) {
- *p = mm_block;
- mm_block->parent = p;
- mm_block->prev_free_block = mm_block->next_free_block = mm_block;
- heap->large_free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
- } else {
- size_t m;
-
- for (m = size << (ZEND_MM_NUM_BUCKETS - index); ; m <<= 1) {
- zend_mm_free_block *prev = *p;
-
- if (ZEND_MM_FREE_BLOCK_SIZE(prev) != size) {
- p = &prev->child[(m >> (ZEND_MM_NUM_BUCKETS-1)) & 1];
- if (!*p) {
- *p = mm_block;
- mm_block->parent = p;
- mm_block->prev_free_block = mm_block->next_free_block = mm_block;
- break;
- }
- } else {
- zend_mm_free_block *next = prev->next_free_block;
-
- prev->next_free_block = next->prev_free_block = mm_block;
- mm_block->next_free_block = next;
- mm_block->prev_free_block = prev;
- mm_block->parent = NULL;
- break;
- }
- }
+ int i = 0;
+
+ do {
+ zend_mm_bitset tmp = bitset[i];
+ if (tmp != (zend_mm_bitset)-1) {
+ return i * ZEND_MM_BITSET_LEN + zend_mm_bitset_nts(tmp);
}
- } else {
- zend_mm_free_block *prev, *next;
+ i++;
+ } while (i < size);
+ return -1;
+}
- index = ZEND_MM_BUCKET_INDEX(size);
+static zend_always_inline int zend_mm_bitset_find_one(zend_mm_bitset *bitset, int size)
+{
+ int i = 0;
- prev = ZEND_MM_SMALL_FREE_BUCKET(heap, index);
- if (prev->prev_free_block == prev) {
- heap->free_bitmap |= (ZEND_MM_INT_CONST(1) << index);
+ do {
+ zend_mm_bitset tmp = bitset[i];
+ if (tmp != 0) {
+ return i * ZEND_MM_BITSET_LEN + zend_mm_bitset_ntz(tmp);
}
- next = prev->next_free_block;
-
- mm_block->prev_free_block = prev;
- mm_block->next_free_block = next;
- prev->next_free_block = next->prev_free_block = mm_block;
- }
+ i++;
+ } while (i < size);
+ return -1;
}
-static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
+static zend_always_inline int zend_mm_bitset_find_zero_and_set(zend_mm_bitset *bitset, int size)
{
- zend_mm_free_block *prev = mm_block->prev_free_block;
- zend_mm_free_block *next = mm_block->next_free_block;
+ int i = 0;
- ZEND_MM_CHECK_MAGIC(mm_block, MEM_BLOCK_FREED);
+ do {
+ zend_mm_bitset tmp = bitset[i];
+ if (tmp != (zend_mm_bitset)-1) {
+ int n = zend_mm_bitset_nts(tmp);
+ bitset[i] |= Z_UL(1) << n;
+ return i * ZEND_MM_BITSET_LEN + n;
+ }
+ i++;
+ } while (i < size);
+ return -1;
+}
- if (EXPECTED(prev == mm_block)) {
- zend_mm_free_block **rp, **cp;
+static zend_always_inline int zend_mm_bitset_is_set(zend_mm_bitset *bitset, int bit)
+{
+ return (bitset[bit / ZEND_MM_BITSET_LEN] & (Z_L(1) << (bit & (ZEND_MM_BITSET_LEN-1)))) != 0;
+}
-#if ZEND_MM_SAFE_UNLINKING
- if (UNEXPECTED(next != mm_block)) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
-#endif
+static zend_always_inline void zend_mm_bitset_set_bit(zend_mm_bitset *bitset, int bit)
+{
+ bitset[bit / ZEND_MM_BITSET_LEN] |= (Z_L(1) << (bit & (ZEND_MM_BITSET_LEN-1)));
+}
- rp = &mm_block->child[mm_block->child[1] != NULL];
- prev = *rp;
- if (EXPECTED(prev == NULL)) {
- size_t index = ZEND_MM_LARGE_BUCKET_INDEX(ZEND_MM_FREE_BLOCK_SIZE(mm_block));
+static zend_always_inline void zend_mm_bitset_reset_bit(zend_mm_bitset *bitset, int bit)
+{
+ bitset[bit / ZEND_MM_BITSET_LEN] &= ~(Z_L(1) << (bit & (ZEND_MM_BITSET_LEN-1)));
+}
- ZEND_MM_CHECK_TREE(mm_block);
- *mm_block->parent = NULL;
- if (mm_block->parent == &heap->large_free_buckets[index]) {
- heap->large_free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
- }
- } else {
- while (*(cp = &(prev->child[prev->child[1] != NULL])) != NULL) {
- prev = *cp;
- rp = cp;
- }
- *rp = NULL;
-
-subst_block:
- ZEND_MM_CHECK_TREE(mm_block);
- *mm_block->parent = prev;
- prev->parent = mm_block->parent;
- if ((prev->child[0] = mm_block->child[0])) {
- ZEND_MM_CHECK_TREE(prev->child[0]);
- prev->child[0]->parent = &prev->child[0];
- }
- if ((prev->child[1] = mm_block->child[1])) {
- ZEND_MM_CHECK_TREE(prev->child[1]);
- prev->child[1]->parent = &prev->child[1];
+static zend_always_inline void zend_mm_bitset_set_range(zend_mm_bitset *bitset, int start, int len)
+{
+ if (len == 1) {
+ zend_mm_bitset_set_bit(bitset, start);
+ } else {
+ int pos = start / ZEND_MM_BITSET_LEN;
+ int end = (start + len - 1) / ZEND_MM_BITSET_LEN;
+ int bit = start & (ZEND_MM_BITSET_LEN - 1);
+ zend_mm_bitset tmp;
+
+ if (pos != end) {
+ /* set bits from "bit" to ZEND_MM_BITSET_LEN-1 */
+ tmp = (zend_mm_bitset)-1 << bit;
+ bitset[pos++] |= tmp;
+ while (pos != end) {
+ /* set all bits */
+ bitset[pos++] = (zend_mm_bitset)-1;
}
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* set bits from "0" to "end" */
+ tmp = (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ bitset[pos] |= tmp;
+ } else {
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* set bits from "bit" to "end" */
+ tmp = (zend_mm_bitset)-1 << bit;
+ tmp &= (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ bitset[pos] |= tmp;
}
- } else {
+ }
+}
-#if ZEND_MM_SAFE_UNLINKING
- if (UNEXPECTED(prev->next_free_block != mm_block) || UNEXPECTED(next->prev_free_block != mm_block)) {
- zend_mm_panic("zend_mm_heap corrupted");
+static zend_always_inline void zend_mm_bitset_reset_range(zend_mm_bitset *bitset, int start, int len)
+{
+ if (len == 1) {
+ zend_mm_bitset_reset_bit(bitset, start);
+ } else {
+ int pos = start / ZEND_MM_BITSET_LEN;
+ int end = (start + len - 1) / ZEND_MM_BITSET_LEN;
+ int bit = start & (ZEND_MM_BITSET_LEN - 1);
+ zend_mm_bitset tmp;
+
+ if (pos != end) {
+ /* reset bits from "bit" to ZEND_MM_BITSET_LEN-1 */
+ tmp = ~((Z_L(1) << bit) - 1);
+ bitset[pos++] &= ~tmp;
+ while (pos != end) {
+ /* set all bits */
+ bitset[pos++] = 0;
+ }
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* reset bits from "0" to "end" */
+ tmp = (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ bitset[pos] &= ~tmp;
+ } else {
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* reset bits from "bit" to "end" */
+ tmp = (zend_mm_bitset)-1 << bit;
+ tmp &= (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ bitset[pos] &= ~tmp;
}
-#endif
-
- prev->next_free_block = next;
- next->prev_free_block = prev;
-
- if (EXPECTED(ZEND_MM_SMALL_SIZE(ZEND_MM_FREE_BLOCK_SIZE(mm_block)))) {
- if (EXPECTED(prev == next)) {
- size_t index = ZEND_MM_BUCKET_INDEX(ZEND_MM_FREE_BLOCK_SIZE(mm_block));
+ }
+}
- if (EXPECTED(heap->free_buckets[index*2] == heap->free_buckets[index*2+1])) {
- heap->free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index);
+static zend_always_inline int zend_mm_bitset_is_free_range(zend_mm_bitset *bitset, int start, int len)
+{
+ if (len == 1) {
+ return !zend_mm_bitset_is_set(bitset, start);
+ } else {
+ int pos = start / ZEND_MM_BITSET_LEN;
+ int end = (start + len - 1) / ZEND_MM_BITSET_LEN;
+ int bit = start & (ZEND_MM_BITSET_LEN - 1);
+ zend_mm_bitset tmp;
+
+ if (pos != end) {
+ /* set bits from "bit" to ZEND_MM_BITSET_LEN-1 */
+ tmp = (zend_mm_bitset)-1 << bit;
+ if ((bitset[pos++] & tmp) != 0) {
+ return 0;
+ }
+ while (pos != end) {
+ /* set all bits */
+ if (bitset[pos++] != 0) {
+ return 0;
}
}
- } else if (UNEXPECTED(mm_block->parent == ZEND_MM_REST_BLOCK)) {
- heap->rest_count--;
- } else if (UNEXPECTED(mm_block->parent != NULL)) {
- goto subst_block;
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* set bits from "0" to "end" */
+ tmp = (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ return (bitset[pos] & tmp) == 0;
+ } else {
+ end = (start + len - 1) & (ZEND_MM_BITSET_LEN - 1);
+ /* set bits from "bit" to "end" */
+ tmp = (zend_mm_bitset)-1 << bit;
+ tmp &= (zend_mm_bitset)-1 >> ((ZEND_MM_BITSET_LEN - 1) - end);
+ return (bitset[pos] & tmp) == 0;
}
}
}
-static inline void zend_mm_add_to_rest_list(zend_mm_heap *heap, zend_mm_free_block *mm_block)
-{
- zend_mm_free_block *prev, *next;
+/**********/
+/* Chunks */
+/**********/
- while (heap->rest_count >= ZEND_MM_MAX_REST_BLOCKS) {
- zend_mm_free_block *p = heap->rest_buckets[1];
+static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
+{
+ void *ptr = zend_mm_mmap(size);
- if (!ZEND_MM_SMALL_SIZE(ZEND_MM_FREE_BLOCK_SIZE(p))) {
- heap->rest_count--;
+ if (ptr == NULL) {
+ return NULL;
+ } else if (ZEND_MM_ALIGNED_OFFSET(ptr, alignment) == 0) {
+#ifdef MADV_HUGEPAGE
+ madvise(ptr, size, MADV_HUGEPAGE);
+#endif
+ return ptr;
+ } else {
+ size_t offset;
+
+ /* chunk has to be aligned */
+ zend_mm_munmap(ptr, size);
+ ptr = zend_mm_mmap(size + alignment - ZEND_MM_PAGE_SIZE);
+#ifdef _WIN32
+ offset = ZEND_MM_ALIGNED_OFFSET(ptr, alignment);
+ zend_mm_munmap(ptr, size + alignment - ZEND_MM_PAGE_SIZE);
+ ptr = zend_mm_mmap_fixed((void*)((char*)ptr + (alignment - offset)), size);
+ offset = ZEND_MM_ALIGNED_OFFSET(ptr, alignment);
+ if (offset != 0) {
+ zend_mm_munmap(ptr, size);
+ return NULL;
}
- prev = p->prev_free_block;
- next = p->next_free_block;
- prev->next_free_block = next;
- next->prev_free_block = prev;
- zend_mm_add_to_free_list(heap, p);
+ return ptr;
+#else
+ offset = ZEND_MM_ALIGNED_OFFSET(ptr, alignment);
+ if (offset != 0) {
+ offset = alignment - offset;
+ zend_mm_munmap(ptr, offset);
+ ptr = (char*)ptr + offset;
+ } else {
+ zend_mm_munmap((char*)ptr + size, alignment - ZEND_MM_PAGE_SIZE);
+ }
+# ifdef MADV_HUGEPAGE
+ madvise(ptr, size, MADV_HUGEPAGE);
+# endif
+#endif
+ return ptr;
}
+}
- if (!ZEND_MM_SMALL_SIZE(ZEND_MM_FREE_BLOCK_SIZE(mm_block))) {
- mm_block->parent = ZEND_MM_REST_BLOCK;
- heap->rest_count++;
+static void *zend_mm_chunk_alloc(zend_mm_heap *heap, size_t size, size_t alignment)
+{
+#if ZEND_MM_STORAGE
+ if (UNEXPECTED(heap->storage)) {
+ void *ptr = heap->storage->chunk_alloc(heap->storage, size, alignment);
+ ZEND_ASSERT(((zend_uintptr_t)((char*)ptr + (alignment-1)) & (alignment-1)) == (zend_uintptr_t)ptr);
+ return ptr;
}
-
- ZEND_MM_SET_MAGIC(mm_block, MEM_BLOCK_FREED);
-
- prev = heap->rest_buckets[0];
- next = prev->next_free_block;
- mm_block->prev_free_block = prev;
- mm_block->next_free_block = next;
- prev->next_free_block = next->prev_free_block = mm_block;
+#endif
+ return zend_mm_chunk_alloc_int(size, alignment);
}
-static inline void zend_mm_init(zend_mm_heap *heap)
+static void zend_mm_chunk_free(zend_mm_heap *heap, void *addr, size_t size)
{
- zend_mm_free_block* p;
- int i;
-
- heap->free_bitmap = 0;
- heap->large_free_bitmap = 0;
-#if ZEND_MM_CACHE
- heap->cached = 0;
- memset(heap->cache, 0, sizeof(heap->cache));
-#endif
-#if ZEND_MM_CACHE_STAT
- for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) {
- heap->cache_stat[i].count = 0;
+#if ZEND_MM_STORAGE
+ if (UNEXPECTED(heap->storage)) {
+ heap->storage->chunk_free(heap->storage, addr, size);
+ return;
}
#endif
- p = ZEND_MM_SMALL_FREE_BUCKET(heap, 0);
- for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) {
- p->next_free_block = p;
- p->prev_free_block = p;
- p = (zend_mm_free_block*)((char*)p + sizeof(zend_mm_free_block*) * 2);
- heap->large_free_buckets[i] = NULL;
- }
- heap->rest_buckets[0] = heap->rest_buckets[1] = ZEND_MM_REST_BUCKET(heap);
- heap->rest_count = 0;
+ zend_mm_munmap(addr, size);
}
-static void zend_mm_del_segment(zend_mm_heap *heap, zend_mm_segment *segment)
+static void zend_mm_chunk_truncate(zend_mm_heap *heap, void *addr, size_t old_size, size_t new_size)
{
- zend_mm_segment **p = &heap->segments_list;
-
- while (*p != segment) {
- p = &(*p)->next_segment;
+#if ZEND_MM_STORAGE
+ if (UNEXPECTED(heap->storage)) {
+ heap->storage->chunk_truncate(heap->storage, addr, old_size, new_size);
+ return;
}
- *p = segment->next_segment;
- heap->real_size -= segment->size;
- ZEND_MM_STORAGE_FREE(segment);
+#endif
+ zend_mm_munmap((char*)addr + new_size, old_size - new_size);
}
-#if ZEND_MM_CACHE
-static void zend_mm_free_cache(zend_mm_heap *heap)
+static zend_always_inline void zend_mm_chunk_init(zend_mm_heap *heap, zend_mm_chunk *chunk)
{
- int i;
-
- for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) {
- if (heap->cache[i]) {
- zend_mm_free_block *mm_block = heap->cache[i];
+ chunk->heap = heap;
+ chunk->next = heap->main_chunk;
+ chunk->prev = heap->main_chunk->prev;
+ chunk->prev->next = chunk;
+ chunk->next->prev = chunk;
+ /* mark first pages as allocated */
+ chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
+ chunk->free_tail = ZEND_MM_FIRST_PAGE;
+ /* the younger chunks have bigger number */
+ chunk->num = chunk->prev->num + 1;
+ /* mark first pages as allocated */
+ chunk->free_map[0] = (1L << ZEND_MM_FIRST_PAGE) - 1;
+ chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
+}
- while (mm_block) {
- size_t size = ZEND_MM_BLOCK_SIZE(mm_block);
- zend_mm_free_block *q = mm_block->prev_free_block;
- zend_mm_block *next_block = ZEND_MM_NEXT_BLOCK(mm_block);
+/***********************/
+/* Huge Runs (forward) */
+/***********************/
- heap->cached -= size;
+static size_t zend_mm_get_huge_block_size(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+static void zend_mm_free_huge(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
- if (ZEND_MM_PREV_BLOCK_IS_FREE(mm_block)) {
- mm_block = (zend_mm_free_block*)ZEND_MM_PREV_BLOCK(mm_block);
- size += ZEND_MM_FREE_BLOCK_SIZE(mm_block);
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) mm_block);
- }
- if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
- size += ZEND_MM_FREE_BLOCK_SIZE(next_block);
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- }
- ZEND_MM_BLOCK(mm_block, ZEND_MM_FREE_BLOCK, size);
+#if ZEND_DEBUG
+static void zend_mm_change_huge_block_size(zend_mm_heap *heap, void *ptr, size_t size, size_t dbg_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+#else
+static void zend_mm_change_huge_block_size(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+#endif
- if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
- ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_NEXT_BLOCK(mm_block))) {
- zend_mm_del_segment(heap, (zend_mm_segment *) ((char *)mm_block - ZEND_MM_ALIGNED_SEGMENT_SIZE));
- } else {
- zend_mm_add_to_free_list(heap, (zend_mm_free_block *) mm_block);
- }
+/**************/
+/* Large Runs */
+/**************/
- mm_block = q;
- }
- heap->cache[i] = NULL;
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[i].count = 0;
-#endif
- }
- }
-}
+#if ZEND_DEBUG
+static void *zend_mm_alloc_pages(zend_mm_heap *heap, int pages_count, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+#else
+static void *zend_mm_alloc_pages(zend_mm_heap *heap, int pages_count ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#endif
-
-#if ZEND_MM_HEAP_PROTECTION || ZEND_MM_COOKIES
-static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */
{
- size_t i = 0;
- unsigned char t;
+ zend_mm_chunk *chunk = heap->main_chunk;
+ int page_num, len;
-#ifdef ZEND_WIN32
- HCRYPTPROV hCryptProv;
- int has_context = 0;
-
- if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
- /* Could mean that the key container does not exist, let try
- again by asking for a new one */
- if (GetLastError() == NTE_BAD_KEYSET) {
- if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
- has_context = 1;
+ while (1) {
+ if (UNEXPECTED(chunk->free_pages < pages_count)) {
+ goto not_found;
+#if 0
+ } else if (UNEXPECTED(chunk->free_pages + chunk->free_tail == ZEND_MM_PAGES)) {
+ if (UNEXPECTED(ZEND_MM_PAGES - chunk->free_tail < pages_count)) {
+ goto not_found;
+ } else {
+ page_num = chunk->free_tail;
+ goto found;
}
- }
- } else {
- has_context = 1;
- }
- if (has_context) {
- do {
- BOOL ret = CryptGenRandom(hCryptProv, size, buf);
- CryptReleaseContext(hCryptProv, 0);
- if (ret) {
- while (i < size && buf[i] != 0) {
- i++;
+ } else if (0) {
+ /* First-Fit Search */
+ int free_tail = chunk->free_tail;
+ zend_mm_bitset *bitset = chunk->free_map;
+ zend_mm_bitset tmp = *(bitset++);
+ int i = 0;
+
+ while (1) {
+ /* skip allocated blocks */
+ while (tmp == (zend_mm_bitset)-1) {
+ i += ZEND_MM_BITSET_LEN;
+ if (i == ZEND_MM_PAGES) {
+ goto not_found;
+ }
+ tmp = *(bitset++);
}
- if (i == size) {
- return;
+ /* find first 0 bit */
+ page_num = i + zend_mm_bitset_nts(tmp);
+ /* reset bits from 0 to "bit" */
+ tmp &= tmp + 1;
+ /* skip free blocks */
+ while (tmp == 0) {
+ i += ZEND_MM_BITSET_LEN;
+ len = i - page_num;
+ if (len >= pages_count) {
+ goto found;
+ } else if (i >= free_tail) {
+ goto not_found;
+ }
+ tmp = *(bitset++);
}
- }
- } while (0);
- }
-#elif defined(HAVE_DEV_URANDOM)
- int fd = open("/dev/urandom", 0);
-
- if (fd >= 0) {
- if (read(fd, buf, size) == size) {
- while (i < size && buf[i] != 0) {
- i++;
- }
- if (i == size) {
- close(fd);
- return;
+ /* find first 1 bit */
+ len = (i + zend_mm_bitset_ntz(tmp)) - page_num;
+ if (len >= pages_count) {
+ goto found;
+ }
+ /* set bits from 0 to "bit" */
+ tmp |= tmp - 1;
}
- }
- close(fd);
- }
-#endif
- t = (unsigned char)getpid();
- while (i < size) {
- do {
- buf[i] = ((unsigned char)rand()) ^ t;
- } while (buf[i] == 0);
- t = buf[i++] << 1;
- }
-}
-/* }}} */
#endif
+ } else {
+ /* Best-Fit Search */
+ int best = -1;
+ int best_len = ZEND_MM_PAGES;
+ int free_tail = chunk->free_tail;
+ zend_mm_bitset *bitset = chunk->free_map;
+ zend_mm_bitset tmp = *(bitset++);
+ int i = 0;
-/* Notes:
- * - This function may alter the block_sizes values to match platform alignment
- * - This function does *not* perform sanity checks on the arguments
- */
-ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, size_t block_size, size_t reserve_size, int internal, void *params)
-{
- zend_mm_storage *storage;
- zend_mm_heap *heap;
-
-#if 0
- int i;
-
- printf("ZEND_MM_ALIGNMENT=%d\n", ZEND_MM_ALIGNMENT);
- printf("ZEND_MM_ALIGNMENT_LOG2=%d\n", ZEND_MM_ALIGNMENT_LOG2);
- printf("ZEND_MM_MIN_SIZE=%d\n", ZEND_MM_MIN_SIZE);
- printf("ZEND_MM_MAX_SMALL_SIZE=%d\n", ZEND_MM_MAX_SMALL_SIZE);
- printf("ZEND_MM_ALIGNED_HEADER_SIZE=%d\n", ZEND_MM_ALIGNED_HEADER_SIZE);
- printf("ZEND_MM_ALIGNED_FREE_HEADER_SIZE=%d\n", ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
- printf("ZEND_MM_MIN_ALLOC_BLOCK_SIZE=%d\n", ZEND_MM_MIN_ALLOC_BLOCK_SIZE);
- printf("ZEND_MM_ALIGNED_MIN_HEADER_SIZE=%d\n", ZEND_MM_ALIGNED_MIN_HEADER_SIZE);
- printf("ZEND_MM_ALIGNED_SEGMENT_SIZE=%d\n", ZEND_MM_ALIGNED_SEGMENT_SIZE);
- for (i = 0; i < ZEND_MM_MAX_SMALL_SIZE; i++) {
- printf("%3d%c: %3ld %d %2ld\n", i, (i == ZEND_MM_MIN_SIZE?'*':' '), (long)ZEND_MM_TRUE_SIZE(i), ZEND_MM_SMALL_SIZE(ZEND_MM_TRUE_SIZE(i)), (long)ZEND_MM_BUCKET_INDEX(ZEND_MM_TRUE_SIZE(i)));
- }
- exit(0);
-#endif
+ while (1) {
+ /* skip allocated blocks */
+ while (tmp == (zend_mm_bitset)-1) {
+ i += ZEND_MM_BITSET_LEN;
+ if (i == ZEND_MM_PAGES) {
+ if (best > 0) {
+ page_num = best;
+ goto found;
+ } else {
+ goto not_found;
+ }
+ }
+ tmp = *(bitset++);
+ }
+ /* find first 0 bit */
+ page_num = i + zend_mm_bitset_nts(tmp);
+ /* reset bits from 0 to "bit" */
+ tmp &= tmp + 1;
+ /* skip free blocks */
+ while (tmp == 0) {
+ i += ZEND_MM_BITSET_LEN;
+ if (i >= free_tail) {
+ len = ZEND_MM_PAGES - page_num;
+ if (len >= pages_count && len < best_len) {
+ chunk->free_tail = page_num + pages_count;
+ goto found;
+ } else {
+ /* set accurate value */
+ chunk->free_tail = page_num;
+ if (best > 0) {
+ page_num = best;
+ goto found;
+ } else {
+ goto not_found;
+ }
+ }
+ }
+ tmp = *(bitset++);
+ }
+ /* find first 1 bit */
+ len = i + zend_mm_bitset_ntz(tmp) - page_num;
+ if (len >= pages_count) {
+ if (len == pages_count) {
+ goto found;
+ } else if (len < best_len) {
+ best_len = len;
+ best = page_num;
+ }
+ }
+ /* set bits from 0 to "bit" */
+ tmp |= tmp - 1;
+ }
+ }
-#if ZEND_MM_HEAP_PROTECTION
- if (_mem_block_start_magic == 0) {
- zend_mm_random((unsigned char*)&_mem_block_start_magic, sizeof(_mem_block_start_magic));
- }
- if (_mem_block_end_magic == 0) {
- zend_mm_random((unsigned char*)&_mem_block_end_magic, sizeof(_mem_block_end_magic));
- }
-#endif
-#if ZEND_MM_COOKIES
- if (_zend_mm_cookie == 0) {
- zend_mm_random((unsigned char*)&_zend_mm_cookie, sizeof(_zend_mm_cookie));
- }
+not_found:
+ if (chunk->next == heap->main_chunk) {
+ if (heap->cached_chunks) {
+ heap->cached_chunks_count--;
+ chunk = heap->cached_chunks;
+ heap->cached_chunks = chunk->next;
+ } else {
+#if ZEND_MM_LIMIT
+ if (heap->real_size + ZEND_MM_CHUNK_SIZE > heap->limit) {
+ if (heap->overflow == 0) {
+#if ZEND_DEBUG
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+#else
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, ZEND_MM_PAGE_SIZE * pages_count);
#endif
-
- if (zend_mm_low_bit(block_size) != zend_mm_high_bit(block_size)) {
- fprintf(stderr, "'block_size' must be a power of two\n");
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+ return NULL;
+ }
+ }
#endif
- exit(255);
- }
- storage = handlers->init(params);
- if (!storage) {
- fprintf(stderr, "Cannot initialize zend_mm storage [%s]\n", handlers->name);
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+ chunk = (zend_mm_chunk*)zend_mm_chunk_alloc(heap, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
+ if (UNEXPECTED(chunk == NULL)) {
+ /* insufficient memory */
+#if !ZEND_MM_LIMIT
+ zend_mm_safe_error(heap, "Out of memory");
+#elif ZEND_DEBUG
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
+#else
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) (tried to allocate %zu bytes)", heap->real_size, ZEND_MM_PAGE_SIZE * pages_count);
#endif
- exit(255);
- }
- storage->handlers = handlers;
+ return NULL;
+ }
+#if ZEND_MM_STAT
+ do {
+ size_t size = heap->real_size + ZEND_MM_CHUNK_SIZE;
+ size_t peak = MAX(heap->real_peak, size);
+ heap->real_size = size;
+ heap->real_peak = peak;
+ } while (0);
+#elif ZEND_MM_LIMIT
+ heap->real_size += ZEND_MM_CHUNK_SIZE;
- heap = malloc(sizeof(struct _zend_mm_heap));
- if (heap == NULL) {
- fprintf(stderr, "Cannot allocate heap for zend_mm storage [%s]\n", handlers->name);
-#ifdef PHP_WIN32
- fflush(stderr);
#endif
- exit(255);
- }
- heap->storage = storage;
- heap->block_size = block_size;
- heap->compact_size = 0;
- heap->segments_list = NULL;
- zend_mm_init(heap);
-# if ZEND_MM_CACHE_STAT
- memset(heap->cache_stat, 0, sizeof(heap->cache_stat));
-# endif
-
- heap->use_zend_alloc = 1;
- heap->real_size = 0;
- heap->overflow = 0;
- heap->real_peak = 0;
- heap->limit = ZEND_MM_INT_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2);
- heap->size = 0;
- heap->peak = 0;
- heap->internal = internal;
- heap->reserve = NULL;
- heap->reserve_size = reserve_size;
- if (reserve_size > 0) {
- heap->reserve = _zend_mm_alloc_int(heap, reserve_size ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
- }
- if (internal) {
- int i;
- zend_mm_free_block *p, *q, *orig;
- zend_mm_heap *mm_heap = _zend_mm_alloc_int(heap, sizeof(zend_mm_heap) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
-
- *mm_heap = *heap;
-
- p = ZEND_MM_SMALL_FREE_BUCKET(mm_heap, 0);
- orig = ZEND_MM_SMALL_FREE_BUCKET(heap, 0);
- for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) {
- q = p;
- while (q->prev_free_block != orig) {
- q = q->prev_free_block;
}
- q->prev_free_block = p;
- q = p;
- while (q->next_free_block != orig) {
- q = q->next_free_block;
- }
- q->next_free_block = p;
- p = (zend_mm_free_block*)((char*)p + sizeof(zend_mm_free_block*) * 2);
- orig = (zend_mm_free_block*)((char*)orig + sizeof(zend_mm_free_block*) * 2);
- if (mm_heap->large_free_buckets[i]) {
- mm_heap->large_free_buckets[i]->parent = &mm_heap->large_free_buckets[i];
+ heap->chunks_count++;
+ if (heap->chunks_count > heap->peak_chunks_count) {
+ heap->peak_chunks_count = heap->chunks_count;
}
+ zend_mm_chunk_init(heap, chunk);
+ page_num = ZEND_MM_FIRST_PAGE;
+ len = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
+ goto found;
+ } else {
+ chunk = chunk->next;
}
- mm_heap->rest_buckets[0] = mm_heap->rest_buckets[1] = ZEND_MM_REST_BUCKET(mm_heap);
- mm_heap->rest_count = 0;
+ }
- free(heap);
- heap = mm_heap;
+found:
+ /* mark run as allocated */
+ chunk->free_pages -= pages_count;
+ zend_mm_bitset_set_range(chunk->free_map, page_num, pages_count);
+ chunk->map[page_num] = ZEND_MM_LRUN(pages_count);
+ if (page_num == chunk->free_tail) {
+ chunk->free_tail = page_num + pages_count;
}
- return heap;
+ return ZEND_MM_PAGE_ADDR(chunk, page_num);
}
-ZEND_API zend_mm_heap *zend_mm_startup(void)
+static zend_always_inline void *zend_mm_alloc_large(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- int i;
- size_t seg_size;
- char *mem_type = getenv("ZEND_MM_MEM_TYPE");
- char *tmp;
- const zend_mm_mem_handlers *handlers;
- zend_mm_heap *heap;
-
- if (mem_type == NULL) {
- i = 0;
- } else {
- for (i = 0; mem_handlers[i].name; i++) {
- if (strcmp(mem_handlers[i].name, mem_type) == 0) {
- break;
- }
- }
- if (!mem_handlers[i].name) {
- fprintf(stderr, "Wrong or unsupported zend_mm storage type '%s'\n", mem_type);
- fprintf(stderr, " supported types:\n");
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+ int pages_count = ZEND_MM_SIZE_TO_NUM(size, ZEND_MM_PAGE_SIZE);
+#if ZEND_DEBUG
+ void *ptr = zend_mm_alloc_pages(heap, pages_count, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ void *ptr = zend_mm_alloc_pages(heap, pages_count ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
#endif
- for (i = 0; mem_handlers[i].name; i++) {
- fprintf(stderr, " '%s'\n", mem_handlers[i].name);
- }
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+#if ZEND_MM_STAT
+ do {
+ size_t size = heap->size + pages_count * ZEND_MM_PAGE_SIZE;
+ size_t peak = MAX(heap->peak, size);
+ heap->size = size;
+ heap->peak = peak;
+ } while (0);
#endif
- exit(255);
- }
- }
- handlers = &mem_handlers[i];
+ return ptr;
+}
- tmp = getenv("ZEND_MM_SEG_SIZE");
- if (tmp) {
- seg_size = zend_atoi(tmp, 0);
- if (zend_mm_low_bit(seg_size) != zend_mm_high_bit(seg_size)) {
- fprintf(stderr, "ZEND_MM_SEG_SIZE must be a power of two\n");
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
-#endif
- exit(255);
- } else if (seg_size < ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE) {
- fprintf(stderr, "ZEND_MM_SEG_SIZE is too small\n");
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+static void zend_mm_free_pages(zend_mm_heap *heap, zend_mm_chunk *chunk, int page_num, int pages_count)
+{
+ chunk->free_pages += pages_count;
+ zend_mm_bitset_reset_range(chunk->free_map, page_num, pages_count);
+ chunk->map[page_num] = 0;
+ if (chunk->free_tail == page_num + pages_count) {
+ /* this setting may be not accurate */
+ chunk->free_tail = page_num;
+ }
+ if (chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
+ /* delete chunk */
+ chunk->next->prev = chunk->prev;
+ chunk->prev->next = chunk->next;
+ heap->chunks_count--;
+ if (heap->chunks_count + heap->cached_chunks_count < heap->avg_chunks_count + 0.1) {
+ /* delay deletion */
+ heap->cached_chunks_count++;
+ chunk->next = heap->cached_chunks;
+ heap->cached_chunks = chunk;
+ } else {
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size -= ZEND_MM_CHUNK_SIZE;
#endif
- exit(255);
+ if (!heap->cached_chunks || chunk->num > heap->cached_chunks->num) {
+ zend_mm_chunk_free(heap, chunk, ZEND_MM_CHUNK_SIZE);
+ } else {
+//TODO: select the best chunk to delete???
+ chunk->next = heap->cached_chunks->next;
+ zend_mm_chunk_free(heap, heap->cached_chunks, ZEND_MM_CHUNK_SIZE);
+ heap->cached_chunks = chunk;
+ }
}
- } else {
- seg_size = ZEND_MM_SEG_SIZE;
}
+}
- heap = zend_mm_startup_ex(handlers, seg_size, ZEND_MM_RESERVE_SIZE, 0, NULL);
- if (heap) {
- tmp = getenv("ZEND_MM_COMPACT");
- if (tmp) {
- heap->compact_size = zend_atoi(tmp, 0);
- } else {
- heap->compact_size = 2 * 1024 * 1024;
- }
- }
- return heap;
+static zend_always_inline void zend_mm_free_large(zend_mm_heap *heap, zend_mm_chunk *chunk, int page_num, int pages_count)
+{
+#if ZEND_MM_STAT
+ heap->size -= pages_count * ZEND_MM_PAGE_SIZE;
+#endif
+ zend_mm_free_pages(heap, chunk, page_num, pages_count);
}
-#if ZEND_DEBUG
-static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
+/**************/
+/* Small Runs */
+/**************/
+
+/* higher set bit number (0->N/A, 1->1, 2->2, 4->3, 8->4, 127->7, 128->8 etc) */
+static zend_always_inline int zend_mm_small_size_to_bit(int size)
{
- zend_int_t leaks = 0;
- zend_mm_block *p, *q;
+#if defined(__GNUC__)
+ return (__builtin_clz(size) ^ 0x1f) + 1;
+#elif defined(_WIN32)
+ unsigned long index;
- p = ZEND_MM_NEXT_BLOCK(b);
- while (1) {
- if (ZEND_MM_IS_GUARD_BLOCK(p)) {
- ZEND_MM_CHECK_MAGIC(p, MEM_BLOCK_GUARD);
- segment = segment->next_segment;
- if (!segment) {
- break;
- }
- p = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- continue;
- }
- q = ZEND_MM_NEXT_BLOCK(p);
- if (q <= p ||
- (char*)q > (char*)segment + segment->size ||
- p->info._size != q->info._prev) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- if (!ZEND_MM_IS_FREE_BLOCK(p)) {
- if (p->magic == MEM_BLOCK_VALID) {
- if (p->debug.filename==b->debug.filename && p->debug.lineno==b->debug.lineno) {
- ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK);
- leaks++;
- }
-#if ZEND_MM_CACHE
- } else if (p->magic == MEM_BLOCK_CACHED) {
- /* skip it */
-#endif
- } else if (p->magic != MEM_BLOCK_LEAK) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- }
- p = q;
+ if (!BitScanReverse(&index, (unsigned long)size)) {
+ /* undefined behavior */
+ return 64;
}
- return leaks;
+
+ return (((31 - (int)index) ^ 0x1f) + 1);
+#else
+ int n = 16;
+ if (size <= 0x00ff) {n -= 8; size = size << 8;}
+ if (size <= 0x0fff) {n -= 4; size = size << 4;}
+ if (size <= 0x3fff) {n -= 2; size = size << 2;}
+ if (size <= 0x7fff) {n -= 1;}
+ return n;
+#endif
}
-static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
+#ifndef MAX
+# define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+# define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+static zend_always_inline int zend_mm_small_size_to_bin(size_t size)
{
- zend_mm_segment *segment = heap->segments_list;
- zend_mm_block *p, *q;
- zend_uint total = 0;
+#if 0
+ int n;
+ /*0, 1, 2, 3, 4, 5, 6, 7, 8, 9 10, 11, 12*/
+ static const int f1[] = { 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9};
+ static const int f2[] = { 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 16, 20, 24};
+
+ if (UNEXPECTED(size <= 2)) return 0;
+ n = zend_mm_small_size_to_bit(size - 1);
+ return ((size-1) >> f1[n]) + f2[n];
+#else
+ int t1, t2, t3;
- if (!segment) {
- return;
- }
- p = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- while (1) {
- q = ZEND_MM_NEXT_BLOCK(p);
- if (q <= p ||
- (char*)q > (char*)segment + segment->size ||
- p->info._size != q->info._prev) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- if (!ZEND_MM_IS_FREE_BLOCK(p)) {
- if (p->magic == MEM_BLOCK_VALID) {
- zend_int_t repeated;
- zend_leak_info leak;
-
- ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK);
-
- leak.addr = ZEND_MM_DATA_OF(p);
- leak.size = p->debug.size;
- leak.filename = p->debug.filename;
- leak.lineno = p->debug.lineno;
- leak.orig_filename = p->debug.orig_filename;
- leak.orig_lineno = p->debug.orig_lineno;
-
- zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
- repeated = zend_mm_find_leaks(segment, p);
- total += 1 + repeated;
- if (repeated) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
- }
-#if ZEND_MM_CACHE
- } else if (p->magic == MEM_BLOCK_CACHED) {
- /* skip it */
+ if (UNEXPECTED(size <= 8)) return 0;
+ t1 = (int)(size - 1);
+ t2 = zend_mm_small_size_to_bit(t1);
+ t3 = t2 - 6;
+ t3 = (t3 < 0) ? 0 : t3;
+ t2 = t3 + 3;
+ t1 = t1 >> t2;
+ t3 = t3 << 2;
+ return t1 + t3;
#endif
- } else if (p->magic != MEM_BLOCK_LEAK) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- }
- if (ZEND_MM_IS_GUARD_BLOCK(q)) {
- segment = segment->next_segment;
- if (!segment) {
- break;
- }
- q = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- }
- p = q;
- }
- if (total) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total TSRMLS_CC);
- }
}
-static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+#define ZEND_MM_SMALL_SIZE_TO_BIN(size) zend_mm_small_size_to_bin(size)
+
+static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap, int bin_num ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mm_block *p;
- int no_cache_notice = 0;
- int had_problems = 0;
- int valid_beginning = 1;
+ zend_mm_chunk *chunk;
+ int page_num;
+ zend_mm_bin *bin;
+ zend_mm_free_slot *p, *end;
- if (silent==2) {
- silent = 1;
- no_cache_notice = 1;
- } else if (silent==3) {
- silent = 0;
- no_cache_notice = 1;
- }
- if (!silent) {
- TSRMLS_FETCH();
-
- zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
- zend_debug_alloc_output("---------------------------------------\n");
- zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr);
- if (__zend_orig_filename) {
- zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- if (!ptr) {
- zend_debug_alloc_output("NULL\n");
- zend_debug_alloc_output("---------------------------------------\n");
- return 0;
- }
+#if ZEND_DEBUG
+ bin = (zend_mm_bin*)zend_mm_alloc_pages(heap, bin_pages[bin_num], bin_data_size[bin_num] ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ bin = (zend_mm_bin*)zend_mm_alloc_pages(heap, bin_pages[bin_num] ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#endif
+ if (UNEXPECTED(bin == NULL)) {
+ /* insufficient memory */
+ return NULL;
}
- if (!ptr) {
- if (silent) {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
+ chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(bin, ZEND_MM_CHUNK_SIZE);
+ page_num = ZEND_MM_ALIGNED_OFFSET(bin, ZEND_MM_CHUNK_SIZE) / ZEND_MM_PAGE_SIZE;
+ chunk->map[page_num] = ZEND_MM_SRUN(bin_num);
+ if (bin_pages[bin_num] > 1) {
+ int i = 1;
+ do {
+ chunk->map[page_num+i] = ZEND_MM_SRUN(bin_num);
+ i++;
+ } while (i < bin_pages[bin_num]);
}
- p = ZEND_MM_HEADER_OF(ptr);
-
-#ifdef ZTS
- if (ZEND_MM_BAD_THREAD_ID(p)) {
- if (!silent) {
- zend_debug_alloc_output("Invalid pointer: ((thread_id=0x%0.8X) != (expected=0x%0.8X))\n", (zend_int_t)p->thread_id, (zend_int_t)tsrm_thread_id());
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
+ /* create a linked list of elements from 1 to last */
+ end = (zend_mm_free_slot*)((char*)bin + (bin_data_size[bin_num] * (bin_elements[bin_num] - 1)));
+ heap->free_slot[bin_num] = p = (zend_mm_free_slot*)((char*)bin + bin_data_size[bin_num]);
+ do {
+ p->next_free_slot = (zend_mm_free_slot*)((char*)p + bin_data_size[bin_num]);;
+#if ZEND_DEBUG
+ do {
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + bin_data_size[bin_num] - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+ dbg->size = 0;
+ } while (0);
#endif
+ p = (zend_mm_free_slot*)((char*)p + bin_data_size[bin_num]);
+ } while (p != end);
- if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) {
- if (!silent) {
- zend_debug_alloc_output("Invalid pointer: ((size="PTR_FMT") != (next.prev="PTR_FMT"))\n", p->info._size, ZEND_MM_NEXT_BLOCK(p)->info._prev);
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
- if (p->info._prev != ZEND_MM_GUARD_BLOCK &&
- ZEND_MM_PREV_BLOCK(p)->info._size != p->info._prev) {
- if (!silent) {
- zend_debug_alloc_output("Invalid pointer: ((prev="PTR_FMT") != (prev.size="PTR_FMT"))\n", p->info._prev, ZEND_MM_PREV_BLOCK(p)->info._size);
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
+ /* terminate list using NULL */
+ p->next_free_slot = NULL;
+#if ZEND_DEBUG
+ do {
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + bin_data_size[bin_num] - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+ dbg->size = 0;
+ } while (0);
+#endif
- if (had_problems) {
- zend_debug_alloc_output("---------------------------------------\n");
- return 0;
- }
+ /* return first element */
+ return (char*)bin;
+}
- if (!silent) {
- zend_debug_alloc_output("%10s\t","Beginning: ");
- }
+static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, size_t size, int bin_num ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+#if ZEND_MM_STAT
+ do {
+ size_t size = heap->size + bin_data_size[bin_num];
+ size_t peak = MAX(heap->peak, size);
+ heap->size = size;
+ heap->peak = peak;
+ } while (0);
+#endif
- if (!ZEND_MM_IS_USED_BLOCK(p)) {
- if (!silent) {
- if (p->magic != MEM_BLOCK_FREED) {
- zend_debug_alloc_output("Freed (magic=0x%0.8X, expected=0x%0.8X)\n", p->magic, MEM_BLOCK_FREED);
- } else {
- zend_debug_alloc_output("Freed\n");
- }
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- } else if (ZEND_MM_IS_GUARD_BLOCK(p)) {
- if (!silent) {
- if (p->magic != MEM_BLOCK_FREED) {
- zend_debug_alloc_output("Guard (magic=0x%0.8X, expected=0x%0.8X)\n", p->magic, MEM_BLOCK_FREED);
- } else {
- zend_debug_alloc_output("Guard\n");
- }
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
+ if (EXPECTED(heap->free_slot[bin_num] != NULL)) {
+ zend_mm_free_slot *p = heap->free_slot[bin_num];
+ heap->free_slot[bin_num] = p->next_free_slot;
+ return (void*)p;
} else {
- switch (p->magic) {
- case MEM_BLOCK_VALID:
- case MEM_BLOCK_LEAK:
- if (!silent) {
- zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->debug.filename, p->debug.lineno, (int)p->debug.size);
- }
- break; /* ok */
- case MEM_BLOCK_CACHED:
- if (!no_cache_notice) {
- if (!silent) {
- zend_debug_alloc_output("Cached\n");
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- }
- case MEM_BLOCK_FREED:
- if (!silent) {
- zend_debug_alloc_output("Freed (invalid)\n");
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- break;
- case MEM_BLOCK_GUARD:
- if (!silent) {
- zend_debug_alloc_output("Guard (invalid)\n");
- had_problems = 1;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- break;
- default:
- if (!silent) {
- zend_debug_alloc_output("Unknown (magic=0x%0.8X, expected=0x%0.8X)\n", p->magic, MEM_BLOCK_VALID);
- had_problems = 1;
- valid_beginning = 0;
- } else {
- return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- break;
- }
+ return zend_mm_alloc_small_slow(heap, bin_num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
+}
-#if ZEND_MM_HEAP_PROTECTION
- if (!valid_beginning) {
- if (!silent) {
- zend_debug_alloc_output("%10s\t", "Start:");
- zend_debug_alloc_output("Unknown\n");
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("Unknown\n");
- }
- } else {
- char *end_magic = ZEND_MM_END_MAGIC_PTR(p);
+static zend_always_inline void zend_mm_free_small(zend_mm_heap *heap, void *ptr, int bin_num)
+{
+ zend_mm_free_slot *p;
- if (p->debug.start_magic == _mem_block_start_magic) {
- if (!silent) {
- zend_debug_alloc_output("%10s\t", "Start:");
- zend_debug_alloc_output("OK\n");
- }
- } else {
- char *overflow_ptr, *magic_ptr=(char *) &_mem_block_start_magic;
- int overflows=0;
- int i;
+#if ZEND_MM_STAT
+ heap->size -= bin_data_size[bin_num];
+#endif
- if (silent) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- overflow_ptr = (char *) &p->debug.start_magic;
- i = END_MAGIC_SIZE;
- while (--i >= 0) {
- if (overflow_ptr[i]!=magic_ptr[i]) {
- overflows++;
- }
- }
- zend_debug_alloc_output("%10s\t", "Start:");
- zend_debug_alloc_output("Overflown (magic=0x%0.8X instead of 0x%0.8X)\n", p->debug.start_magic, _mem_block_start_magic);
- zend_debug_alloc_output("%10s\t","");
- if (overflows >= END_MAGIC_SIZE) {
- zend_debug_alloc_output("At least %d bytes overflown\n", END_MAGIC_SIZE);
- } else {
- zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
- }
- }
- if (memcmp(end_magic, &_mem_block_end_magic, END_MAGIC_SIZE)==0) {
- if (!silent) {
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("OK\n");
- }
- } else {
- char *overflow_ptr, *magic_ptr=(char *) &_mem_block_end_magic;
- int overflows=0;
- int i;
+#if ZEND_DEBUG
+ do {
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)ptr + bin_data_size[bin_num] - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+ dbg->size = 0;
+ } while (0);
+#endif
- if (silent) {
- return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
- had_problems = 1;
- overflow_ptr = (char *) end_magic;
+ p = (zend_mm_free_slot*)ptr;
+ p->next_free_slot = heap->free_slot[bin_num];
+ heap->free_slot[bin_num] = p;
+}
- for (i=0; i < END_MAGIC_SIZE; i++) {
- if (overflow_ptr[i]!=magic_ptr[i]) {
- overflows++;
- }
- }
+/********/
+/* Heap */
+/********/
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("Overflown (magic=0x%0.8X instead of 0x%0.8X)\n", *end_magic, _mem_block_end_magic);
- zend_debug_alloc_output("%10s\t","");
- if (overflows >= END_MAGIC_SIZE) {
- zend_debug_alloc_output("At least %d bytes overflown\n", END_MAGIC_SIZE);
- } else {
- zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
- }
- }
- }
-#endif
+#if ZEND_DEBUG
+static zend_always_inline zend_mm_debug_info *zend_mm_get_debug_info(zend_mm_heap *heap, void *ptr)
+{
+ size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
+ zend_mm_chunk *chunk;
+ int page_num;
+ zend_mm_page_info info;
- if (!silent) {
- zend_debug_alloc_output("---------------------------------------\n");
+ ZEND_MM_CHECK(page_offset != 0, "zend_mm_heap corrupted");
+ chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
+ page_num = page_offset / ZEND_MM_PAGE_SIZE;
+ info = chunk->map[page_num];
+ ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
+ if (EXPECTED(info & ZEND_MM_IS_SRUN)) {
+ int bin_num = ZEND_MM_SRUN_BIN_NUM(info);
+ return (zend_mm_debug_info*)((char*)ptr + bin_data_size[bin_num] - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+ } else /* if (info & ZEND_MM_IS_LRUN) */ {
+ int pages_count = ZEND_MM_LRUN_PAGES(info);
+
+ return (zend_mm_debug_info*)((char*)ptr + ZEND_MM_PAGE_SIZE * pages_count - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
}
- return ((!had_problems) ? 1 : 0);
}
+#endif
-static int zend_mm_check_heap(zend_mm_heap *heap, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static zend_always_inline void *zend_mm_alloc_heap(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mm_segment *segment = heap->segments_list;
- zend_mm_block *p, *q;
- int errors = 0;
+ void *ptr;
+#if ZEND_DEBUG
+ size_t real_size = size;
+ zend_mm_debug_info *dbg;
- if (!segment) {
- return 0;
- }
- p = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- while (1) {
- q = ZEND_MM_NEXT_BLOCK(p);
- if (q <= p ||
- (char*)q > (char*)segment + segment->size ||
- p->info._size != q->info._prev) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- if (!ZEND_MM_IS_FREE_BLOCK(p)) {
- if (p->magic == MEM_BLOCK_VALID || p->magic == MEM_BLOCK_LEAK) {
- if (!zend_mm_check_ptr(heap, ZEND_MM_DATA_OF(p), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) {
- errors++;
- }
-#if ZEND_MM_CACHE
- } else if (p->magic == MEM_BLOCK_CACHED) {
- /* skip it */
+ /* special handling for zero-size allocation */
+ size = MAX(size, 1);
+ size = ZEND_MM_ALIGNED_SIZE(size) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info));
#endif
- } else if (p->magic != MEM_BLOCK_LEAK) {
- zend_mm_panic("zend_mm_heap corrupted");
- }
- }
- if (ZEND_MM_IS_GUARD_BLOCK(q)) {
- segment = segment->next_segment;
- if (!segment) {
- return errors;
- }
- q = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- }
- p = q;
+ if (size <= ZEND_MM_MAX_SMALL_SIZE) {
+ ptr = zend_mm_alloc_small(heap, size, ZEND_MM_SMALL_SIZE_TO_BIN(size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
+ } else if (size <= ZEND_MM_MAX_LARGE_SIZE) {
+ ptr = zend_mm_alloc_large(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
+ } else {
+#if ZEND_DEBUG
+ size = real_size;
+#endif
+ return zend_mm_alloc_huge(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
}
-#endif
-ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC)
+static zend_always_inline void zend_mm_free_heap(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mm_storage *storage;
- zend_mm_segment *segment;
- zend_mm_segment *prev;
- int internal;
+ size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
- if (!heap->use_zend_alloc) {
- if (full_shutdown) {
- free(heap);
+ if (UNEXPECTED(page_offset == 0)) {
+ if (ptr != NULL) {
+ zend_mm_free_huge(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
- return;
- }
+ } else {
+ zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
+ int page_num = page_offset / ZEND_MM_PAGE_SIZE;
+ zend_mm_page_info info = chunk->map[page_num];
- if (heap->reserve) {
-#if ZEND_DEBUG
- if (!silent) {
- _zend_mm_free_int(heap, heap->reserve ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
+ ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
+ if (EXPECTED(info & ZEND_MM_IS_SRUN)) {
+ zend_mm_free_small(heap, ptr, ZEND_MM_SRUN_BIN_NUM(info));
+ } else /* if (info & ZEND_MM_IS_LRUN) */ {
+ int pages_count = ZEND_MM_LRUN_PAGES(info);
+
+ ZEND_MM_CHECK(ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
+ zend_mm_free_large(heap, chunk, page_num, pages_count);
}
-#endif
- heap->reserve = NULL;
}
+}
-#if ZEND_MM_CACHE_STAT
- if (full_shutdown) {
- FILE *f;
+static size_t zend_mm_size(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
- f = fopen("zend_mm.log", "w");
- if (f) {
- int i,j;
- size_t size, true_size, min_size, max_size;
- int hit = 0, miss = 0;
+ if (UNEXPECTED(page_offset == 0)) {
+ return zend_mm_get_huge_block_size(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ } else {
+ zend_mm_chunk *chunk;
+#if 0 && ZEND_DEBUG
+ zend_mm_debug_info *dbg = zend_mm_get_debug_info(heap, ptr);
+ return dbg->size;
+#else
+ int page_num;
+ zend_mm_page_info info;
- fprintf(f, "\nidx min_size max_size true_size max_len hits misses\n");
- size = 0;
- while (1) {
- true_size = ZEND_MM_TRUE_SIZE(size);
- if (ZEND_MM_SMALL_SIZE(true_size)) {
- min_size = size;
- i = ZEND_MM_BUCKET_INDEX(true_size);
- size++;
- while (1) {
- true_size = ZEND_MM_TRUE_SIZE(size);
- if (ZEND_MM_SMALL_SIZE(true_size)) {
- j = ZEND_MM_BUCKET_INDEX(true_size);
- if (j > i) {
- max_size = size-1;
- break;
- }
- } else {
- max_size = size-1;
- break;
- }
- size++;
- }
- hit += heap->cache_stat[i].hit;
- miss += heap->cache_stat[i].miss;
- fprintf(f, "%2d %8d %8d %9d %8d %8d %8d\n", i, (int)min_size, (int)max_size, ZEND_MM_TRUE_SIZE(max_size), heap->cache_stat[i].max_count, heap->cache_stat[i].hit, heap->cache_stat[i].miss);
- } else {
- break;
- }
- }
- fprintf(f, " %8d %8d\n", hit, miss);
- fprintf(f, " %8d %8d\n", heap->cache_stat[ZEND_MM_NUM_BUCKETS].hit, heap->cache_stat[ZEND_MM_NUM_BUCKETS].miss);
- fclose(f);
+ chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
+ page_num = page_offset / ZEND_MM_PAGE_SIZE;
+ info = chunk->map[page_num];
+ ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
+ if (EXPECTED(info & ZEND_MM_IS_SRUN)) {
+ return bin_data_size[ZEND_MM_SRUN_BIN_NUM(info)];
+ } else /* if (info & ZEND_MM_IS_LARGE_RUN) */ {
+ return ZEND_MM_LRUN_PAGES(info) * ZEND_MM_PAGE_SIZE;
}
- }
#endif
+ }
+}
+static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ size_t page_offset;
+ size_t old_size;
+ size_t new_size;
+ void *ret;
#if ZEND_DEBUG
- if (!silent) {
- zend_mm_check_leaks(heap TSRMLS_CC);
- }
+ size_t real_size;
+ zend_mm_debug_info *dbg;
#endif
- internal = heap->internal;
- storage = heap->storage;
- segment = heap->segments_list;
- if (full_shutdown) {
- while (segment) {
- prev = segment;
- segment = segment->next_segment;
- ZEND_MM_STORAGE_FREE(prev);
+ page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
+ if (UNEXPECTED(page_offset == 0)) {
+ if (UNEXPECTED(ptr == NULL)) {
+ return zend_mm_alloc_heap(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
- heap->segments_list = NULL;
- storage->handlers->dtor(storage);
- if (!internal) {
- free(heap);
- }
- } else {
- if (segment) {
-#ifndef ZEND_WIN32
- if (heap->reserve_size) {
- while (segment->next_segment) {
- prev = segment;
- segment = segment->next_segment;
- ZEND_MM_STORAGE_FREE(prev);
- }
- heap->segments_list = segment;
- } else {
+ old_size = zend_mm_get_huge_block_size(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#if ZEND_DEBUG
+ real_size = size;
+ size = ZEND_MM_ALIGNED_SIZE(size) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info));
#endif
- do {
- prev = segment;
- segment = segment->next_segment;
- ZEND_MM_STORAGE_FREE(prev);
- } while (segment);
- heap->segments_list = NULL;
-#ifndef ZEND_WIN32
- }
+ if (size > ZEND_MM_MAX_LARGE_SIZE) {
+#if ZEND_DEBUG
+ size = real_size;
#endif
- }
- if (heap->compact_size &&
- heap->real_peak > heap->compact_size) {
- storage->handlers->compact(storage);
- }
- zend_mm_init(heap);
- if (heap->segments_list) {
- heap->real_size = heap->segments_list->size;
- heap->real_peak = heap->segments_list->size;
- } else {
- heap->real_size = 0;
- heap->real_peak = 0;
- }
- heap->size = 0;
- heap->peak = 0;
- if (heap->segments_list) {
- /* mark segment as a free block */
- zend_mm_free_block *b = (zend_mm_free_block*)((char*)heap->segments_list + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- size_t block_size = heap->segments_list->size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_HEADER_SIZE;
-
- ZEND_MM_MARK_FIRST_BLOCK(b);
- ZEND_MM_LAST_BLOCK(ZEND_MM_BLOCK_AT(b, block_size));
- ZEND_MM_BLOCK(b, ZEND_MM_FREE_BLOCK, block_size);
- zend_mm_add_to_free_list(heap, b);
- }
- if (heap->reserve_size) {
- heap->reserve = _zend_mm_alloc_int(heap, heap->reserve_size ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
- }
- heap->overflow = 0;
- }
-}
-
-static void zend_mm_safe_error(zend_mm_heap *heap,
- const char *format,
- size_t limit,
+ new_size = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE);
+ if (new_size == old_size) {
#if ZEND_DEBUG
- const char *filename,
- uint lineno,
+ zend_mm_change_huge_block_size(heap, ptr, new_size, real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ zend_mm_change_huge_block_size(heap, ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#endif
+ return ptr;
+#ifndef _WIN32
+ } else if (new_size < old_size) {
+ /* unmup tail */
+ zend_mm_chunk_truncate(heap, ptr, old_size, new_size);
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size -= old_size - new_size;
+#endif
+#if ZEND_MM_STAT
+ heap->size -= old_size - new_size;
#endif
- size_t size)
-{
- if (heap->reserve) {
- _zend_mm_free_int(heap, heap->reserve ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC);
- heap->reserve = NULL;
- }
- if (heap->overflow == 0) {
- const char *error_filename;
- uint error_lineno;
- TSRMLS_FETCH();
- if (zend_is_compiling(TSRMLS_C)) {
- zend_string *str = zend_get_compiled_filename(TSRMLS_C);
- error_filename = str ? str->val : NULL;
- error_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (EG(current_execute_data)) {
- zend_execute_data *ex = EG(current_execute_data);
-
- while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
- ex = ex->prev_execute_data;
- }
- if (ex) {
- error_filename = ex->func->op_array.filename->val;
- error_lineno = ex->opline->lineno;
- } else {
- error_filename = NULL;
- error_lineno = 0;
- }
- } else {
- error_filename = NULL;
- error_lineno = 0;
- }
- if (!error_filename) {
- error_filename = "Unknown";
- }
- heap->overflow = 1;
- zend_try {
- zend_error_noreturn(E_ERROR,
- format,
- limit,
#if ZEND_DEBUG
- filename,
- lineno,
-#endif
- size);
- } zend_catch {
- if (heap->overflow == 2) {
- fprintf(stderr, "\nFatal error: ");
- fprintf(stderr,
- format,
- limit,
+ zend_mm_change_huge_block_size(heap, ptr, new_size, real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ zend_mm_change_huge_block_size(heap, ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#endif
+ return ptr;
+ } else /* if (new_size > old_size) */ {
+#if ZEND_MM_LIMIT
+ if (heap->real_size + (new_size - old_size) > heap->limit) {
+ if (heap->overflow == 0) {
#if ZEND_DEBUG
- filename,
- lineno,
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+#else
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size);
#endif
- size);
- fprintf(stderr, " in %s on line %d\n", error_filename, error_lineno);
- }
-/* See http://support.microsoft.com/kb/190351 */
-#ifdef PHP_WIN32
- fflush(stderr);
+ return NULL;
+ }
+ }
#endif
- } zend_end_try();
+ /* try to map tail right after this block */
+ if (zend_mm_mmap_fixed((char*)ptr + old_size, new_size - old_size)) {
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size += new_size - old_size;
+#endif
+#if ZEND_MM_STAT
+ heap->size += new_size - old_size;
+#endif
+#if ZEND_DEBUG
+ zend_mm_change_huge_block_size(heap, ptr, new_size, real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ zend_mm_change_huge_block_size(heap, ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#endif
+ return ptr;
+ }
+#endif
+ }
+ }
} else {
- heap->overflow = 2;
- }
- zend_bailout();
-}
+ zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
+ int page_num = page_offset / ZEND_MM_PAGE_SIZE;
+ zend_mm_page_info info = chunk->map[page_num];
+#if ZEND_DEBUG
+ size_t real_size = size;
-static zend_mm_free_block *zend_mm_search_large_block(zend_mm_heap *heap, size_t true_size)
-{
- zend_mm_free_block *best_fit;
- size_t index = ZEND_MM_LARGE_BUCKET_INDEX(true_size);
- size_t bitmap = heap->large_free_bitmap >> index;
- zend_mm_free_block *p;
+ size = ZEND_MM_ALIGNED_SIZE(size) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info));
+#endif
- if (bitmap == 0) {
- return NULL;
- }
+ ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
+ if (info & ZEND_MM_IS_SRUN) {
+ int old_bin_num, bin_num;
- if (UNEXPECTED((bitmap & 1) != 0)) {
- /* Search for best "large" free block */
- zend_mm_free_block *rst = NULL;
- size_t m;
- size_t best_size = -1;
-
- best_fit = NULL;
- p = heap->large_free_buckets[index];
- for (m = true_size << (ZEND_MM_NUM_BUCKETS - index); ; m <<= 1) {
- if (UNEXPECTED(ZEND_MM_FREE_BLOCK_SIZE(p) == true_size)) {
- return p->next_free_block;
- } else if (ZEND_MM_FREE_BLOCK_SIZE(p) >= true_size &&
- ZEND_MM_FREE_BLOCK_SIZE(p) < best_size) {
- best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
- best_fit = p;
+ old_bin_num = ZEND_MM_SRUN_BIN_NUM(info);
+ old_size = bin_data_size[old_bin_num];
+ bin_num = ZEND_MM_SMALL_SIZE_TO_BIN(size);
+ if (old_bin_num == bin_num) {
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
}
- if ((m & (ZEND_MM_INT_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) {
- if (p->child[1]) {
- rst = p->child[1];
- }
- if (p->child[0]) {
- p = p->child[0];
- } else {
- break;
+ } else /* if (info & ZEND_MM_IS_LARGE_RUN) */ {
+ ZEND_MM_CHECK(ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
+ old_size = ZEND_MM_LRUN_PAGES(info) * ZEND_MM_PAGE_SIZE;
+ if (size > ZEND_MM_MAX_SMALL_SIZE && size <= ZEND_MM_MAX_LARGE_SIZE) {
+ new_size = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE);
+ if (new_size == old_size) {
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
+ } else if (new_size < old_size) {
+ /* free tail pages */
+ int new_pages_count = new_size / ZEND_MM_PAGE_SIZE;
+ int rest_pages_count = (old_size - new_size) / ZEND_MM_PAGE_SIZE;
+
+#if ZEND_MM_STAT
+ heap->size -= rest_pages_count * ZEND_MM_PAGE_SIZE;
+#endif
+ chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
+ chunk->free_pages += rest_pages_count;
+ zend_mm_bitset_reset_range(chunk->free_map, page_num + new_pages_count, rest_pages_count);
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
+ } else /* if (new_size > old_size) */ {
+ int new_pages_count = new_size / ZEND_MM_PAGE_SIZE;
+ int old_pages_count = old_size / ZEND_MM_PAGE_SIZE;
+
+ /* try to allocate tail pages after this block */
+ if (page_num + new_pages_count <= ZEND_MM_PAGES &&
+ zend_mm_bitset_is_free_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pages_count)) {
+#if ZEND_MM_STAT
+ do {
+ size_t size = heap->size + (new_size - old_size);
+ size_t peak = MAX(heap->peak, size);
+ heap->size = size;
+ heap->peak = peak;
+ } while (0);
+#endif
+ chunk->free_pages -= new_pages_count - old_pages_count;
+ zend_mm_bitset_set_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pages_count);
+ chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
+#if ZEND_DEBUG
+ dbg = zend_mm_get_debug_info(heap, ptr);
+ dbg->size = real_size;
+ dbg->filename = __zend_filename;
+ dbg->orig_filename = __zend_orig_filename;
+ dbg->lineno = __zend_lineno;
+ dbg->orig_lineno = __zend_orig_lineno;
+#endif
+ return ptr;
+ }
}
- } else if (p->child[1]) {
- p = p->child[1];
- } else {
- break;
}
}
-
- for (p = rst; p; p = p->child[p->child[0] != NULL]) {
- if (UNEXPECTED(ZEND_MM_FREE_BLOCK_SIZE(p) == true_size)) {
- return p->next_free_block;
- } else if (ZEND_MM_FREE_BLOCK_SIZE(p) > true_size &&
- ZEND_MM_FREE_BLOCK_SIZE(p) < best_size) {
- best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
- best_fit = p;
- }
- }
-
- if (best_fit) {
- return best_fit->next_free_block;
- }
- bitmap = bitmap >> 1;
- if (!bitmap) {
- return NULL;
- }
- index++;
+#if ZEND_DEBUG
+ size = real_size;
+#endif
}
- /* Search for smallest "large" free block */
- best_fit = p = heap->large_free_buckets[index + zend_mm_low_bit(bitmap)];
- while ((p = p->child[p->child[0] != NULL])) {
- if (ZEND_MM_FREE_BLOCK_SIZE(p) < ZEND_MM_FREE_BLOCK_SIZE(best_fit)) {
- best_fit = p;
- }
- }
- return best_fit->next_free_block;
+ /* Naive reallocation */
+ old_size = zend_mm_size(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ ret = zend_mm_alloc_heap(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ memcpy(ret, ptr, MIN(old_size, size));
+ zend_mm_free_heap(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ return ret;
}
-static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- zend_mm_free_block *best_fit;
- size_t true_size = ZEND_MM_TRUE_SIZE(size);
- size_t block_size;
- size_t remaining_size;
- size_t segment_size;
- zend_mm_segment *segment;
- int keep_rest = 0;
-#ifdef ZEND_SIGNALS
- TSRMLS_FETCH();
-#endif
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if (EXPECTED(ZEND_MM_SMALL_SIZE(true_size))) {
- size_t index = ZEND_MM_BUCKET_INDEX(true_size);
- size_t bitmap;
-
- if (UNEXPECTED(true_size < size)) {
- goto out_of_memory;
- }
-#if ZEND_MM_CACHE
- if (EXPECTED(heap->cache[index] != NULL)) {
- /* Get block from cache */
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[index].count--;
- heap->cache_stat[index].hit++;
-#endif
- best_fit = heap->cache[index];
- heap->cache[index] = best_fit->prev_free_block;
- heap->cached -= true_size;
- ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
- ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return ZEND_MM_DATA_OF(best_fit);
- }
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[index].miss++;
-#endif
-#endif
-
- bitmap = heap->free_bitmap >> index;
- if (bitmap) {
- /* Found some "small" free block that can be used */
- index += zend_mm_low_bit(bitmap);
- best_fit = heap->free_buckets[index*2];
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[ZEND_MM_NUM_BUCKETS].hit++;
-#endif
- goto zend_mm_finished_searching_for_block;
- }
- }
+/*********************/
+/* Huge Runs (again) */
+/*********************/
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[ZEND_MM_NUM_BUCKETS].miss++;
+#if ZEND_DEBUG
+static void zend_mm_add_huge_block(zend_mm_heap *heap, void *ptr, size_t size, size_t dbg_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+#else
+static void zend_mm_add_huge_block(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#endif
+{
+ zend_mm_huge_list *list = (zend_mm_huge_list*)zend_mm_alloc_heap(heap, sizeof(zend_mm_huge_list) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ list->ptr = ptr;
+ list->size = size;
+ list->next = heap->huge_list;
+#if ZEND_DEBUG
+ list->dbg.size = dbg_size;
+ list->dbg.filename = __zend_filename;
+ list->dbg.orig_filename = __zend_orig_filename;
+ list->dbg.lineno = __zend_lineno;
+ list->dbg.orig_lineno = __zend_orig_lineno;
+#endif
+ heap->huge_list = list;
+}
- best_fit = zend_mm_search_large_block(heap, true_size);
-
- if (!best_fit && heap->real_size >= heap->limit - heap->block_size) {
- zend_mm_free_block *p = heap->rest_buckets[0];
- size_t best_size = -1;
+static size_t zend_mm_del_huge_block(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ zend_mm_huge_list *prev = NULL;
+ zend_mm_huge_list *list = heap->huge_list;
+ while (list != NULL) {
+ if (list->ptr == ptr) {
+ size_t size;
- while (p != ZEND_MM_REST_BUCKET(heap)) {
- if (UNEXPECTED(ZEND_MM_FREE_BLOCK_SIZE(p) == true_size)) {
- best_fit = p;
- goto zend_mm_finished_searching_for_block;
- } else if (ZEND_MM_FREE_BLOCK_SIZE(p) > true_size &&
- ZEND_MM_FREE_BLOCK_SIZE(p) < best_size) {
- best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
- best_fit = p;
+ if (prev) {
+ prev->next = list->next;
+ } else {
+ heap->huge_list = list->next;
}
- p = p->prev_free_block;
+ size = list->size;
+ zend_mm_free_heap(heap, list ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ return size;
}
+ prev = list;
+ list = list->next;
}
+ ZEND_MM_CHECK(0, "zend_mm_heap corrupted");
+ return 0;
+}
- if (!best_fit) {
- if (true_size > heap->block_size - (ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE)) {
- /* Make sure we add a memory block which is big enough,
- segment must have header "size" and trailer "guard" block */
- segment_size = true_size + ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE;
- segment_size = (segment_size + (heap->block_size-1)) & ~(heap->block_size-1);
- keep_rest = 1;
- } else {
- segment_size = heap->block_size;
+static size_t zend_mm_get_huge_block_size(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ zend_mm_huge_list *list = heap->huge_list;
+ while (list != NULL) {
+ if (list->ptr == ptr) {
+ return list->size;
}
+ list = list->next;
+ }
+ ZEND_MM_CHECK(0, "zend_mm_heap corrupted");
+ return 0;
+}
- if (segment_size < true_size ||
- heap->real_size + segment_size > heap->limit) {
- /* Memory limit overflow */
-#if ZEND_MM_CACHE
- zend_mm_free_cache(heap);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
+static void zend_mm_change_huge_block_size(zend_mm_heap *heap, void *ptr, size_t size, size_t dbg_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#else
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
+static void zend_mm_change_huge_block_size(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+#endif
+{
+ zend_mm_huge_list *list = heap->huge_list;
+ while (list != NULL) {
+ if (list->ptr == ptr) {
+ list->size = size;
+#if ZEND_DEBUG
+ list->dbg.size = dbg_size;
+ list->dbg.filename = __zend_filename;
+ list->dbg.orig_filename = __zend_orig_filename;
+ list->dbg.lineno = __zend_lineno;
+ list->dbg.orig_lineno = __zend_orig_lineno;
#endif
+ return;
}
+ list = list->next;
+ }
+}
- segment = (zend_mm_segment *) ZEND_MM_STORAGE_ALLOC(segment_size);
+static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE);
+ void *ptr;
- if (!segment) {
- /* Storage manager cannot allocate memory */
-#if ZEND_MM_CACHE
- zend_mm_free_cache(heap);
-#endif
-out_of_memory:
- HANDLE_UNBLOCK_INTERRUPTIONS();
+#if ZEND_MM_LIMIT
+ if (heap->real_size + new_size > heap->limit) {
+ if (heap->overflow == 0) {
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %lu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) (tried to allocate %lu bytes)", heap->real_size, size);
+ zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size);
#endif
return NULL;
}
-
- heap->real_size += segment_size;
- if (heap->real_size > heap->real_peak) {
- heap->real_peak = heap->real_size;
- }
-
- segment->size = segment_size;
- segment->next_segment = heap->segments_list;
- heap->segments_list = segment;
-
- best_fit = (zend_mm_free_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- ZEND_MM_MARK_FIRST_BLOCK(best_fit);
-
- block_size = segment_size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_HEADER_SIZE;
-
- ZEND_MM_LAST_BLOCK(ZEND_MM_BLOCK_AT(best_fit, block_size));
-
- } else {
-zend_mm_finished_searching_for_block:
- /* remove from free list */
- ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_FREED);
- ZEND_MM_CHECK_COOKIE(best_fit);
- ZEND_MM_CHECK_BLOCK_LINKAGE(best_fit);
- zend_mm_remove_from_free_list(heap, best_fit);
-
- block_size = ZEND_MM_FREE_BLOCK_SIZE(best_fit);
}
-
- remaining_size = block_size - true_size;
-
- if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
- true_size = block_size;
- ZEND_MM_BLOCK(best_fit, ZEND_MM_USED_BLOCK, true_size);
- } else {
- zend_mm_free_block *new_free_block;
-
- /* prepare new free block */
- ZEND_MM_BLOCK(best_fit, ZEND_MM_USED_BLOCK, true_size);
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(best_fit, true_size);
- ZEND_MM_BLOCK(new_free_block, ZEND_MM_FREE_BLOCK, remaining_size);
-
- /* add the new free block to the free list */
- if (EXPECTED(!keep_rest)) {
- zend_mm_add_to_free_list(heap, new_free_block);
- } else {
- zend_mm_add_to_rest_list(heap, new_free_block);
- }
- }
-
- ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 1);
-
- heap->size += true_size;
- if (heap->peak < heap->size) {
- heap->peak = heap->size;
+#endif
+ ptr = zend_mm_chunk_alloc(heap, new_size, ZEND_MM_CHUNK_SIZE);
+ if (UNEXPECTED(ptr == NULL)) {
+ /* insufficient memory */
+#if !ZEND_MM_LIMIT
+ zend_mm_safe_error(heap, "Out of memory");
+#elif ZEND_DEBUG
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
+#else
+ zend_mm_safe_error(heap, "Out of memory (allocated %zu) (tried to allocate %zu bytes)", heap->real_size, size);
+#endif
+ return NULL;
}
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- return ZEND_MM_DATA_OF(best_fit);
+#if ZEND_DEBUG
+ zend_mm_add_huge_block(heap, ptr, new_size, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ zend_mm_add_huge_block(heap, ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#endif
+#if ZEND_MM_STAT
+ do {
+ size_t size = heap->real_size + new_size;
+ size_t peak = MAX(heap->real_peak, size);
+ heap->real_size = size;
+ heap->real_peak = peak;
+ } while (0);
+ do {
+ size_t size = heap->size + new_size;
+ size_t peak = MAX(heap->peak, size);
+ heap->size = size;
+ heap->peak = peak;
+ } while (0);
+#elif ZEND_MM_LIMIT
+ heap->real_size += new_size;
+#endif
+ return ptr;
}
-
-static void _zend_mm_free_int(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static void zend_mm_free_huge(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mm_block *mm_block;
- zend_mm_block *next_block;
size_t size;
-#ifdef ZEND_SIGNALS
- TSRMLS_FETCH();
+
+ ZEND_MM_CHECK(ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE) == 0, "zend_mm_heap corrupted");
+ size = zend_mm_del_huge_block(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ zend_mm_chunk_free(heap, ptr, size);
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size -= size;
#endif
- if (!ZEND_MM_VALID_PTR(p)) {
- return;
- }
+#if ZEND_MM_STAT
+ heap->size -= size;
+#endif
+}
- HANDLE_BLOCK_INTERRUPTIONS();
+/******************/
+/* Initialization */
+/******************/
- mm_block = ZEND_MM_HEADER_OF(p);
- size = ZEND_MM_BLOCK_SIZE(mm_block);
- ZEND_MM_CHECK_PROTECTION(mm_block);
+static zend_mm_heap *zend_mm_init(void)
+{
+ zend_mm_chunk *chunk = (zend_mm_chunk*)zend_mm_chunk_alloc_int(ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
+ zend_mm_heap *heap;
-#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
- memset(ZEND_MM_DATA_OF(mm_block), 0x5a, mm_block->debug.size);
+ if (UNEXPECTED(chunk == NULL)) {
+#if ZEND_MM_ERROR
+#ifdef _WIN32
+ stderr_last_error("Can't initialize heap");
+#else
+ fprintf(stderr, "\nCan't initialize heap: [%d] %s\n", errno, strerror(errno));
#endif
-
-#if ZEND_MM_CACHE
- if (EXPECTED(ZEND_MM_SMALL_SIZE(size)) && EXPECTED(heap->cached < ZEND_MM_CACHE_SIZE)) {
- size_t index = ZEND_MM_BUCKET_INDEX(size);
- zend_mm_free_block **cache = &heap->cache[index];
-
- ((zend_mm_free_block*)mm_block)->prev_free_block = *cache;
- *cache = (zend_mm_free_block*)mm_block;
- heap->cached += size;
- ZEND_MM_SET_MAGIC(mm_block, MEM_BLOCK_CACHED);
-#if ZEND_MM_CACHE_STAT
- if (++heap->cache_stat[index].count > heap->cache_stat[index].max_count) {
- heap->cache_stat[index].max_count = heap->cache_stat[index].count;
- }
#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return;
+ return NULL;
}
+ heap = &chunk->heap_slot;
+ chunk->heap = heap;
+ chunk->next = chunk;
+ chunk->prev = chunk;
+ chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
+ chunk->free_tail = ZEND_MM_FIRST_PAGE;
+ chunk->num = 0;
+ chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
+ chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
+ heap->main_chunk = chunk;
+ heap->cached_chunks = NULL;
+ heap->chunks_count = 1;
+ heap->peak_chunks_count = 1;
+ heap->cached_chunks_count = 0;
+ heap->avg_chunks_count = 1.0;
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size = ZEND_MM_CHUNK_SIZE;
+#endif
+#if ZEND_MM_STAT
+ heap->real_peak = ZEND_MM_CHUNK_SIZE;
+ heap->size = 0;
+ heap->peak = 0;
#endif
+#if ZEND_MM_LIMIT
+ heap->limit = (Z_L(-1) >> Z_L(1));
+ heap->overflow = 0;
+#endif
+#if ZEND_MM_CUSTOM
+ heap->use_custom_heap = 0;
+#endif
+#if ZEND_MM_STORAGE
+ heap->storage = NULL;
+#endif
+ heap->huge_list = NULL;
+ return heap;
+}
- heap->size -= size;
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, size);
- if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- size += ZEND_MM_FREE_BLOCK_SIZE(next_block);
- }
- if (ZEND_MM_PREV_BLOCK_IS_FREE(mm_block)) {
- mm_block = ZEND_MM_PREV_BLOCK(mm_block);
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) mm_block);
- size += ZEND_MM_FREE_BLOCK_SIZE(mm_block);
+#if ZEND_DEBUG
+/******************/
+/* Leak detection */
+/******************/
+
+static zend_long zend_mm_find_leaks_small(zend_mm_chunk *p, int i, int j, zend_leak_info *leak)
+{
+ int empty = 1;
+ zend_long count = 0;
+ int bin_num = ZEND_MM_SRUN_BIN_NUM(p->map[i]);
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + ZEND_MM_PAGE_SIZE * i + bin_data_size[bin_num] * (j + 1) - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+
+ while (j < bin_elements[bin_num]) {
+ if (dbg->size != 0) {
+ if (dbg->filename == leak->filename && dbg->lineno == leak->lineno) {
+ count++;
+ dbg->size = 0;
+ dbg->filename = NULL;
+ dbg->lineno = 0;
+ } else {
+ empty = 0;
+ }
+ }
+ j++;
+ dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]);
}
- if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
- ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(mm_block, size))) {
- zend_mm_del_segment(heap, (zend_mm_segment *) ((char *)mm_block - ZEND_MM_ALIGNED_SEGMENT_SIZE));
- } else {
- ZEND_MM_BLOCK(mm_block, ZEND_MM_FREE_BLOCK, size);
- zend_mm_add_to_free_list(heap, (zend_mm_free_block *) mm_block);
+ if (empty) {
+ zend_mm_bitset_reset_range(p->free_map, i, bin_pages[bin_num]);
}
- HANDLE_UNBLOCK_INTERRUPTIONS();
+ return count;
}
-static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, int i, zend_leak_info *leak)
{
- zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
- zend_mm_block *next_block;
- size_t true_size;
- size_t orig_size;
- void *ptr;
-#ifdef ZEND_SIGNALS
- TSRMLS_FETCH();
-#endif
- if (UNEXPECTED(!p) || !ZEND_MM_VALID_PTR(p)) {
- return _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- mm_block = ZEND_MM_HEADER_OF(p);
- true_size = ZEND_MM_TRUE_SIZE(size);
- orig_size = ZEND_MM_BLOCK_SIZE(mm_block);
- ZEND_MM_CHECK_PROTECTION(mm_block);
-
- if (UNEXPECTED(true_size < size)) {
- goto out_of_memory;
- }
+ zend_long count = 0;
- if (true_size <= orig_size) {
- size_t remaining_size = orig_size - true_size;
+ do {
+ while (i < p->free_tail) {
+ if (zend_mm_bitset_is_set(p->free_map, i)) {
+ if (p->map[i] & ZEND_MM_IS_SRUN) {
+ int bin_num = ZEND_MM_SRUN_BIN_NUM(p->map[i]);
+ count += zend_mm_find_leaks_small(p, i, 0, leak);
+ i += bin_pages[bin_num];
+ } else /* if (p->map[i] & ZEND_MM_IS_LRUN) */ {
+ int pages_count = ZEND_MM_LRUN_PAGES(p->map[i]);
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + ZEND_MM_PAGE_SIZE * (i + pages_count) - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
- if (remaining_size >= ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
- zend_mm_free_block *new_free_block;
-
- next_block = ZEND_MM_BLOCK_AT(mm_block, orig_size);
- if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
- remaining_size += ZEND_MM_FREE_BLOCK_SIZE(next_block);
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
+ if (dbg->filename == leak->filename && dbg->lineno == leak->lineno) {
+ count++;
+ }
+ zend_mm_bitset_reset_range(p->free_map, i, pages_count);
+ i += pages_count;
+ }
+ } else {
+ i++;
}
-
- /* prepare new free block */
- ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, true_size);
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, true_size);
-
- ZEND_MM_BLOCK(new_free_block, ZEND_MM_FREE_BLOCK, remaining_size);
-
- /* add the new free block to the free list */
- zend_mm_add_to_free_list(heap, new_free_block);
- heap->size += (true_size - orig_size);
}
- ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return p;
- }
+ p = p->next;
+ } while (p != heap->main_chunk);
+ return count;
+}
-#if ZEND_MM_CACHE
- if (ZEND_MM_SMALL_SIZE(true_size)) {
- size_t index = ZEND_MM_BUCKET_INDEX(true_size);
-
- if (heap->cache[index] != NULL) {
- zend_mm_free_block *best_fit;
- zend_mm_free_block **cache;
+static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC)
+{
+ zend_mm_huge_list *list;
+ zend_mm_chunk *p;
+ zend_leak_info leak;
+ zend_long repeated = 0;
+ uint32_t total = 0;
+ int i, j;
-#if ZEND_MM_CACHE_STAT
- heap->cache_stat[index].count--;
- heap->cache_stat[index].hit++;
-#endif
- best_fit = heap->cache[index];
- heap->cache[index] = best_fit->prev_free_block;
- ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
- ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
-
- ptr = ZEND_MM_DATA_OF(best_fit);
+ /* find leaked huge blocks and free them */
+ list = heap->huge_list;
+ while (list) {
+ zend_mm_huge_list *q = list;
-#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
- memcpy(ptr, p, mm_block->debug.size);
-#else
- memcpy(ptr, p, orig_size - ZEND_MM_ALIGNED_HEADER_SIZE);
-#endif
+ heap->huge_list = list->next;
- heap->cached -= true_size - orig_size;
+ leak.addr = list->ptr;
+ leak.size = list->dbg.size;
+ leak.filename = list->dbg.filename;
+ leak.orig_filename = list->dbg.orig_filename;
+ leak.lineno = list->dbg.lineno;
+ leak.orig_lineno = list->dbg.orig_lineno;
- index = ZEND_MM_BUCKET_INDEX(orig_size);
- cache = &heap->cache[index];
-
- ((zend_mm_free_block*)mm_block)->prev_free_block = *cache;
- *cache = (zend_mm_free_block*)mm_block;
- ZEND_MM_SET_MAGIC(mm_block, MEM_BLOCK_CACHED);
-#if ZEND_MM_CACHE_STAT
- if (++heap->cache_stat[index].count > heap->cache_stat[index].max_count) {
- heap->cache_stat[index].max_count = heap->cache_stat[index].count;
+ zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
+//??? repeated = zend_mm_find_leaks_huge(segment, p);
+ total += 1 + repeated;
+ if (repeated) {
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
+ }
+
+ list = list->next;
+ zend_mm_chunk_free(heap, q->ptr, q->size);
+ zend_mm_free_heap(heap, q, NULL, 0, NULL, 0);
+ }
+
+ /* for each chunk */
+ p = heap->main_chunk;
+ do {
+ i = ZEND_MM_FIRST_PAGE;
+ while (i < p->free_tail) {
+ if (zend_mm_bitset_is_set(p->free_map, i)) {
+ if (p->map[i] & ZEND_MM_IS_SRUN) {
+ int bin_num = ZEND_MM_SRUN_BIN_NUM(p->map[i]);
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + ZEND_MM_PAGE_SIZE * i + bin_data_size[bin_num] - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+
+ j = 0;
+ while (j < bin_elements[bin_num]) {
+ if (dbg->size != 0) {
+ leak.addr = (zend_mm_debug_info*)((char*)p + ZEND_MM_PAGE_SIZE * i + bin_data_size[bin_num] * j);
+ leak.size = dbg->size;
+ leak.filename = dbg->filename;
+ leak.orig_filename = dbg->orig_filename;
+ leak.lineno = dbg->lineno;
+ leak.orig_lineno = dbg->orig_lineno;
+
+ zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
+
+ dbg->size = 0;
+ dbg->filename = NULL;
+ dbg->lineno = 0;
+
+ repeated = zend_mm_find_leaks_small(p, i, j + 1, &leak) +
+ zend_mm_find_leaks(heap, p, i + bin_pages[bin_num], &leak);
+ total += 1 + repeated;
+ if (repeated) {
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
+ }
+ }
+ dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]);
+ j++;
+ }
+ i += bin_pages[bin_num];
+ } else /* if (p->map[i] & ZEND_MM_IS_LRUN) */ {
+ int pages_count = ZEND_MM_LRUN_PAGES(p->map[i]);
+ zend_mm_debug_info *dbg = (zend_mm_debug_info*)((char*)p + ZEND_MM_PAGE_SIZE * (i + pages_count) - ZEND_MM_ALIGNED_SIZE(sizeof(zend_mm_debug_info)));
+
+ leak.addr = (void*)((char*)p + ZEND_MM_PAGE_SIZE * i);
+ leak.size = dbg->size;
+ leak.filename = dbg->filename;
+ leak.orig_filename = dbg->orig_filename;
+ leak.lineno = dbg->lineno;
+ leak.orig_lineno = dbg->orig_lineno;
+
+ zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak TSRMLS_CC);
+
+ zend_mm_bitset_reset_range(p->free_map, i, pages_count);
+
+ repeated = zend_mm_find_leaks(heap, p, i + pages_count, &leak);
+ total += 1 + repeated;
+ if (repeated) {
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated TSRMLS_CC);
+ }
+ i += pages_count;
+ }
+ } else {
+ i++;
}
-#endif
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return ptr;
}
+ p = p->next;
+ } while (p != heap->main_chunk);
+ if (total) {
+ zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &total TSRMLS_CC);
}
+}
#endif
- next_block = ZEND_MM_BLOCK_AT(mm_block, orig_size);
-
- if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
- ZEND_MM_CHECK_COOKIE(next_block);
- ZEND_MM_CHECK_BLOCK_LINKAGE(next_block);
- if (orig_size + ZEND_MM_FREE_BLOCK_SIZE(next_block) >= true_size) {
- size_t block_size = orig_size + ZEND_MM_FREE_BLOCK_SIZE(next_block);
- size_t remaining_size = block_size - true_size;
-
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
-
- if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
- true_size = block_size;
- ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, true_size);
- } else {
- zend_mm_free_block *new_free_block;
-
- /* prepare new free block */
- ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, true_size);
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, true_size);
- ZEND_MM_BLOCK(new_free_block, ZEND_MM_FREE_BLOCK, remaining_size);
-
- /* add the new free block to the free list */
- if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
- ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(new_free_block, remaining_size))) {
- zend_mm_add_to_rest_list(heap, new_free_block);
- } else {
- zend_mm_add_to_free_list(heap, new_free_block);
- }
- }
- ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0);
- heap->size = heap->size + true_size - orig_size;
- if (heap->peak < heap->size) {
- heap->peak = heap->size;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return p;
- } else if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
- ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(next_block, ZEND_MM_FREE_BLOCK_SIZE(next_block)))) {
- zend_mm_remove_from_free_list(heap, (zend_mm_free_block *) next_block);
- goto realloc_segment;
- }
- } else if (ZEND_MM_IS_FIRST_BLOCK(mm_block) && ZEND_MM_IS_GUARD_BLOCK(next_block)) {
- zend_mm_segment *segment;
- zend_mm_segment *segment_copy;
- size_t segment_size;
- size_t block_size;
- size_t remaining_size;
-
-realloc_segment:
- /* segment size, size of block and size of guard block */
- if (true_size > heap->block_size - (ZEND_MM_ALIGNED_SEGMENT_SIZE + ZEND_MM_ALIGNED_HEADER_SIZE)) {
- segment_size = true_size+ZEND_MM_ALIGNED_SEGMENT_SIZE+ZEND_MM_ALIGNED_HEADER_SIZE;
- segment_size = (segment_size + (heap->block_size-1)) & ~(heap->block_size-1);
- } else {
- segment_size = heap->block_size;
- }
+void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent TSRMLS_DC)
+{
+ zend_mm_chunk *p;
+ zend_mm_huge_list *list;
- segment_copy = (zend_mm_segment *) ((char *)mm_block - ZEND_MM_ALIGNED_SEGMENT_SIZE);
- if (segment_size < true_size ||
- heap->real_size + segment_size - segment_copy->size > heap->limit) {
- if (ZEND_MM_IS_FREE_BLOCK(next_block)) {
- zend_mm_add_to_free_list(heap, (zend_mm_free_block *) next_block);
- }
-#if ZEND_MM_CACHE
- zend_mm_free_cache(heap);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
-#else
- zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
+#if ZEND_MM_CUSTOM
+ if (heap->use_custom_heap) {
+ return;
+ }
#endif
- return NULL;
- }
- segment = ZEND_MM_STORAGE_REALLOC(segment_copy, segment_size);
- if (!segment) {
-#if ZEND_MM_CACHE
- zend_mm_free_cache(heap);
-#endif
-out_of_memory:
- HANDLE_UNBLOCK_INTERRUPTIONS();
#if ZEND_DEBUG
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) at %s:%d (tried to allocate %ld bytes)", heap->real_size, __zend_filename, __zend_lineno, size);
-#else
- zend_mm_safe_error(heap, "Out of memory (allocated %ld) (tried to allocate %ld bytes)", heap->real_size, size);
+ if (!silent) {
+ zend_mm_check_leaks(heap TSRMLS_CC);
+ }
#endif
- return NULL;
- }
- heap->real_size += segment_size - segment->size;
- if (heap->real_size > heap->real_peak) {
- heap->real_peak = heap->real_size;
- }
-
- segment->size = segment_size;
-
- if (segment != segment_copy) {
- zend_mm_segment **seg = &heap->segments_list;
- while (*seg != segment_copy) {
- seg = &(*seg)->next_segment;
- }
- *seg = segment;
- mm_block = (zend_mm_block *) ((char *) segment + ZEND_MM_ALIGNED_SEGMENT_SIZE);
- ZEND_MM_MARK_FIRST_BLOCK(mm_block);
- }
-
- block_size = segment_size - ZEND_MM_ALIGNED_SEGMENT_SIZE - ZEND_MM_ALIGNED_HEADER_SIZE;
- remaining_size = block_size - true_size;
- /* setup guard block */
- ZEND_MM_LAST_BLOCK(ZEND_MM_BLOCK_AT(mm_block, block_size));
+ /* free huge blocks */
+ list = heap->huge_list;
+ while (list) {
+ zend_mm_huge_list *q = list;
+ list = list->next;
+ zend_mm_chunk_free(heap, q->ptr, q->size);
+ }
- if (remaining_size < ZEND_MM_ALIGNED_MIN_HEADER_SIZE) {
- true_size = block_size;
- ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, true_size);
+ /* move all chunks except of the first one into the cache */
+ p = heap->main_chunk->next;
+ while (p != heap->main_chunk) {
+ zend_mm_chunk *q = p->next;
+ p->next = heap->cached_chunks;
+ heap->cached_chunks = p;
+ p = q;
+ heap->chunks_count--;
+ heap->cached_chunks_count++;
+ }
+
+ if (full) {
+ /* free all cached chunks */
+ while (heap->cached_chunks) {
+ p = heap->cached_chunks;
+ heap->cached_chunks = p->next;
+ zend_mm_chunk_free(heap, p, ZEND_MM_CHUNK_SIZE);
+ }
+ /* free the first chunk */
+#if ZEND_MM_STORAGE
+ if (UNEXPECTED(heap->storage)) {
+ zend_mm_storage *storage = heap->storage;
+ zend_mm_chunk_free(heap, heap->main_chunk, ZEND_MM_CHUNK_SIZE);
+ storage->dtor(storage);
} else {
- zend_mm_free_block *new_free_block;
-
- /* prepare new free block */
- ZEND_MM_BLOCK(mm_block, ZEND_MM_USED_BLOCK, true_size);
- new_free_block = (zend_mm_free_block *) ZEND_MM_BLOCK_AT(mm_block, true_size);
- ZEND_MM_BLOCK(new_free_block, ZEND_MM_FREE_BLOCK, remaining_size);
-
- /* add the new free block to the free list */
- zend_mm_add_to_rest_list(heap, new_free_block);
+ zend_mm_chunk_free(heap, heap->main_chunk, ZEND_MM_CHUNK_SIZE);
}
+#else
+ zend_mm_chunk_free(heap, heap->main_chunk, ZEND_MM_CHUNK_SIZE);
+#endif
+ } else {
+ zend_mm_heap old_heap;
- ZEND_MM_SET_DEBUG_INFO(mm_block, size, 1, 1);
-
- heap->size = heap->size + true_size - orig_size;
- if (heap->peak < heap->size) {
- heap->peak = heap->size;
+ /* free some cached chunks to keep average count */
+ heap->avg_chunks_count = (heap->avg_chunks_count + (double)heap->peak_chunks_count) / 2.0;
+ while ((double)heap->cached_chunks_count + 0.9 > heap->avg_chunks_count &&
+ heap->cached_chunks) {
+ p = heap->cached_chunks;
+ heap->cached_chunks = p->next;
+ zend_mm_chunk_free(heap, p, ZEND_MM_CHUNK_SIZE);
+ heap->cached_chunks_count--;
+ }
+ /* clear cached chunks */
+ p = heap->cached_chunks;
+ while (p != NULL) {
+ zend_mm_chunk *q = p->next;
+ memset(p, 0, sizeof(zend_mm_chunk));
+ p->next = q;
+ p = q;
}
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return ZEND_MM_DATA_OF(mm_block);
- }
-
- ptr = _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
-#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
- memcpy(ptr, p, mm_block->debug.size);
-#else
- memcpy(ptr, p, orig_size - ZEND_MM_ALIGNED_HEADER_SIZE);
+ /* reinitialize the first chunk and heap */
+ old_heap = *heap;
+ p = heap->main_chunk;
+ memset(p, 0, ZEND_MM_FIRST_PAGE * ZEND_MM_PAGE_SIZE);
+ *heap = old_heap;
+ memset(heap->free_slot, 0, sizeof(heap->free_slot));
+ heap->main_chunk = p;
+ p->heap = &p->heap_slot;
+ p->next = p;
+ p->prev = p;
+ p->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
+ p->free_tail = ZEND_MM_FIRST_PAGE;
+ p->free_map[0] = (1L << ZEND_MM_FIRST_PAGE) - 1;
+ p->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
+ heap->chunks_count = 1;
+ heap->peak_chunks_count = 1;
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size = ZEND_MM_CHUNK_SIZE;
#endif
- _zend_mm_free_int(heap, p ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return ptr;
+#if ZEND_MM_STAT
+ heap->real_peak = ZEND_MM_CHUNK_SIZE;
+#endif
+ }
}
-ZEND_API void *_zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+/**************/
+/* PUBLIC API */
+/**************/
+
+ZEND_API void* ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- return _zend_mm_alloc_int(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ return zend_mm_alloc_heap(heap, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-ZEND_API void _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- _zend_mm_free_int(heap, p ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ zend_mm_free_heap(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-ZEND_API void *_zend_mm_realloc(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+void* ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- return _zend_mm_realloc_int(heap, ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ return zend_mm_realloc_heap(heap, ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-ZEND_API size_t _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_mm_block *mm_block;
-
- if (!ZEND_MM_VALID_PTR(p)) {
- return 0;
- }
- mm_block = ZEND_MM_HEADER_OF(p);
- ZEND_MM_CHECK_PROTECTION(mm_block);
-#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
- return mm_block->debug.size;
-#else
- return ZEND_MM_BLOCK_SIZE(mm_block);
-#endif
+ return zend_mm_size(heap, ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
/**********************/
@@ -2427,190 +2078,181 @@ static zend_alloc_globals alloc_globals;
ZEND_API int is_zend_mm(TSRMLS_D)
{
- return AG(mm_heap)->use_zend_alloc;
+#if ZEND_MM_CUSTOM
+ return !AG(mm_heap)->use_custom_heap;
+#else
+ return 1;
+#endif
}
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- TSRMLS_FETCH();
+#if !ZEND_DEBUG && !defined(_WIN32)
+#undef _emalloc
- if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
- return AG(mm_heap)->_malloc(size);
+#if ZEND_MM_CUSTOM
+# define ZEND_MM_CUSTOM_ALLOCATOR(size) do { \
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) { \
+ return AG(mm_heap)->_malloc(size); \
+ } \
+ } while (0)
+# define ZEND_MM_CUSTOM_DEALLOCATOR(ptr) do { \
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) { \
+ AG(mm_heap)->_free(ptr); \
+ return; \
+ } \
+ } while (0)
+#else
+# define ZEND_MM_CUSTOM_ALLOCATOR(size)
+# define ZEND_MM_CUSTOM_DEALLOCATOR(ptr)
+#endif
+
+# define _ZEND_BIN_ALLOCATOR(_num, _size, _elements, _pages, x, y) \
+ ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) { \
+ TSRMLS_FETCH(); \
+ ZEND_MM_CUSTOM_ALLOCATOR(_size); \
+ return zend_mm_alloc_small(AG(mm_heap), _size, _num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
}
- return _zend_mm_alloc_int(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
-}
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR, x, y)
+
+ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
TSRMLS_FETCH();
- if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
- AG(mm_heap)->_free(ptr);
- return;
- }
- _zend_mm_free_int(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ ZEND_MM_CUSTOM_ALLOCATOR(size);
+ return zend_mm_alloc_large(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
{
TSRMLS_FETCH();
- if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
- return AG(mm_heap)->_realloc(ptr, size);
- }
- return _zend_mm_realloc_int(AG(mm_heap), ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
-}
-
-ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-{
- if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
- return 0;
+ ZEND_MM_CUSTOM_ALLOCATOR(size);
+ return zend_mm_alloc_huge(AG(mm_heap), size);
+}
+
+# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
+ ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
+ TSRMLS_FETCH(); \
+ ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \
+ { \
+ size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE); \
+ zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
+ int page_num = page_offset / ZEND_MM_PAGE_SIZE; \
+ ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
+ ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_SRUN); \
+ ZEND_ASSERT(ZEND_MM_SRUN_BIN_NUM(chunk->map[page_num]) == _num); \
+ zend_mm_free_small(AG(mm_heap), ptr, _num); \
+ } \
}
- return _zend_mm_block_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
-}
-#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
+ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y)
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
{
- size_t res = nmemb;
- zend_uint_t overflow = 0;
+ TSRMLS_FETCH();
- __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1"
- : "=&a"(res), "=&d" (overflow)
- : "%0"(res),
- "rm"(size),
- "rm"(offset));
-
- if (UNEXPECTED(overflow)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
- return 0;
+ ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
+ {
+ size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
+ zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
+ int page_num = page_offset / ZEND_MM_PAGE_SIZE;
+ int pages_count = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE) / ZEND_MM_PAGE_SIZE;
+
+ ZEND_MM_CHECK(chunk->heap == AG(mm_heap) && ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
+ ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_LRUN);
+ ZEND_ASSERT(ZEND_MM_LRUN_PAGES(chunk->map[page_num]) == pages_count);
+ zend_mm_free_large(AG(mm_heap), chunk, page_num, pages_count);
}
- return res;
}
-#elif defined(__GNUC__) && defined(__x86_64__)
-
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
{
- size_t res = nmemb;
- zend_uint_t overflow = 0;
+ TSRMLS_FETCH();
-#ifdef __ILP32__ /* x32 */
-# define LP_SUFF "l"
-#else /* amd64 */
-# define LP_SUFF "q"
+ ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
+ // TODO: use size???
+ zend_mm_free_huge(AG(mm_heap), ptr);
+}
#endif
- __asm__ ("mul" LP_SUFF " %3\n\t"
- "add %4,%0\n\t"
- "adc $0,%1"
- : "=&a"(res), "=&d" (overflow)
- : "%0"(res),
- "rm"(size),
- "rm"(offset));
+ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+{
+ TSRMLS_FETCH();
-#undef LP_SUFF
- if (UNEXPECTED(overflow)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
- return 0;
- }
- return res;
+#if ZEND_MM_CUSTOM
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
+ return AG(mm_heap)->_malloc(size);
+ }
+#endif
+ return zend_mm_alloc_heap(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-#elif defined(__GNUC__) && defined(__arm__)
-
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- size_t res;
- zend_uint_t overflow;
-
- __asm__ ("umlal %0,%1,%2,%3"
- : "=r"(res), "=r"(overflow)
- : "r"(nmemb),
- "r"(size),
- "0"(offset),
- "1"(0));
+ TSRMLS_FETCH();
- if (UNEXPECTED(overflow)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
- return 0;
- }
- return res;
+#if ZEND_MM_CUSTOM
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
+ AG(mm_heap)->_free(ptr);
+ return;
+ }
+#endif
+ zend_mm_free_heap(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-#elif defined(__GNUC__) && defined(__aarch64__)
-
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- size_t res;
- zend_uint_t overflow;
-
- __asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr"
- : "=&r"(res), "=&r"(overflow)
- : "r"(nmemb),
- "r"(size),
- "r"(offset));
+ TSRMLS_FETCH();
- if (UNEXPECTED(overflow)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
- return 0;
- }
- return res;
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
+ return AG(mm_heap)->_realloc(ptr, size);
+ }
+ return zend_mm_realloc_heap(AG(mm_heap), ptr, size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-#elif SIZEOF_SIZE_T == 4 && defined(HAVE_ZEND_LONG64)
-
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_ulong64 res = (zend_ulong64)nmemb * (zend_ulong64)size + (zend_ulong64)offset;
-
- if (UNEXPECTED(res > (zend_ulong64)0xFFFFFFFFL)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
+ if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return 0;
}
- return (size_t) res;
+ return zend_mm_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-#else
-
-static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+static zend_always_inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
- size_t res = nmemb * size + offset;
- double _d = (double)nmemb * (double)size + (double)offset;
- double _delta = (double)res - _d;
+ int overflow;
+ size_t ret = zend_safe_address(nmemb, size, offset, &overflow);
- if (UNEXPECTED((_d + _delta ) != _d)) {
+ if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
}
- return res;
+ return ret;
}
-#endif
-ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void* ZEND_FASTCALL _safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return emalloc_rel(safe_address(nmemb, size, offset));
}
-ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset)
+ZEND_API void* ZEND_FASTCALL _safe_malloc(size_t nmemb, size_t size, size_t offset)
{
return pemalloc(safe_address(nmemb, size, offset), 1);
}
-ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return erealloc_rel(ptr, safe_address(nmemb, size, offset));
}
-ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset)
+ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset)
{
return perealloc(ptr, safe_address(nmemb, size, offset), 1);
}
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void* ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
void *p;
#ifdef ZEND_SIGNALS
@@ -2628,9 +2270,9 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
return p;
}
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
- zend_size_t length;
+ size_t length;
char *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -2649,7 +2291,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
return p;
}
-ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
char *p;
#ifdef ZEND_SIGNALS
@@ -2670,7 +2312,7 @@ ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEN
}
-ZEND_API char *zend_strndup(const char *s, zend_size_t length)
+ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
{
char *p;
#ifdef ZEND_SIGNALS
@@ -2695,31 +2337,35 @@ ZEND_API char *zend_strndup(const char *s, zend_size_t length)
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
{
- AG(mm_heap)->limit = (memory_limit >= AG(mm_heap)->block_size) ? memory_limit : AG(mm_heap)->block_size;
-
+#if ZEND_MM_LIMIT
+ AG(mm_heap)->limit = (memory_limit >= ZEND_MM_CHUNK_SIZE) ? memory_limit : ZEND_MM_CHUNK_SIZE;
+#endif
return SUCCESS;
}
ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC)
{
+#if ZEND_MM_STAT
if (real_usage) {
return AG(mm_heap)->real_size;
} else {
size_t usage = AG(mm_heap)->size;
-#if ZEND_MM_CACHE
- usage -= AG(mm_heap)->cached;
-#endif
return usage;
}
+#endif
+ return 0;
}
ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC)
{
+#if ZEND_MM_STAT
if (real_usage) {
return AG(mm_heap)->real_peak;
} else {
return AG(mm_heap)->peak;
}
+#endif
+ return 0;
}
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
@@ -2729,18 +2375,20 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
{
+#if ZEND_MM_CUSTOM
char *tmp = getenv("USE_ZEND_ALLOC");
if (tmp && !zend_atoi(tmp, 0)) {
- alloc_globals->mm_heap = malloc(sizeof(struct _zend_mm_heap));
- memset(alloc_globals->mm_heap, 0, sizeof(struct _zend_mm_heap));
- alloc_globals->mm_heap->use_zend_alloc = 0;
+ alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
+ memset(alloc_globals->mm_heap, 0, sizeof(zend_mm_heap));
+ alloc_globals->mm_heap->use_custom_heap = 1;
alloc_globals->mm_heap->_malloc = malloc;
alloc_globals->mm_heap->_free = free;
alloc_globals->mm_heap->_realloc = realloc;
- } else {
- alloc_globals->mm_heap = zend_mm_startup();
+ return;
}
+#endif
+ alloc_globals->mm_heap = zend_mm_init();
}
#ifdef ZTS
@@ -2764,13 +2412,8 @@ ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC)
zend_mm_heap *old_heap;
old_heap = AG(mm_heap);
- AG(mm_heap) = new_heap;
- return old_heap;
-}
-
-ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap)
-{
- return heap->storage;
+ AG(mm_heap) = (zend_mm_heap*)new_heap;
+ return (zend_mm_heap*)old_heap;
}
ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
@@ -2778,42 +2421,107 @@ ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
void (*_free)(void*),
void* (*_realloc)(void*, size_t))
{
- heap->use_zend_alloc = 0;
- heap->_malloc = _malloc;
- heap->_free = _free;
- heap->_realloc = _realloc;
+#if ZEND_MM_CUSTOM
+ zend_mm_heap *_heap = (zend_mm_heap*)heap;
+
+ _heap->use_custom_heap = 1;
+ _heap->_malloc = _malloc;
+ _heap->_free = _free;
+ _heap->_realloc = _realloc;
+#endif
}
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API void zend_mm_get_custom_handlers(zend_mm_heap *heap,
+ void* (**_malloc)(size_t),
+ void (**_free)(void*),
+ void* (**_realloc)(void*, size_t))
{
- TSRMLS_FETCH();
+#if ZEND_MM_CUSTOM
+ zend_mm_heap *_heap = (zend_mm_heap*)heap;
- if (!AG(mm_heap)->use_zend_alloc) {
- return 1;
+ if (heap->use_custom_heap) {
+ *_malloc = _heap->_malloc;
+ *_free = _heap->_free;
+ *_realloc = _heap->_realloc;
+ } else {
+ *_malloc = NULL;
+ *_free = NULL;
+ *_realloc = NULL;
}
- return zend_mm_check_ptr(AG(mm_heap), ptr, silent ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+#else
+ *_malloc = NULL;
+ *_free = NULL;
+ *_realloc = NULL;
+#endif
}
-
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
+ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap)
{
- int errors;
- TSRMLS_FETCH();
-
- if (!AG(mm_heap)->use_zend_alloc) {
- return;
- }
+#if ZEND_MM_CUSTOM
+ return heap->storage;
+#else
+ return NULL
+#endif
+}
- zend_debug_alloc_output("------------------------------------------------\n");
- zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC);
+ZEND_API zend_mm_heap *zend_mm_startup(void)
+{
+ return zend_mm_init();
+}
- errors = zend_mm_check_heap(AG(mm_heap), silent ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ZEND_API zend_mm_heap *zend_mm_startup_ex(zend_mm_storage *storage)
+{
+#if ZEND_MM_STORAGE
+ zend_mm_chunk *chunk = (zend_mm_chunk*)storage->chunk_alloc(storage, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
+ zend_mm_heap *heap;
- zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors);
- zend_debug_alloc_output("------------------------------------------------\n");
-}
+ if (UNEXPECTED(chunk == NULL)) {
+#if ZEND_MM_ERROR
+#ifdef _WIN32
+ stderr_last_error("Can't initialize heap");
+#else
+ fprintf(stderr, "\nCan't initialize heap: [%d] %s\n", errno, strerror(errno));
+#endif
+#endif
+ return NULL;
+ }
+ heap = &chunk->heap_slot;
+ chunk->heap = heap;
+ chunk->next = chunk;
+ chunk->prev = chunk;
+ chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
+ chunk->free_tail = ZEND_MM_FIRST_PAGE;
+ chunk->num = 0;
+ chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
+ chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
+ heap->main_chunk = chunk;
+ heap->cached_chunks = NULL;
+ heap->chunks_count = 1;
+ heap->peak_chunks_count = 1;
+ heap->cached_chunks_count = 0;
+ heap->avg_chunks_count = 1.0;
+#if ZEND_MM_STAT || ZEND_MM_LIMIT
+ heap->real_size = ZEND_MM_CHUNK_SIZE;
+#endif
+#if ZEND_MM_STAT
+ heap->real_peak = ZEND_MM_CHUNK_SIZE;
+ heap->size = 0;
+ heap->peak = 0;
#endif
+#if ZEND_MM_LIMIT
+ heap->limit = (Z_L(-1) >> Z_L(1));
+ heap->overflow = 0;
+#endif
+#if ZEND_MM_CUSTOM
+ heap->use_custom_heap = 0;
+#endif
+ heap->storage = storage;
+ heap->huge_list = NULL;
+ return heap;
+#else
+ return NULL;
+#endif
+}
/*
* Local variables:
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index 3c143419ae..c9918955ab 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -26,51 +26,124 @@
#include "../TSRM/TSRM.h"
#include "zend.h"
-#include "zend_types.h"
#ifndef ZEND_MM_ALIGNMENT
-# define ZEND_MM_ALIGNMENT Z_I(8)
-# define ZEND_MM_ALIGNMENT_LOG2 Z_I(3)
-#elif ZEND_MM_ALIGNMENT < Z_I(4)
+# define ZEND_MM_ALIGNMENT Z_L(8)
+# define ZEND_MM_ALIGNMENT_LOG2 Z_L(3)
+#elif ZEND_MM_ALIGNMENT < 4
# undef ZEND_MM_ALIGNMENT
# undef ZEND_MM_ALIGNMENT_LOG2
-# define ZEND_MM_ALIGNMENT Z_I(4)
-# define ZEND_MM_ALIGNMENT_LOG2 Z_I(2)
+# define ZEND_MM_ALIGNMENT Z_L(4)
+# define ZEND_MM_ALIGNMENT_LOG2 Z_L(2)
#endif
-#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-Z_I(1))
+#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT - Z_L(1))
-#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - Z_I(1)) & ZEND_MM_ALIGNMENT_MASK)
+#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - Z_L(1)) & ZEND_MM_ALIGNMENT_MASK)
typedef struct _zend_leak_info {
void *addr;
size_t size;
const char *filename;
- uint lineno;
const char *orig_filename;
+ uint lineno;
uint orig_lineno;
} zend_leak_info;
BEGIN_EXTERN_C()
-ZEND_API char *zend_strndup(const char *s, zend_size_t length) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length) ZEND_ATTRIBUTE_MALLOC;
+
+ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
+ZEND_API void* ZEND_FASTCALL _safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API void* ZEND_FASTCALL _safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void* ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE2(1,2);
+ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2);
+ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
+ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+
+#include "zend_alloc_sizes.h"
+
+/* _emalloc() & _efree() specialization */
+#if !ZEND_DEBUG && !defined(_WIN32)
+
+# define _ZEND_BIN_ALLOCATOR_DEF(_num, _size, _elements, _pages, x, y) \
+ ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) ZEND_ATTRIBUTE_MALLOC;
+
+ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR_DEF, x, y)
+
+ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
+ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
+
+# define _ZEND_BIN_ALLOCATOR_SELECTOR_START(_num, _size, _elements, _pages, size, y) \
+ ((size <= _size) ? _emalloc_ ## _size() :
+# define _ZEND_BIN_ALLOCATOR_SELECTOR_END(_num, _size, _elements, _pages, size, y) \
+ )
+
+# define ZEND_ALLOCATOR(size) \
+ ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR_SELECTOR_START, size, y) \
+ ((size <= ZEND_MM_MAX_LARGE_SIZE) ? _emalloc_large(size) : _emalloc_huge(size)) \
+ ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR_SELECTOR_END, size, y)
+
+# define _emalloc(size) \
+ (__builtin_constant_p(size) ? \
+ ZEND_ALLOCATOR(size) \
+ : \
+ _emalloc(size) \
+ )
+
+# define _ZEND_BIN_DEALLOCATOR_DEF(_num, _size, _elements, _pages, x, y) \
+ ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *);
+
+ZEND_MM_BINS_INFO(_ZEND_BIN_DEALLOCATOR_DEF, x, y)
+
+ZEND_API void ZEND_FASTCALL _efree_large(void *, size_t size);
+ZEND_API void ZEND_FASTCALL _efree_huge(void *, size_t size);
+
+# define _ZEND_BIN_DEALLOCATOR_SELECTOR_START(_num, _size, _elements, _pages, ptr, size) \
+ if (size <= _size) { _efree_ ## _size(ptr); } else
+
+# define ZEND_DEALLOCATOR(ptr, size) \
+ ZEND_MM_BINS_INFO(_ZEND_BIN_DEALLOCATOR_SELECTOR_START, ptr, size) \
+ if (size <= ZEND_MM_MAX_LARGE_SIZE) { _efree_large(ptr, size); } \
+ else { _efree_huge(ptr, size); }
+
+# define efree_size(ptr, size) do { \
+ if (__builtin_constant_p(size)) { \
+ ZEND_DEALLOCATOR(ptr, size) \
+ } else { \
+ _efree(ptr); \
+ } \
+ } while (0)
+# define efree_size_rel(ptr, size) \
+ efree_size(ptr, size)
+
+#else
+
+# define efree_size(ptr, size) \
+ efree(ptr)
+# define efree_size_rel(ptr, size) \
+ efree_rel(ptr)
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
-ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE2(1,2);
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2);
-ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+#define _emalloc_large _emalloc
+#define _emalloc_huge _emalloc
+#define _efree_large _efree
+#define _efree_huge _efree
+
+#endif
/* Standard wrapper macros */
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define emalloc_large(size) _emalloc_large((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define emalloc_huge(size) _emalloc_huge((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define efree_large(ptr) _efree_large((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
+#define efree_huge(ptr) _efree_huge((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define safe_erealloc(ptr, nmemb, size, offset) _safe_erealloc((ptr), (nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
@@ -91,7 +164,7 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_
#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define zend_mem_block_size_rel(ptr) _zend_mem_block_size((ptr) TSRMLS_CC ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
-inline static void * __zend_malloc(size_t len)
+zend_always_inline static void * __zend_malloc(size_t len)
{
void *tmp = malloc(len);
if (tmp) {
@@ -101,14 +174,14 @@ inline static void * __zend_malloc(size_t len)
exit(1);
}
-inline static void * __zend_calloc(size_t nmemb, size_t len)
+zend_always_inline static void * __zend_calloc(size_t nmemb, size_t len)
{
void *tmp = _safe_malloc(nmemb, len, 0);
memset(tmp, 0, nmemb * len);
return tmp;
}
-inline static void * __zend_realloc(void *p, size_t len)
+zend_always_inline static void * __zend_realloc(void *p, size_t len)
{
p = realloc(p, len);
if (p) {
@@ -123,6 +196,7 @@ inline static void * __zend_realloc(void *p, size_t len)
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
+#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
#define safe_perealloc(ptr, nmemb, size, offset, persistent) ((persistent)?_safe_realloc((ptr), (nmemb), (size), (offset)):safe_erealloc((ptr), (nmemb), (size), (offset)))
@@ -143,44 +217,31 @@ ZEND_API void start_memory_manager(TSRMLS_D);
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
ZEND_API int is_zend_mm(TSRMLS_D);
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-void zend_debug_alloc_output(char *format, ...);
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-#else
-#define mem_block_check(type, ptr, silent)
-#define full_mem_check(silent)
-#endif
-
ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC);
ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
-END_EXTERN_C()
-
/* fast cache for HashTables */
#define ALLOC_HASHTABLE(ht) \
(ht) = (HashTable *) emalloc(sizeof(HashTable))
#define FREE_HASHTABLE(ht) \
- efree(ht)
+ efree_size(ht, sizeof(HashTable))
#define ALLOC_HASHTABLE_REL(ht) \
(ht) = (HashTable *) emalloc_rel(sizeof(HashTable))
#define FREE_HASHTABLE_REL(ht) \
- efree_rel(ht)
+ efree_size_rel(ht, sizeof(HashTable))
/* Heap functions */
typedef struct _zend_mm_heap zend_mm_heap;
ZEND_API zend_mm_heap *zend_mm_startup(void);
ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC);
-ZEND_API void *_zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API size_t _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void* ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
+ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void* ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
#define zend_mm_alloc(heap, size) _zend_mm_alloc((heap), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define zend_mm_free(heap, p) _zend_mm_free((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
@@ -192,37 +253,35 @@ ZEND_API size_t _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_D
#define zend_mm_realloc_rel(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
#define zend_mm_block_size_rel(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
-/* Heaps with user defined storage */
+ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC);
+
+ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
+ void* (*_malloc)(size_t),
+ void (*_free)(void*),
+ void* (*_realloc)(void*, size_t));
+ZEND_API void zend_mm_get_custom_handlers(zend_mm_heap *heap,
+ void* (**_malloc)(size_t),
+ void (**_free)(void*),
+ void* (**_realloc)(void*, size_t));
+
typedef struct _zend_mm_storage zend_mm_storage;
-typedef struct _zend_mm_segment {
- size_t size;
- struct _zend_mm_segment *next_segment;
-} zend_mm_segment;
-
-typedef struct _zend_mm_mem_handlers {
- const char *name;
- zend_mm_storage* (*init)(void *params);
- void (*dtor)(zend_mm_storage *storage);
- void (*compact)(zend_mm_storage *storage);
- zend_mm_segment* (*_alloc)(zend_mm_storage *storage, size_t size);
- zend_mm_segment* (*_realloc)(zend_mm_storage *storage, zend_mm_segment *ptr, size_t size);
- void (*_free)(zend_mm_storage *storage, zend_mm_segment *ptr);
-} zend_mm_mem_handlers;
+typedef void* (*zend_mm_chunk_alloc_t)(zend_mm_storage *storage, size_t size, size_t alignment);
+typedef void (*zend_mm_chunk_free_t)(zend_mm_storage *storage, void *chunk, size_t size);
+typedef void (*zend_mm_chunk_truncate_t)(zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size);
+typedef void (*zend_mm_storage_dtor_t)(zend_mm_storage *storage);
struct _zend_mm_storage {
- const zend_mm_mem_handlers *handlers;
- void *data;
+ zend_mm_chunk_alloc_t chunk_alloc;
+ zend_mm_chunk_free_t chunk_free;
+ zend_mm_chunk_truncate_t chunk_truncate;
+ zend_mm_storage_dtor_t dtor;
};
-ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, size_t block_size, size_t reserve_size, int internal, void *params);
-ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC);
ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap);
+ZEND_API zend_mm_heap *zend_mm_startup_ex(zend_mm_storage *storage);
-ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
- void* (*_malloc)(size_t),
- void (*_free)(void*),
- void* (*_realloc)(void*, size_t));
+END_EXTERN_C()
#endif
diff --git a/Zend/zend_alloc_sizes.h b/Zend/zend_alloc_sizes.h
new file mode 100644
index 0000000000..177238ae34
--- /dev/null
+++ b/Zend/zend_alloc_sizes.h
@@ -0,0 +1,46 @@
+#ifndef ZEND_ALLOC_SIZES_H
+#define ZEND_ALLOC_SIZES_H
+
+#define ZEND_MM_CHUNK_SIZE (2 * 1024 * 1024) /* 2 MB */
+#define ZEND_MM_PAGE_SIZE (4 * 1024) /* 4 KB */
+#define ZEND_MM_PAGES (ZEND_MM_CHUNK_SIZE / ZEND_MM_PAGE_SIZE) /* 512 */
+#define ZEND_MM_FIRST_PAGE (1)
+
+#define ZEND_MM_MIN_SMALL_SIZE 8
+#define ZEND_MM_MAX_SMALL_SIZE 3072
+#define ZEND_MM_MAX_LARGE_SIZE (ZEND_MM_CHUNK_SIZE - (ZEND_MM_PAGE_SIZE * ZEND_MM_FIRST_PAGE))
+
+/* num, size, count, pages */
+#define ZEND_MM_BINS_INFO(_, x, y) \
+ _( 0, 8, 512, 1, x, y) \
+ _( 1, 16, 256, 1, x, y) \
+ _( 2, 24, 170, 1, x, y) \
+ _( 3, 32, 128, 1, x, y) \
+ _( 4, 40, 102, 1, x, y) \
+ _( 5, 48, 85, 1, x, y) \
+ _( 6, 56, 73, 1, x, y) \
+ _( 7, 64, 64, 1, x, y) \
+ _( 8, 80, 51, 1, x, y) \
+ _( 9, 96, 42, 1, x, y) \
+ _(10, 112, 36, 1, x, y) \
+ _(11, 128, 32, 1, x, y) \
+ _(12, 160, 25, 1, x, y) \
+ _(13, 192, 21, 1, x, y) \
+ _(14, 224, 18, 1, x, y) \
+ _(15, 256, 16, 1, x, y) \
+ _(16, 320, 64, 5, x, y) \
+ _(17, 384, 32, 3, x, y) \
+ _(18, 448, 9, 1, x, y) \
+ _(19, 512, 8, 1, x, y) \
+ _(20, 640, 32, 5, x, y) \
+ _(21, 768, 16, 3, x, y) \
+ _(22, 896, 9, 2, x, y) \
+ _(23, 1024, 8, 2, x, y) \
+ _(24, 1280, 16, 5, x, y) \
+ _(25, 1536, 8, 3, x, y) \
+ _(26, 1792, 16, 7, x, y) \
+ _(27, 2048, 8, 4, x, y) \
+ _(28, 2560, 8, 5, x, y) \
+ _(29, 3072, 4, 3, x, y)
+
+#endif /* ZEND_ALLOC_SIZES_H */
diff --git a/Zend/zend_arena.h b/Zend/zend_arena.h
index 0a1d6f1107..64fde19619 100644
--- a/Zend/zend_arena.h
+++ b/Zend/zend_arena.h
@@ -65,7 +65,7 @@ static zend_always_inline void* zend_arena_alloc(zend_arena **arena_ptr, size_t
size_t arena_size =
UNEXPECTED((size + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena))) > (size_t)(arena->end - (char*) arena)) ?
(size + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena))) :
- (arena->end - (char*) arena);
+ (size_t)(arena->end - (char*) arena);
zend_arena *new_arena = (zend_arena*)emalloc(arena_size);
ptr = (char*) new_arena + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena));
@@ -80,10 +80,14 @@ static zend_always_inline void* zend_arena_alloc(zend_arena **arena_ptr, size_t
static zend_always_inline void* zend_arena_calloc(zend_arena **arena_ptr, size_t count, size_t unit_size)
{
- size_t size = unit_size * count;
+ int overflow;
+ size_t size;
void *ret;
- ZEND_ASSERT(size >= unit_size && size >= count);
+ size = zend_safe_address(unit_size, count, 0, &overflow);
+ if (UNEXPECTED(overflow)) {
+ zend_error(E_ERROR, "Possible integer overflow in zend_arena_calloc() (%zu * %zu)", unit_size, count);
+ }
ret = zend_arena_alloc(arena_ptr, size);
memset(ret, 0, size);
return ret;
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index dd7574ba3c..9604079a9e 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -23,82 +23,158 @@
#include "zend_API.h"
#include "zend_operators.h"
-ZEND_API zend_ast *zend_ast_create_constant(zval *zv)
-{
- zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zval));
- ast->kind = ZEND_CONST;
- ast->children = 0;
- ZVAL_COPY_VALUE(&ast->u.val, zv);
- return ast;
+static inline void *zend_ast_alloc(size_t size TSRMLS_DC) {
+ return zend_arena_alloc(&CG(ast_arena), size);
}
-ZEND_API zend_ast* zend_ast_create_unary(uint kind, zend_ast *op0)
-{
- zend_ast *ast = emalloc(sizeof(zend_ast));
+static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size TSRMLS_DC) {
+ void *new = zend_ast_alloc(new_size TSRMLS_CC);
+ memcpy(new, old, old_size);
+ return new;
+}
+
+static inline size_t zend_ast_size(uint32_t children) {
+ return sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
+}
+
+static inline size_t zend_ast_list_size(uint32_t children) {
+ return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
+}
+
+ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
+ zend_ast_znode *ast;
+ TSRMLS_FETCH();
+
+ ast = zend_ast_alloc(sizeof(zend_ast_znode) TSRMLS_CC);
+ ast->kind = ZEND_AST_ZNODE;
+ ast->attr = 0;
+ ast->lineno = CG(zend_lineno);
+ ast->node = *node;
+ return (zend_ast *) ast;
+}
+
+ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
+ zend_ast_zval *ast;
+ TSRMLS_FETCH();
+
+ ast = zend_ast_alloc(sizeof(zend_ast_zval) TSRMLS_CC);
+ ast->kind = ZEND_AST_ZVAL;
+ ast->attr = attr;
+ ZVAL_COPY_VALUE(&ast->val, zv);
+ ast->val.u2.lineno = CG(zend_lineno);
+ return (zend_ast *) ast;
+}
+
+ZEND_API zend_ast *zend_ast_create_decl(
+ zend_ast_kind kind, uint32_t flags, uint32_t start_lineno, zend_string *doc_comment,
+ zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2
+) {
+ zend_ast_decl *ast;
+ TSRMLS_FETCH();
+
+ ast = zend_ast_alloc(sizeof(zend_ast_decl) TSRMLS_CC);
ast->kind = kind;
- ast->children = 1;
- (&ast->u.child)[0] = op0;
- return ast;
+ ast->attr = 0;
+ ast->start_lineno = start_lineno;
+ ast->end_lineno = CG(zend_lineno);
+ ast->flags = flags;
+ ast->lex_pos = LANG_SCNG(yy_text);
+ ast->doc_comment = doc_comment;
+ ast->name = name;
+ ast->child[0] = child0;
+ ast->child[1] = child1;
+ ast->child[2] = child2;
+
+ return (zend_ast *) ast;
}
-ZEND_API zend_ast* zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1)
-{
- zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*));
+static zend_ast *zend_ast_create_from_va_list(zend_ast_kind kind, zend_ast_attr attr, va_list va) {
+ uint32_t i, children = kind >> ZEND_AST_NUM_CHILDREN_SHIFT;
+ zend_ast *ast;
+ TSRMLS_FETCH();
+
+ ast = zend_ast_alloc(zend_ast_size(children) TSRMLS_CC);
ast->kind = kind;
- ast->children = 2;
- (&ast->u.child)[0] = op0;
- (&ast->u.child)[1] = op1;
+ ast->attr = attr;
+ ast->lineno = (uint32_t) -1;
+
+ for (i = 0; i < children; ++i) {
+ ast->child[i] = va_arg(va, zend_ast *);
+ if (ast->child[i] != NULL) {
+ uint32_t lineno = zend_ast_get_lineno(ast->child[i]);
+ if (lineno < ast->lineno) {
+ ast->lineno = lineno;
+ }
+ }
+ }
+
+ if (ast->lineno == UINT_MAX) {
+ ast->lineno = CG(zend_lineno);
+ }
+
return ast;
}
-ZEND_API zend_ast* zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2)
-{
- zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 2);
- ast->kind = kind;
- ast->children = 3;
- (&ast->u.child)[0] = op0;
- (&ast->u.child)[1] = op1;
- (&ast->u.child)[2] = op2;
+ZEND_API zend_ast *zend_ast_create_ex(zend_ast_kind kind, zend_ast_attr attr, ...) {
+ va_list va;
+ zend_ast *ast;
+
+ va_start(va, attr);
+ ast = zend_ast_create_from_va_list(kind, attr, va);
+ va_end(va);
+
return ast;
}
-ZEND_API zend_ast* zend_ast_create_dynamic(uint kind)
-{
- zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 3); /* use 4 children as deafult */
- ast->kind = kind;
- ast->children = 0;
+ZEND_API zend_ast *zend_ast_create(zend_ast_kind kind, ...) {
+ va_list va;
+ zend_ast *ast;
+
+ va_start(va, kind);
+ ast = zend_ast_create_from_va_list(kind, 0, va);
+ va_end(va);
+
return ast;
}
-ZEND_API void zend_ast_dynamic_add(zend_ast **ast, zend_ast *op)
-{
- if ((*ast)->children >= 4 && (*ast)->children == ((*ast)->children & -(*ast)->children)) {
- *ast = erealloc(*ast, sizeof(zend_ast) + sizeof(zend_ast*) * ((*ast)->children * 2 + 1));
+ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind kind, ...) {
+ zend_ast *ast;
+ zend_ast_list *list;
+ TSRMLS_FETCH();
+
+ ast = zend_ast_alloc(zend_ast_list_size(4) TSRMLS_CC);
+ list = (zend_ast_list *) ast;
+ list->kind = kind;
+ list->attr = 0;
+ list->lineno = CG(zend_lineno);
+ list->children = 0;
+
+ {
+ va_list va;
+ uint32_t i;
+ va_start(va, kind);
+ for (i = 0; i < init_children; ++i) {
+ ast = zend_ast_list_add(ast, va_arg(va, zend_ast *));
+ }
+ va_end(va);
}
- (&(*ast)->u.child)[(*ast)->children++] = op;
-}
-ZEND_API void zend_ast_dynamic_shrink(zend_ast **ast)
-{
- *ast = erealloc(*ast, sizeof(zend_ast) + sizeof(zend_ast*) * ((*ast)->children - 1));
+ return ast;
}
-ZEND_API int zend_ast_is_ct_constant(zend_ast *ast)
-{
- int i;
+static inline zend_bool is_power_of_two(uint32_t n) {
+ return ((n != 0) && (n == (n & (~n + 1))));
+}
- if (ast->kind == ZEND_CONST) {
- return !Z_CONSTANT(ast->u.val);
- } else {
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- if (!zend_ast_is_ct_constant((&ast->u.child)[i])) {
- return 0;
- }
- }
- }
- return 1;
+ZEND_API zend_ast *zend_ast_list_add(zend_ast *ast, zend_ast *op) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ if (list->children >= 4 && is_power_of_two(list->children)) {
+ TSRMLS_FETCH();
+ list = zend_ast_realloc(list,
+ zend_ast_list_size(list->children), zend_ast_list_size(list->children * 2) TSRMLS_CC);
}
+ list->child[list->children++] = op;
+ return (zend_ast *) list;
}
static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TSRMLS_DC)
@@ -114,8 +190,8 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS
case IS_NULL:
zend_symtable_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), expr);
break;
- case IS_INT:
- zend_hash_index_update(Z_ARRVAL_P(result), Z_IVAL_P(offset), expr);
+ case IS_LONG:
+ zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), expr);
break;
case IS_FALSE:
zend_hash_index_update(Z_ARRVAL_P(result), 0, expr);
@@ -124,7 +200,7 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS
zend_hash_index_update(Z_ARRVAL_P(result), 1, expr);
break;
case IS_DOUBLE:
- zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_ival(Z_DVAL_P(offset)), expr);
+ zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr);
break;
default:
zend_error(E_ERROR, "Illegal offset type");
@@ -137,167 +213,58 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
zval op1, op2;
switch (ast->kind) {
- case ZEND_ADD:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- add_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_SUB:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- sub_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_MUL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- mul_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_POW:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- pow_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_DIV:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- div_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_MOD:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- mod_function(result, &op1, &op2 TSRMLS_CC);
+ case ZEND_AST_BINARY_OP:
+ {
+ binary_op_type op = get_binary_op(ast->attr);
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
+ op(result, &op1, &op2 TSRMLS_CC);
zval_dtor(&op1);
zval_dtor(&op2);
break;
- case ZEND_SL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- shift_left_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_SR:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- shift_right_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_CONCAT:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- concat_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_BW_OR:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- bitwise_or_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_BW_AND:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- bitwise_and_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_BW_XOR:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- bitwise_xor_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_BW_NOT:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- bitwise_not_function(result, &op1 TSRMLS_CC);
- zval_dtor(&op1);
- break;
- case ZEND_BOOL_NOT:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- boolean_not_function(result, &op1 TSRMLS_CC);
- zval_dtor(&op1);
- break;
- case ZEND_BOOL_XOR:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- boolean_xor_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_IS_IDENTICAL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_identical_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_IS_NOT_IDENTICAL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_not_identical_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_IS_EQUAL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_equal_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_IS_NOT_EQUAL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_not_equal_function(result, &op1, &op2 TSRMLS_CC);
- zval_dtor(&op1);
- zval_dtor(&op2);
- break;
- case ZEND_IS_SMALLER:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_smaller_function(result, &op1, &op2 TSRMLS_CC);
+ }
+ case ZEND_AST_GREATER:
+ case ZEND_AST_GREATER_EQUAL:
+ {
+ /* op1 > op2 is the same as op2 < op1 */
+ binary_op_type op = ast->kind == ZEND_AST_GREATER
+ ? is_smaller_function : is_smaller_or_equal_function;
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
+ op(result, &op2, &op1 TSRMLS_CC);
zval_dtor(&op1);
zval_dtor(&op2);
break;
- case ZEND_IS_SMALLER_OR_EQUAL:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
- is_smaller_or_equal_function(result, &op1, &op2 TSRMLS_CC);
+ }
+ case ZEND_AST_UNARY_OP:
+ {
+ unary_op_type op = get_unary_op(ast->attr);
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
+ op(result, &op1 TSRMLS_CC);
zval_dtor(&op1);
- zval_dtor(&op2);
break;
- case ZEND_CONST:
- /* class constants may be updated in-place */
+ }
+ case ZEND_AST_ZVAL:
+ {
+ zval *zv = zend_ast_get_zval(ast);
if (scope) {
- if (Z_OPT_CONSTANT(ast->u.val)) {
- zval_update_constant_ex(&ast->u.val, 1, scope TSRMLS_CC);
+ /* class constants may be updated in-place */
+ if (Z_OPT_CONSTANT_P(zv)) {
+ zval_update_constant_ex(zv, 1, scope TSRMLS_CC);
}
- ZVAL_DUP(result, &ast->u.val);
+ ZVAL_DUP(result, zv);
} else {
- ZVAL_DUP(result, &ast->u.val);
+ ZVAL_DUP(result, zv);
if (Z_OPT_CONSTANT_P(result)) {
zval_update_constant_ex(result, 1, scope TSRMLS_CC);
}
}
break;
- case ZEND_BOOL_AND:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
+ }
+ case ZEND_AST_AND:
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
zval_dtor(&op2);
} else {
@@ -305,61 +272,63 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
}
zval_dtor(&op1);
break;
- case ZEND_BOOL_OR:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
+ case ZEND_AST_OR:
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
ZVAL_BOOL(result, 1);
} else {
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
zval_dtor(&op2);
}
zval_dtor(&op1);
break;
- case ZEND_SELECT:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
+ case ZEND_AST_CONDITIONAL:
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
if (zend_is_true(&op1 TSRMLS_CC)) {
- if (!(&ast->u.child)[1]) {
+ if (!ast->child[1]) {
*result = op1;
} else {
- zend_ast_evaluate(result, (&ast->u.child)[1], scope TSRMLS_CC);
+ zend_ast_evaluate(result, ast->child[1], scope TSRMLS_CC);
zval_dtor(&op1);
}
} else {
- zend_ast_evaluate(result, (&ast->u.child)[2], scope TSRMLS_CC);
+ zend_ast_evaluate(result, ast->child[2], scope TSRMLS_CC);
zval_dtor(&op1);
}
break;
- case ZEND_UNARY_PLUS:
- ZVAL_INT(&op1, 0);
- zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
+ case ZEND_AST_UNARY_PLUS:
+ ZVAL_LONG(&op1, 0);
+ zend_ast_evaluate(&op2, ast->child[0], scope TSRMLS_CC);
add_function(result, &op1, &op2 TSRMLS_CC);
zval_dtor(&op2);
break;
- case ZEND_UNARY_MINUS:
- ZVAL_INT(&op1, 0);
- zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
+ case ZEND_AST_UNARY_MINUS:
+ ZVAL_LONG(&op1, 0);
+ zend_ast_evaluate(&op2, ast->child[0], scope TSRMLS_CC);
sub_function(result, &op1, &op2 TSRMLS_CC);
zval_dtor(&op2);
break;
- case ZEND_INIT_ARRAY:
+ case ZEND_AST_ARRAY:
array_init(result);
{
- int i;
- for (i = 0; i < ast->children; i+=2) {
- if ((&ast->u.child)[i]) {
- zend_ast_evaluate(&op1, (&ast->u.child)[i], scope TSRMLS_CC);
+ uint32_t i;
+ zend_ast_list *list = zend_ast_get_list(ast);
+ for (i = 0; i < list->children; i++) {
+ zend_ast *elem = list->child[i];
+ if (elem->child[1]) {
+ zend_ast_evaluate(&op1, elem->child[1], scope TSRMLS_CC);
} else {
ZVAL_UNDEF(&op1);
}
- zend_ast_evaluate(&op2, (&ast->u.child)[i+1], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, elem->child[0], scope TSRMLS_CC);
zend_ast_add_array_element(result, &op1, &op2 TSRMLS_CC);
}
}
break;
- case ZEND_FETCH_DIM_R:
- zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
- zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
+ case ZEND_AST_DIM:
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
{
zval tmp;
zend_fetch_dimension_by_zval(&tmp, &op1, &op2 TSRMLS_CC);
@@ -377,35 +346,100 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast)
{
if (ast == NULL) {
return NULL;
- } else if (ast->kind == ZEND_CONST) {
- zend_ast *copy = zend_ast_create_constant(&ast->u.val);
- zval_copy_ctor(&copy->u.val);
- return copy;
- } else if (ast->children) {
- zend_ast *new = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- int i;
+ } else if (ast->kind == ZEND_AST_ZVAL) {
+ zend_ast_zval *new = emalloc(sizeof(zend_ast_zval));
+ new->kind = ZEND_AST_ZVAL;
+ new->attr = ast->attr;
+ ZVAL_COPY(&new->val, zend_ast_get_zval(ast));
+ return (zend_ast *) new;
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_ast_list *new = emalloc(zend_ast_list_size(list->children));
+ uint32_t i;
+ new->kind = list->kind;
+ new->attr = list->attr;
+ new->children = list->children;
+ for (i = 0; i < list->children; i++) {
+ new->child[i] = zend_ast_copy(list->child[i]);
+ }
+ return (zend_ast *) new;
+ } else {
+ uint32_t i, children = zend_ast_get_num_children(ast);
+ zend_ast *new = emalloc(zend_ast_size(children));
new->kind = ast->kind;
- new->children = ast->children;
- for (i = 0; i < ast->children; i++) {
- (&new->u.child)[i] = zend_ast_copy((&ast->u.child)[i]);
+ new->attr = ast->attr;
+ for (i = 0; i < children; i++) {
+ new->child[i] = zend_ast_copy(ast->child[i]);
}
return new;
}
- return zend_ast_create_dynamic(ast->kind);
}
-ZEND_API void zend_ast_destroy(zend_ast *ast)
-{
- int i;
+static void zend_ast_destroy_ex(zend_ast *ast, zend_bool free) {
+ if (!ast) {
+ return;
+ }
- if (ast->kind == ZEND_CONST) {
- zval_dtor(&ast->u.val);
- } else {
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- zend_ast_destroy((&ast->u.child)[i]);
+ switch (ast->kind) {
+ case ZEND_AST_ZVAL:
+ /* Destroy value without using GC: When opcache moves arrays into SHM it will
+ * free the zend_array structure, so references to it from outside the op array
+ * become invalid. GC would cause such a reference in the root buffer. */
+ zval_ptr_dtor_nogc(zend_ast_get_zval(ast));
+ break;
+ case ZEND_AST_FUNC_DECL:
+ case ZEND_AST_CLOSURE:
+ case ZEND_AST_METHOD:
+ case ZEND_AST_CLASS:
+ {
+ zend_ast_decl *decl = (zend_ast_decl *) ast;
+ zend_string_release(decl->name);
+ if (decl->doc_comment) {
+ zend_string_release(decl->doc_comment);
+ }
+ zend_ast_destroy_ex(decl->child[0], free);
+ zend_ast_destroy_ex(decl->child[1], free);
+ zend_ast_destroy_ex(decl->child[2], free);
+ break;
+ }
+ default:
+ if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; i++) {
+ zend_ast_destroy_ex(list->child[i], free);
+ }
+ } else {
+ uint32_t i, children = zend_ast_get_num_children(ast);
+ for (i = 0; i < children; i++) {
+ zend_ast_destroy_ex(ast->child[i], free);
+ }
}
+ }
+
+ if (free) {
+ efree(ast);
+ }
+}
+
+ZEND_API void zend_ast_destroy(zend_ast *ast) {
+ zend_ast_destroy_ex(ast, 0);
+}
+ZEND_API void zend_ast_destroy_and_free(zend_ast *ast) {
+ zend_ast_destroy_ex(ast, 1);
+}
+
+ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn TSRMLS_DC) {
+ if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; ++i) {
+ fn(&list->child[i] TSRMLS_CC);
+ }
+ } else {
+ uint32_t i, children = zend_ast_get_num_children(ast);
+ for (i = 0; i < children; ++i) {
+ fn(&ast->child[i] TSRMLS_CC);
}
}
- efree(ast);
}
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index 8678299f0f..6bd6850d83 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -14,6 +14,7 @@
+----------------------------------------------------------------------+
| Authors: Bob Weinand <bwoebi@php.net> |
| Dmitry Stogov <dmitry@zend.com> |
+ | Nikita Popov <nikic@php.net> |
+----------------------------------------------------------------------+
*/
@@ -24,39 +25,242 @@
#include "zend.h"
-typedef enum _zend_ast_kind {
- /* first 256 kinds are reserved for opcodes */
- ZEND_CONST = 256,
- ZEND_BOOL_AND,
- ZEND_BOOL_OR,
- ZEND_SELECT,
- ZEND_UNARY_PLUS,
- ZEND_UNARY_MINUS,
-} zend_ast_kind;
+#define ZEND_AST_SPECIAL_SHIFT 6
+#define ZEND_AST_IS_LIST_SHIFT 7
+#define ZEND_AST_NUM_CHILDREN_SHIFT 8
+
+enum _zend_ast_kind {
+ /* special nodes */
+ ZEND_AST_ZVAL = 1 << ZEND_AST_SPECIAL_SHIFT,
+ ZEND_AST_ZNODE,
+
+ /* declaration nodes */
+ ZEND_AST_FUNC_DECL,
+ ZEND_AST_CLOSURE,
+ ZEND_AST_METHOD,
+ ZEND_AST_CLASS,
+
+ /* list nodes */
+ ZEND_AST_ARG_LIST = 1 << ZEND_AST_IS_LIST_SHIFT,
+ ZEND_AST_LIST,
+ ZEND_AST_ARRAY,
+ ZEND_AST_ENCAPS_LIST,
+ ZEND_AST_EXPR_LIST,
+ ZEND_AST_STMT_LIST,
+ ZEND_AST_IF,
+ ZEND_AST_SWITCH_LIST,
+ ZEND_AST_CATCH_LIST,
+ ZEND_AST_PARAM_LIST,
+ ZEND_AST_CLOSURE_USES,
+ ZEND_AST_PROP_DECL,
+ ZEND_AST_CONST_DECL,
+ ZEND_AST_CLASS_CONST_DECL,
+ ZEND_AST_NAME_LIST,
+ ZEND_AST_TRAIT_ADAPTATIONS,
+ ZEND_AST_USE,
+
+ /* 0 child nodes */
+ ZEND_AST_MAGIC_CONST = 0 << ZEND_AST_NUM_CHILDREN_SHIFT,
+ ZEND_AST_TYPE,
+
+ /* 1 child node */
+ ZEND_AST_VAR = 1 << ZEND_AST_NUM_CHILDREN_SHIFT,
+ ZEND_AST_CONST,
+ ZEND_AST_RESOLVE_CLASS_NAME,
+ ZEND_AST_UNPACK,
+ ZEND_AST_UNARY_PLUS,
+ ZEND_AST_UNARY_MINUS,
+ ZEND_AST_CAST,
+ ZEND_AST_EMPTY,
+ ZEND_AST_ISSET,
+ ZEND_AST_SILENCE,
+ ZEND_AST_SHELL_EXEC,
+ ZEND_AST_CLONE,
+ ZEND_AST_EXIT,
+ ZEND_AST_PRINT,
+ ZEND_AST_INCLUDE_OR_EVAL,
+ ZEND_AST_UNARY_OP,
+ ZEND_AST_PRE_INC,
+ ZEND_AST_PRE_DEC,
+ ZEND_AST_POST_INC,
+ ZEND_AST_POST_DEC,
+
+ ZEND_AST_GLOBAL,
+ ZEND_AST_UNSET,
+ ZEND_AST_RETURN,
+ ZEND_AST_LABEL,
+ ZEND_AST_REF,
+ ZEND_AST_HALT_COMPILER,
+ ZEND_AST_ECHO,
+ ZEND_AST_THROW,
+ ZEND_AST_GOTO,
+ ZEND_AST_BREAK,
+ ZEND_AST_CONTINUE,
+
+ /* 2 child nodes */
+ ZEND_AST_DIM = 2 << ZEND_AST_NUM_CHILDREN_SHIFT,
+ ZEND_AST_PROP,
+ ZEND_AST_STATIC_PROP,
+ ZEND_AST_CALL,
+ ZEND_AST_CLASS_CONST,
+ ZEND_AST_ASSIGN,
+ ZEND_AST_ASSIGN_REF,
+ ZEND_AST_ASSIGN_OP,
+ ZEND_AST_BINARY_OP,
+ ZEND_AST_GREATER,
+ ZEND_AST_GREATER_EQUAL,
+ ZEND_AST_AND,
+ ZEND_AST_OR,
+ ZEND_AST_ARRAY_ELEM,
+ ZEND_AST_NEW,
+ ZEND_AST_INSTANCEOF,
+ ZEND_AST_YIELD,
+ ZEND_AST_COALESCE,
+
+ ZEND_AST_STATIC,
+ ZEND_AST_WHILE,
+ ZEND_AST_DO_WHILE,
+ ZEND_AST_IF_ELEM,
+ ZEND_AST_SWITCH,
+ ZEND_AST_SWITCH_CASE,
+ ZEND_AST_DECLARE,
+ ZEND_AST_PROP_ELEM,
+ ZEND_AST_CONST_ELEM,
+ ZEND_AST_USE_TRAIT,
+ ZEND_AST_TRAIT_PRECEDENCE,
+ ZEND_AST_METHOD_REFERENCE,
+ ZEND_AST_NAMESPACE,
+ ZEND_AST_USE_ELEM,
+ ZEND_AST_TRAIT_ALIAS,
+
+ /* 3 child nodes */
+ ZEND_AST_METHOD_CALL = 3 << ZEND_AST_NUM_CHILDREN_SHIFT,
+ ZEND_AST_STATIC_CALL,
+ ZEND_AST_CONDITIONAL,
+
+ ZEND_AST_TRY,
+ ZEND_AST_CATCH,
+ ZEND_AST_PARAM,
+
+ /* 4 child nodes */
+ ZEND_AST_FOR = 4 << ZEND_AST_NUM_CHILDREN_SHIFT,
+ ZEND_AST_FOREACH,
+};
+
+typedef uint16_t zend_ast_kind;
+typedef uint16_t zend_ast_attr;
struct _zend_ast {
- unsigned short kind;
- unsigned short children;
- union {
- zval val;
- zend_ast *child;
- } u;
+ zend_ast_kind kind; /* Type of the node (ZEND_AST_* enum constant) */
+ zend_ast_attr attr; /* Additional attribute, use depending on node type */
+ uint32_t lineno; /* Line number */
+ zend_ast *child[1]; /* Array of children (using struct hack) */
};
-ZEND_API zend_ast *zend_ast_create_constant(zval *zv);
+/* Same as zend_ast, but with children count, which is updated dynamically */
+typedef struct _zend_ast_list {
+ zend_ast_kind kind;
+ zend_ast_attr attr;
+ uint32_t lineno;
+ uint32_t children;
+ zend_ast *child[1];
+} zend_ast_list;
+
+/* Lineno is stored in val.u2.lineno */
+typedef struct _zend_ast_zval {
+ zend_ast_kind kind;
+ zend_ast_attr attr;
+ zval val;
+} zend_ast_zval;
+
+/* Separate structure for function and class declaration, as they need extra information. */
+typedef struct _zend_ast_decl {
+ zend_ast_kind kind;
+ zend_ast_attr attr; /* Unused - for structure compatibility */
+ uint32_t start_lineno;
+ uint32_t end_lineno;
+ uint32_t flags;
+ unsigned char *lex_pos;
+ zend_string *doc_comment;
+ zend_string *name;
+ zend_ast *child[3];
+} zend_ast_decl;
-ZEND_API zend_ast *zend_ast_create_unary(uint kind, zend_ast *op0);
-ZEND_API zend_ast *zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1);
-ZEND_API zend_ast *zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2);
-ZEND_API zend_ast* zend_ast_create_dynamic(uint kind);
-ZEND_API void zend_ast_dynamic_add(zend_ast **ast, zend_ast *op);
-ZEND_API void zend_ast_dynamic_shrink(zend_ast **ast);
+ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr);
-ZEND_API int zend_ast_is_ct_constant(zend_ast *ast);
+ZEND_API zend_ast *zend_ast_create_ex(zend_ast_kind kind, zend_ast_attr attr, ...);
+ZEND_API zend_ast *zend_ast_create(zend_ast_kind kind, ...);
+
+ZEND_API zend_ast *zend_ast_create_decl(
+ zend_ast_kind kind, uint32_t flags, uint32_t start_lineno, zend_string *doc_comment,
+ zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2
+);
+
+ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind kind, ...);
+ZEND_API zend_ast *zend_ast_list_add(zend_ast *list, zend_ast *op);
ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *scope TSRMLS_DC);
ZEND_API zend_ast *zend_ast_copy(zend_ast *ast);
ZEND_API void zend_ast_destroy(zend_ast *ast);
+ZEND_API void zend_ast_destroy_and_free(zend_ast *ast);
+
+typedef void (*zend_ast_apply_func)(zend_ast **ast_ptr TSRMLS_DC);
+ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn TSRMLS_DC);
+
+static zend_always_inline zend_bool zend_ast_is_list(zend_ast *ast) {
+ return (ast->kind >> ZEND_AST_IS_LIST_SHIFT) & 1;
+}
+static zend_always_inline zend_ast_list *zend_ast_get_list(zend_ast *ast) {
+ ZEND_ASSERT(zend_ast_is_list(ast));
+ return (zend_ast_list *) ast;
+}
+
+static zend_always_inline zval *zend_ast_get_zval(zend_ast *ast) {
+ ZEND_ASSERT(ast->kind == ZEND_AST_ZVAL);
+ return &((zend_ast_zval *) ast)->val;
+}
+static zend_always_inline zend_string *zend_ast_get_str(zend_ast *ast) {
+ zval *zv = zend_ast_get_zval(ast);
+ ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
+ return Z_STR_P(zv);
+}
+
+static zend_always_inline uint32_t zend_ast_get_num_children(zend_ast *ast) {
+ ZEND_ASSERT(!zend_ast_is_list(ast));
+ return ast->kind >> ZEND_AST_NUM_CHILDREN_SHIFT;
+}
+static zend_always_inline uint32_t zend_ast_get_lineno(zend_ast *ast) {
+ if (ast->kind == ZEND_AST_ZVAL) {
+ zval *zv = zend_ast_get_zval(ast);
+ return zv->u2.lineno;
+ } else {
+ return ast->lineno;
+ }
+}
+
+static zend_always_inline zend_ast *zend_ast_create_zval(zval *zv) {
+ return zend_ast_create_zval_ex(zv, 0);
+}
+static zend_always_inline zend_ast *zend_ast_create_zval_from_str(zend_string *str) {
+ zval zv;
+ ZVAL_STR(&zv, str);
+ return zend_ast_create_zval(&zv);
+}
+static zend_always_inline zend_ast *zend_ast_create_zval_from_long(zend_long lval) {
+ zval zv;
+ ZVAL_LONG(&zv, lval);
+ return zend_ast_create_zval(&zv);
+}
+
+static zend_always_inline zend_ast *zend_ast_create_binary_op(uint32_t opcode, zend_ast *op0, zend_ast *op1) {
+ return zend_ast_create_ex(ZEND_AST_BINARY_OP, opcode, op0, op1);
+}
+static zend_always_inline zend_ast *zend_ast_create_assign_op(uint32_t opcode, zend_ast *op0, zend_ast *op1) {
+ return zend_ast_create_ex(ZEND_AST_ASSIGN_OP, opcode, op0, op1);
+}
+static zend_always_inline zend_ast *zend_ast_create_cast(uint32_t type, zend_ast *op0) {
+ return zend_ast_create_ex(ZEND_AST_CAST, type, op0);
+}
#endif
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index e89f199b11..9487bb6c1e 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -364,7 +364,7 @@ ZEND_FUNCTION(zend_version)
Returns number of freed zvals */
ZEND_FUNCTION(gc_collect_cycles)
{
- RETURN_INT(gc_collect_cycles(TSRMLS_C));
+ RETURN_LONG(gc_collect_cycles(TSRMLS_C));
}
/* }}} */
@@ -380,9 +380,9 @@ ZEND_FUNCTION(gc_enabled)
Activates the circular reference collector */
ZEND_FUNCTION(gc_enable)
{
- zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
- zend_alter_ini_entry(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- STR_RELEASE(key);
+ zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
+ zend_alter_ini_entry_chars(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string_release(key);
}
/* }}} */
@@ -390,9 +390,9 @@ ZEND_FUNCTION(gc_enable)
Deactivates the circular reference collector */
ZEND_FUNCTION(gc_disable)
{
- zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
- zend_alter_ini_entry(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- STR_RELEASE(key);
+ zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
+ zend_alter_ini_entry_chars(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string_release(key);
}
/* }}} */
@@ -400,13 +400,13 @@ ZEND_FUNCTION(gc_disable)
Get the number of arguments that were passed to the function */
ZEND_FUNCTION(func_num_args)
{
- zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
+ zend_execute_data *ex = EX(prev_execute_data);
- if (ex->frame_kind == VM_FRAME_NESTED_FUNCTION || ex->frame_kind == VM_FRAME_TOP_FUNCTION) {
- RETURN_INT(ex->num_args);
+ if (VM_FRAME_KIND(ex->frame_info) == VM_FRAME_NESTED_FUNCTION || VM_FRAME_KIND(ex->frame_info) == VM_FRAME_TOP_FUNCTION) {
+ RETURN_LONG(ex->num_args);
} else {
zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
}
/* }}} */
@@ -415,12 +415,12 @@ ZEND_FUNCTION(func_num_args)
Get the $arg_num'th argument that was passed to the function */
ZEND_FUNCTION(func_get_arg)
{
- int arg_count, first_extra_arg;
+ uint32_t arg_count, first_extra_arg;
zval *arg;
- zend_int_t requested_offset;
+ zend_long requested_offset;
zend_execute_data *ex;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &requested_offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &requested_offset) == FAILURE) {
return;
}
@@ -429,8 +429,8 @@ ZEND_FUNCTION(func_get_arg)
RETURN_FALSE;
}
- ex = EG(current_execute_data)->prev_execute_data;
- if (ex->frame_kind != VM_FRAME_NESTED_FUNCTION && ex->frame_kind != VM_FRAME_TOP_FUNCTION) {
+ ex = EX(prev_execute_data);
+ if (VM_FRAME_KIND(ex->frame_info) != VM_FRAME_NESTED_FUNCTION && VM_FRAME_KIND(ex->frame_info) != VM_FRAME_TOP_FUNCTION) {
zend_error(E_WARNING, "func_get_arg(): Called from the global scope - no function context");
RETURN_FALSE;
}
@@ -438,7 +438,7 @@ ZEND_FUNCTION(func_get_arg)
arg_count = ex->num_args;
if (requested_offset >= arg_count) {
- zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_INT_FMT " not passed to function", requested_offset);
+ zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset);
RETURN_FALSE;
}
@@ -460,11 +460,11 @@ ZEND_FUNCTION(func_get_arg)
ZEND_FUNCTION(func_get_args)
{
zval *p;
- int arg_count, first_extra_arg;
- int i;
- zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
+ uint32_t arg_count, first_extra_arg;
+ uint32_t i;
+ zend_execute_data *ex = EX(prev_execute_data);
- if (ex->frame_kind != VM_FRAME_NESTED_FUNCTION && ex->frame_kind != VM_FRAME_TOP_FUNCTION) {
+ if (VM_FRAME_KIND(ex->frame_info) != VM_FRAME_NESTED_FUNCTION && VM_FRAME_KIND(ex->frame_info) != VM_FRAME_TOP_FUNCTION) {
zend_error(E_WARNING, "func_get_args(): Called from the global scope - no function context");
RETURN_FALSE;
}
@@ -519,7 +519,8 @@ ZEND_FUNCTION(func_get_args)
/* }}} */
/* {{{ proto int strlen(string str)
- Get string length */
+ Get string length
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
ZEND_FUNCTION(strlen)
{
zend_string *s;
@@ -534,11 +535,10 @@ ZEND_FUNCTION(strlen)
ZEND_PARSE_PARAMETERS_END();
#endif
- RETVAL_INT(s->len);
+ RETVAL_LONG(s->len);
}
/* }}} */
-
/* {{{ proto int strcmp(string str1, string str2)
Binary safe string comparison */
ZEND_FUNCTION(strcmp)
@@ -549,19 +549,18 @@ ZEND_FUNCTION(strcmp)
return;
}
- RETURN_INT(zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len));
+ RETURN_LONG(zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len));
}
/* }}} */
-
/* {{{ proto int strncmp(string str1, string str2, int len)
Binary safe string comparison */
ZEND_FUNCTION(strncmp)
{
zend_string *s1, *s2;
- zend_int_t len;
+ zend_long len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s2, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) {
return;
}
@@ -570,11 +569,10 @@ ZEND_FUNCTION(strncmp)
RETURN_FALSE;
}
- RETURN_INT(zend_binary_strncmp(s1->val, s1->len, s2->val, s2->len, len));
+ RETURN_LONG(zend_binary_strncmp(s1->val, s1->len, s2->val, s2->len, len));
}
/* }}} */
-
/* {{{ proto int strcasecmp(string str1, string str2)
Binary safe case-insensitive string comparison */
ZEND_FUNCTION(strcasecmp)
@@ -585,19 +583,18 @@ ZEND_FUNCTION(strcasecmp)
return;
}
- RETURN_INT(zend_binary_strcasecmp(s1->val, s1->len, s2->val, s2->len));
+ RETURN_LONG(zend_binary_strcasecmp(s1->val, s1->len, s2->val, s2->len));
}
/* }}} */
-
/* {{{ proto int strncasecmp(string str1, string str2, int len)
Binary safe string comparison */
ZEND_FUNCTION(strncasecmp)
{
zend_string *s1, *s2;
- zend_int_t len;
+ zend_long len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s2, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) {
return;
}
@@ -606,17 +603,16 @@ ZEND_FUNCTION(strncasecmp)
RETURN_FALSE;
}
- RETURN_INT(zend_binary_strncasecmp(s1->val, s1->len, s2->val, s2->len, len));
+ RETURN_LONG(zend_binary_strncasecmp(s1->val, s1->len, s2->val, s2->len, len));
}
/* }}} */
-
/* {{{ proto array each(array arr)
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
ZEND_FUNCTION(each)
{
zval *array, *entry, tmp;
- zend_uint_t num_key;
+ zend_ulong num_key;
HashTable *target_hash;
zend_string *key;
@@ -659,10 +655,10 @@ ZEND_FUNCTION(each)
/* add the key elements */
if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) {
- ZVAL_STR(&tmp, STR_COPY(key));
+ ZVAL_STR_COPY(&tmp, key);
if (Z_REFCOUNTED(tmp)) Z_ADDREF(tmp);
} else {
- ZVAL_INT(&tmp, num_key);
+ ZVAL_LONG(&tmp, num_key);
}
zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "key", sizeof("key")-1, &tmp);
@@ -670,31 +666,28 @@ ZEND_FUNCTION(each)
}
/* }}} */
-
/* {{{ proto int error_reporting([int new_error_level])
Return the current error_reporting level, and if an argument was passed - change to the new level */
ZEND_FUNCTION(error_reporting)
{
- char *err;
- int err_len;
+ zend_string *err;
int old_error_reporting;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err) == FAILURE) {
return;
}
old_error_reporting = EG(error_reporting);
if(ZEND_NUM_ARGS() != 0) {
- zend_string *key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
- zend_alter_ini_entry(key, err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- STR_RELEASE(key);
+ zend_string *key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
+ zend_alter_ini_entry(key, err, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string_release(key);
}
- RETVAL_INT(old_error_reporting);
+ RETVAL_LONG(old_error_reporting);
}
/* }}} */
-
/* {{{ proto bool define(string constant_name, mixed value, boolean case_insensitive=false)
Define a new constant */
ZEND_FUNCTION(define)
@@ -732,7 +725,7 @@ ZEND_FUNCTION(define)
repeat:
switch (Z_TYPE_P(val)) {
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_FALSE:
@@ -764,7 +757,7 @@ repeat:
ZVAL_DUP(&c.value, val);
zval_ptr_dtor(&val_free);
c.flags = case_sensitive; /* non persistent */
- c.name = STR_COPY(name);
+ c.name = zend_string_copy(name);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
@@ -774,9 +767,9 @@ repeat:
}
/* }}} */
-
/* {{{ proto bool defined(string constant_name)
- Check whether a constant exists */
+ Check whether a constant exists
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
ZEND_FUNCTION(defined)
{
zend_string *name;
@@ -799,7 +792,6 @@ ZEND_FUNCTION(defined)
}
/* }}} */
-
/* {{{ proto string get_class([object object])
Retrieves the class name */
ZEND_FUNCTION(get_class)
@@ -812,18 +804,17 @@ ZEND_FUNCTION(get_class)
if (!obj) {
if (EG(scope)) {
- RETURN_STR(STR_COPY(EG(scope)->name));
+ RETURN_STR(zend_string_copy(EG(scope)->name));
} else {
zend_error(E_WARNING, "get_class() called without object from outside a class");
RETURN_FALSE;
}
}
- RETURN_STR(zend_get_object_classname(Z_OBJ_P(obj) TSRMLS_CC));
+ RETURN_STR(zend_string_copy(Z_OBJCE_P(obj)->name));
}
/* }}} */
-
/* {{{ proto string get_called_class()
Retrieves the "Late Static Binding" class name */
ZEND_FUNCTION(get_called_class)
@@ -832,8 +823,8 @@ ZEND_FUNCTION(get_called_class)
return;
}
- if (EG(current_execute_data)->called_scope) {
- RETURN_STR(STR_COPY(EG(current_execute_data)->called_scope->name));
+ if (EX(called_scope)) {
+ RETURN_STR(zend_string_copy(EX(called_scope)->name));
} else if (!EG(scope)) {
zend_error(E_WARNING, "get_called_class() called from outside a class");
}
@@ -841,14 +832,12 @@ ZEND_FUNCTION(get_called_class)
}
/* }}} */
-
/* {{{ proto string get_parent_class([mixed object])
Retrieves the parent class name for object or class or current scope. */
ZEND_FUNCTION(get_parent_class)
{
zval *arg;
zend_class_entry *ce = NULL;
- zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
return;
@@ -857,33 +846,27 @@ ZEND_FUNCTION(get_parent_class)
if (!ZEND_NUM_ARGS()) {
ce = EG(scope);
if (ce && ce->parent) {
- RETURN_STR(STR_COPY(ce->parent->name));
+ RETURN_STR(zend_string_copy(ce->parent->name));
} else {
RETURN_FALSE;
}
}
if (Z_TYPE_P(arg) == IS_OBJECT) {
- if (Z_OBJ_HT_P(arg)->get_class_name
- && (name = Z_OBJ_HT_P(arg)->get_class_name(Z_OBJ_P(arg), 1 TSRMLS_CC)) != NULL) {
- RETURN_STR(name);
- } else {
- ce = zend_get_class_entry(Z_OBJ_P(arg) TSRMLS_CC);
- }
+ ce = Z_OBJ_P(arg)->ce;
} else if (Z_TYPE_P(arg) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(arg) TSRMLS_CC);
}
if (ce && ce->parent) {
- RETURN_STR(STR_COPY(ce->parent->name));
+ RETURN_STR(zend_string_copy(ce->parent->name));
} else {
RETURN_FALSE;
}
}
/* }}} */
-
-static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
+static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /* {{{ */
{
zval *obj;
zend_string *class_name;
@@ -916,7 +899,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
if (!instance_ce) {
RETURN_FALSE;
}
- } else if (Z_TYPE_P(obj) == IS_OBJECT && HAS_CLASS_ENTRY(*obj)) {
+ } else if (Z_TYPE_P(obj) == IS_OBJECT) {
instance_ce = Z_OBJCE_P(obj);
} else {
RETURN_FALSE;
@@ -935,7 +918,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
RETURN_BOOL(retval);
}
-
+/* }}} */
/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true])
Returns true if the object has this class as one of its parents */
@@ -945,7 +928,6 @@ ZEND_FUNCTION(is_subclass_of)
}
/* }}} */
-
/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false])
Returns true if the first argument is an object and is this class or has this class as one of its parents, */
ZEND_FUNCTION(is_a)
@@ -954,7 +936,6 @@ ZEND_FUNCTION(is_a)
}
/* }}} */
-
/* {{{ add_class_vars */
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC)
{
@@ -1002,7 +983,6 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
}
/* }}} */
-
/* {{{ proto array get_class_vars(string class_name)
Returns an array of default properties of the class. */
ZEND_FUNCTION(get_class_vars)
@@ -1026,7 +1006,6 @@ ZEND_FUNCTION(get_class_vars)
}
/* }}} */
-
/* {{{ proto array get_object_vars(object obj)
Returns an array of object properties */
ZEND_FUNCTION(get_object_vars)
@@ -1035,8 +1014,6 @@ ZEND_FUNCTION(get_object_vars)
zval *value;
HashTable *properties;
zend_string *key;
- const char *prop_name, *class_name;
- uint prop_len;
zend_object *zobj;
#ifndef FAST_ZPP
@@ -1061,7 +1038,7 @@ ZEND_FUNCTION(get_object_vars)
zobj = Z_OBJ_P(obj);
- array_init(return_value);
+ array_init_size(return_value, zend_hash_num_elements(properties));
ZEND_HASH_FOREACH_STR_KEY_VAL_IND(properties, key, value) {
if (key) {
@@ -1069,7 +1046,9 @@ ZEND_FUNCTION(get_object_vars)
/* Not separating references */
if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
if (key->val[0] == 0) {
- zend_unmangle_property_name_ex(key->val, key->len, &class_name, &prop_name, (int*) &prop_len);
+ const char *prop_name, *class_name;
+ size_t prop_len;
+ zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_len);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), prop_name, prop_len, value);
} else {
zend_hash_add_new(Z_ARRVAL_P(return_value), key, value);
@@ -1080,13 +1059,14 @@ ZEND_FUNCTION(get_object_vars)
}
/* }}} */
-static int same_name(const char *key, const char *name, zend_uint name_len)
+static int same_name(const char *key, const char *name, uint32_t name_len) /* {{{ */
{
char *lcname = zend_str_tolower_dup(name, name_len);
int ret = memcmp(lcname, key, name_len) == 0;
efree(lcname);
return ret;
}
+/* }}} */
/* {{{ proto array get_class_methods(mixed class)
Returns an array of method names for class or class instance. */
@@ -1103,10 +1083,6 @@ ZEND_FUNCTION(get_class_methods)
}
if (Z_TYPE_P(klass) == IS_OBJECT) {
- /* TBI!! new object handlers */
- if (!HAS_CLASS_ENTRY(*klass)) {
- RETURN_FALSE;
- }
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC);
@@ -1130,7 +1106,7 @@ ZEND_FUNCTION(get_class_methods)
/* Do not display old-style inherited constructors */
if (!key) {
- ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+ ZVAL_STR_COPY(&method_name, mptr->common.function_name);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
mptr->common.scope == ce ||
@@ -1140,10 +1116,10 @@ ZEND_FUNCTION(get_class_methods)
*mptr->op_array.refcount > 1 &&
(len != key->len ||
!same_name(key->val, mptr->common.function_name->val, len))) {
- ZVAL_STR(&method_name, STR_COPY(zend_find_alias_name(mptr->common.scope, key)));
+ ZVAL_STR_COPY(&method_name, zend_find_alias_name(mptr->common.scope, key));
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else {
- ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+ ZVAL_STR_COPY(&method_name, mptr->common.function_name);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
}
}
@@ -1152,7 +1128,6 @@ ZEND_FUNCTION(get_class_methods)
}
/* }}} */
-
/* {{{ proto bool method_exists(object object, string method)
Checks if the class method exists */
ZEND_FUNCTION(method_exists)
@@ -1182,10 +1157,10 @@ ZEND_FUNCTION(method_exists)
RETURN_FALSE;
}
- lcname = STR_ALLOC(method_name->len, 0);
+ lcname = zend_string_alloc(method_name->len, 0);
zend_str_tolower_copy(lcname->val, method_name->val, method_name->len);
if (zend_hash_exists(&ce->function_table, lcname)) {
- STR_FREE(lcname);
+ zend_string_free(lcname);
RETURN_TRUE;
} else {
union _zend_function *func = NULL;
@@ -1198,12 +1173,11 @@ ZEND_FUNCTION(method_exists)
&& (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0
) {
/* Returns true to the fake Closure's __invoke */
- RETVAL_BOOL((func->common.scope == zend_ce_closure
- && (method_name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0);
+ RETVAL_BOOL(func->common.scope == zend_ce_closure
+ && zend_string_equals_literal(method_name, ZEND_INVOKE_FUNC_NAME));
- STR_FREE(lcname);
- STR_RELEASE(func->common.function_name);
+ zend_string_free(lcname);
+ zend_string_release(func->common.function_name);
efree(func);
return;
}
@@ -1262,7 +1236,6 @@ ZEND_FUNCTION(property_exists)
}
/* }}} */
-
/* {{{ proto bool class_exists(string classname [, bool autoload])
Checks if the class exists */
ZEND_FUNCTION(class_exists)
@@ -1287,14 +1260,14 @@ ZEND_FUNCTION(class_exists)
if (!autoload) {
if (class_name->val[0] == '\\') {
/* Ignore leading "\" */
- lc_name = STR_ALLOC(class_name->len - 1, 0);
+ lc_name = zend_string_alloc(class_name->len - 1, 0);
zend_str_tolower_copy(lc_name->val, class_name->val + 1, class_name->len - 1);
} else {
- lc_name = STR_ALLOC(class_name->len, 0);
+ lc_name = zend_string_alloc(class_name->len, 0);
zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
}
ce = zend_hash_find_ptr(EG(class_table), lc_name);
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
RETURN_BOOL(ce && !((ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
@@ -1330,14 +1303,14 @@ ZEND_FUNCTION(interface_exists)
if (!autoload) {
if (iface_name->val[0] == '\\') {
/* Ignore leading "\" */
- lc_name = STR_ALLOC(iface_name->len - 1, 0);
+ lc_name = zend_string_alloc(iface_name->len - 1, 0);
zend_str_tolower_copy(lc_name->val, iface_name->val + 1, iface_name->len - 1);
} else {
- lc_name = STR_ALLOC(iface_name->len, 0);
+ lc_name = zend_string_alloc(iface_name->len, 0);
zend_str_tolower_copy(lc_name->val, iface_name->val, iface_name->len);
}
ce = zend_hash_find_ptr(EG(class_table), lc_name);
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
RETURN_BOOL(ce && ce->ce_flags & ZEND_ACC_INTERFACE);
}
@@ -1373,14 +1346,14 @@ ZEND_FUNCTION(trait_exists)
if (!autoload) {
if (trait_name->val[0] == '\\') {
/* Ignore leading "\" */
- lc_name = STR_ALLOC(trait_name->len - 1, 0);
+ lc_name = zend_string_alloc(trait_name->len - 1, 0);
zend_str_tolower_copy(lc_name->val, trait_name->val + 1, trait_name->len - 1);
} else {
- lc_name = STR_ALLOC(trait_name->len, 0);
+ lc_name = zend_string_alloc(trait_name->len, 0);
zend_str_tolower_copy(lc_name->val, trait_name->val, trait_name->len);
}
ce = zend_hash_find_ptr(EG(class_table), lc_name);
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
RETURN_BOOL(ce && ((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
@@ -1393,13 +1366,12 @@ ZEND_FUNCTION(trait_exists)
}
/* }}} */
-
/* {{{ proto bool function_exists(string function_name)
Checks if the function exists */
ZEND_FUNCTION(function_exists)
{
char *name;
- int name_len;
+ size_t name_len;
zend_function *func;
zend_string *lcname;
@@ -1415,15 +1387,15 @@ ZEND_FUNCTION(function_exists)
if (name[0] == '\\') {
/* Ignore leading "\" */
- lcname = STR_ALLOC(name_len - 1, 0);
+ lcname = zend_string_alloc(name_len - 1, 0);
zend_str_tolower_copy(lcname->val, name + 1, name_len - 1);
} else {
- lcname = STR_ALLOC(name_len, 0);
+ lcname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lcname->val, name, name_len);
}
func = zend_hash_find_ptr(EG(function_table), lcname);
- STR_FREE(lcname);
+ zend_string_free(lcname);
/*
* A bit of a hack, but not a bad one: we see if the handler of the function
@@ -1441,7 +1413,7 @@ ZEND_FUNCTION(class_alias)
zend_string *class_name;
char *alias_name;
zend_class_entry *ce;
- int alias_name_len;
+ size_t alias_name_len;
zend_bool autoload = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
@@ -1474,9 +1446,9 @@ ZEND_FUNCTION(class_alias)
Cause an intentional memory leak, for testing/debugging purposes */
ZEND_FUNCTION(leak)
{
- zend_int_t leakbytes=3;
+ zend_long leakbytes=3;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &leakbytes) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &leakbytes) == FAILURE) {
return;
}
@@ -1531,22 +1503,21 @@ ZEND_FUNCTION(get_included_files)
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) {
if (entry) {
- add_next_index_str(return_value, STR_COPY(entry));
+ add_next_index_str(return_value, zend_string_copy(entry));
}
} ZEND_HASH_FOREACH_END();
}
/* }}} */
-
/* {{{ proto void trigger_error(string message [, int error_type])
Generates a user-level error/warning/notice message */
ZEND_FUNCTION(trigger_error)
{
- zend_int_t error_type = E_USER_NOTICE;
+ zend_long error_type = E_USER_NOTICE;
char *message;
- int message_len;
+ size_t message_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &message, &message_len, &error_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) {
return;
}
@@ -1567,16 +1538,15 @@ ZEND_FUNCTION(trigger_error)
}
/* }}} */
-
/* {{{ proto string set_error_handler(string error_handler [, int error_types])
Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
ZEND_FUNCTION(set_error_handler)
{
zval *error_handler;
zend_string *error_handler_name = NULL;
- zend_int_t error_type = E_ALL;
+ zend_long error_type = E_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &error_handler, &error_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
return;
}
@@ -1584,10 +1554,10 @@ ZEND_FUNCTION(set_error_handler)
if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) {
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name->val:"unknown");
- STR_RELEASE(error_handler_name);
+ zend_string_release(error_handler_name);
return;
}
- STR_RELEASE(error_handler_name);
+ zend_string_release(error_handler_name);
}
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
@@ -1607,7 +1577,6 @@ ZEND_FUNCTION(set_error_handler)
}
/* }}} */
-
/* {{{ proto void restore_error_handler(void)
Restores the previously defined error handler function */
ZEND_FUNCTION(restore_error_handler)
@@ -1634,7 +1603,6 @@ ZEND_FUNCTION(restore_error_handler)
}
/* }}} */
-
/* {{{ proto string set_exception_handler(callable exception_handler)
Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
ZEND_FUNCTION(set_exception_handler)
@@ -1650,10 +1618,10 @@ ZEND_FUNCTION(set_exception_handler)
if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) {
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name->val:"unknown");
- STR_RELEASE(exception_handler_name);
+ zend_string_release(exception_handler_name);
return;
}
- STR_RELEASE(exception_handler_name);
+ zend_string_release(exception_handler_name);
}
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
@@ -1671,7 +1639,6 @@ ZEND_FUNCTION(set_exception_handler)
}
/* }}} */
-
/* {{{ proto void restore_exception_handler(void)
Restores the previously defined exception handler function */
ZEND_FUNCTION(restore_exception_handler)
@@ -1690,33 +1657,34 @@ ZEND_FUNCTION(restore_exception_handler)
}
/* }}} */
-static int copy_class_or_interface_name(zval *el TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int copy_class_or_interface_name(zval *el TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
zend_class_entry *ce = (zend_class_entry *)Z_PTR_P(el);
zval *array = va_arg(args, zval *);
- zend_uint mask = va_arg(args, zend_uint);
- zend_uint comply = va_arg(args, zend_uint);
- zend_uint comply_mask = (comply)? mask:0;
+ uint32_t mask = va_arg(args, uint32_t);
+ uint32_t comply = va_arg(args, uint32_t);
+ uint32_t comply_mask = (comply)? mask:0;
if ((hash_key->key && hash_key->key->val[0] != 0)
&& (comply_mask == (ce->ce_flags & mask))) {
if (ce->refcount > 1 &&
(ce->name->len != hash_key->key->len ||
!same_name(hash_key->key->val, ce->name->val, ce->name->len))) {
- add_next_index_str(array, STR_COPY(hash_key->key));
+ add_next_index_str(array, zend_string_copy(hash_key->key));
} else {
- add_next_index_str(array, STR_COPY(ce->name));
+ add_next_index_str(array, zend_string_copy(ce->name));
}
}
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
/* {{{ proto array get_declared_traits()
Returns an array of all declared traits. */
ZEND_FUNCTION(get_declared_traits)
{
- zend_uint mask = ZEND_ACC_TRAIT;
- zend_uint comply = 1;
+ uint32_t mask = ZEND_ACC_TRAIT;
+ uint32_t comply = 1;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1727,13 +1695,12 @@ ZEND_FUNCTION(get_declared_traits)
}
/* }}} */
-
/* {{{ proto array get_declared_classes()
Returns an array of all declared classes. */
ZEND_FUNCTION(get_declared_classes)
{
- zend_uint mask = ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT & ~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
- zend_uint comply = 0;
+ uint32_t mask = ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT & ~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ uint32_t comply = 0;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1748,8 +1715,8 @@ ZEND_FUNCTION(get_declared_classes)
Returns an array of all declared interfaces. */
ZEND_FUNCTION(get_declared_interfaces)
{
- zend_uint mask = ZEND_ACC_INTERFACE;
- zend_uint comply = 1;
+ uint32_t mask = ZEND_ACC_INTERFACE;
+ uint32_t comply = 1;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1760,8 +1727,7 @@ ZEND_FUNCTION(get_declared_interfaces)
}
/* }}} */
-
-static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
zend_function *func = Z_PTR_P(zv);
zval *internal_ar = va_arg(args, zval *),
@@ -1772,20 +1738,20 @@ static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, ze
}
if (func->type == ZEND_INTERNAL_FUNCTION) {
- add_next_index_str(internal_ar, STR_COPY(hash_key->key));
+ add_next_index_str(internal_ar, zend_string_copy(hash_key->key));
} else if (func->type == ZEND_USER_FUNCTION) {
- add_next_index_str(user_ar, STR_COPY(hash_key->key));
+ add_next_index_str(user_ar, zend_string_copy(hash_key->key));
}
return 0;
}
-
+/* }}} */
/* {{{ proto array get_defined_functions(void)
Returns an array of all defined functions */
ZEND_FUNCTION(get_defined_functions)
{
- zval internal, user, *ret;
+ zval internal, user;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1797,27 +1763,11 @@ ZEND_FUNCTION(get_defined_functions)
zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, copy_function_name, 2, &internal, &user);
- ret = zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
-
- if (!ret) {
- zval_ptr_dtor(&internal);
- zval_ptr_dtor(&user);
- zval_dtor(return_value);
- zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
-
- ret = zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
- if (!ret) {
- zval_ptr_dtor(&user);
- zval_dtor(return_value);
- zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()");
- RETURN_FALSE;
- }
+ zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
+ zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
}
/* }}} */
-
/* {{{ proto array get_defined_vars(void)
Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */
ZEND_FUNCTION(get_defined_vars)
@@ -1829,7 +1779,6 @@ ZEND_FUNCTION(get_defined_vars)
}
/* }}} */
-
#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
/* {{{ proto string create_function(string args, string code)
Creates an anonymous function, and returns its name (funny, eh?) */
@@ -1837,7 +1786,7 @@ ZEND_FUNCTION(create_function)
{
zend_string *function_name;
char *eval_code, *function_args, *function_code;
- int eval_code_length, function_args_len, function_code_len;
+ size_t eval_code_length, function_args_len, function_code_len;
int retval;
char *eval_name;
@@ -1882,11 +1831,11 @@ ZEND_FUNCTION(create_function)
}
(*func->refcount)++;
- function_name = STR_ALLOC(sizeof("0lambda_")+MAX_LENGTH_OF_ZEND_INT, 0);
+ function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
function_name->val[0] = '\0';
do {
- function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_ZEND_INT, "lambda_%d", ++EG(lambda_count)) + 1;
+ function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
} while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
static_variables = func->static_variables;
func->static_variables = NULL;
@@ -1900,7 +1849,6 @@ ZEND_FUNCTION(create_function)
}
/* }}} */
-
#if ZEND_DEBUG
ZEND_FUNCTION(zend_test_func)
{
@@ -1913,7 +1861,7 @@ ZEND_FUNCTION(zend_test_func)
#ifdef ZTS
ZEND_FUNCTION(zend_thread_id)
{
- RETURN_INT((zend_int_t)tsrm_thread_id());
+ RETURN_LONG((zend_long)tsrm_thread_id());
}
#endif
#endif
@@ -1944,7 +1892,7 @@ ZEND_FUNCTION(get_resources)
{
zend_string *type = NULL;
zend_string *key;
- zend_uint_t index;
+ zend_ulong index;
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &type) == FAILURE) {
@@ -1959,8 +1907,7 @@ ZEND_FUNCTION(get_resources)
zend_hash_index_add_new(Z_ARRVAL_P(return_value), index, val);
}
} ZEND_HASH_FOREACH_END();
- } else if (type->len == sizeof("Unknown")-1 &&
- memcmp(type->val, "Unknown", sizeof("Unknown")-1) == 0) {
+ } else if (zend_string_equals_literal(type, "Unknown")) {
array_init(return_value);
ZEND_HASH_FOREACH_KEY_VAL(&EG(regular_list), index, key, val) {
if (!key && Z_RES_TYPE_P(val) <= 0) {
@@ -1987,22 +1934,24 @@ ZEND_FUNCTION(get_resources)
}
/* }}} */
-static int add_extension_info(zval *item, void *arg TSRMLS_DC)
+static int add_extension_info(zval *item, void *arg TSRMLS_DC) /* {{{ */
{
zval *name_array = (zval *)arg;
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(item);
add_next_index_string(name_array, module->name);
return 0;
}
+/* }}} */
-static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC)
+static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC) /* {{{ */
{
zval *name_array = (zval *)arg;
add_next_index_string(name_array, ext->name);
return 0;
}
+/* }}} */
-static int add_constant_info(zval *item, void *arg TSRMLS_DC)
+static int add_constant_info(zval *item, void *arg TSRMLS_DC) /* {{{ */
{
zval *name_array = (zval *)arg;
zend_constant *constant = (zend_constant*)Z_PTR_P(item);
@@ -2017,7 +1966,7 @@ static int add_constant_info(zval *item, void *arg TSRMLS_DC)
zend_hash_add_new(Z_ARRVAL_P(name_array), constant->name, &const_val);
return 0;
}
-
+/* }}} */
/* {{{ proto array get_loaded_extensions([bool zend_extensions]) U
Return an array containing names of loaded extensions */
@@ -2039,7 +1988,6 @@ ZEND_FUNCTION(get_loaded_extensions)
}
/* }}} */
-
/* {{{ proto array get_defined_constants([bool categorize])
Return an array containing the names and values of all defined constants */
ZEND_FUNCTION(get_defined_constants)
@@ -2102,18 +2050,17 @@ ZEND_FUNCTION(get_defined_constants)
}
/* }}} */
-
-static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TSRMLS_DC)
+static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TSRMLS_DC) /* {{{ */
{
- int num_args = call->num_args;
+ uint32_t num_args = call->num_args;
array_init_size(arg_array, num_args);
if (num_args) {
- int i = 0;
+ uint32_t i = 0;
zval *p = ZEND_CALL_ARG(call, 1);
if (call->func->type == ZEND_USER_FUNCTION) {
- int first_extra_arg = call->func->op_array.num_args;
+ uint32_t first_extra_arg = call->func->op_array.num_args;
if (call->func->op_array.fn_flags & ZEND_ACC_VARIADIC) {
first_extra_arg--;
@@ -2137,8 +2084,9 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TS
}
}
}
+/* }}} */
-void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
+void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) /* {{{ */
{
zval *tmp;
int i = 0;
@@ -2150,6 +2098,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
zend_print_flat_zval_r(tmp TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
}
+/* }}} */
/* {{{ proto void debug_print_backtrace([int options[, int limit]]) */
ZEND_FUNCTION(debug_print_backtrace)
@@ -2165,15 +2114,15 @@ ZEND_FUNCTION(debug_print_backtrace)
const char *include_filename = NULL;
zval arg_array;
int indent = 0;
- zend_int_t options = 0;
- zend_int_t limit = 0;
+ zend_long options = 0;
+ zend_long limit = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
return;
}
ZVAL_UNDEF(&arg_array);
- ptr = EG(current_execute_data)->prev_execute_data;
+ ptr = EX(prev_execute_data);
/* skip debug_backtrace() */
call = ptr;
@@ -2213,7 +2162,7 @@ ZEND_FUNCTION(debug_print_backtrace)
}
/* $this may be passed into regular internal functions */
- object = call->object;
+ object = Z_OBJ(call->This);
if (object &&
call &&
call->func->type == ZEND_INTERNAL_FUNCTION &&
@@ -2226,9 +2175,7 @@ ZEND_FUNCTION(debug_print_backtrace)
function_name = (func->common.scope &&
func->common.scope->trait_aliases) ?
zend_resolve_method_name(
- (object ?
- zend_get_class_entry(object TSRMLS_CC) :
- func->common.scope), func)->val :
+ (object ? object->ce : func->common.scope), func)->val :
(func->common.function_name ?
func->common.function_name->val : NULL);
} else {
@@ -2241,7 +2188,7 @@ ZEND_FUNCTION(debug_print_backtrace)
if (func->common.scope) {
class_name = func->common.scope->name;
} else {
- class_name = zend_get_object_classname(object TSRMLS_CC);
+ class_name = object->ce->name;
}
call_type = "->";
@@ -2340,7 +2287,7 @@ ZEND_FUNCTION(debug_print_backtrace)
/* }}} */
-ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC)
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC) /* {{{ */
{
zend_execute_data *call, *ptr, *skip;
zend_object *object;
@@ -2348,7 +2295,6 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
zend_function *func;
const char *function_name;
const char *filename;
- zend_string *class_name;
const char *include_filename = NULL;
zval stack_frame;
@@ -2406,7 +2352,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
lineno = skip->opline->lineno;
}
add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename);
- add_assoc_int_ex(&stack_frame, "line", sizeof("line")-1, lineno);
+ add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
* and debug_baktrace() might have been called by the error_handler. in this case we don't
@@ -2424,8 +2370,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
break;
}
if (prev->func && ZEND_USER_CODE(prev->func->common.type)) {
- add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, STR_COPY(prev->func->op_array.filename));
- add_assoc_int_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
+ add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, zend_string_copy(prev->func->op_array.filename));
+ add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
break;
}
prev_call = prev;
@@ -2435,8 +2381,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
}
/* $this may be passed into regular internal functions */
- object = call ? call->object : NULL;
+ object = call ? Z_OBJ(call->This) : NULL;
if (object &&
+ call->func &&
call->func->type == ZEND_INTERNAL_FUNCTION &&
!call->func->common.scope) {
object = NULL;
@@ -2447,9 +2394,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
function_name = (func->common.scope &&
func->common.scope->trait_aliases) ?
zend_resolve_method_name(
- (object ?
- zend_get_class_entry(object TSRMLS_CC) :
- func->common.scope), func)->val :
+ (object ? object->ce : func->common.scope), func)->val :
(func->common.function_name ?
func->common.function_name->val : NULL);
} else {
@@ -2462,10 +2407,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if (object) {
if (func->common.scope) {
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(func->common.scope->name));
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(func->common.scope->name));
} else {
- class_name = zend_get_object_classname(object TSRMLS_CC);
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(class_name));
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(object->ce->name));
}
if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) {
@@ -2477,7 +2421,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->");
} else if (func->common.scope) {
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(func->common.scope->name));
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(func->common.scope->name));
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::");
}
@@ -2548,15 +2492,14 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
}
/* }}} */
-
/* {{{ proto array debug_backtrace([int options[, int limit]])
Return backtrace as array */
ZEND_FUNCTION(debug_backtrace)
{
- zend_int_t options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
- zend_int_t limit = 0;
+ zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
+ zend_long limit = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) {
return;
}
@@ -2569,32 +2512,32 @@ ZEND_FUNCTION(debug_backtrace)
ZEND_FUNCTION(extension_loaded)
{
char *extension_name;
- int extension_name_len;
+ size_t extension_name_len;
zend_string *lcname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
- lcname = STR_ALLOC(extension_name_len, 0);
+ lcname = zend_string_alloc(extension_name_len, 0);
zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
if (zend_hash_exists(&module_registry, lcname)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
}
/* }}} */
-
/* {{{ proto array get_extension_funcs(string extension_name)
Returns an array with the names of functions belonging to the named extension */
ZEND_FUNCTION(get_extension_funcs)
{
char *extension_name;
zend_string *lcname;
- int extension_name_len, array;
+ size_t extension_name_len;
+ int array;
zend_module_entry *module;
zend_function *zif;
@@ -2602,13 +2545,13 @@ ZEND_FUNCTION(get_extension_funcs)
return;
}
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
- lcname = STR_ALLOC(extension_name_len, 0);
+ lcname = zend_string_alloc(extension_name_len, 0);
zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
} else {
- lcname = STR_INIT("core", sizeof("core")-1, 0);
+ lcname = zend_string_init("core", sizeof("core")-1, 0);
}
module = zend_hash_find_ptr(&module_registry, lcname);
- STR_FREE(lcname);
+ zend_string_free(lcname);
if (!module) {
RETURN_FALSE;
}
@@ -2628,7 +2571,7 @@ ZEND_FUNCTION(get_extension_funcs)
array_init(return_value);
array = 1;
}
- add_next_index_str(return_value, STR_COPY(zif->common.function_name));
+ add_next_index_str(return_value, zend_string_copy(zif->common.function_name));
}
} ZEND_HASH_FOREACH_END();
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index c10c1a4327..e4827f83b7 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -47,7 +47,7 @@ static zend_object_handlers closure_handlers;
ZEND_METHOD(Closure, __invoke) /* {{{ */
{
- zend_function *func = EG(current_execute_data)->func;
+ zend_function *func = EX(func);
zval *arguments;
arguments = emalloc(sizeof(zval) * ZEND_NUM_ARGS());
@@ -61,11 +61,66 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
efree(arguments);
/* destruct the function also, then - we have allocated it in get_method */
- STR_RELEASE(func->internal_function.function_name);
+ zend_string_release(func->internal_function.function_name);
efree(func);
}
/* }}} */
+/* {{{ proto mixed Closure::call(object $to [, mixed $parameter] [, mixed $...] )
+ Call closure, binding to a given object with its class as the scope */
+ZEND_METHOD(Closure, call)
+{
+ zval *zclosure, *newthis, closure_result;
+ zend_closure *closure;
+ zend_fcall_info fci;
+ zend_fcall_info_cache fci_cache;
+ zval *my_params;
+ int my_param_count = 0;
+ zend_function my_function;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o*", &newthis, &my_params, &my_param_count) == FAILURE) {
+ return;
+ }
+
+ zclosure = getThis();
+ closure = (zend_closure *)Z_OBJ_P(zclosure);
+
+ if (closure->func.common.fn_flags & ZEND_ACC_STATIC) {
+ zend_error(E_WARNING, "Cannot bind an instance to a static closure");
+ return;
+ }
+
+ if (closure->func.type == ZEND_INTERNAL_FUNCTION) {
+ /* verify that we aren't binding internal function to a wrong object */
+ if ((closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0 &&
+ !instanceof_function(Z_OBJCE_P(newthis), closure->func.common.scope TSRMLS_CC)) {
+ zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", closure->func.common.scope->name->val, closure->func.common.function_name->val, Z_OBJCE_P(newthis)->name->val);
+ return;
+ }
+ }
+
+ /* This should never happen as closures will always be callable */
+ if (zend_fcall_info_init(zclosure, 0, &fci, &fci_cache, NULL, NULL TSRMLS_CC) != SUCCESS) {
+ ZEND_ASSERT(0);
+ }
+
+ fci.retval = &closure_result;
+ fci.params = my_params;
+ fci.param_count = my_param_count;
+ fci.object = fci_cache.object = Z_OBJ_P(newthis);
+ fci_cache.initialized = 1;
+
+ my_function = *fci_cache.function_handler;
+ /* use scope of passed object */
+ my_function.common.scope = Z_OBJCE_P(newthis);
+ fci_cache.function_handler = &my_function;
+
+ if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(closure_result) != IS_UNDEF) {
+ ZVAL_COPY_VALUE(return_value, &closure_result);
+ }
+}
+/* }}} */
+
/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] )
Create a closure from another one and bind to another object and scope */
ZEND_METHOD(Closure, bind)
@@ -85,21 +140,20 @@ ZEND_METHOD(Closure, bind)
}
if (scope_arg != NULL) { /* scope argument was given */
- if (IS_ZEND_STD_OBJECT(*scope_arg)) {
+ if (Z_TYPE_P(scope_arg) == IS_OBJECT) {
ce = Z_OBJCE_P(scope_arg);
} else if (Z_TYPE_P(scope_arg) == IS_NULL) {
ce = NULL;
} else {
zend_string *class_name = zval_get_string(scope_arg);
- if ((class_name->len == sizeof("static") - 1) &&
- (memcmp("static", class_name->val, sizeof("static") - 1) == 0)) {
+ if (zend_string_equals_literal(class_name, "static")) {
ce = closure->func.common.scope;
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) {
zend_error(E_WARNING, "Class '%s' not found", class_name->val);
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
RETURN_NULL();
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
}
} else { /* scope argument not given; do not change the scope by default */
ce = closure->func.common.scope;
@@ -133,7 +187,7 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object TSRML
invoke->internal_function.handler = ZEND_MN(Closure___invoke);
invoke->internal_function.module = 0;
invoke->internal_function.scope = zend_ce_closure;
- invoke->internal_function.function_name = STR_INIT(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0);
+ invoke->internal_function.function_name = zend_string_init(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0);
return invoke;
}
/* }}} */
@@ -156,15 +210,13 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
{
zend_string *lc_name;
- lc_name = STR_ALLOC(method->len, 0);
+ lc_name = zend_string_alloc(method->len, 0);
zend_str_tolower_copy(lc_name->val, method->val, method->len);
- if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) &&
- memcmp(lc_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- ) {
- STR_FREE(lc_name);
+ if (zend_string_equals_literal(method, ZEND_INVOKE_FUNC_NAME)) {
+ zend_string_free(lc_name);
return zend_get_closure_invoke_method(*object TSRMLS_CC);
}
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
return std_object_handlers.get_method(object, method, key TSRMLS_CC);
}
/* }}} */
@@ -308,7 +360,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
}
if (arg_info) {
- zend_uint i, required = closure->func.common.required_num_args;
+ uint32_t i, required = closure->func.common.required_num_args;
array_init(&val);
@@ -324,9 +376,9 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
arg_info->pass_by_reference ? "&" : "",
i + 1);
}
- ZVAL_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>"));
+ ZVAL_NEW_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>"));
zend_hash_update(Z_ARRVAL(val), name, &info);
- STR_RELEASE(name);
+ zend_string_release(name);
arg_info++;
}
zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val);
@@ -373,10 +425,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bind, 0, 0, 2)
ZEND_ARG_INFO(0, newscope)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_call, 0, 0, 1)
+ ZEND_ARG_INFO(0, newthis)
+ ZEND_ARG_VARIADIC_INFO(0, parameters)
+ZEND_END_ARG_INFO()
+
static const zend_function_entry closure_functions[] = {
ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE)
ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index b15548a27f..5d3ee24c84 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -14,6 +14,7 @@
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+ | Nikita Popov <nikic@php.net> |
+----------------------------------------------------------------------+
*/
@@ -29,6 +30,7 @@
#include "zend_virtual_cwd.h"
#include "zend_multibyte.h"
#include "zend_language_scanner.h"
+#include "zend_inheritance.h"
#define CONSTANT_EX(op_array, op) \
(op_array)->literals[op]
@@ -51,43 +53,21 @@
(target)->u.constant = CONSTANT(src.constant); \
} else { \
(target)->u.op = src; \
- (target)->EA = 0; \
} \
} while (0)
-#define COPY_NODE(target, src) do { \
- target ## _type = src ## _type; \
- target = src; \
- } while (0)
-
-#define GET_CACHE_SLOT(literal) do { \
- Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot++; \
- if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \
- CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \
- CG(active_op_array)->run_time_cache[CG(active_op_array)->last_cache_slot - 1] = NULL; \
- } \
- } while (0)
+static inline void zend_alloc_cache_slot(uint32_t literal TSRMLS_DC) {
+ zend_op_array *op_array = CG(active_op_array);
+ Z_CACHE_SLOT(op_array->literals[literal]) = op_array->last_cache_slot++;
+}
#define POLYMORPHIC_CACHE_SLOT_SIZE 2
-#define GET_POLYMORPHIC_CACHE_SLOT(literal) do { \
- Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot; \
- CG(active_op_array)->last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE; \
- if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \
- CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \
- CG(active_op_array)->run_time_cache[CG(active_op_array)->last_cache_slot - 1] = NULL; \
- CG(active_op_array)->run_time_cache[CG(active_op_array)->last_cache_slot - 2] = NULL; \
- } \
- } while (0)
-
-#define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \
- if (Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) != -1 && \
- Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) == \
- CG(active_op_array)->last_cache_slot - POLYMORPHIC_CACHE_SLOT_SIZE) { \
- Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = -1; \
- CG(active_op_array)->last_cache_slot -= POLYMORPHIC_CACHE_SLOT_SIZE; \
- } \
- } while (0)
+static inline void zend_alloc_polymorphic_cache_slot(uint32_t literal TSRMLS_DC) {
+ zend_op_array *op_array = CG(active_op_array);
+ Z_CACHE_SLOT(op_array->literals[literal]) = op_array->last_cache_slot;
+ op_array->last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE;
+}
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename TSRMLS_DC);
@@ -97,43 +77,13 @@ ZEND_API zend_compiler_globals compiler_globals;
ZEND_API zend_executor_globals executor_globals;
#endif
-static void zend_push_function_call_entry(zend_function *fbc, zend_uint opline_num TSRMLS_DC) /* {{{ */
-{
- zend_function_call_entry fcall = { fbc, opline_num };
- zend_stack_push(&CG(function_call_stack), &fcall);
-}
-/* }}} */
-
-static zend_property_info *zend_duplicate_property_info(zend_property_info *property_info TSRMLS_DC) /* {{{ */
-{
- zend_property_info* new_property_info;
-
- new_property_info = zend_arena_alloc(&CG(arena), sizeof(zend_property_info));
- memcpy(new_property_info, property_info, sizeof(zend_property_info));
- STR_ADDREF(new_property_info->name);
- if (new_property_info->doc_comment) {
- STR_ADDREF(new_property_info->doc_comment);
- }
- return new_property_info;
-}
-/* }}} */
-
-static zend_property_info *zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */
-{
- zend_property_info* new_property_info = pemalloc(sizeof(zend_property_info), 1);
- memcpy(new_property_info, property_info, sizeof(zend_property_info));
- STR_ADDREF(new_property_info->name);
- return new_property_info;
-}
-/* }}} */
-
static void zend_destroy_property_info(zval *zv) /* {{{ */
{
zend_property_info *property_info = Z_PTR_P(zv);
- STR_RELEASE(property_info->name);
+ zend_string_release(property_info->name);
if (property_info->doc_comment) {
- STR_RELEASE(property_info->doc_comment);
+ zend_string_release(property_info->doc_comment);
}
}
/* }}} */
@@ -142,42 +92,68 @@ static void zend_destroy_property_info_internal(zval *zv) /* {{{ */
{
zend_property_info *property_info = Z_PTR_P(zv);
- STR_RELEASE(property_info->name);
+ zend_string_release(property_info->name);
free(property_info);
}
/* }}} */
-static void build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) /* {{{ */
+static zend_string *zend_new_interned_string_safe(zend_string *str TSRMLS_DC) /* {{{ */ {
+ zend_string *interned_str;
+
+ zend_string_addref(str);
+ interned_str = zend_new_interned_string(str TSRMLS_CC);
+ if (str != interned_str) {
+ return interned_str;
+ } else {
+ zend_string_release(str);
+ return str;
+ }
+}
+/* }}} */
+
+static zend_string *zend_build_runtime_definition_key(zend_string *name, unsigned char *lex_pos TSRMLS_DC) /* {{{ */
{
+ zend_string *result;
char char_pos_buf[32];
- uint char_pos_len;
- const char *filename;
+ size_t filename_len, char_pos_len = zend_sprintf(char_pos_buf, "%p", lex_pos);
- char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text));
+ const char *filename;
if (CG(active_op_array)->filename) {
filename = CG(active_op_array)->filename->val;
+ filename_len = CG(active_op_array)->filename->len;
} else {
filename = "-";
+ filename_len = sizeof("-") - 1;
}
-
/* NULL, name length, filename length, last accepting char position length */
- ZVAL_NEW_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0));
+ result = zend_string_alloc(1 + name->len + filename_len + char_pos_len, 0);
+ sprintf(result->val, "%c%s%s%s", '\0', name->val, filename, char_pos_buf);
+ return zend_new_interned_string(result TSRMLS_CC);
+}
+/* }}} */
- /* must be binary safe */
- Z_STRVAL_P(result)[0] = '\0';
- sprintf(Z_STRVAL_P(result)+1, "%s%s%s", name, filename, char_pos_buf);
+static zend_bool zend_get_unqualified_name(const zend_string *name, const char **result, size_t *result_len) /* {{{ */
+{
+ const char *ns_separator = zend_memrchr(name->val, '\\', name->len);
+ if (ns_separator != NULL) {
+ *result = ns_separator + 1;
+ *result_len = name->val + name->len - *result;
+ return 1;
+ }
+
+ return 0;
}
/* }}} */
static void init_compiler_declarables(TSRMLS_D) /* {{{ */
{
- ZVAL_INT(&CG(declarables).ticks, 0);
+ ZVAL_LONG(&CG(declarables).ticks, 0);
}
/* }}} */
void zend_init_compiler_context(TSRMLS_D) /* {{{ */
{
- CG(context).opcodes_size = (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) ? INITIAL_INTERACTIVE_OP_ARRAY_SIZE : INITIAL_OP_ARRAY_SIZE;
+ CG(context).opcodes_size = INITIAL_OP_ARRAY_SIZE;
CG(context).vars_size = 0;
CG(context).literals_size = 0;
CG(context).current_brk_cont = -1;
@@ -189,19 +165,12 @@ void zend_init_compiler_context(TSRMLS_D) /* {{{ */
void zend_init_compiler_data_structures(TSRMLS_D) /* {{{ */
{
- zend_stack_init(&CG(bp_stack), sizeof(zend_llist));
- zend_stack_init(&CG(function_call_stack), sizeof(zend_function_call_entry));
- zend_stack_init(&CG(switch_cond_stack), sizeof(zend_switch_entry));
- zend_stack_init(&CG(foreach_copy_stack), sizeof(zend_op));
- zend_stack_init(&CG(object_stack), sizeof(znode));
- zend_stack_init(&CG(declare_stack), sizeof(zend_declarables));
+ zend_stack_init(&CG(loop_var_stack), sizeof(znode));
+ zend_stack_init(&CG(delayed_oplines_stack), sizeof(zend_op));
CG(active_class_entry) = NULL;
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_stack_init(&CG(list_stack), sizeof(zend_llist));
CG(in_compilation) = 0;
CG(start_lineno) = 0;
- ZVAL_UNDEF(&CG(current_namespace));
+ CG(current_namespace) = NULL;
CG(in_namespace) = 0;
CG(has_bracketed_namespaces) = 0;
CG(current_import) = NULL;
@@ -238,13 +207,8 @@ void init_compiler(TSRMLS_D) /* {{{ */
void shutdown_compiler(TSRMLS_D) /* {{{ */
{
- zend_stack_destroy(&CG(bp_stack));
- zend_stack_destroy(&CG(function_call_stack));
- zend_stack_destroy(&CG(switch_cond_stack));
- zend_stack_destroy(&CG(foreach_copy_stack));
- zend_stack_destroy(&CG(object_stack));
- zend_stack_destroy(&CG(declare_stack));
- zend_stack_destroy(&CG(list_stack));
+ zend_stack_destroy(&CG(loop_var_stack));
+ zend_stack_destroy(&CG(delayed_oplines_stack));
zend_hash_destroy(&CG(filenames_table));
zend_hash_destroy(&CG(const_filenames));
zend_stack_destroy(&CG(context_stack));
@@ -261,7 +225,7 @@ ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filen
CG(compiled_filename) = p;
return p;
}
- p = STR_COPY(new_compiled_filename);
+ p = zend_string_copy(new_compiled_filename);
zend_hash_update_ptr(&CG(filenames_table), new_compiled_filename, p);
CG(compiled_filename) = p;
return p;
@@ -292,22 +256,22 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */
}
/* }}} */
-static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */
+static uint32_t get_temporary_variable(zend_op_array *op_array) /* {{{ */
{
- return (zend_uint)op_array->T++;
+ return (uint32_t)op_array->T++;
}
/* }}} */
static int lookup_cv(zend_op_array *op_array, zend_string* name TSRMLS_DC) /* {{{ */{
int i = 0;
- zend_uint_t hash_value = STR_HASH_VAL(name);
+ zend_ulong hash_value = zend_string_hash_val(name);
while (i < op_array->last_var) {
if (op_array->vars[i]->val == name->val ||
(op_array->vars[i]->h == hash_value &&
op_array->vars[i]->len == name->len &&
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
- STR_RELEASE(name);
+ zend_string_release(name);
return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
}
i++;
@@ -339,7 +303,7 @@ void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int literal_position TSRMLS_DC) /* {{{ */
{
if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
- STR_HASH_VAL(Z_STR_P(zv));
+ zend_string_hash_val(Z_STR_P(zv));
Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv) TSRMLS_CC);
if (IS_INTERNED(Z_STR_P(zv))) {
Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
@@ -368,164 +332,108 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int zend_add_func_name_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) /* {{{ */
+static inline int zend_add_literal_string(zend_op_array *op_array, zend_string **str TSRMLS_DC) /* {{{ */
{
int ret;
- zend_string *lc_name;
- zval c;
-
- if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1] == zv &&
- Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
- /* we already have function name as last literal (do nothing) */
- ret = op_array->last_literal - 1;
- } else {
- ret = zend_add_literal(op_array, zv TSRMLS_CC);
- }
+ zval zv;
+ ZVAL_STR(&zv, *str);
+ ret = zend_add_literal(op_array, &zv TSRMLS_CC);
+ *str = Z_STR(zv);
+ return ret;
+}
+
+static int zend_add_func_name_literal(zend_op_array *op_array, zend_string *name TSRMLS_DC) /* {{{ */
+{
+ /* Original name */
+ int ret = zend_add_literal_string(op_array, &name TSRMLS_CC);
- lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv));
- ZVAL_NEW_STR(&c, lc_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* Lowercased name */
+ zend_string *lc_name = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lc_name->val, name->val, name->len);
+ zend_add_literal_string(op_array, &lc_name TSRMLS_CC);
return ret;
}
/* }}} */
-static int zend_add_ns_func_name_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) /* {{{ */
+static int zend_add_ns_func_name_literal(zend_op_array *op_array, zend_string *name TSRMLS_DC) /* {{{ */
{
- int ret;
- zend_string *lc_name;
- const char *ns_separator;
- int lc_len;
- zval c;
-
- if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1] == zv &&
- Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
- /* we already have function name as last literal (do nothing) */
- ret = op_array->last_literal - 1;
- } else {
- ret = zend_add_literal(op_array, zv TSRMLS_CC);
- }
+ const char *unqualified_name;
+ size_t unqualified_name_len;
- lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv));
- ZVAL_NEW_STR(&c, lc_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* Original name */
+ int ret = zend_add_literal_string(op_array, &name TSRMLS_CC);
- ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRSIZE_P(zv));
+ /* Lowercased name */
+ zend_string *lc_name = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lc_name->val, name->val, name->len);
+ zend_add_literal_string(op_array, &lc_name TSRMLS_CC);
- if (ns_separator != NULL) {
- ns_separator += 1;
- lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv));
- lc_name = STR_ALLOC(lc_len, 0);
- zend_str_tolower_copy(lc_name->val, ns_separator, lc_len);
- ZVAL_NEW_STR(&c, lc_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* Lowercased unqualfied name */
+ if (zend_get_unqualified_name(name, &unqualified_name, &unqualified_name_len)) {
+ lc_name = zend_string_alloc(unqualified_name_len, 0);
+ zend_str_tolower_copy(lc_name->val, unqualified_name, unqualified_name_len);
+ zend_add_literal_string(op_array, &lc_name TSRMLS_CC);
}
return ret;
}
/* }}} */
-static int zend_add_class_name_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) /* {{{ */
+static int zend_add_class_name_literal(zend_op_array *op_array, zend_string *name TSRMLS_DC) /* {{{ */
{
- int ret;
- zend_string *lc_name;
- zval c;
-
- if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1] == zv &&
- Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
- /* we already have function name as last literal (do nothing) */
- ret = op_array->last_literal - 1;
- } else {
- ret = zend_add_literal(op_array, zv TSRMLS_CC);
- }
+ /* Original name */
+ int ret = zend_add_literal_string(op_array, &name TSRMLS_CC);
- if (Z_STRVAL_P(zv)[0] == '\\') {
- lc_name = STR_ALLOC(Z_STRSIZE_P(zv) - 1, 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv) + 1, Z_STRSIZE_P(zv) - 1);
- } else {
- lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv));
- }
- ZVAL_NEW_STR(&c, lc_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* Lowercased name */
+ zend_string *lc_name = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lc_name->val, name->val, name->len);
+ zend_add_literal_string(op_array, &lc_name TSRMLS_CC);
- GET_CACHE_SLOT(ret);
+ zend_alloc_cache_slot(ret TSRMLS_CC);
return ret;
}
/* }}} */
-static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int unqualified TSRMLS_DC) /* {{{ */
+static int zend_add_const_name_literal(zend_op_array *op_array, zend_string *name, zend_bool unqualified TSRMLS_DC) /* {{{ */
{
- int ret;
- char *name;
zend_string *tmp_name;
- const char *ns_separator;
- int name_len, ns_len;
- zval c;
-
- if (op_array->last_literal > 0 &&
- &op_array->literals[op_array->last_literal - 1] == zv &&
- Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) {
- /* we already have function name as last literal (do nothing) */
- ret = op_array->last_literal - 1;
- } else {
- ret = zend_add_literal(op_array, zv TSRMLS_CC);
- }
- /* skip leading '\\' */
- if (Z_STRVAL_P(zv)[0] == '\\') {
- name_len = Z_STRSIZE_P(zv) - 1;
- name = Z_STRVAL_P(zv) + 1;
- } else {
- name_len = Z_STRSIZE_P(zv);
- name = Z_STRVAL_P(zv);
- }
- ns_separator = zend_memrchr(name, '\\', name_len);
- if (ns_separator) {
- ns_len = ns_separator - name;
- } else {
- ns_len = 0;
- }
+ int ret = zend_add_literal_string(op_array, &name TSRMLS_CC);
+
+ size_t ns_len = 0, after_ns_len = name->len;
+ const char *after_ns = zend_memrchr(name->val, '\\', name->len);
+ if (after_ns) {
+ after_ns += 1;
+ ns_len = after_ns - name->val - 1;
+ after_ns_len = name->len - ns_len - 1;
- if (ns_len) {
/* lowercased namespace name & original constant name */
- tmp_name = STR_INIT(name, name_len, 0);
+ tmp_name = zend_string_init(name->val, name->len, 0);
zend_str_tolower(tmp_name->val, ns_len);
- ZVAL_NEW_STR(&c, tmp_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ zend_add_literal_string(op_array, &tmp_name TSRMLS_CC);
/* lowercased namespace name & lowercased constant name */
- tmp_name = STR_ALLOC(name_len, 0);
- zend_str_tolower_copy(tmp_name->val, name, name_len);
- ZVAL_NEW_STR(&c, tmp_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- }
+ tmp_name = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(tmp_name->val, name->val, name->len);
+ zend_add_literal_string(op_array, &tmp_name TSRMLS_CC);
- if (ns_len) {
if (!unqualified) {
return ret;
}
- ns_len++;
- name += ns_len;
- name_len -= ns_len;
+ } else {
+ after_ns = name->val;
}
- /* original constant name */
- tmp_name = STR_INIT(name, name_len, 0);
- ZVAL_NEW_STR(&c, tmp_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* original unqualified constant name */
+ tmp_name = zend_string_init(after_ns, after_ns_len, 0);
+ zend_add_literal_string(op_array, &tmp_name TSRMLS_CC);
- /* lowercased constant name */
- tmp_name = STR_ALLOC(name_len, 0);
- zend_str_tolower_copy(tmp_name->val, name, name_len);
- ZVAL_NEW_STR(&c, tmp_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
+ /* lowercased unqualified constant name */
+ tmp_name = zend_string_alloc(after_ns_len, 0);
+ zend_str_tolower_copy(tmp_name->val, after_ns, after_ns_len);
+ zend_add_literal_string(op_array, &tmp_name TSRMLS_CC);
return ret;
}
@@ -537,5130 +445,4159 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un
op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
} while (0)
-#define LITERAL_STRINGL(op, str, len) do { \
- zval _c; \
- ZVAL_STRINGL(&_c, str, len); \
- op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
- } while (0)
-
-#define LITERAL_INT(op, val) do { \
- zval _c; \
- ZVAL_INT(&_c, val); \
- op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
- } while (0)
-
-#define LITERAL_INT_EX(op_array, op, val) do { \
- zval _c; \
- ZVAL_INT(&_c, val); \
- op.constant = zend_add_literal(op_array, &_c TSRMLS_CC); \
- } while (0)
+#define MAKE_NOP(opline) do { \
+ opline->opcode = ZEND_NOP; \
+ memset(&opline->result, 0, sizeof(opline->result)); \
+ memset(&opline->op1, 0, sizeof(opline->op1)); \
+ memset(&opline->op2, 0, sizeof(opline->op2)); \
+ opline->result_type = opline->op1_type = opline->op2_type = IS_UNUSED; \
+} while (0)
-#define LITERAL_NULL(op) do { \
- zval _c; \
- ZVAL_NULL(&_c); \
- op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
- } while (0)
+void zend_stop_lexing(TSRMLS_D) {
+ LANG_SCNG(yy_cursor) = LANG_SCNG(yy_limit);
+}
-static inline zend_bool zend_is_function_or_method_call(const znode *variable) /* {{{ */
+static inline void zend_begin_loop(TSRMLS_D) /* {{{ */
{
- zend_uint type = variable->EA;
+ zend_brk_cont_element *brk_cont_element;
+ int parent;
- return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL));
+ parent = CG(context).current_brk_cont;
+ CG(context).current_brk_cont = CG(active_op_array)->last_brk_cont;
+ brk_cont_element = get_next_brk_cont_element(CG(active_op_array));
+ brk_cont_element->start = get_next_op_number(CG(active_op_array));
+ brk_cont_element->parent = parent;
}
/* }}} */
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+static inline void zend_end_loop(int cont_addr, int has_loop_var TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = op;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, op1);
- SET_NODE(opline->op2, op2);
- GET_NODE(result, opline->result);
+ if (!has_loop_var) {
+ /* The start fileld is used to free temporary variables in case of exceptions.
+ * We won't try to free something of we don't have loop variable.
+ */
+ CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].start = -1;
+ }
+ CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].cont = cont_addr;
+ CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].brk = get_next_op_number(CG(active_op_array));
+ CG(context).current_brk_cont = CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].parent;
}
/* }}} */
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC) /* {{{ */
+void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ if (op1->op_type==IS_TMP_VAR) {
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = op;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, op1);
- GET_NODE(result, opline->result);
- SET_UNUSED(opline->op2);
+ opline->opcode = ZEND_FREE;
+ SET_NODE(opline->op1, op1);
+ SET_UNUSED(opline->op2);
+ } else if (op1->op_type==IS_VAR) {
+ zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
+
+ while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END || opline->opcode == ZEND_OP_DATA) {
+ opline--;
+ }
+ if (opline->result_type == IS_VAR
+ && opline->result.var == op1->u.op.var) {
+ if (opline->opcode == ZEND_FETCH_R ||
+ opline->opcode == ZEND_FETCH_DIM_R ||
+ opline->opcode == ZEND_FETCH_OBJ_R) {
+ /* It's very rare and useless case. It's better to use
+ additional FREE opcode and simplify the FETCH handlers
+ their selves */
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_FREE;
+ SET_NODE(opline->op1, op1);
+ SET_UNUSED(opline->op2);
+ } else {
+ opline->result_type |= EXT_TYPE_UNUSED;
+ }
+ } else {
+ while (opline>CG(active_op_array)->opcodes) {
+ if (opline->opcode == ZEND_FETCH_LIST &&
+ opline->op1_type == IS_VAR &&
+ opline->op1.var == op1->u.op.var) {
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+
+ opline->opcode = ZEND_FREE;
+ SET_NODE(opline->op1, op1);
+ SET_UNUSED(opline->op2);
+ return;
+ }
+ if (opline->result_type==IS_VAR
+ && opline->result.var == op1->u.op.var) {
+ if (opline->opcode == ZEND_NEW) {
+ opline->result_type |= EXT_TYPE_UNUSED;
+ opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
+ while (opline->opcode != ZEND_DO_FCALL || opline->op1.num != ZEND_CALL_CTOR) {
+ opline--;
+ }
+ opline->op1.num |= ZEND_CALL_CTOR_RESULT_UNUSED;
+ }
+ break;
+ }
+ opline--;
+ }
+ }
+ } else if (op1->op_type == IS_CONST) {
+ /* Destroy value without using GC: When opcache moves arrays into SHM it will
+ * free the zend_array structure, so references to it from outside the op array
+ * become invalid. GC would cause such a reference in the root buffer. */
+ zval_ptr_dtor_nogc(&op1->u.constant);
+ }
}
/* }}} */
-#define MAKE_NOP(opline) { opline->opcode = ZEND_NOP; memset(&opline->result,0,sizeof(opline->result)); memset(&opline->op1,0,sizeof(opline->op1)); memset(&opline->op2,0,sizeof(opline->op2)); opline->result_type=opline->op1_type=opline->op2_type=IS_UNUSED; }
-
-static void zend_do_op_data(zend_op *data_op, znode *value TSRMLS_DC) /* {{{ */
+uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag) /* {{{ */
{
- data_op->opcode = ZEND_OP_DATA;
- SET_NODE(data_op->op1, value);
- SET_UNUSED(data_op->op2);
+ uint32_t new_flags = flags | new_flag;
+ if ((flags & ZEND_ACC_PPP_MASK) && (new_flag & ZEND_ACC_PPP_MASK)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed");
+ }
+ if ((flags & ZEND_ACC_ABSTRACT) && (new_flag & ZEND_ACC_ABSTRACT)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed");
+ }
+ if ((flags & ZEND_ACC_STATIC) && (new_flag & ZEND_ACC_STATIC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Multiple static modifiers are not allowed");
+ }
+ if ((flags & ZEND_ACC_FINAL) && (new_flag & ZEND_ACC_FINAL)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Multiple final modifiers are not allowed");
+ }
+ if ((new_flags & ZEND_ACC_ABSTRACT) && (new_flags & ZEND_ACC_FINAL)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member");
+ }
+ return new_flags;
}
/* }}} */
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+zend_string *zend_concat3(char *str1, size_t str1_len, char *str2, size_t str2_len, char *str3, size_t str3_len) /* {{{ */
{
- int last_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ size_t len = str1_len + str2_len + str3_len;
+ zend_string *res = zend_string_alloc(len, 0);
- if (last_op_number > 0) {
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
+ memcpy(res->val, str1, str1_len);
+ memcpy(res->val + str1_len, str2, str2_len);
+ memcpy(res->val + str1_len + str2_len, str3, str3_len);
+ res->val[len] = '\0';
- switch (last_op->opcode) {
- case ZEND_FETCH_OBJ_RW:
- last_op->opcode = op;
- last_op->extended_value = ZEND_ASSIGN_OBJ;
+ return res;
+}
- zend_do_op_data(opline, op2 TSRMLS_CC);
- SET_UNUSED(opline->result);
- GET_NODE(result, last_op->result);
- return;
- case ZEND_FETCH_DIM_RW:
- last_op->opcode = op;
- last_op->extended_value = ZEND_ASSIGN_DIM;
-
- zend_do_op_data(opline, op2 TSRMLS_CC);
- opline->op2.var = get_temporary_variable(CG(active_op_array));
- opline->op2_type = IS_VAR;
- SET_UNUSED(opline->result);
- GET_NODE(result,last_op->result);
- return;
- default:
- break;
- }
+zend_string *zend_concat_names(char *name1, size_t name1_len, char *name2, size_t name2_len) {
+ return zend_concat3(name1, name1_len, "\\", 1, name2, name2_len);
+}
+
+zend_string *zend_prefix_with_ns(zend_string *name TSRMLS_DC) {
+ if (CG(current_namespace)) {
+ zend_string *ns = CG(current_namespace);
+ return zend_concat_names(ns->val, ns->len, name->val, name->len);
+ } else {
+ return zend_string_copy(name);
}
+}
- opline->opcode = op;
- SET_NODE(opline->op1, op1);
- SET_NODE(opline->op2, op2);
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
+void *zend_hash_find_ptr_lc(HashTable *ht, const char *str, size_t len) {
+ void *result;
+ zend_string *lcname;
+ ALLOCA_FLAG(use_heap);
+
+ STR_ALLOCA_ALLOC(lcname, len, use_heap);
+ zend_str_tolower_copy(lcname->val, str, len);
+ result = zend_hash_find_ptr(ht, lcname);
+ STR_ALLOCA_FREE(lcname, use_heap);
+
+ return result;
}
-/* }}} */
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC) /* {{{ */
-{
- zend_op opline;
- zend_op *opline_ptr;
+zend_string *zend_resolve_non_class_name(
+ zend_string *name, uint32_t type, zend_bool *is_fully_qualified,
+ zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC
+) {
+ char *compound;
+ *is_fully_qualified = 0;
- if (varname->op_type == IS_CONST) {
- if (Z_TYPE(varname->u.constant) != IS_STRING) {
- convert_to_string(&varname->u.constant);
+ if (name->val[0] == '\\') {
+ /* Remove \ prefix (only relevant if this is a string rather than a label) */
+ return zend_string_init(name->val + 1, name->len - 1, 0);
+ }
+
+ if (type == ZEND_NAME_FQ) {
+ *is_fully_qualified = 1;
+ return zend_string_copy(name);
+ }
+
+ if (type == ZEND_NAME_RELATIVE) {
+ *is_fully_qualified = 1;
+ return zend_prefix_with_ns(name TSRMLS_CC);
+ }
+
+ if (current_import_sub) {
+ /* If an unqualified name is a function/const alias, replace it. */
+ zend_string *import_name;
+ if (case_sensitive) {
+ import_name = zend_hash_find_ptr(current_import_sub, name);
+ } else {
+ import_name = zend_hash_find_ptr_lc(current_import_sub, name->val, name->len);
}
- if (!zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) &&
- !(Z_STRSIZE(varname->u.constant) == (sizeof("this")-1) &&
- !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1)) &&
- (CG(active_op_array)->last == 0 ||
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) {
- result->op_type = IS_CV;
- result->u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
- Z_STR(varname->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(result->u.op.var)];
- result->EA = 0;
- return;
+ if (import_name) {
+ *is_fully_qualified = 1;
+ return zend_string_copy(import_name);
}
}
- if (bp) {
- opline_ptr = &opline;
- init_op(opline_ptr TSRMLS_CC);
- } else {
- opline_ptr = get_next_op(CG(active_op_array) TSRMLS_CC);
+ compound = memchr(name->val, '\\', name->len);
+ if (compound) {
+ *is_fully_qualified = 1;
}
- opline_ptr->opcode = op;
- opline_ptr->result_type = IS_VAR;
- opline_ptr->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline_ptr->op1, varname);
- GET_NODE(result, opline_ptr->result);
- SET_UNUSED(opline_ptr->op2);
- opline_ptr->extended_value = ZEND_FETCH_LOCAL;
+ if (compound && CG(current_import)) {
+ /* If the first part of a qualified name is an alias, substitute it. */
+ size_t len = compound - name->val;
+ zend_string *import_name = zend_hash_find_ptr_lc(CG(current_import), name->val, len);
- if (varname->op_type == IS_CONST) {
- if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
- opline_ptr->extended_value = ZEND_FETCH_GLOBAL;
+ if (import_name) {
+ return zend_concat_names(
+ import_name->val, import_name->len, name->val + len + 1, name->len - len - 1);
}
}
- if (bp) {
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_add_element(fetch_list_ptr, opline_ptr);
- }
+ return zend_prefix_with_ns(name TSRMLS_CC);
}
/* }}} */
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC) /* {{{ */
+zend_string *zend_resolve_function_name(zend_string *name, uint32_t type, zend_bool *is_fully_qualified TSRMLS_DC) /* {{{ */
{
- /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC);
+ return zend_resolve_non_class_name(
+ name, type, is_fully_qualified, 0, CG(current_import_function) TSRMLS_CC);
}
/* }}} */
-void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* {{{ */
+zend_string *zend_resolve_const_name(zend_string *name, uint32_t type, zend_bool *is_fully_qualified TSRMLS_DC) /* {{{ */ {
+ return zend_resolve_non_class_name(
+ name, type, is_fully_qualified, 1, CG(current_import_const) TSRMLS_CC);
+}
+/* }}} */
+
+zend_string *zend_resolve_class_name(zend_string *name, uint32_t type TSRMLS_DC) /* {{{ */
{
- znode class_node;
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline_ptr;
- zend_op opline;
+ char *compound;
- if (class_name->op_type == IS_CONST &&
- ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) {
- zend_resolve_class_name(class_name TSRMLS_CC);
- class_node = *class_name;
- } else {
- zend_do_fetch_class(&class_node, class_name TSRMLS_CC);
- }
- fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- if (result->op_type == IS_CV) {
- init_op(&opline TSRMLS_CC);
-
- opline.opcode = ZEND_FETCH_W;
- opline.result_type = IS_VAR;
- opline.result.var = get_temporary_variable(CG(active_op_array));
- opline.op1_type = IS_CONST;
- LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(result->u.op.var)]));
- GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant);
- if (class_node.op_type == IS_CONST) {
- opline.op2_type = IS_CONST;
- opline.op2.constant =
- zend_add_class_name_literal(CG(active_op_array), &class_node.u.constant TSRMLS_CC);
+ if (type == ZEND_NAME_RELATIVE) {
+ return zend_prefix_with_ns(name TSRMLS_CC);
+ }
+
+ if (type == ZEND_NAME_FQ || name->val[0] == '\\') {
+ /* Remove \ prefix (only relevant if this is a string rather than a label) */
+ if (name->val[0] == '\\') {
+ name = zend_string_init(name->val + 1, name->len - 1, 0);
} else {
- SET_NODE(opline.op2, &class_node);
+ zend_string_addref(name);
+ }
+ /* Ensure that \self, \parent and \static are not used */
+ if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", name->val);
}
- GET_NODE(result,opline.result);
- opline.extended_value |= ZEND_FETCH_STATIC_MEMBER;
- opline_ptr = &opline;
+ return name;
+ }
- zend_llist_add_element(fetch_list_ptr, &opline);
- } else {
- le = fetch_list_ptr->head;
-
- opline_ptr = (zend_op *)le->data;
- if (opline_ptr->opcode != ZEND_FETCH_W && opline_ptr->op1_type == IS_CV) {
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_W;
- opline.result_type = IS_VAR;
- opline.result.var = get_temporary_variable(CG(active_op_array));
- opline.op1_type = IS_CONST;
- LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(opline_ptr->op1.var)]));
- GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant);
- if (class_node.op_type == IS_CONST) {
- opline.op2_type = IS_CONST;
- opline.op2.constant =
- zend_add_class_name_literal(CG(active_op_array), &class_node.u.constant TSRMLS_CC);
- } else {
- SET_NODE(opline.op2, &class_node);
+ if (CG(current_import)) {
+ compound = memchr(name->val, '\\', name->len);
+ if (compound) {
+ /* If the first part of a qualified name is an alias, substitute it. */
+ size_t len = compound - name->val;
+ zend_string *import_name = zend_hash_find_ptr_lc(CG(current_import), name->val, len);
+
+ if (import_name) {
+ return zend_concat_names(
+ import_name->val, import_name->len, name->val + len + 1, name->len - len - 1);
}
- opline.extended_value |= ZEND_FETCH_STATIC_MEMBER;
- COPY_NODE(opline_ptr->op1, opline.result);
-
- zend_llist_prepend_element(fetch_list_ptr, &opline);
} else {
- if (opline_ptr->op1_type == IS_CONST) {
- GET_POLYMORPHIC_CACHE_SLOT(opline_ptr->op1.constant);
- }
- if (class_node.op_type == IS_CONST) {
- opline_ptr->op2_type = IS_CONST;
- opline_ptr->op2.constant =
- zend_add_class_name_literal(CG(active_op_array), &class_node.u.constant TSRMLS_CC);
- } else {
- SET_NODE(opline_ptr->op2, &class_node);
+ /* If an unqualified name is an alias, replace it. */
+ zend_string *import_name
+ = zend_hash_find_ptr_lc(CG(current_import), name->val, name->len);
+
+ if (import_name) {
+ return zend_string_copy(import_name);
}
- opline_ptr->extended_value |= ZEND_FETCH_STATIC_MEMBER;
}
}
+
+ /* If not fully qualified and not an alias, prepend the current namespace */
+ return zend_prefix_with_ns(name TSRMLS_CC);
}
/* }}} */
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC) /* {{{ */
+zend_string *zend_resolve_class_name_ast(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- fetch_simple_variable(result, varname, 1 TSRMLS_CC);
+ zend_string *name = zend_ast_get_str(ast);
+ return zend_resolve_class_name(name, ast->attr TSRMLS_CC);
+}
+/* }}} */
+
+static void ptr_dtor(zval *zv) /* {{{ */
+{
+ efree(Z_PTR_P(zv));
+}
+/* }}} */
- fetch_array_dim(result, result, first_dim TSRMLS_CC);
+static void str_dtor(zval *zv) /* {{{ */ {
+ zend_string_release(Z_STR_P(zv));
}
/* }}} */
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC) /* {{{ */
+void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC) /* {{{ */
{
- zend_op opline;
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
+ zend_label *dest;
+ zend_long current, distance;
+ zval *label;
- if (zend_is_function_or_method_call(parent)) {
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_SEPARATE;
- SET_NODE(opline.op1, parent);
- SET_UNUSED(opline.op2);
- opline.result_type = IS_VAR;
- opline.result.var = opline.op1.var;
- zend_llist_add_element(fetch_list_ptr, &opline);
+ if (pass2) {
+ label = opline->op2.zv;
+ } else {
+ label = &CONSTANT_EX(op_array, opline->op2.constant);
}
+ if (CG(context).labels == NULL ||
+ (dest = zend_hash_find_ptr(CG(context).labels, Z_STR_P(label))) == NULL) {
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */
- opline.result_type = IS_VAR;
- opline.result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline.op1, parent);
- SET_NODE(opline.op2, dim);
- if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
- zend_uint_t index;
+ if (pass2) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = opline->lineno;
+ zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
+ } else {
+ /* Label is not defined. Delay to pass 2. */
+ return;
+ }
+ }
- if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline.op2.constant)), index)) {
- zval_dtor(&CONSTANT(opline.op2.constant));
- ZVAL_INT(&CONSTANT(opline.op2.constant), index);
+ opline->op1.opline_num = dest->opline_num;
+ zval_dtor(label);
+ ZVAL_NULL(label);
+
+ /* Check that we are not moving into loop or switch */
+ current = opline->extended_value;
+ for (distance = 0; current != dest->brk_cont; distance++) {
+ if (current == -1) {
+ if (pass2) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = opline->lineno;
+ }
+ zend_error_noreturn(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed");
}
+ current = op_array->brk_cont_array[current].parent;
}
- GET_NODE(result, opline.result);
+ if (distance == 0) {
+ /* Nothing to break out of, optimize to ZEND_JMP */
+ opline->opcode = ZEND_JMP;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ } else {
+ /* Set real break distance */
+ ZVAL_LONG(label, distance);
+ }
+}
+/* }}} */
- zend_llist_add_element(fetch_list_ptr, &opline);
+void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */
+{
+ if (CG(context).labels) {
+ zend_hash_destroy(CG(context).labels);
+ FREE_HASHTABLE(CG(context).labels);
+ CG(context).labels = NULL;
+ }
+ if (!temporary && !zend_stack_is_empty(&CG(context_stack))) {
+ zend_compiler_context *ctx = zend_stack_top(&CG(context_stack));
+ CG(context) = *ctx;
+ zend_stack_del_top(&CG(context_stack));
+ }
}
/* }}} */
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC) /* {{{ */
+static zend_bool zend_is_call(zend_ast *ast);
+
+static int generate_free_loop_var(znode *var TSRMLS_DC) /* {{{ */
{
- fetch_array_dim(result, parent, offset TSRMLS_CC);
+ switch (var->op_type) {
+ case IS_UNUSED:
+ /* Stack separator on function boundary, stop applying */
+ return 1;
+ case IS_VAR:
+ case IS_TMP_VAR:
+ {
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+
+ opline->opcode = ZEND_FREE;
+ SET_NODE(opline->op1, var);
+ SET_UNUSED(opline->op2);
+ }
+ }
+
+ return 0;
}
/* }}} */
-void zend_do_print(znode *result, znode *arg TSRMLS_DC) /* {{{ */
+static uint32_t zend_add_try_element(uint32_t try_op TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_op_array *op_array = CG(active_op_array);
+ uint32_t try_catch_offset = op_array->last_try_catch++;
+ zend_try_catch_element *elem;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->opcode = ZEND_PRINT;
- SET_NODE(opline->op1, arg);
- SET_UNUSED(opline->op2);
- GET_NODE(result, opline->result);
+ op_array->try_catch_array = safe_erealloc(
+ op_array->try_catch_array, sizeof(zend_try_catch_element), op_array->last_try_catch, 0);
+
+ elem = &op_array->try_catch_array[try_catch_offset];
+ elem->try_op = try_op;
+ elem->catch_op = 0;
+ elem->finally_op = 0;
+ elem->finally_end = 0;
+
+ return try_catch_offset;
}
/* }}} */
-void zend_do_echo(znode *arg TSRMLS_DC) /* {{{ */
+ZEND_API void function_add_ref(zend_function *function) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ if (function->type == ZEND_USER_FUNCTION) {
+ zend_op_array *op_array = &function->op_array;
- opline->opcode = ZEND_ECHO;
- SET_NODE(opline->op1, arg);
- SET_UNUSED(opline->op2);
+ (*op_array->refcount)++;
+ if (op_array->static_variables) {
+ HashTable *static_variables = op_array->static_variables;
+
+ ALLOC_HASHTABLE(op_array->static_variables);
+ zend_array_dup(op_array->static_variables, static_variables);
+ }
+ op_array->run_time_cache = NULL;
+ } else if (function->type == ZEND_INTERNAL_FUNCTION) {
+ if (function->common.function_name) {
+ zend_string_addref(function->common.function_name);
+ }
+ }
}
/* }}} */
-void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC) /* {{{ */
+ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opline, HashTable *function_table, zend_bool compile_time TSRMLS_DC) /* {{{ */
{
- char *method_type;
+ zend_function *function, *new_function;
+ zval *op1, *op2;
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- Z_IVAL(modifiers->u.constant) |= ZEND_ACC_ABSTRACT;
- method_type = "Interface";
+ if (compile_time) {
+ op1 = &CONSTANT_EX(op_array, opline->op1.constant);
+ op2 = &CONSTANT_EX(op_array, opline->op2.constant);
} else {
- method_type = "Abstract";
+ op1 = opline->op1.zv;
+ op2 = opline->op2.zv;
}
- if (Z_IVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) {
- if(Z_IVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
- }
- if (Z_IVAL(body->u.constant) == ZEND_ACC_ABSTRACT) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ function = zend_hash_find_ptr(function_table, Z_STR_P(op1));
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_function, function, sizeof(zend_op_array));
+ if (zend_hash_add_ptr(function_table, Z_STR_P(op2), new_function) == NULL) {
+ int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
+ zend_function *old_function;
- opline->opcode = ZEND_RAISE_ABSTRACT_ERROR;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ efree_size(new_function, sizeof(zend_op_array));
+ if ((old_function = zend_hash_find_ptr(function_table, Z_STR_P(op2))) != NULL
+ && old_function->type == ZEND_USER_FUNCTION
+ && old_function->op_array.last > 0) {
+ zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
+ function->common.function_name->val,
+ old_function->op_array.filename->val,
+ old_function->op_array.opcodes[0].lineno);
} else {
- /* we had code in the function body */
- zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
+ zend_error(error_level, "Cannot redeclare %s()", function->common.function_name->val);
}
+ return FAILURE;
} else {
- if (Z_IVAL(body->u.constant) == ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
- }
+ (*function->op_array.refcount)++;
+ function->op_array.static_variables = NULL; /* NULL out the unbound function */
+ return SUCCESS;
}
}
/* }}} */
-static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC) /* {{{ */
{
- if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
- && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
- && ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
- && (Z_STRHASH(CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
- && (Z_STRSIZE(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
- && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this") - 1)) {
- return 1;
+ zend_class_entry *ce;
+ zval *op1, *op2;
+
+ if (compile_time) {
+ op1 = &CONSTANT_EX(op_array, opline->op1.constant);
+ op2 = &CONSTANT_EX(op_array, opline->op2.constant);
} else {
- return 0;
+ op1 = opline->op1.zv;
+ op2 = opline->op2.zv;
+ }
+ if ((ce = zend_hash_find_ptr(class_table, Z_STR_P(op1))) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1));
+ return NULL;
+ }
+ ce->refcount++;
+ if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
+ ce->refcount--;
+ if (!compile_time) {
+ /* If we're in compile time, in practice, it's quite possible
+ * that we'll never reach this class declaration at runtime,
+ * so we shut up about it. This allows the if (!defined('FOO')) { return; }
+ * approach to work.
+ */
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
+ }
+ return NULL;
+ } else {
+ if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
+ zend_verify_abstract_class(ce TSRMLS_CC);
+ }
+ return ce;
}
}
/* }}} */
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC) /* {{{ */
{
- int last_op_number;
- zend_op *opline;
+ zend_class_entry *ce;
+ zval *op1, *op2;
- if (value->op_type == IS_CV) {
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- if (fetch_list_ptr && fetch_list_ptr->head) {
- opline = (zend_op *)fetch_list_ptr->head->data;
+ if (compile_time) {
+ op1 = &CONSTANT_EX(op_array, opline->op1.constant);
+ op2 = &CONSTANT_EX(op_array, opline->op2.constant);
+ } else {
+ op1 = opline->op1.zv;
+ op2 = opline->op2.zv;
+ }
- if (opline->opcode == ZEND_FETCH_DIM_W &&
- opline->op1_type == IS_CV &&
- opline->op1.var == value->u.op.var) {
+ ce = zend_hash_find_ptr(class_table, Z_STR_P(op1));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_R;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->op1_type = IS_CONST;
- LITERAL_STR(opline->op1,
- STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(value->u.op.var)]));
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_LOCAL;
- GET_NODE(value, opline->result);
- }
+ if (!ce) {
+ if (!compile_time) {
+ /* If we're in compile time, in practice, it's quite possible
+ * that we'll never reach this class declaration at runtime,
+ * so we shut up about it. This allows the if (!defined('FOO')) { return; }
+ * approach to work.
+ */
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", Z_STRVAL_P(op2));
}
+ return NULL;
}
- zend_do_end_variable_parse(variable, BP_VAR_W, 0 TSRMLS_CC);
+ if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name->val, parent_ce->name->val);
+ } else if ((parent_ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name->val, parent_ce->name->val);
+ }
- last_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_do_inheritance(ce, parent_ce TSRMLS_CC);
- if (variable->op_type == IS_CV) {
- if (variable->u.op.var == CG(active_op_array)->this_var) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- } else if (variable->op_type == IS_VAR) {
- int n = 0;
-
- while (last_op_number - n > 0) {
- zend_op *last_op;
-
- last_op = &CG(active_op_array)->opcodes[last_op_number-n-1];
-
- if (last_op->result_type == IS_VAR &&
- last_op->result.var == variable->u.op.var) {
- if (last_op->opcode == ZEND_FETCH_OBJ_W) {
- if (n > 0) {
- int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline);
- *opline = *last_op;
- MAKE_NOP(last_op);
- /* last_op = opline; */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- /* get_next_op can realloc, we need to move last_op */
- last_op = &CG(active_op_array)->opcodes[opline_no];
+ ce->refcount++;
+
+ /* Register the derived class */
+ if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
+ }
+ return ce;
+}
+/* }}} */
+
+void zend_do_early_binding(TSRMLS_D) /* {{{ */
+{
+ zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
+ HashTable *table;
+
+ while (opline->opcode == ZEND_TICKS && opline > CG(active_op_array)->opcodes) {
+ opline--;
+ }
+
+ switch (opline->opcode) {
+ case ZEND_DECLARE_FUNCTION:
+ if (do_bind_function(CG(active_op_array), opline, CG(function_table), 1 TSRMLS_CC) == FAILURE) {
+ return;
+ }
+ table = CG(function_table);
+ break;
+ case ZEND_DECLARE_CLASS:
+ if (do_bind_class(CG(active_op_array), opline, CG(class_table), 1 TSRMLS_CC) == NULL) {
+ return;
+ }
+ table = CG(class_table);
+ break;
+ case ZEND_DECLARE_INHERITED_CLASS:
+ {
+ zend_op *fetch_class_opline = opline-1;
+ zval *parent_name;
+ zend_class_entry *ce;
+
+ parent_name = &CONSTANT(fetch_class_opline->op2.constant);
+ if (((ce = zend_lookup_class(Z_STR_P(parent_name) TSRMLS_CC)) == NULL) ||
+ ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) &&
+ (ce->type == ZEND_INTERNAL_CLASS))) {
+ if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) {
+ uint32_t *opline_num = &CG(active_op_array)->early_binding;
+
+ while (*opline_num != -1) {
+ opline_num = &CG(active_op_array)->opcodes[*opline_num].result.opline_num;
+ }
+ *opline_num = opline - CG(active_op_array)->opcodes;
+ opline->opcode = ZEND_DECLARE_INHERITED_CLASS_DELAYED;
+ opline->result_type = IS_UNUSED;
+ opline->result.opline_num = -1;
}
- last_op->opcode = ZEND_ASSIGN_OBJ;
- zend_do_op_data(opline, value TSRMLS_CC);
- SET_UNUSED(opline->result);
- GET_NODE(result, last_op->result);
return;
- } else if (last_op->opcode == ZEND_FETCH_DIM_W) {
- if (n > 0) {
- int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline);
- *opline = *last_op;
- MAKE_NOP(last_op);
- /* last_op = opline; */
- /* TBFixed: this can realloc opcodes, leaving last_op pointing wrong */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- /* get_next_op can realloc, we need to move last_op */
- last_op = &CG(active_op_array)->opcodes[opline_no];
- }
- last_op->opcode = ZEND_ASSIGN_DIM;
- zend_do_op_data(opline, value TSRMLS_CC);
- opline->op2.var = get_temporary_variable(CG(active_op_array));
- opline->op2_type = IS_VAR;
- SET_UNUSED(opline->result);
- GET_NODE(result, last_op->result);
+ }
+ if (do_bind_inherited_class(CG(active_op_array), opline, CG(class_table), ce, 1 TSRMLS_CC) == NULL) {
return;
- } else if (opline_is_fetch_this(last_op TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- } else {
- break;
}
+ /* clear unnecessary ZEND_FETCH_CLASS opcode */
+ zend_del_literal(CG(active_op_array), fetch_class_opline->op2.constant);
+ MAKE_NOP(fetch_class_opline);
+
+ table = CG(class_table);
+ break;
}
- n++;
- }
+ case ZEND_VERIFY_ABSTRACT_CLASS:
+ case ZEND_ADD_INTERFACE:
+ case ZEND_ADD_TRAIT:
+ case ZEND_BIND_TRAITS:
+ /* We currently don't early-bind classes that implement interfaces */
+ /* Classes with traits are handled exactly the same, no early-bind here */
+ return;
+ default:
+ zend_error_noreturn(E_COMPILE_ERROR, "Invalid binding type");
+ return;
}
- opline->opcode = ZEND_ASSIGN;
- SET_NODE(opline->op1, variable);
- SET_NODE(opline->op2, value);
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
+ zend_hash_del(table, Z_STR(CONSTANT(opline->op1.constant)));
+ zend_del_literal(CG(active_op_array), opline->op1.constant);
+ zend_del_literal(CG(active_op_array), opline->op2.constant);
+ MAKE_NOP(opline);
}
/* }}} */
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC) /* {{{ */
+ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
-
- if (lvar->op_type == IS_CV) {
- if (lvar->u.op.var == CG(active_op_array)->this_var) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- } else if (lvar->op_type == IS_VAR) {
- int last_op_number = get_next_op_number(CG(active_op_array));
+ if (op_array->early_binding != -1) {
+ zend_bool orig_in_compilation = CG(in_compilation);
+ uint32_t opline_num = op_array->early_binding;
+ zend_class_entry *ce;
- if (last_op_number > 0) {
- opline = &CG(active_op_array)->opcodes[last_op_number-1];
- if (opline_is_fetch_this(opline TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
+ CG(in_compilation) = 1;
+ while (opline_num != -1) {
+ if ((ce = zend_lookup_class(Z_STR_P(op_array->opcodes[opline_num-1].op2.zv) TSRMLS_CC)) != NULL) {
+ do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0 TSRMLS_CC);
}
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ASSIGN_REF;
- if (zend_is_function_or_method_call(rvar)) {
- opline->extended_value = ZEND_RETURNS_FUNCTION;
- } else if (rvar->EA & ZEND_PARSED_NEW) {
- opline->extended_value = ZEND_RETURNS_NEW;
- } else {
- opline->extended_value = 0;
- }
- if (result) {
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
- } else {
- opline->result_type = IS_UNUSED | EXT_TYPE_UNUSED;
+ opline_num = op_array->opcodes[opline_num].result.opline_num;
+ }
+ CG(in_compilation) = orig_in_compilation;
}
- SET_NODE(opline->op1, lvar);
- SET_NODE(opline->op2, rvar);
}
/* }}} */
-static inline void do_begin_loop(TSRMLS_D) /* {{{ */
+ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal) /* {{{ */
{
- zend_brk_cont_element *brk_cont_element;
- int parent;
+ size_t prop_name_length = 1 + src1_length + 1 + src2_length;
+ zend_string *prop_name = zend_string_alloc(prop_name_length, internal);
- parent = CG(context).current_brk_cont;
- CG(context).current_brk_cont = CG(active_op_array)->last_brk_cont;
- brk_cont_element = get_next_brk_cont_element(CG(active_op_array));
- brk_cont_element->start = get_next_op_number(CG(active_op_array));
- brk_cont_element->parent = parent;
+ prop_name->val[0] = '\0';
+ memcpy(prop_name->val + 1, src1, src1_length+1);
+ memcpy(prop_name->val + 1 + src1_length + 1, src2, src2_length+1);
+ return prop_name;
}
/* }}} */
-static inline void do_end_loop(int cont_addr, int has_loop_var TSRMLS_DC) /* {{{ */
+static int zend_strnlen(const char* s, size_t maxlen) /* {{{ */
{
- if (!has_loop_var) {
- /* The start fileld is used to free temporary variables in case of exceptions.
- * We won't try to free something of we don't have loop variable.
- */
- CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].start = -1;
- }
- CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].cont = cont_addr;
- CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(context).current_brk_cont = CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].parent;
+ size_t len = 0;
+ while (*s++ && maxlen--) len++;
+ return len;
}
/* }}} */
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC) /* {{{ */
+ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len) /* {{{ */
{
- int while_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ size_t class_name_len;
- opline->opcode = ZEND_JMPZ;
- SET_NODE(opline->op1, expr);
- close_bracket_token->u.op.opline_num = while_cond_op_number;
- SET_UNUSED(opline->op2);
+ *class_name = NULL;
+
+ if (name->val[0] != '\0') {
+ *prop_name = name->val;
+ if (prop_len) {
+ *prop_len = name->len;
+ }
+ return SUCCESS;
+ }
+ if (name->len < 3 || name->val[1] == '\0') {
+ zend_error(E_NOTICE, "Illegal member variable name");
+ *prop_name = name->val;
+ if (prop_len) {
+ *prop_len = name->len;
+ }
+ return FAILURE;
+ }
+
+ class_name_len = zend_strnlen(name->val + 1, name->len - 2);
+ if (class_name_len >= name->len - 2 || name->val[class_name_len + 1] != '\0') {
+ zend_error(E_NOTICE, "Corrupt member variable name");
+ *prop_name = name->val;
+ if (prop_len) {
+ *prop_len = name->len;
+ }
+ return FAILURE;
+ }
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
+ *class_name = name->val + 1;
+ *prop_name = name->val + class_name_len + 2;
+ if (prop_len) {
+ *prop_len = name->len - class_name_len - 2;
+ }
+ return SUCCESS;
}
/* }}} */
-void zend_do_while_end(const znode *while_token, const znode *close_bracket_token TSRMLS_DC) /* {{{ */
+static zend_constant *zend_lookup_reserved_const(const char *name, size_t len TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_constant *c = zend_hash_find_ptr_lc(EG(zend_constants), name, len);
+ if (c && !(c->flags & CONST_CS) && (c->flags & CONST_CT_SUBST)) {
+ return c;
+ }
+ return NULL;
+}
+/* }}} */
- /* add unconditional jump */
- opline->opcode = ZEND_JMP;
- opline->op1.opline_num = while_token->u.op.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool is_fully_qualified TSRMLS_DC) /* {{{ */
+{
+ zend_constant *c;
+
+ if (!(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION)) {
+ /* Substitute case-sensitive (or lowercase) persistent constants */
+ c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c && (c->flags & CONST_PERSISTENT)) {
+ ZVAL_DUP(zv, &c->value);
+ return 1;
+ }
+ }
- /* update while's conditional jmp */
- CG(active_op_array)->opcodes[close_bracket_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
+ {
+ /* Substitute true, false and null (including unqualified usage in namespaces) */
+ const char *lookup_name = name->val;
+ size_t lookup_len = name->len;
- do_end_loop(while_token->u.op.opline_num, 0 TSRMLS_CC);
+ if (!is_fully_qualified) {
+ zend_get_unqualified_name(name, &lookup_name, &lookup_len);
+ }
- DEC_BPC(CG(active_op_array));
+ c = zend_lookup_reserved_const(lookup_name, lookup_len TSRMLS_CC);
+ if (c) {
+ ZVAL_DUP(zv, &c->value);
+ return 1;
+ }
+ }
+
+ return 0;
}
/* }}} */
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC) /* {{{ */
+void zend_init_list(void *result, void *item TSRMLS_DC) /* {{{ */
{
- int for_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ void** list = emalloc(sizeof(void*) * 2);
- opline->opcode = ZEND_JMPZNZ;
- SET_NODE(opline->op1, expr); /* the conditional expression */
- second_semicolon_token->u.op.opline_num = for_cond_op_number;
- SET_UNUSED(opline->op2);
+ list[0] = item;
+ list[1] = NULL;
+
+ *(void**)result = list;
}
/* }}} */
-void zend_do_for_before_statement(const znode *cond_start, const znode *second_semicolon_token TSRMLS_DC) /* {{{ */
+void zend_add_to_list(void *result, void *item TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ void** list = *(void**)result;
+ size_t n = 0;
- opline->opcode = ZEND_JMP;
- opline->op1.opline_num = cond_start->u.op.opline_num;
- CG(active_op_array)->opcodes[second_semicolon_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (list) {
+ while (list[n]) {
+ n++;
+ }
+ }
+
+ list = erealloc(list, sizeof(void*) * (n+2));
- do_begin_loop(TSRMLS_C);
+ list[n] = item;
+ list[n+1] = NULL;
- INC_BPC(CG(active_op_array));
+ *(void**)result = list;
}
/* }}} */
-void zend_do_for_end(const znode *second_semicolon_token TSRMLS_DC) /* {{{ */
+void zend_do_extended_info(TSRMLS_D) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_op *opline;
- opline->opcode = ZEND_JMP;
- opline->op1.opline_num = second_semicolon_token->u.op.opline_num+1;
- CG(active_op_array)->opcodes[second_semicolon_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
+ return;
+ }
- do_end_loop(second_semicolon_token->u.op.opline_num+1, 0 TSRMLS_CC);
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- DEC_BPC(CG(active_op_array));
+ opline->opcode = ZEND_EXT_STMT;
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
}
/* }}} */
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) /* {{{ */
+void zend_do_extended_fcall_begin(TSRMLS_D) /* {{{ */
{
- int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
- if (last_op_number > 0) {
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- last_op->opcode = (op==ZEND_PRE_INC)?ZEND_PRE_INC_OBJ:ZEND_PRE_DEC_OBJ;
- last_op->result_type = IS_VAR;
- last_op->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, last_op->result);
- return;
- }
+ if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
+ return;
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = op;
- SET_NODE(opline->op1, op1);
+
+ opline->opcode = ZEND_EXT_FCALL_BEGIN;
+ SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
}
/* }}} */
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC) /* {{{ */
+void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */
{
- int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
- if (last_op_number > 0) {
- zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
-
- if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
- last_op->opcode = (op==ZEND_POST_INC)?ZEND_POST_INC_OBJ:ZEND_POST_DEC_OBJ;
- last_op->result_type = IS_TMP_VAR;
- last_op->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, last_op->result);
- return;
- }
+ if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
+ return;
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = op;
- SET_NODE(opline->op1, op1);
+
+ opline->opcode = ZEND_EXT_FCALL_END;
+ SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
}
/* }}} */
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC) /* {{{ */
+zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC) /* {{{ */
{
- int if_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_auto_global *auto_global;
- opline->opcode = ZEND_JMPZ;
- SET_NODE(opline->op1, cond);
- closing_bracket_token->u.op.opline_num = if_cond_op_number;
- SET_UNUSED(opline->op2);
- INC_BPC(CG(active_op_array));
+ if ((auto_global = zend_hash_find_ptr(CG(auto_globals), name)) != NULL) {
+ if (auto_global->armed) {
+ auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
+ }
+ return 1;
+ }
+ return 0;
}
/* }}} */
-void zend_do_if_after_statement(const znode *closing_bracket_token, unsigned char initialize TSRMLS_DC) /* {{{ */
+int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */
{
- int if_end_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_llist *jmp_list_ptr;
+ zend_auto_global auto_global;
+ int retval;
- opline->opcode = ZEND_JMP;
- /* save for backpatching */
- if (initialize) {
- zend_llist jmp_list;
+ auto_global.name = zend_new_interned_string(name TSRMLS_CC);
+ auto_global.auto_global_callback = auto_global_callback;
+ auto_global.jit = jit;
- zend_llist_init(&jmp_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &jmp_list);
- }
- jmp_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_add_element(jmp_list_ptr, &if_end_op_number);
+ retval = zend_hash_add_mem(CG(auto_globals), name, &auto_global, sizeof(zend_auto_global)) != NULL ? SUCCESS : FAILURE;
- CG(active_op_array)->opcodes[closing_bracket_token->u.op.opline_num].op2.opline_num = if_end_op_number+1;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ zend_string_release(auto_global.name);
+ return retval;
}
/* }}} */
-void zend_do_if_end(TSRMLS_D) /* {{{ */
+ZEND_API void zend_activate_auto_globals(TSRMLS_D) /* {{{ */
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_llist *jmp_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_element *le;
+ zend_auto_global *auto_global;
- for (le=jmp_list_ptr->head; le; le = le->next) {
- CG(active_op_array)->opcodes[*((int *) le->data)].op1.opline_num = next_op_number;
- }
- zend_llist_destroy(jmp_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
- DEC_BPC(CG(active_op_array));
+ ZEND_HASH_FOREACH_PTR(CG(auto_globals), auto_global) {
+ if (auto_global->jit) {
+ auto_global->armed = 1;
+ } else if (auto_global->auto_global_callback) {
+ auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
+ } else {
+ auto_global->armed = 0;
+ }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
-void zend_check_writable_variable(const znode *variable) /* {{{ */
+int zendlex(zend_parser_stack_elem *elem TSRMLS_DC) /* {{{ */
{
- zend_uint type = variable->EA;
+ zval zv;
+ int retval;
- if (type & ZEND_PARSED_METHOD_CALL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Can't use method return value in write context");
- }
- if (type == ZEND_PARSED_FUNCTION_CALL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Can't use function return value in write context");
+ if (CG(increment_lineno)) {
+ CG(zend_lineno)++;
+ CG(increment_lineno) = 0;
}
-}
-/* }}} */
-void zend_do_begin_variable_parse(TSRMLS_D) /* {{{ */
-{
- zend_llist fetch_list;
+again:
+ ZVAL_UNDEF(&zv);
+ retval = lex_scan(&zv TSRMLS_CC);
+ switch (retval) {
+ case T_COMMENT:
+ case T_DOC_COMMENT:
+ case T_OPEN_TAG:
+ case T_WHITESPACE:
+ goto again;
- zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &fetch_list);
+ case T_CLOSE_TAG:
+ if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1] != '>') {
+ CG(increment_lineno) = 1;
+ }
+ retval = ';'; /* implicit ; */
+ break;
+ case T_OPEN_TAG_WITH_ECHO:
+ retval = T_ECHO;
+ break;
+ }
+ if (Z_TYPE(zv) != IS_UNDEF) {
+ elem->ast = zend_ast_create_zval(&zv);
+ }
+
+ return retval;
}
/* }}} */
-void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS_DC) /* {{{ */
+ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC) /* {{{ */
{
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_element *le = fetch_list_ptr->head;
- zend_op *opline = NULL;
- zend_op *opline_ptr;
- zend_uint this_var = -1;
+ zend_bool persistent_hashes = (ce->type == ZEND_INTERNAL_CLASS) ? 1 : 0;
+ dtor_func_t zval_ptr_dtor_func = ((persistent_hashes) ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR);
- /* TODO: $foo->x->y->z = 1 should fetch "x" and "y" for R or RW, not just W */
+ ce->refcount = 1;
+ ce->ce_flags = ZEND_ACC_CONSTANTS_UPDATED;
- if (le) {
- opline_ptr = (zend_op *)le->data;
- if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) {
- /* convert to FETCH_?(this) into IS_CV */
- if (CG(active_op_array)->last == 0 ||
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE) {
+ ce->default_properties_table = NULL;
+ ce->default_static_members_table = NULL;
+ zend_hash_init_ex(&ce->properties_info, 8, NULL, (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
+ zend_hash_init_ex(&ce->constants_table, 8, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
+ zend_hash_init_ex(&ce->function_table, 8, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
- this_var = opline_ptr->result.var;
- if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STR(CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC);
- ZVAL_UNDEF(&CONSTANT(opline_ptr->op1.constant));
- } else {
- zend_del_literal(CG(active_op_array), opline_ptr->op1.constant);
- }
- le = le->next;
- if (variable->op_type == IS_VAR &&
- variable->u.op.var == this_var) {
- variable->op_type = IS_CV;
- variable->u.op.var = CG(active_op_array)->this_var;
- }
- } else if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), STR_INIT("this", sizeof("this")-1, 0) TSRMLS_CC);
- }
- }
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+#ifdef ZTS
+ int n = zend_hash_num_elements(CG(class_table));
- while (le) {
- opline_ptr = (zend_op *)le->data;
- if (opline_ptr->opcode == ZEND_SEPARATE) {
- if (type != BP_VAR_R && type != BP_VAR_IS) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- }
- le = le->next;
- continue;
- }
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- if (opline->op1_type == IS_VAR &&
- opline->op1.var == this_var) {
- opline->op1_type = IS_CV;
- opline->op1.var = CG(active_op_array)->this_var;
- }
- switch (type) {
- case BP_VAR_R:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode -= 3;
- break;
- case BP_VAR_W:
- break;
- case BP_VAR_RW:
- opline->opcode += 3;
- break;
- case BP_VAR_IS:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode += 6; /* 3+3 */
- break;
- case BP_VAR_FUNC_ARG:
- opline->opcode += 9; /* 3+3+3 */
- opline->extended_value |= arg_offset;
- break;
- case BP_VAR_UNSET:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for unsetting");
- }
- opline->opcode += 12; /* 3+3+3+3 */
- break;
- }
- le = le->next;
+ if (CG(static_members_table) && n >= CG(last_static_member)) {
+ /* Support for run-time declaration: dl() */
+ CG(last_static_member) = n+1;
+ CG(static_members_table) = realloc(CG(static_members_table), (n+1)*sizeof(zval*));
+ CG(static_members_table)[n] = NULL;
}
- if (opline && type == BP_VAR_W && arg_offset) {
- opline->extended_value |= ZEND_FETCH_MAKE_REF;
+ ce->static_members_table = (zval*)(zend_intptr_t)n;
+#else
+ ce->static_members_table = NULL;
+#endif
+ } else {
+ ce->static_members_table = ce->default_static_members_table;
+ ce->info.user.doc_comment = NULL;
+ }
+
+ ce->default_properties_count = 0;
+ ce->default_static_members_count = 0;
+
+ if (nullify_handlers) {
+ ce->constructor = NULL;
+ ce->destructor = NULL;
+ ce->clone = NULL;
+ ce->__get = NULL;
+ ce->__set = NULL;
+ ce->__unset = NULL;
+ ce->__isset = NULL;
+ ce->__call = NULL;
+ ce->__callstatic = NULL;
+ ce->__tostring = NULL;
+ ce->create_object = NULL;
+ ce->get_iterator = NULL;
+ ce->iterator_funcs.funcs = NULL;
+ ce->interface_gets_implemented = NULL;
+ ce->get_static_method = NULL;
+ ce->parent = NULL;
+ ce->num_interfaces = 0;
+ ce->interfaces = NULL;
+ ce->num_traits = 0;
+ ce->traits = NULL;
+ ce->trait_aliases = NULL;
+ ce->trait_precedences = NULL;
+ ce->serialize = NULL;
+ ce->unserialize = NULL;
+ ce->serialize_func = NULL;
+ ce->unserialize_func = NULL;
+ ce->__debugInfo = NULL;
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ ce->info.internal.module = NULL;
+ ce->info.internal.builtin_functions = NULL;
}
}
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
}
/* }}} */
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+uint32_t zend_get_class_fetch_type(zend_string *name) /* {{{ */
{
- zend_op *opline;
-
- if (Z_STRSIZE(op2->u.constant) > 1) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_STRING;
- } else if (Z_STRSIZE(op2->u.constant) == 1) {
- int ch = *Z_STRVAL(op2->u.constant);
-
- /* Free memory and use ZEND_ADD_CHAR in case of 1 character strings */
- STR_FREE(Z_STR(op2->u.constant));
- ZVAL_INT(&op2->u.constant, ch);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_CHAR;
- } else { /* String can be empty after a variable at the end of a heredoc */
- STR_FREE(Z_STR(op2->u.constant));
- return;
- }
-
- if (op1) {
- SET_NODE(opline->op1, op1);
- SET_NODE(opline->result, op1);
+ if (zend_string_equals_literal_ci(name, "self")) {
+ return ZEND_FETCH_CLASS_SELF;
+ } else if (zend_string_equals_literal_ci(name, "parent")) {
+ return ZEND_FETCH_CLASS_PARENT;
+ } else if (zend_string_equals_literal_ci(name, "static")) {
+ return ZEND_FETCH_CLASS_STATIC;
} else {
- SET_UNUSED(opline->op1);
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
+ return ZEND_FETCH_CLASS_DEFAULT;
}
- SET_NODE(opline->op2, op2);
- GET_NODE(result, opline->result);
}
/* }}} */
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, uint32_t var) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ return op_array->vars[EX_VAR_TO_NUM(var)];
+}
+/* }}} */
- opline->opcode = ZEND_ADD_VAR;
+zend_ast *zend_ast_append_str(zend_ast *left_ast, zend_ast *right_ast) /* {{{ */
+{
+ zval *left_zv = zend_ast_get_zval(left_ast);
+ zend_string *left = Z_STR_P(left_zv);
+ zend_string *right = zend_ast_get_str(right_ast);
- if (op1) {
- SET_NODE(opline->op1, op1);
- SET_NODE(opline->result, op1);
- } else {
- SET_UNUSED(opline->op1);
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- }
- SET_NODE(opline->op2, op2);
- GET_NODE(result, opline->result);
+ zend_string *result;
+ size_t left_len = left->len;
+ size_t len = left_len + right->len + 1; /* left\right */
+
+ result = zend_string_realloc(left, len, 0);
+ result->val[left_len] = '\\';
+ memcpy(&result->val[left_len + 1], right->val, right->len);
+ result->val[len] = '\0';
+ zend_string_release(right);
+
+ ZVAL_STR(left_zv, result);
+ return left_ast;
}
/* }}} */
-void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */
+/* A hacky way that is used to store the doc comment for properties */
+zend_ast *zend_ast_append_doc_comment(zend_ast *list TSRMLS_DC) /* {{{ */
{
- if (op1->op_type==IS_TMP_VAR) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ if (CG(doc_comment)) {
+ list = zend_ast_list_add(list, zend_ast_create_zval_from_str(CG(doc_comment)));
+ CG(doc_comment) = NULL;
+ }
- opline->opcode = ZEND_FREE;
- SET_NODE(opline->op1, op1);
- SET_UNUSED(opline->op2);
- } else if (op1->op_type==IS_VAR) {
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
+ return list;
+}
+/* }}} */
- while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END || opline->opcode == ZEND_OP_DATA) {
- opline--;
- }
- if (opline->result_type == IS_VAR
- && opline->result.var == op1->u.op.var) {
- if (opline->opcode == ZEND_FETCH_R ||
- opline->opcode == ZEND_FETCH_DIM_R ||
- opline->opcode == ZEND_FETCH_OBJ_R ||
- opline->opcode == ZEND_QM_ASSIGN_VAR) {
- /* It's very rare and useless case. It's better to use
- additional FREE opcode and simplify the FETCH handlers
- their selves */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FREE;
- SET_NODE(opline->op1, op1);
- SET_UNUSED(opline->op2);
- } else {
- opline->result_type |= EXT_TYPE_UNUSED;
- }
- } else {
- while (opline>CG(active_op_array)->opcodes) {
- if (opline->opcode == ZEND_FETCH_DIM_R
- && opline->op1_type == IS_VAR
- && opline->op1.var == op1->u.op.var) {
- /* This should the end of a list() construct
- * Mark its result as unused
- */
- opline->extended_value = ZEND_FETCH_STANDARD;
- break;
- } else if (opline->result_type==IS_VAR
- && opline->result.var == op1->u.op.var) {
- if (opline->opcode == ZEND_NEW) {
- opline->result_type |= EXT_TYPE_UNUSED;
- opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
- while (opline->opcode != ZEND_DO_FCALL || opline->op1.num != ZEND_CALL_CTOR) {
- opline--;
- }
- opline->op1.num |= ZEND_CALL_CTOR_RESULT_UNUSED;
- }
- break;
- }
- opline--;
- }
- }
- } else if (op1->op_type == IS_CONST) {
- zval_dtor(&op1->u.constant);
+void zend_verify_namespace(TSRMLS_D) /* {{{ */
+{
+ if (CG(has_bracketed_namespaces) && !CG(in_namespace)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "No code may exist outside of namespace {}");
}
}
/* }}} */
-int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier) /* {{{ */
+static void zend_reset_import_tables(TSRMLS_D) /* {{{ */
{
- if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK)
- && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed");
- }
- if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_ABSTRACT)
- && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_ABSTRACT)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed");
+ if (CG(current_import)) {
+ zend_hash_destroy(CG(current_import));
+ efree(CG(current_import));
+ CG(current_import) = NULL;
}
- if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_STATIC)
- && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_STATIC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Multiple static modifiers are not allowed");
+
+ if (CG(current_import_function)) {
+ zend_hash_destroy(CG(current_import_function));
+ efree(CG(current_import_function));
+ CG(current_import_function) = NULL;
}
- if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_FINAL)
- && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_FINAL)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Multiple final modifiers are not allowed");
+
+ if (CG(current_import_const)) {
+ zend_hash_destroy(CG(current_import_const));
+ efree(CG(current_import_const));
+ CG(current_import_const) = NULL;
}
- if (((Z_IVAL(current_access_type->u.constant) | Z_IVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member");
+}
+/* }}} */
+
+static void zend_end_namespace(TSRMLS_D) /* {{{ */ {
+ CG(in_namespace) = 0;
+ zend_reset_import_tables(TSRMLS_C);
+ if (CG(current_namespace)) {
+ zend_string_release(CG(current_namespace));
+ CG(current_namespace) = NULL;
}
- return (Z_IVAL(current_access_type->u.constant) | Z_IVAL(new_modifier->u.constant));
}
/* }}} */
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */
+void zend_do_end_compilation(TSRMLS_D) /* {{{ */
{
- zend_op_array op_array;
- zend_string *name = Z_STR(function_name->u.constant);
- int function_begin_line = function_token->u.op.opline_num;
- zend_uint fn_flags;
- zend_string *lcname;
- zend_bool orig_interactive;
- ALLOCA_FLAG(use_heap)
+ CG(has_bracketed_namespaces) = 0;
+ zend_end_namespace(TSRMLS_C);
+}
+/* }}} */
- if (is_method) {
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- if ((Z_IVAL(fn_flags_znode->u.constant) & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted", CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
- }
- Z_IVAL(fn_flags_znode->u.constant) |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */
+/* {{{ zend_dirname
+ Returns directory name component of path */
+ZEND_API size_t zend_dirname(char *path, size_t len)
+{
+ register char *end = path + len - 1;
+ unsigned int len_adjust = 0;
+
+#ifdef PHP_WIN32
+ /* Note that on Win32 CWD is per drive (heritage from CP/M).
+ * This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
+ */
+ if ((2 <= len) && isalpha((int)((unsigned char *)path)[0]) && (':' == path[1])) {
+ /* Skip over the drive spec (if any) so as not to change */
+ path += 2;
+ len_adjust += 2;
+ if (2 == len) {
+ /* Return "c:" on Win32 for dirname("c:").
+ * It would be more consistent to return "c:."
+ * but that would require making the string *longer*.
+ */
+ return len;
}
- fn_flags = Z_IVAL(fn_flags_znode->u.constant); /* must be done *after* the above check */
- } else {
- fn_flags = 0;
}
- if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error(E_STRICT, "Static function %s%s%s() should not be abstract", is_method ? CG(active_class_entry)->name->val : "", is_method ? "::" : "", Z_STRVAL(function_name->u.constant));
+#elif defined(NETWARE)
+ /*
+ * Find the first occurrence of : from the left
+ * move the path pointer to the position just after :
+ * increment the len_adjust to the length of path till colon character(inclusive)
+ * If there is no character beyond : simple return len
+ */
+ char *colonpos = NULL;
+ colonpos = strchr(path, ':');
+ if (colonpos != NULL) {
+ len_adjust = ((colonpos - path) + 1);
+ path += len_adjust;
+ if (len_adjust == len) {
+ return len;
+ }
}
+#endif
- function_token->u.op_array = CG(active_op_array);
-
- orig_interactive = CG(interactive);
- CG(interactive) = 0;
- init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(interactive) = orig_interactive;
-
- op_array.function_name = name;
- if (return_reference) {
- op_array.fn_flags |= ZEND_ACC_RETURN_REFERENCE;
+ if (len == 0) {
+ /* Illegal use of this function */
+ return 0;
}
- op_array.fn_flags |= fn_flags;
- op_array.scope = is_method?CG(active_class_entry):NULL;
- op_array.prototype = NULL;
-
- op_array.line_start = zend_get_compiled_lineno(TSRMLS_C);
+ /* Strip trailing slashes */
+ while (end >= path && IS_SLASH_P(end)) {
+ end--;
+ }
+ if (end < path) {
+ /* The path only contained slashes */
+ path[0] = DEFAULT_SLASH;
+ path[1] = '\0';
+ return 1 + len_adjust;
+ }
- if (is_method) {
- lcname = STR_ALLOC(name->len, 0);
- zend_str_tolower_copy(lcname->val, name->val, name->len);
- lcname = zend_new_interned_string(lcname TSRMLS_CC);
- CG(active_op_array) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(CG(active_op_array), &op_array, sizeof(zend_op_array));
- if (zend_hash_add_ptr(&CG(active_class_entry)->function_table, lcname, CG(active_op_array)) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name->val, name->val);
+ /* Strip filename */
+ while (end >= path && !IS_SLASH_P(end)) {
+ end--;
+ }
+ if (end < path) {
+ /* No slash found, therefore return '.' */
+#ifdef NETWARE
+ if (len_adjust == 0) {
+ path[0] = '.';
+ path[1] = '\0';
+ return 1; /* only one character */
+ } else {
+ path[0] = '\0';
+ return len_adjust;
}
+#else
+ path[0] = '.';
+ path[1] = '\0';
+ return 1 + len_adjust;
+#endif
+ }
- zend_stack_push(&CG(context_stack), (void *) &CG(context));
- zend_init_compiler_context(TSRMLS_C);
+ /* Strip slashes which came before the file name */
+ while (end >= path && IS_SLASH_P(end)) {
+ end--;
+ }
+ if (end < path) {
+ path[0] = DEFAULT_SLASH;
+ path[1] = '\0';
+ return 1 + len_adjust;
+ }
+ *(end+1) = '\0';
- if (fn_flags & ZEND_ACC_ABSTRACT) {
- CG(active_class_entry)->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
- }
+ return (size_t)(end + 1 - path) + len_adjust;
+}
+/* }}} */
- if (!(fn_flags & ZEND_ACC_PPP_MASK)) {
- fn_flags |= ZEND_ACC_PUBLIC;
- }
+static inline zend_bool zend_string_equals_str_ci(zend_string *str1, zend_string *str2) /* {{{ */
+{
+ return str1->len == str2->len
+ && !zend_binary_strcasecmp(str1->val, str1->len, str2->val, str2->len);
+}
+/* }}} */
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- if ((name->len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __call() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
- if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) {
- zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static");
- }
- } else if ((name->len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __get() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __set() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __unset() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __isset() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __toString() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
- }
+static void zend_adjust_for_fetch_type(zend_op *opline, uint32_t type) /* {{{ */
+{
+ switch (type & BP_VAR_MASK) {
+ case BP_VAR_R:
+ return;
+ case BP_VAR_W:
+ opline->opcode += 3;
+ return;
+ case BP_VAR_REF:
+ opline->opcode += 3;
+ opline->extended_value |= ZEND_FETCH_MAKE_REF;
+ return;
+ case BP_VAR_RW:
+ opline->opcode += 6;
+ return;
+ case BP_VAR_IS:
+ opline->opcode += 9;
+ return;
+ case BP_VAR_FUNC_ARG:
+ opline->opcode += 12;
+ opline->extended_value |= type >> BP_VAR_SHIFT;
+ return;
+ case BP_VAR_UNSET:
+ opline->opcode += 15;
+ return;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+}
+/* }}} */
- } else if ((name->len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have public visibility and cannot be static");
- }
- }
- } else {
- char *class_lcname;
+static inline void zend_make_var_result(znode *result, zend_op *opline TSRMLS_DC) /* {{{ */
+{
+ opline->result_type = IS_VAR;
+ opline->result.var = get_temporary_variable(CG(active_op_array));
+ GET_NODE(result, opline->result);
+}
+/* }}} */
- class_lcname = do_alloca(CG(active_class_entry)->name->len + 1, use_heap);
- zend_str_tolower_copy(class_lcname, CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
- /* Improve after RC: cache the lowercase class name */
+static inline void zend_make_tmp_result(znode *result, zend_op *opline TSRMLS_DC) /* {{{ */
+{
+ opline->result_type = IS_TMP_VAR;
+ opline->result.var = get_temporary_variable(CG(active_op_array));
+ GET_NODE(result, opline->result);
+}
+/* }}} */
- if ((CG(active_class_entry)->name->len == name->len) && ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) && (!memcmp(class_lcname, lcname->val, name->len))) {
- if (!CG(active_class_entry)->constructor) {
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- }
- } else if ((name->len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1))) {
- if (CG(active_class_entry)->constructor) {
- zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name->val);
- }
- CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1))) {
- CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1))) {
- CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __call() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
- if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) {
- zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static");
- }
- CG(active_class_entry)->__callstatic = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __get() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __set() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __unset() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__unset = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __isset() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__isset = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __toString() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__tostring = (zend_function *) CG(active_op_array);
- } else if ((name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
- }
- } else if ((name->len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1))) {
- if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have public visibility and cannot be static");
- }
- CG(active_class_entry)->__debugInfo = (zend_function *) CG(active_op_array);
- } else if (!(fn_flags & ZEND_ACC_STATIC)) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
- }
- free_alloca(class_lcname, use_heap);
- }
+static zend_op *zend_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+{
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = opcode;
- STR_RELEASE(lcname);
+ if (op1 == NULL) {
+ SET_UNUSED(opline->op1);
} else {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zval key;
- zval *ns_name;
-
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix function name with current namespace name */
- znode tmp;
-
- ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
- zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC);
- op_array.function_name = Z_STR(tmp.u.constant);
- lcname = STR_ALLOC(Z_STRSIZE(tmp.u.constant), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(tmp.u.constant), Z_STRSIZE(tmp.u.constant));
- } else {
- lcname = STR_ALLOC(name->len, 0);
- zend_str_tolower_copy(lcname->val, name->val, name->len);
- }
-
- /* Function name must not conflict with import names */
- if (CG(current_import_function) &&
- (ns_name = zend_hash_find(CG(current_import_function), lcname)) != NULL) {
-
- char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name));
+ SET_NODE(opline->op1, op1);
+ }
- if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(function_name->u.constant) ||
- memcmp(tmp, lcname->val, Z_STRSIZE(function_name->u.constant))) {
- zend_error(E_COMPILE_ERROR, "Cannot declare function %s because the name is already in use", Z_STRVAL(function_name->u.constant));
- }
- efree(tmp);
- }
+ if (op2 == NULL) {
+ SET_UNUSED(opline->op2);
+ } else {
+ SET_NODE(opline->op2, op2);
+ }
- opline->opcode = ZEND_DECLARE_FUNCTION;
- opline->op1_type = IS_CONST;
- build_runtime_defined_function_key(&key, lcname->val, lcname->len TSRMLS_CC);
- opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC);
- opline->op2_type = IS_CONST;
- LITERAL_STR(opline->op2, STR_COPY(lcname));
- opline->extended_value = ZEND_DECLARE_FUNCTION;
- CG(active_op_array) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(CG(active_op_array), &op_array, sizeof(zend_op_array));
- zend_hash_update_ptr(CG(function_table), Z_STR(key), CG(active_op_array));
- zend_stack_push(&CG(context_stack), (void *) &CG(context));
- zend_init_compiler_context(TSRMLS_C);
- STR_RELEASE(lcname);
+ if (result) {
+ zend_make_var_result(result, opline TSRMLS_CC);
}
+ return opline;
+}
+/* }}} */
- if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+static zend_op *zend_emit_op_tmp(znode *result, zend_uchar opcode, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+{
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = opcode;
- opline->opcode = ZEND_EXT_NOP;
- opline->lineno = function_begin_line;
+ if (op1 == NULL) {
SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ } else {
+ SET_NODE(opline->op1, op1);
}
- {
- /* Push a separator to the switch stack */
- zend_switch_entry switch_entry;
-
- switch_entry.cond.op_type = IS_UNUSED;
- switch_entry.default_case = 0;
- switch_entry.control_var = 0;
+ if (op2 == NULL) {
+ SET_UNUSED(opline->op2);
+ } else {
+ SET_NODE(opline->op2, op2);
+ }
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry);
+ if (result) {
+ zend_make_tmp_result(result, opline TSRMLS_CC);
}
- {
- /* Push a separator to the foreach stack */
- zend_op dummy_opline;
+ return opline;
+}
+/* }}} */
- dummy_opline.result_type = IS_UNUSED;
+static void zend_emit_tick(TSRMLS_D) /* {{{ */
+{
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline);
- }
+ opline->opcode = ZEND_TICKS;
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ opline->extended_value = Z_LVAL(CG(declarables).ticks);
+}
+/* }}} */
- if (CG(doc_comment)) {
- CG(active_op_array)->doc_comment = CG(doc_comment);
- CG(doc_comment) = NULL;
- }
+static inline zend_op *zend_emit_op_data(znode *value TSRMLS_DC) /* {{{ */
+{
+ return zend_emit_op(NULL, ZEND_OP_DATA, value, NULL TSRMLS_CC);
}
/* }}} */
-void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC) /* {{{ */
+static inline uint32_t zend_emit_jump(uint32_t opnum_target TSRMLS_DC) /* {{{ */
{
- znode function_name;
- zend_op_array *current_op_array = CG(active_op_array);
- int current_op_number = get_next_op_number(CG(active_op_array));
- zend_op *current_op;
+ uint32_t opnum = get_next_op_number(CG(active_op_array));
+ zend_op *opline = zend_emit_op(NULL, ZEND_JMP, NULL, NULL TSRMLS_CC);
+ opline->op1.opline_num = opnum_target;
+ return opnum;
+}
+/* }}} */
- function_name.op_type = IS_CONST;
- ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1);
+static inline uint32_t zend_emit_cond_jump(zend_uchar opcode, znode *cond, uint32_t opnum_target TSRMLS_DC) /* {{{ */
+{
+ uint32_t opnum = get_next_op_number(CG(active_op_array));
+ zend_op *opline = zend_emit_op(NULL, opcode, cond, NULL TSRMLS_CC);
+ opline->op2.opline_num = opnum_target;
+ return opnum;
+}
+/* }}} */
- zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC);
+static inline void zend_update_jump_target(uint32_t opnum_jump, uint32_t opnum_target TSRMLS_DC) /* {{{ */
+{
+ zend_op *opline = &CG(active_op_array)->opcodes[opnum_jump];
+ switch (opline->opcode) {
+ case ZEND_JMP:
+ opline->op1.opline_num = opnum_target;
+ break;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ opline->op2.opline_num = opnum_target;
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+}
+/* }}} */
- result->op_type = IS_TMP_VAR;
- result->u.op.var = get_temporary_variable(current_op_array);
+static inline void zend_update_jump_target_to_next(uint32_t opnum_jump TSRMLS_DC) /* {{{ */
+{
+ zend_update_jump_target(opnum_jump, get_next_op_number(CG(active_op_array)) TSRMLS_CC);
+}
+/* }}} */
- current_op = &current_op_array->opcodes[current_op_number];
- current_op->opcode = ZEND_DECLARE_LAMBDA_FUNCTION;
- zend_del_literal(current_op_array, current_op->op2.constant);
- SET_UNUSED(current_op->op2);
- SET_NODE(current_op->result, result);
- if (is_static) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
+static inline zend_op *zend_delayed_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2 TSRMLS_DC) /* {{{ */
+{
+ zend_op tmp_opline;
+ init_op(&tmp_opline TSRMLS_CC);
+ tmp_opline.opcode = opcode;
+ SET_NODE(tmp_opline.op1, op1);
+ SET_NODE(tmp_opline.op2, op2);
+ if (result) {
+ zend_make_var_result(result, &tmp_opline TSRMLS_CC);
}
- CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE;
+
+ zend_stack_push(&CG(delayed_oplines_stack), &tmp_opline);
+ return zend_stack_top(&CG(delayed_oplines_stack));
}
/* }}} */
-void zend_do_handle_exception(TSRMLS_D) /* {{{ */
+static inline uint32_t zend_delayed_compile_begin(TSRMLS_D) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_HANDLE_EXCEPTION;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ return zend_stack_count(&CG(delayed_oplines_stack));
}
/* }}} */
-void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* {{{ */
+static zend_op *zend_delayed_compile_end(uint32_t offset TSRMLS_DC) /* {{{ */
{
- char lcname[16];
- int name_len;
+ zend_op *opline, *oplines = zend_stack_base(&CG(delayed_oplines_stack));
+ uint32_t i, count = zend_stack_count(&CG(delayed_oplines_stack));
- zend_do_extended_info(TSRMLS_C);
- zend_do_return(NULL, 0 TSRMLS_CC);
+ ZEND_ASSERT(count > offset);
+ for (i = offset; i < count; ++i) {
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ memcpy(opline, &oplines[i], sizeof(zend_op));
+ }
+ CG(delayed_oplines_stack).top = offset;
+ return opline;
+}
+/* }}} */
- pass_two(CG(active_op_array) TSRMLS_CC);
- zend_release_labels(0 TSRMLS_CC);
+void zend_emit_final_return(zval *zv TSRMLS_DC) /* {{{ */
+{
+ znode zn;
+ zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
- if (CG(active_class_entry)) {
- zend_check_magic_method_implementation(CG(active_class_entry), (zend_function*)CG(active_op_array), E_COMPILE_ERROR TSRMLS_CC);
+ zn.op_type = IS_CONST;
+ if (zv) {
+ ZVAL_COPY_VALUE(&zn.u.constant, zv);
} else {
- /* we don't care if the function name is longer, in fact lowercasing only
- * the beginning of the name speeds up the check process */
- name_len = CG(active_op_array)->function_name->len;
- zend_str_tolower_copy(lcname, CG(active_op_array)->function_name->val, MIN(name_len, sizeof(lcname)-1));
- lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
- if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
- }
+ ZVAL_NULL(&zn.u.constant);
}
- CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C);
- CG(active_op_array) = function_token->u.op_array;
+ zend_emit_op(NULL, returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN, &zn, NULL TSRMLS_CC);
+}
+/* }}} */
+static inline zend_bool zend_is_variable(zend_ast *ast) /* {{{ */
+{
+ return ast->kind == ZEND_AST_VAR || ast->kind == ZEND_AST_DIM
+ || ast->kind == ZEND_AST_PROP || ast->kind == ZEND_AST_STATIC_PROP
+ || ast->kind == ZEND_AST_CALL || ast->kind == ZEND_AST_METHOD_CALL
+ || ast->kind == ZEND_AST_STATIC_CALL;
+}
+/* }}} */
- /* Pop the switch and foreach separators */
- zend_stack_del_top(&CG(switch_cond_stack));
- zend_stack_del_top(&CG(foreach_copy_stack));
+static inline zend_bool zend_is_call(zend_ast *ast) /* {{{ */
+{
+ return ast->kind == ZEND_AST_CALL
+ || ast->kind == ZEND_AST_METHOD_CALL
+ || ast->kind == ZEND_AST_STATIC_CALL;
}
/* }}} */
-void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, znode *class_type, zend_uchar pass_by_reference, zend_bool is_variadic TSRMLS_DC) /* {{{ */
+static inline zend_bool zend_is_unticked_stmt(zend_ast *ast) /* {{{ */
{
- zend_op *opline;
- zend_arg_info *cur_arg_info;
- znode var;
+ return ast->kind == ZEND_AST_STMT_LIST || ast->kind == ZEND_AST_LABEL;
+}
+/* }}} */
- if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant));
- } else {
- var.op_type = IS_CV;
- var.u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
- Z_STR(varname->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(var.u.op.var)];
- var.EA = 0;
- if (EX_VAR_TO_NUM(var.u.op.var) != CG(active_op_array)->num_args) {
- zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s", Z_STRVAL(varname->u.constant));
- } else if (Z_STRHASH(varname->u.constant) == THIS_HASHVAL &&
- Z_STRSIZE(varname->u.constant) == sizeof("this")-1 &&
- !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) {
- if (CG(active_op_array)->scope &&
- (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- CG(active_op_array)->this_var = var.u.op.var;
- }
+static inline zend_bool zend_can_write_to_variable(zend_ast *ast) /* {{{ */
+{
+ while (ast->kind == ZEND_AST_DIM || ast->kind == ZEND_AST_PROP) {
+ ast = ast->child[0];
}
- if (CG(active_op_array)->fn_flags & ZEND_ACC_VARIADIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Only the last parameter can be variadic");
- }
+ return zend_is_variable(ast);
+}
+/* }}} */
- if (is_variadic) {
- if (op == ZEND_RECV_INIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Variadic parameter cannot have a default value");
- }
+static inline zend_bool zend_is_const_default_class_ref(zend_ast *name_ast) /* {{{ */
+{
+ zend_string *name;
- op = ZEND_RECV_VARIADIC;
- CG(active_op_array)->fn_flags |= ZEND_ACC_VARIADIC;
+ if (name_ast->kind != ZEND_AST_ZVAL) {
+ return 0;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- CG(active_op_array)->num_args++;
- opline->opcode = op;
- SET_NODE(opline->result, &var);
- opline->op1_type = IS_UNUSED;
- opline->op1.num = CG(active_op_array)->num_args;
- if (op == ZEND_RECV_INIT) {
- SET_NODE(opline->op2, initialization);
- } else {
- SET_UNUSED(opline->op2);
- if (!is_variadic) {
- CG(active_op_array)->required_num_args = CG(active_op_array)->num_args;
- }
- }
- CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
- cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
- cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRSIZE(varname->u.constant));
- cur_arg_info->name_len = Z_STRSIZE(varname->u.constant);
- cur_arg_info->type_hint = 0;
- cur_arg_info->pass_by_reference = pass_by_reference;
- cur_arg_info->allow_null = 1;
- cur_arg_info->is_variadic = is_variadic;
- cur_arg_info->class_name = NULL;
- cur_arg_info->class_name_len = 0;
-
- if (class_type->op_type != IS_UNUSED) {
- cur_arg_info->allow_null = 0;
-
- if (Z_TYPE(class_type->u.constant) != IS_NULL) {
- if (Z_TYPE(class_type->u.constant) == IS_ARRAY) {
- cur_arg_info->type_hint = IS_ARRAY;
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
- }
- }
- } else if (Z_TYPE(class_type->u.constant) == IS_CALLABLE) {
- cur_arg_info->type_hint = IS_CALLABLE;
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
- }
- }
- } else {
- cur_arg_info->type_hint = IS_OBJECT;
- if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant))) {
- zend_resolve_class_name(class_type TSRMLS_CC);
- }
- Z_STR(class_type->u.constant) = zend_new_interned_string(Z_STR(class_type->u.constant) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(class_type->u.constant))) {
- Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
- }
-// TODO: for now we have to copy it ???
-#if 1
- cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant));
- cur_arg_info->class_name_len = Z_STRSIZE(class_type->u.constant);
- STR_RELEASE(Z_STR(class_type->u.constant));
-#else
- cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
- cur_arg_info->class_name_len = Z_STRSIZE(class_type->u.constant);
-#endif
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
- }
- }
- }
+ /* Fully qualified names are always default refs */
+ if (!name_ast->attr) {
+ return 1;
+ }
+
+ name = zend_ast_get_str(name_ast);
+ return ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(name);
+}
+/* }}} */
+
+static inline void zend_handle_numeric_op(znode *node TSRMLS_DC) /* {{{ */
+{
+ if (node->op_type == IS_CONST && Z_TYPE(node->u.constant) == IS_STRING) {
+ zend_ulong index;
+
+ if (ZEND_HANDLE_NUMERIC(Z_STR(node->u.constant), index)) {
+ zval_ptr_dtor(&node->u.constant);
+ ZVAL_LONG(&node->u.constant, index);
}
}
+}
+/* }}} */
- if (cur_arg_info->class_name || cur_arg_info->type_hint) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
+static inline void zend_set_class_name_op1(zend_op *opline, znode *class_node TSRMLS_DC) /* {{{ */
+{
+ if (class_node->op_type == IS_CONST) {
+ opline->op1_type = IS_CONST;
+ opline->op1.constant = zend_add_class_name_literal(
+ CG(active_op_array), Z_STR(class_node->u.constant) TSRMLS_CC);
+ } else {
+ SET_NODE(opline->op1, class_node);
}
}
/* }}} */
-int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC) /* {{{ */
+static zend_op *zend_compile_class_ref(znode *result, zend_ast *name_ast TSRMLS_DC) /* {{{ */
{
zend_op *opline;
- zend_uint op_number;
- zend_function *function;
- zend_string *lcname;
- char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRSIZE(function_name->u.constant));
+ znode name_node;
+ zend_compile_expr(&name_node, name_ast TSRMLS_CC);
- zend_resolve_function_name(function_name, &check_namespace TSRMLS_CC);
+ if (name_node.op_type == IS_CONST) {
+ zend_string *name = Z_STR(name_node.u.constant);
+ uint32_t fetch_type = zend_get_class_fetch_type(name);
- if (check_namespace && Z_TYPE(CG(current_namespace)) != IS_UNDEF && !is_compound) {
- /* We assume we call function from the current namespace
- if it is not prefixed. */
+ opline = zend_emit_op(result, ZEND_FETCH_CLASS, NULL, NULL TSRMLS_CC);
+ opline->extended_value = fetch_type;
- /* In run-time PHP will check for function with full name and
- internal function with short name */
- zend_do_begin_dynamic_function_call(function_name, 1 TSRMLS_CC);
- return 1;
+ if (fetch_type == ZEND_FETCH_CLASS_DEFAULT) {
+ uint32_t type = name_ast->kind == ZEND_AST_ZVAL ? name_ast->attr : ZEND_NAME_FQ;
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_class_name_literal(CG(active_op_array),
+ zend_resolve_class_name(name, type TSRMLS_CC) TSRMLS_CC);
+ }
+
+ zend_string_release(name);
+ } else {
+ opline = zend_emit_op(result, ZEND_FETCH_CLASS, NULL, &name_node TSRMLS_CC);
+ opline->extended_value = ZEND_FETCH_CLASS_DEFAULT;
}
- lcname = STR_ALLOC(Z_STRSIZE(function_name->u.constant), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(function_name->u.constant), Z_STRSIZE(function_name->u.constant));
- if (((function = zend_hash_find_ptr(CG(function_table), lcname)) == NULL) ||
- ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) &&
- (function->type == ZEND_INTERNAL_FUNCTION))) {
- zend_do_begin_dynamic_function_call(function_name, 0 TSRMLS_CC);
- efree(lcname);
- return 1; /* Dynamic */
- }
- STR_RELEASE(Z_STR(function_name->u.constant));
- Z_STR(function_name->u.constant) = lcname;
+ return opline;
+}
+/* }}} */
- op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_FCALL;
- SET_UNUSED(opline->op1);
- SET_NODE(opline->op2, function_name);
- GET_CACHE_SLOT(opline->op2.constant);
+static int zend_try_compile_cv(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ zend_ast *name_ast = ast->child[0];
+ if (name_ast->kind == ZEND_AST_ZVAL) {
+ zend_string *name = zval_get_string(zend_ast_get_zval(name_ast));
- zend_push_function_call_entry(function, op_number TSRMLS_CC);
- zend_do_extended_fcall_begin(TSRMLS_C);
- return 0;
+ if (zend_is_auto_global(name TSRMLS_CC)) {
+ zend_string_release(name);
+ return FAILURE;
+ }
+
+ result->op_type = IS_CV;
+ result->u.op.var = lookup_cv(CG(active_op_array), name TSRMLS_CC);
+
+ if (zend_string_equals_literal(name, "this")) {
+ CG(active_op_array)->this_var = result->u.op.var;
+ }
+ return SUCCESS;
+ }
+
+ return FAILURE;
}
/* }}} */
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
+static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_op *last_op;
- int last_op_number;
+ zend_ast *name_ast = ast->child[0];
+ znode name_node;
+ zend_op *opline;
- zend_do_end_variable_parse(left_bracket, BP_VAR_R, 0 TSRMLS_CC);
- zend_do_begin_variable_parse(TSRMLS_C);
+ /* there is a chance someone is accessing $this */
+ if (ast->kind != ZEND_AST_ZVAL
+ && CG(active_op_array)->scope && CG(active_op_array)->this_var == -1
+ ) {
+ zend_string *key = zend_string_init("this", sizeof("this") - 1, 0);
+ CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC);
+ }
- last_op_number = get_next_op_number(CG(active_op_array))-1;
- last_op = &CG(active_op_array)->opcodes[last_op_number];
+ zend_compile_expr(&name_node, name_ast TSRMLS_CC);
- if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRSIZE(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1)
- && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRSIZE(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead");
- }
+ opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL TSRMLS_CC);
- if (last_op->opcode == ZEND_FETCH_OBJ_R) {
- if (last_op->op2_type == IS_CONST) {
- zval name;
- name = CONSTANT(last_op->op2.constant);
- if (Z_TYPE(name) != IS_STRING) {
- zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string");
- }
- Z_STR(name) = STR_COPY(Z_STR(name));
- FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant);
- last_op->op2.constant =
- zend_add_func_name_literal(CG(active_op_array), &name TSRMLS_CC);
- GET_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant);
- }
- last_op->opcode = ZEND_INIT_METHOD_CALL;
- last_op->result_type = IS_UNUSED;
- Z_IVAL(left_bracket->u.constant) = ZEND_INIT_FCALL_BY_NAME;
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- SET_UNUSED(opline->op1);
- if (left_bracket->op_type == IS_CONST) {
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_func_name_literal(CG(active_op_array), &left_bracket->u.constant TSRMLS_CC);
- GET_CACHE_SLOT(opline->op2.constant);
- } else {
- SET_NODE(opline->op2, left_bracket);
+ opline->extended_value = ZEND_FETCH_LOCAL;
+ if (name_node.op_type == IS_CONST) {
+ if (zend_is_auto_global(Z_STR(name_node.u.constant) TSRMLS_CC)) {
+ opline->extended_value = ZEND_FETCH_GLOBAL;
}
}
- zend_push_function_call_entry(NULL, last_op_number TSRMLS_CC);
- zend_do_extended_fcall_begin(TSRMLS_C);
+ return opline;
}
/* }}} */
-void zend_do_clone(znode *result, znode *expr TSRMLS_DC) /* {{{ */
+static void zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_CLONE;
- SET_NODE(opline->op1, expr);
- SET_UNUSED(opline->op2);
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
+ if (zend_try_compile_cv(result, ast TSRMLS_CC) == FAILURE) {
+ zend_op *opline = zend_compile_simple_var_no_cv(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
+ }
}
/* }}} */
-void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRMLS_DC) /* {{{ */
+static void zend_separate_if_call_and_write(znode *node, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_uint op_number;
- zend_op *opline;
-
- op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (ns_call) {
- /* In run-time PHP will check for function with full name and
- internal function with short name */
- opline->opcode = ZEND_INIT_NS_FCALL_BY_NAME;
- SET_UNUSED(opline->op1);
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_ns_func_name_literal(CG(active_op_array), &function_name->u.constant TSRMLS_CC);
- GET_CACHE_SLOT(opline->op2.constant);
- } else {
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- SET_UNUSED(opline->op1);
- if (function_name->op_type == IS_CONST) {
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_func_name_literal(CG(active_op_array), &function_name->u.constant TSRMLS_CC);
- GET_CACHE_SLOT(opline->op2.constant);
+ if (type != BP_VAR_R && type != BP_VAR_IS && zend_is_call(ast)) {
+ if (node->op_type == IS_VAR) {
+ zend_op *opline = zend_emit_op(NULL, ZEND_SEPARATE, node, NULL TSRMLS_CC);
+ opline->result_type = IS_VAR;
+ opline->result.var = opline->op1.var;
} else {
- SET_NODE(opline->op2, function_name);
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use result of built-in function in write context");
}
}
+}
+/* }}} */
- zend_push_function_call_entry(NULL, op_number TSRMLS_CC);
- zend_do_extended_fcall_begin(TSRMLS_C);
+void zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC);
+void zend_compile_assign(znode *result, zend_ast *ast TSRMLS_DC);
+static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_node TSRMLS_DC);
+
+static inline void zend_emit_assign_znode(zend_ast *var_ast, znode *value_node TSRMLS_DC) /* {{{ */
+{
+ znode dummy_node;
+ if (var_ast->kind == ZEND_AST_LIST) {
+ zend_compile_list_assign(&dummy_node, var_ast, value_node TSRMLS_CC);
+ } else {
+ zend_ast *assign_ast = zend_ast_create(ZEND_AST_ASSIGN, var_ast,
+ zend_ast_create_znode(value_node));
+ zend_compile_assign(&dummy_node, assign_ast TSRMLS_CC);
+ }
+ zend_do_free(&dummy_node TSRMLS_CC);
}
/* }}} */
-void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace, zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC) /* {{{ */
+static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- znode tmp;
- int len;
- zval *ns;
- zend_string *lookup_name;
- char *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRSIZE(element_name->u.constant));
+ zend_ast *var_ast = ast->child[0];
+ zend_ast *dim_ast = ast->child[1];
- if (Z_STRVAL(element_name->u.constant)[0] == '\\') {
- /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */
- memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRSIZE(element_name->u.constant));
- --Z_STRSIZE(element_name->u.constant);
- return;
- }
+ znode var_node, dim_node;
- if(!*check_namespace) {
- return;
- }
+ zend_delayed_compile_var(&var_node, var_ast, type TSRMLS_CC);
+ zend_separate_if_call_and_write(&var_node, var_ast, type TSRMLS_CC);
- if (current_import_sub) {
- len = Z_STRSIZE(element_name->u.constant);
- if (case_sensitive) {
- lookup_name = STR_INIT(Z_STRVAL(element_name->u.constant), len, 0);
- } else {
- lookup_name = STR_ALLOC(len, 0);
- zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len);
- }
- /* Check if function/const matches imported name */
- if ((ns = zend_hash_find(current_import_sub, lookup_name)) != NULL) {
- zval_dtor(&element_name->u.constant);
- ZVAL_DUP(&element_name->u.constant, ns);
- STR_FREE(lookup_name);
- *check_namespace = 0;
- return;
+ if (dim_ast == NULL) {
+ if (type == BP_VAR_R || type == BP_VAR_IS) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
}
- STR_FREE(lookup_name);
- }
-
- if (compound && CG(current_import)) {
- len = compound - Z_STRVAL(element_name->u.constant);
- /* namespace is always lowercase */
- lookup_name = STR_ALLOC(len, 0);
- zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len);
- /* Check if first part of compound name is an import name */
- if ((ns = zend_hash_find(CG(current_import), lookup_name)) != NULL) {
- /* Substitute import name */
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, ns);
- len += 1;
- Z_STRSIZE(element_name->u.constant) -= len;
- memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRSIZE(element_name->u.constant)+1);
- zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC);
- *element_name = tmp;
- STR_FREE(lookup_name);
- *check_namespace = 0;
- return;
+ if (type == BP_VAR_UNSET) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for unsetting");
}
- STR_FREE(lookup_name);
+ dim_node.op_type = IS_UNUSED;
+ } else {
+ zend_compile_expr(&dim_node, dim_ast TSRMLS_CC);
+ zend_handle_numeric_op(&dim_node TSRMLS_CC);
}
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- tmp = *element_name;
- Z_STR(tmp.u.constant) = STR_ALLOC(sizeof("\\")-1 + Z_STRSIZE(element_name->u.constant) + Z_STRSIZE(CG(current_namespace)), 0);
- Z_TYPE_FLAGS(tmp.u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
- memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace)));
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE(CG(current_namespace))]), "\\", sizeof("\\")-1);
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRSIZE(element_name->u.constant)+1);
- STR_RELEASE(Z_STR(element_name->u.constant));
- *element_name = tmp;
- }
+ return zend_delayed_emit_op(result, ZEND_FETCH_DIM_R, &var_node, &dim_node TSRMLS_CC);
}
/* }}} */
-void zend_resolve_function_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC) /* {{{ */
+static inline zend_op *zend_compile_dim_common(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_resolve_non_class_name(element_name, check_namespace, 0, CG(current_import_function) TSRMLS_CC);
+ uint32_t offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_dim(result, ast, type TSRMLS_CC);
+ return zend_delayed_compile_end(offset TSRMLS_CC);
}
/* }}} */
-void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC) /* {{{ */
+void zend_compile_dim(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_resolve_non_class_name(element_name, check_namespace, 1, CG(current_import_const) TSRMLS_CC);
+ zend_op *opline = zend_compile_dim_common(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
}
/* }}} */
-void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC) /* {{{ */
+static zend_bool is_this_fetch(zend_ast *ast) /* {{{ */
{
- char *lcname;
- int lctype;
- znode constant_name;
-
- lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant));
- lctype = zend_get_class_fetch_type(lcname, strlen(lcname));
- switch (lctype) {
- case ZEND_FETCH_CLASS_SELF:
- if (!CG(active_class_entry)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active");
- }
- zval_dtor(&class_name->u.constant);
- class_name->op_type = IS_CONST;
- ZVAL_STR(&class_name->u.constant, STR_COPY(CG(active_class_entry)->name));
- *result = *class_name;
- break;
- case ZEND_FETCH_CLASS_STATIC:
- case ZEND_FETCH_CLASS_PARENT:
- if (is_static) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "%s::class cannot be used for compile-time class name resolution",
- lctype == ZEND_FETCH_CLASS_STATIC ? "static" : "parent"
- );
- }
- if (!CG(active_class_entry)) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot access %s::class when no class scope is active",
- lctype == ZEND_FETCH_CLASS_STATIC ? "static" : "parent"
- );
- }
- constant_name.op_type = IS_CONST;
- ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1);
- zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC);
- break;
- case ZEND_FETCH_CLASS_DEFAULT:
- zend_resolve_class_name(class_name TSRMLS_CC);
- *result = *class_name;
- break;
+ if (ast->kind == ZEND_AST_VAR && ast->child[0]->kind == ZEND_AST_ZVAL) {
+ zval *name = zend_ast_get_zval(ast->child[0]);
+ return Z_TYPE_P(name) == IS_STRING && zend_string_equals_literal(Z_STR_P(name), "this");
}
- efree(lcname);
-
+ return 0;
}
/* }}} */
-void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
+static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- char *compound;
- zend_string *lcname;
- zval *ns;
- znode tmp;
- int len;
+ zend_ast *obj_ast = ast->child[0];
+ zend_ast *prop_ast = ast->child[1];
- compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRSIZE(class_name->u.constant));
- if (compound) {
- /* This is a compound class name that contains namespace prefix */
- if (Z_STRVAL(class_name->u.constant)[0] == '\\') {
- /* The STRING name has "\" prefix */
- memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRSIZE(class_name->u.constant));
- Z_STR(class_name->u.constant) = STR_REALLOC(
- Z_STR(class_name->u.constant),
- Z_STRSIZE(class_name->u.constant) - 1, 0);
- Z_TYPE_FLAGS(class_name->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
-
- if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) {
- zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant));
- }
- } else {
- if (CG(current_import)) {
- len = compound - Z_STRVAL(class_name->u.constant);
- lcname = STR_ALLOC(len, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), len);
- /* Check if first part of compound name is an import name */
- if ((ns = zend_hash_find(CG(current_import), lcname)) != NULL) {
- /* Substitute import name */
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, ns);
- len += 1;
- Z_STRSIZE(class_name->u.constant) -= len;
- memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRSIZE(class_name->u.constant)+1);
- zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
- *class_name = tmp;
- STR_FREE(lcname);
- return;
- }
- STR_FREE(lcname);
- }
- /* Here name is not prefixed with \ and not imported */
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
- zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
- *class_name = tmp;
- }
- }
- } else if (CG(current_import) || Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* this is a plain name (without \) */
- lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant));
+ znode obj_node, prop_node;
+ zend_op *opline;
- if (CG(current_import) &&
- (ns = zend_hash_find(CG(current_import), lcname)) != NULL) {
- /* The given name is an import name. Substitute it. */
- zval_dtor(&class_name->u.constant);
- ZVAL_DUP(&class_name->u.constant, ns);
- } else if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* plain name, no import - prepend current namespace to it */
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
- zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
- *class_name = tmp;
- }
- STR_FREE(lcname);
+ if (is_this_fetch(obj_ast)) {
+ obj_node.op_type = IS_UNUSED;
+ } else {
+ zend_delayed_compile_var(&obj_node, obj_ast, type TSRMLS_CC);
+ zend_separate_if_call_and_write(&obj_node, obj_ast, type TSRMLS_CC);
+ }
+ zend_compile_expr(&prop_node, prop_ast TSRMLS_CC);
+
+ opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node TSRMLS_CC);
+ if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
+ zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
}
+
+ return opline;
}
/* }}} */
-void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */
+static zend_op *zend_compile_prop_common(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_int_t fetch_class_op_number;
- zend_op *opline;
-
- fetch_class_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_FETCH_CLASS;
- SET_UNUSED(opline->op1);
- opline->extended_value = ZEND_FETCH_CLASS_DEFAULT;
- CG(catch_begin) = fetch_class_op_number;
- if (class_name->op_type == IS_CONST) {
- int fetch_type;
-
- fetch_type = zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant));
- switch (fetch_type) {
- case ZEND_FETCH_CLASS_SELF:
- case ZEND_FETCH_CLASS_PARENT:
- case ZEND_FETCH_CLASS_STATIC:
- SET_UNUSED(opline->op2);
- opline->extended_value = fetch_type;
- zval_dtor(&class_name->u.constant);
- break;
- default:
- zend_resolve_class_name(class_name TSRMLS_CC);
- opline->op2_type = IS_CONST;
- opline->op2.constant =
- zend_add_class_name_literal(CG(active_op_array), &class_name->u.constant TSRMLS_CC);
- break;
- }
- } else {
- SET_NODE(opline->op2, class_name);
- }
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_VAR; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
- GET_NODE(result, opline->result);
- result->EA = opline->extended_value;
+ uint32_t offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_prop(result, ast, type TSRMLS_CC);
+ return zend_delayed_compile_end(offset TSRMLS_CC);
}
/* }}} */
-static void ptr_dtor(zval *zv) /* {{{ */
+void zend_compile_prop(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- efree(Z_PTR_P(zv));
+ zend_op *opline = zend_compile_prop_common(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
}
/* }}} */
-void zend_do_label(znode *label TSRMLS_DC) /* {{{ */
+zend_op *zend_compile_static_prop_common(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_label dest;
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *prop_ast = ast->child[1];
- if (!CG(context).labels) {
- ALLOC_HASHTABLE(CG(context).labels);
- zend_hash_init(CG(context).labels, 8, NULL, ptr_dtor, 0);
+ znode class_node, prop_node;
+ zend_op *opline;
+
+ if (zend_is_const_default_class_ref(class_ast)) {
+ class_node.op_type = IS_CONST;
+ ZVAL_STR(&class_node.u.constant, zend_resolve_class_name_ast(class_ast TSRMLS_CC));
+ } else {
+ zend_compile_class_ref(&class_node, class_ast TSRMLS_CC);
}
- dest.brk_cont = CG(context).current_brk_cont;
- dest.opline_num = get_next_op_number(CG(active_op_array));
+ zend_compile_expr(&prop_node, prop_ast TSRMLS_CC);
- if (zend_hash_add_mem(CG(context).labels, Z_STR(label->u.constant), &dest, sizeof(zend_label)) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant));
+ opline = zend_emit_op(result, ZEND_FETCH_R, &prop_node, NULL TSRMLS_CC);
+ if (opline->op1_type == IS_CONST) {
+ zend_alloc_polymorphic_cache_slot(opline->op1.constant TSRMLS_CC);
}
+ if (class_node.op_type == IS_CONST) {
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_class_name_literal(
+ CG(active_op_array), Z_STR(class_node.u.constant) TSRMLS_CC);
+ } else {
+ SET_NODE(opline->op2, &class_node);
+ }
+ opline->extended_value |= ZEND_FETCH_STATIC_MEMBER;
- /* Done with label now */
- zval_dtor(&label->u.constant);
+ return opline;
}
/* }}} */
-void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC) /* {{{ */
+void zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_label *dest;
- zend_int_t current, distance;
- zval *label;
+ zend_op *opline = zend_compile_static_prop_common(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
+}
+/* }}} */
- if (pass2) {
- label = opline->op2.zv;
- } else {
- label = &CONSTANT_EX(op_array, opline->op2.constant);
- }
- if (CG(context).labels == NULL ||
- (dest = zend_hash_find_ptr(CG(context).labels, Z_STR_P(label))) == NULL) {
+static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_node TSRMLS_DC) /* {{{ */
+{
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
- if (pass2) {
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- CG(zend_lineno) = opline->lineno;
- zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
- } else {
- /* Label is not defined. Delay to pass 2. */
- INC_BPC(op_array);
- return;
- }
+ if (list->children == 1 && !list->child[0]) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list");
}
- opline->op1.opline_num = dest->opline_num;
- zval_dtor(label);
- ZVAL_NULL(label);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *var_ast = list->child[i];
+ znode fetch_result, dim_node;
- /* Check that we are not moving into loop or switch */
- current = opline->extended_value;
- for (distance = 0; current != dest->brk_cont; distance++) {
- if (current == -1) {
- if (pass2) {
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- CG(zend_lineno) = opline->lineno;
- }
- zend_error_noreturn(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed");
+ if (var_ast == NULL) {
+ continue;
}
- current = op_array->brk_cont_array[current].parent;
- }
- if (distance == 0) {
- /* Nothing to break out of, optimize to ZEND_JMP */
- opline->opcode = ZEND_JMP;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- } else {
- /* Set real break distance */
- ZVAL_INT(label, distance);
- }
+ dim_node.op_type = IS_CONST;
+ ZVAL_LONG(&dim_node.u.constant, i);
- if (pass2) {
- DEC_BPC(op_array);
+ if (expr_node->op_type == IS_CONST) {
+ Z_TRY_ADDREF(expr_node->u.constant);
+ }
+
+ zend_emit_op(&fetch_result, ZEND_FETCH_LIST, expr_node, &dim_node TSRMLS_CC);
+ zend_emit_assign_znode(var_ast, &fetch_result TSRMLS_CC);
}
+ *result = *expr_node;
}
/* }}} */
-void zend_do_goto(znode *label TSRMLS_DC) /* {{{ */
+void zend_ensure_writable_variable(const zend_ast *ast) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_GOTO;
- opline->extended_value = CG(context).current_brk_cont;
- SET_UNUSED(opline->op1);
- SET_NODE(opline->op2, label);
- zend_resolve_goto_label(CG(active_op_array), opline, 0 TSRMLS_CC);
+ if (ast->kind == ZEND_AST_CALL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Can't use function return value in write context");
+ }
+ if (ast->kind == ZEND_AST_METHOD_CALL || ast->kind == ZEND_AST_STATIC_CALL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Can't use method return value in write context");
+ }
}
/* }}} */
-void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */
+/* Detects $a... = $a pattern */
+zend_bool zend_is_assign_to_self(zend_ast *var_ast, zend_ast *expr_ast TSRMLS_DC) /* {{{ */
{
- if (CG(context).labels) {
- zend_hash_destroy(CG(context).labels);
- FREE_HASHTABLE(CG(context).labels);
- CG(context).labels = NULL;
+ if (expr_ast->kind != ZEND_AST_VAR || expr_ast->child[0]->kind != ZEND_AST_ZVAL) {
+ return 0;
}
- if (!temporary && !zend_stack_is_empty(&CG(context_stack))) {
- zend_compiler_context *ctx = zend_stack_top(&CG(context_stack));
- CG(context) = *ctx;
- zend_stack_del_top(&CG(context_stack));
+
+ while (zend_is_variable(var_ast) && var_ast->kind != ZEND_AST_VAR) {
+ var_ast = var_ast->child[0];
+ }
+
+ if (var_ast->kind != ZEND_AST_VAR || var_ast->child[0]->kind != ZEND_AST_ZVAL) {
+ return 0;
+ }
+
+ {
+ zend_string *name1 = zval_get_string(zend_ast_get_zval(var_ast->child[0]));
+ zend_string *name2 = zval_get_string(zend_ast_get_zval(expr_ast->child[0]));
+ zend_bool result = zend_string_equals(name1, name2);
+ zend_string_release(name1);
+ zend_string_release(name2);
+ return result;
}
}
/* }}} */
-void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC) /* {{{ */
+void zend_compile_assign(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_uint length;
+ zend_ast *var_ast = ast->child[0];
+ zend_ast *expr_ast = ast->child[1];
- if (!result) {
- result = prefix;
- } else {
- *result = *prefix;
+ znode var_node, expr_node;
+ zend_op *opline;
+ uint32_t offset;
+
+ if (is_this_fetch(var_ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
}
- if (is_class_member) {
- int old_len = Z_STRSIZE(result->u.constant);
- length = sizeof("::")-1 + old_len + Z_STRSIZE(name->u.constant);
- Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0);
- Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
- memcpy(&Z_STRVAL(result->u.constant)[old_len], "::", sizeof("::")-1);
- memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant)+1);
- STR_RELEASE(Z_STR(name->u.constant));
- } else {
- int old_len = Z_STRSIZE(result->u.constant);
- length = sizeof("\\")-1 + old_len + Z_STRSIZE(name->u.constant);
- Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0);
- Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
- memcpy(&Z_STRVAL(result->u.constant)[old_len], "\\", sizeof("\\")-1);
- memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant)+1);
- STR_RELEASE(Z_STR(name->u.constant));
+ zend_ensure_writable_variable(var_ast);
+
+ switch (var_ast->kind) {
+ case ZEND_AST_VAR:
+ case ZEND_AST_STATIC_PROP:
+ zend_compile_var(&var_node, var_ast, BP_VAR_W TSRMLS_CC);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+ zend_emit_op(result, ZEND_ASSIGN, &var_node, &expr_node TSRMLS_CC);
+ return;
+ case ZEND_AST_DIM:
+ offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_dim(result, var_ast, BP_VAR_W TSRMLS_CC);
+
+ if (zend_is_assign_to_self(var_ast, expr_ast TSRMLS_CC)) {
+ /* $a[0] = $a should evaluate the right $a first */
+ zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R TSRMLS_CC);
+ } else {
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+ }
+
+ opline = zend_delayed_compile_end(offset TSRMLS_CC);
+ opline->opcode = ZEND_ASSIGN_DIM;
+
+ opline = zend_emit_op_data(&expr_node TSRMLS_CC);
+ opline->op2.var = get_temporary_variable(CG(active_op_array));
+ opline->op2_type = IS_VAR;
+ return;
+ case ZEND_AST_PROP:
+ offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_prop(result, var_ast, BP_VAR_W TSRMLS_CC);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ opline = zend_delayed_compile_end(offset TSRMLS_CC);
+ opline->opcode = ZEND_ASSIGN_OBJ;
+
+ zend_emit_op_data(&expr_node TSRMLS_CC);
+ return;
+ case ZEND_AST_LIST:
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+ zend_compile_list_assign(result, var_ast, &expr_node TSRMLS_CC);
+ return;
+ EMPTY_SWITCH_DEFAULT_CASE();
}
}
/* }}} */
-int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) /* {{{ */
+void zend_compile_assign_ref(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- znode class_node;
- zend_uint op_number;
+ zend_ast *target_ast = ast->child[0];
+ zend_ast *source_ast = ast->child[1];
+
+ znode target_node, source_node;
zend_op *opline;
- if (method_name->op_type == IS_CONST) {
- char *lcname;
- if (Z_TYPE(method_name->u.constant) != IS_STRING) {
- zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string");
- }
- lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRSIZE(method_name->u.constant));
- if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRSIZE(method_name->u.constant) &&
- memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
- zval_dtor(&method_name->u.constant);
- method_name->op_type = IS_UNUSED;
- }
- efree(lcname);
+ if (is_this_fetch(target_ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
}
+ zend_ensure_writable_variable(target_ast);
- if (class_name->op_type == IS_CONST &&
- ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) {
- zend_resolve_class_name(class_name TSRMLS_CC);
- class_node = *class_name;
- op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- } else {
- zend_do_fetch_class(&class_node, class_name TSRMLS_CC);
- op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- }
- opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
- if (class_node.op_type == IS_CONST) {
- opline->op1_type = IS_CONST;
- opline->op1.constant =
- zend_add_class_name_literal(CG(active_op_array), &class_node.u.constant TSRMLS_CC);
- } else {
- SET_NODE(opline->op1, &class_node);
+ zend_compile_var(&target_node, target_ast, BP_VAR_W TSRMLS_CC);
+ zend_compile_var(&source_node, source_ast, BP_VAR_REF TSRMLS_CC);
+
+ if (source_node.op_type != IS_VAR && zend_is_call(source_ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use result of built-in function in write context");
}
- if (method_name->op_type == IS_CONST) {
- opline->op2_type = IS_CONST;
- opline->op2.constant =
- zend_add_func_name_literal(CG(active_op_array), &method_name->u.constant TSRMLS_CC);
- if (opline->op1_type == IS_CONST) {
- GET_CACHE_SLOT(opline->op2.constant);
- } else {
- GET_POLYMORPHIC_CACHE_SLOT(opline->op2.constant);
- }
- } else {
- SET_NODE(opline->op2, method_name);
+
+ opline = zend_emit_op(result, ZEND_ASSIGN_REF, &target_node, &source_node TSRMLS_CC);
+ if (!result) {
+ opline->result_type |= EXT_TYPE_UNUSED;
}
- zend_push_function_call_entry(NULL, op_number TSRMLS_CC);
- zend_do_extended_fcall_begin(TSRMLS_C);
- return 1; /* Dynamic */
+ if (zend_is_call(source_ast)) {
+ opline->extended_value = ZEND_RETURNS_FUNCTION;
+ } else if (source_ast->kind == ZEND_AST_NEW) {
+ zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated");
+ opline->extended_value = ZEND_RETURNS_NEW;
+ }
}
/* }}} */
-static int zend_do_convert_call(zend_op *init_opline, zend_op *opline, zend_int_t num_args, zend_function **func_ptr TSRMLS_DC) /* {{{ */
+static inline void zend_emit_assign_ref_znode(zend_ast *var_ast, znode *value_node TSRMLS_DC) /* {{{ */
{
- zval *function_name;
- zend_string *lcname;
- zend_function *function;
-
- *func_ptr = NULL;
- if (opline->op1_type == IS_CONST && Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) {
- function_name = &CONSTANT(opline->op1.constant);
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
- if (((function = zend_hash_find_ptr(CG(function_table), lcname)) == NULL) ||
- ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) &&
- (function->type == ZEND_INTERNAL_FUNCTION))) {
- function = NULL;
- STR_RELEASE(lcname);
- opline->opcode = ZEND_INIT_USER_CALL;
- opline->extended_value = num_args;
- opline->op2_type = opline->op1_type;
- opline->op2 = opline->op1;
- opline->op1_type = IS_CONST;
- opline->op1 = init_opline->op2;
- SET_UNUSED(opline->result);
- MAKE_NOP(init_opline);
- return 1;
- } else {
- STR_RELEASE(Z_STR_P(function_name));
- Z_STR_P(function_name) = zend_new_interned_string(lcname TSRMLS_CC);
- opline->opcode = ZEND_INIT_FCALL;
- opline->extended_value = num_args;
- opline->op2_type = IS_CONST;
- opline->op2.constant = opline->op1.constant;
- GET_CACHE_SLOT(opline->op2.constant);
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->result);
- MAKE_NOP(init_opline);
- *func_ptr = function;
- return 1;
- }
- } else {
- opline->opcode = ZEND_INIT_USER_CALL;
- opline->extended_value = num_args;
- opline->op2_type = opline->op1_type;
- opline->op2 = opline->op1;
- opline->op1_type = IS_CONST;
- opline->op1 = init_opline->op2;
- SET_UNUSED(opline->result);
- MAKE_NOP(init_opline);
- return 1;
- }
- return 0;
+ zend_ast *assign_ast = zend_ast_create(ZEND_AST_ASSIGN_REF, var_ast,
+ zend_ast_create_znode(value_node));
+ zend_compile_assign_ref(NULL, assign_ast TSRMLS_CC);
}
/* }}} */
-static int zend_do_convert_call_user_func(zend_op *init_opline, zend_uint num_args TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = init_opline + 1;
- int level = 0;
- int converted = 0;
- zend_uint arg_num = 0;
- zend_function *func = NULL;
-
- while (1) {
- switch (opline->opcode) {
- case ZEND_SEND_VAL:
- case ZEND_SEND_VAL_EX:
- case ZEND_SEND_VAR:
- case ZEND_SEND_VAR_EX:
- case ZEND_SEND_VAR_NO_REF:
- case ZEND_SEND_REF:
- case ZEND_SEND_UNPACK:
- if (level == 0) {
- if (!converted) {
- if (opline->opcode == ZEND_SEND_UNPACK) {
- return 0;
- }
- if (!zend_do_convert_call(init_opline, opline, init_opline->extended_value - 1, &func TSRMLS_CC)) {
- return 0;
- }
- converted = 1;
- } else {
- /* Use ZEND_SEND_USER instruction for parameters that may pass by reference */
- if (opline->opcode != ZEND_SEND_VAL &&
- (func == NULL ||
- ARG_SHOULD_BE_SENT_BY_REF(func, opline->op2.num-1))) {
- opline->opcode = ZEND_SEND_USER;
- }
- opline->op2.num--;
- }
- if (++arg_num == num_args) {
- return 1;
- }
- }
- break;
- case ZEND_INIT_FCALL_BY_NAME:
- case ZEND_INIT_NS_FCALL_BY_NAME:
- case ZEND_NEW:
- case ZEND_INIT_METHOD_CALL:
- case ZEND_INIT_STATIC_METHOD_CALL:
- case ZEND_INIT_FCALL:
- level++;
- break;
- case ZEND_DO_FCALL:
- level--;
- break;
- }
- opline++;
+void zend_compile_compound_assign(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ zend_ast *var_ast = ast->child[0];
+ zend_ast *expr_ast = ast->child[1];
+ uint32_t opcode = ast->attr;
+
+ znode var_node, expr_node;
+ zend_op *opline;
+ uint32_t offset;
+
+ zend_ensure_writable_variable(var_ast);
+
+ switch (var_ast->kind) {
+ case ZEND_AST_VAR:
+ case ZEND_AST_STATIC_PROP:
+ zend_compile_var(&var_node, var_ast, BP_VAR_RW TSRMLS_CC);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+ zend_emit_op(result, opcode, &var_node, &expr_node TSRMLS_CC);
+ return;
+ case ZEND_AST_DIM:
+ offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_dim(result, var_ast, BP_VAR_RW TSRMLS_CC);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ opline = zend_delayed_compile_end(offset TSRMLS_CC);
+ opline->opcode = opcode;
+ opline->extended_value = ZEND_ASSIGN_DIM;
+
+ opline = zend_emit_op_data(&expr_node TSRMLS_CC);
+ opline->op2.var = get_temporary_variable(CG(active_op_array));
+ opline->op2_type = IS_VAR;
+ return;
+ case ZEND_AST_PROP:
+ offset = zend_delayed_compile_begin(TSRMLS_C);
+ zend_delayed_compile_prop(result, var_ast, BP_VAR_RW TSRMLS_CC);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ opline = zend_delayed_compile_end(offset TSRMLS_CC);
+ opline->opcode = opcode;
+ opline->extended_value = ZEND_ASSIGN_OBJ;
+
+ zend_emit_op_data(&expr_node TSRMLS_CC);
+ return;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
}
/* }}} */
-static int zend_do_convert_call_user_func_array(zend_op *init_opline TSRMLS_DC) /* {{{ */
+uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) /* {{{ */
{
- zend_op *opline = init_opline + 1;
- zend_op *send1 = NULL, *send2 = NULL;
- int level = 0;
- zend_function *func;
+ /* TODO.AST &var error */
+ zend_ast_list *args = zend_ast_get_list(ast);
+ uint32_t i;
+ zend_bool uses_arg_unpack = 0;
+ uint32_t arg_count = 0; /* number of arguments not including unpacks */
+
+ for (i = 0; i < args->children; ++i) {
+ zend_ast *arg = args->child[i];
+ uint32_t arg_num = i + 1;
+
+ znode arg_node;
+ zend_op *opline;
+ zend_uchar opcode;
+ zend_ulong flags = 0;
+
+ if (arg->kind == ZEND_AST_UNPACK) {
+ uses_arg_unpack = 1;
+ fbc = NULL;
+
+ zend_compile_expr(&arg_node, arg->child[0] TSRMLS_CC);
+ opline = zend_emit_op(NULL, ZEND_SEND_UNPACK, &arg_node, NULL TSRMLS_CC);
+ opline->op2.num = arg_count;
+ continue;
+ }
+
+ if (uses_arg_unpack) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use positional argument after argument unpacking");
+ }
- do {
- switch (opline->opcode) {
- case ZEND_SEND_VAL:
- case ZEND_SEND_VAL_EX:
- case ZEND_SEND_VAR:
- case ZEND_SEND_VAR_EX:
- case ZEND_SEND_VAR_NO_REF:
- case ZEND_SEND_REF:
- case ZEND_SEND_UNPACK:
- if (level == 0) {
- if (opline->opcode == ZEND_SEND_UNPACK) {
- return 0;
+ arg_count++;
+ if (zend_is_variable(arg)) {
+ if (zend_is_call(arg)) {
+ zend_compile_var(&arg_node, arg, BP_VAR_R TSRMLS_CC);
+ if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
+ /* Function call was converted into builtin instruction */
+ opcode = ZEND_SEND_VAL;
+ } else {
+ opcode = ZEND_SEND_VAR_NO_REF;
+ flags |= ZEND_ARG_SEND_FUNCTION;
+ if (fbc && ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
+ flags |= ZEND_ARG_SEND_BY_REF;
+ if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
+ flags |= ZEND_ARG_SEND_SILENT;
+ }
}
- if (send1 == NULL) {
- send1 = opline;
- } else {
- send2 = opline;
+ }
+ } else if (fbc) {
+ if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
+ zend_compile_var(&arg_node, arg, BP_VAR_W TSRMLS_CC);
+ opcode = ZEND_SEND_REF;
+ } else {
+ zend_compile_var(&arg_node, arg, BP_VAR_R TSRMLS_CC);
+ opcode = ZEND_SEND_VAR;
+ }
+ } else {
+ zend_compile_var(&arg_node, arg,
+ BP_VAR_FUNC_ARG | (arg_num << BP_VAR_SHIFT) TSRMLS_CC);
+ opcode = ZEND_SEND_VAR_EX;
+ }
+ } else {
+ zend_compile_expr(&arg_node, arg TSRMLS_CC);
+ if (arg_node.op_type & (IS_VAR|IS_CV)) {
+ opcode = ZEND_SEND_VAR_NO_REF;
+ if (fbc && ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
+ flags |= ZEND_ARG_SEND_BY_REF;
+ }
+ } else {
+ if (fbc) {
+ opcode = ZEND_SEND_VAL;
+ if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Only variables can be passed by reference");
}
+ } else {
+ opcode = ZEND_SEND_VAL_EX;
}
- break;
- case ZEND_INIT_FCALL_BY_NAME:
- case ZEND_INIT_NS_FCALL_BY_NAME:
- case ZEND_NEW:
- case ZEND_INIT_METHOD_CALL:
- case ZEND_INIT_STATIC_METHOD_CALL:
- case ZEND_INIT_FCALL:
- level++;
- break;
- case ZEND_DO_FCALL:
- level--;
- break;
+ }
}
- opline++;
- } while (send2 == NULL);
- if (!zend_do_convert_call(init_opline, send1, 0, &func TSRMLS_CC)) {
- return 0;
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = opcode;
+ SET_NODE(opline->op1, &arg_node);
+ SET_UNUSED(opline->op2);
+ opline->op2.opline_num = arg_num;
+
+ if (opcode == ZEND_SEND_VAR_NO_REF) {
+ if (fbc) {
+ flags |= ZEND_ARG_COMPILE_TIME_BOUND;
+ }
+ opline->extended_value = flags;
+ } else if (fbc) {
+ opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
+ }
}
- send2->opcode = ZEND_SEND_ARRAY;
- send2->extended_value = 0;
- send2->op2.num--;
- return 1;
+ return arg_count;
}
/* }}} */
-static int zend_do_convert_strlen(zend_op *init_opline, znode *result TSRMLS_DC) /* {{{ */
+void zend_compile_call_common(znode *result, zend_ast *args_ast, zend_function *fbc TSRMLS_DC) /* {{{ */
{
- zend_op *opline = init_opline + 1;
- zend_op *send = NULL;
- int level = 0;
+ zend_op *opline;
+ uint32_t opnum_init = get_next_op_number(CG(active_op_array)) - 1;
+ uint32_t arg_count;
+ uint32_t call_flags;
- do {
- switch (opline->opcode) {
- case ZEND_SEND_VAL:
- case ZEND_SEND_VAL_EX:
- case ZEND_SEND_VAR:
- case ZEND_SEND_VAR_EX:
- case ZEND_SEND_VAR_NO_REF:
- case ZEND_SEND_REF:
- case ZEND_SEND_UNPACK:
- if (level == 0) {
- if (opline->opcode == ZEND_SEND_UNPACK) {
- return 0;
- }
- send = opline;
- }
- break;
- case ZEND_INIT_FCALL_BY_NAME:
- case ZEND_INIT_NS_FCALL_BY_NAME:
- case ZEND_NEW:
- case ZEND_INIT_METHOD_CALL:
- case ZEND_INIT_STATIC_METHOD_CALL:
- case ZEND_INIT_FCALL:
- level++;
- break;
- case ZEND_DO_FCALL:
- level--;
- break;
- }
- opline++;
- } while (send == NULL);
+ zend_do_extended_fcall_begin(TSRMLS_C);
- MAKE_NOP(init_opline);
- send->opcode = ZEND_STRLEN;
- send->extended_value = 0;
- SET_UNUSED(send->op2);
- send->result.var = get_temporary_variable(CG(active_op_array));
- send->result_type = IS_TMP_VAR;
- GET_NODE(result, send->result);
- return 1;
+ arg_count = zend_compile_args(args_ast, fbc TSRMLS_CC);
+
+ opline = &CG(active_op_array)->opcodes[opnum_init];
+ opline->extended_value = arg_count;
+
+ call_flags = (opline->opcode == ZEND_NEW ? ZEND_CALL_CTOR : 0);
+ opline = zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
+ opline->op1.num = call_flags;
+
+ zend_do_extended_fcall_end(TSRMLS_C);
}
/* }}} */
-static int zend_do_convert_type_check(zend_op *init_opline, znode *result, zend_uint type TSRMLS_DC) /* {{{ */
+zend_bool zend_compile_function_name(znode *name_node, zend_ast *name_ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = init_opline + 1;
- zend_op *send = NULL;
- int level = 0;
+ zend_string *orig_name = zend_ast_get_str(name_ast);
+ zend_bool is_fully_qualified;
- do {
- switch (opline->opcode) {
- case ZEND_SEND_VAL:
- case ZEND_SEND_VAL_EX:
- case ZEND_SEND_VAR:
- case ZEND_SEND_VAR_EX:
- case ZEND_SEND_VAR_NO_REF:
- case ZEND_SEND_REF:
- case ZEND_SEND_UNPACK:
- if (level == 0) {
- if (opline->opcode == ZEND_SEND_UNPACK) {
- return 0;
- }
- send = opline;
- }
- break;
- case ZEND_INIT_FCALL_BY_NAME:
- case ZEND_INIT_NS_FCALL_BY_NAME:
- case ZEND_NEW:
- case ZEND_INIT_METHOD_CALL:
- case ZEND_INIT_STATIC_METHOD_CALL:
- case ZEND_INIT_FCALL:
- level++;
- break;
- case ZEND_DO_FCALL:
- level--;
- break;
- }
- opline++;
- } while (send == NULL);
+ name_node->op_type = IS_CONST;
+ ZVAL_STR(&name_node->u.constant, zend_resolve_function_name(
+ orig_name, name_ast->attr, &is_fully_qualified TSRMLS_CC));
- MAKE_NOP(init_opline);
- send->opcode = ZEND_TYPE_CHECK;
- send->extended_value = type;
- SET_UNUSED(send->op2);
- send->result.var = get_temporary_variable(CG(active_op_array));
- send->result_type = IS_TMP_VAR;
- GET_NODE(result, send->result);
- return 1;
+ return !is_fully_qualified && CG(current_namespace);
}
/* }}} */
-static int zend_do_convert_defined(zend_op *init_opline, znode *result TSRMLS_DC) /* {{{ */
+void zend_compile_ns_call(znode *result, znode *name_node, zend_ast *args_ast TSRMLS_DC) /* {{{ */
{
- zval c;
- zend_string *lc_name;
- zend_op *opline = init_opline + 1;
-
- if (opline->opcode != ZEND_SEND_VAL ||
- opline->op1_type != IS_CONST ||
- Z_TYPE(CONSTANT(opline->op1.constant)) != IS_STRING
- || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), '\\', Z_STRSIZE(CONSTANT(opline->op1.constant))) != NULL
- || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), ':', Z_STRSIZE(CONSTANT(opline->op1.constant))) != NULL) {
- return 0;
- }
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_INIT_NS_FCALL_BY_NAME;
+ SET_UNUSED(opline->op1);
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_ns_func_name_literal(
+ CG(active_op_array), Z_STR(name_node->u.constant) TSRMLS_CC);
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
- MAKE_NOP(init_opline);
- opline->opcode = ZEND_DEFINED;
- opline->extended_value = 0;
- GET_CACHE_SLOT(opline->op1.constant);
- /* lowcase constant name */
- lc_name = STR_ALLOC(Z_STRSIZE(CONSTANT(opline->op1.constant)), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant)));
- ZVAL_NEW_STR(&c, lc_name);
- zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_TMP_VAR;
- GET_NODE(result, opline->result);
- return 1;
+ zend_compile_call_common(result, args_ast, NULL TSRMLS_CC);
}
/* }}} */
-void zend_do_end_function_call(znode *function_name, znode *result, int is_method, int is_dynamic_fcall TSRMLS_DC) /* {{{ */
+void zend_compile_dynamic_call(znode *result, znode *name_node, zend_ast *args_ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- zend_function_call_entry *fcall = zend_stack_top(&CG(function_call_stack));
-
- if (is_method && function_name && function_name->op_type == IS_UNUSED) {
- /* clone */
- if (fcall->arg_num != 0) {
- zend_error(E_WARNING, "Clone method does not require arguments");
- }
- opline = &CG(active_op_array)->opcodes[Z_IVAL(function_name->u.constant)];
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_INIT_FCALL_BY_NAME;
+ SET_UNUSED(opline->op1);
+ if (name_node->op_type == IS_CONST && Z_TYPE(name_node->u.constant) == IS_STRING) {
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_func_name_literal(CG(active_op_array),
+ Z_STR(name_node->u.constant) TSRMLS_CC);
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
} else {
- zend_uint call_flags = 0;
+ SET_NODE(opline->op2, name_node);
+ }
- opline = &CG(active_op_array)->opcodes[fcall->op_number];
- opline->extended_value = fcall->arg_num;
+ zend_compile_call_common(result, args_ast, NULL TSRMLS_CC);
+}
+/* }}} */
- if (opline->opcode == ZEND_NEW) {
- call_flags = ZEND_CALL_CTOR;
- } else {
- zend_function *func = fcall->fbc;
- if (func && func->type == ZEND_INTERNAL_FUNCTION) {
- /* Convert calls to some internal functions into built-ins */
- if (func->common.function_name->len == sizeof("call_user_func")-1 &&
- memcmp(func->common.function_name->val, "call_user_func", sizeof("call_user_func")-1) == 0) {
- if (fcall->arg_num > 0) {
- if (zend_do_convert_call_user_func(opline, fcall->arg_num TSRMLS_CC)) {
- fcall->arg_num--;
- }
- }
- } else if (func->common.function_name->len == sizeof("call_user_func_array")-1 &&
- memcmp(func->common.function_name->val, "call_user_func_array", sizeof("call_user_func_array")-1) == 0) {
- if (fcall->arg_num == 2) {
- if (zend_do_convert_call_user_func_array(opline TSRMLS_CC)) {
- fcall->arg_num = 0;
- }
- }
- } else if (func->common.function_name->len == sizeof("defined")-1 &&
- memcmp(func->common.function_name->val, "defined", sizeof("defined")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_defined(opline, result TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 &&
- func->common.function_name->len == sizeof("strlen")-1 &&
- memcmp(func->common.function_name->val, "strlen", sizeof("strlen")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_strlen(opline, result TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_null")-1 &&
- memcmp(func->common.function_name->val, "is_null", sizeof("is_null")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_NULL TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_bool")-1 &&
- memcmp(func->common.function_name->val, "is_bool", sizeof("is_bool")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, _IS_BOOL TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_long")-1 &&
- memcmp(func->common.function_name->val, "is_long", sizeof("is_long")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_INT TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_float")-1 &&
- memcmp(func->common.function_name->val, "is_float", sizeof("is_float")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_DOUBLE TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_string")-1 &&
- memcmp(func->common.function_name->val, "is_string", sizeof("is_string")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_STRING TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_array")-1 &&
- memcmp(func->common.function_name->val, "is_array", sizeof("is_array")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_ARRAY TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_object")-1 &&
- memcmp(func->common.function_name->val, "is_object", sizeof("is_object")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_OBJECT TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- } else if (func->common.function_name->len == sizeof("is_resouce")-1 &&
- memcmp(func->common.function_name->val, "is_resource", sizeof("is_resource")-1) == 0) {
- if (fcall->arg_num == 1) {
- if (zend_do_convert_type_check(opline, result, IS_RESOURCE TSRMLS_CC)) {
- zend_stack_del_top(&CG(function_call_stack));
- return;
- }
- }
- }
- }
+static zend_bool zend_args_contain_unpack(zend_ast_list *args) /* {{{ */
+{
+ uint32_t i;
+ for (i = 0; i < args->children; ++i) {
+ if (args->child[i]->kind == ZEND_AST_UNPACK) {
+ return 1;
}
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DO_FCALL;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- opline->op1.num = call_flags;
}
+ return 0;
+}
+/* }}} */
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_VAR;
- GET_NODE(result, opline->result);
- opline->extended_value = fcall->arg_num;
+int zend_compile_func_strlen(znode *result, zend_ast_list *args TSRMLS_DC) /* {{{ */
+{
+ znode arg_node;
+
+ if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)
+ || args->children != 1 || args->child[0]->kind == ZEND_AST_UNPACK
+ ) {
+ return FAILURE;
+ }
- zend_stack_del_top(&CG(function_call_stack));
+ zend_compile_expr(&arg_node, args->child[0] TSRMLS_CC);
+ zend_emit_op_tmp(result, ZEND_STRLEN, &arg_node, NULL TSRMLS_CC);
+ return SUCCESS;
}
/* }}} */
-void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC) /* {{{ */
+int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t type TSRMLS_DC) /* {{{ */
{
+ znode arg_node;
zend_op *opline;
- int original_op = op;
- zend_function_call_entry *fcall = zend_stack_top(&CG(function_call_stack));
- zend_function *function_ptr = fcall->fbc;
- int send_by_reference = 0;
- int send_function = 0;
- fcall->arg_num++;
-
- if (fcall->uses_argument_unpacking) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot use positional argument after argument unpacking");
+ if (args->children != 1 || args->child[0]->kind == ZEND_AST_UNPACK) {
+ return FAILURE;
}
+
+ zend_compile_expr(&arg_node, args->child[0] TSRMLS_CC);
+ opline = zend_emit_op_tmp(result, ZEND_TYPE_CHECK, &arg_node, NULL TSRMLS_CC);
+ opline->extended_value = type;
+ return SUCCESS;
+}
+/* }}} */
- if (op == ZEND_SEND_VAR && (param->op_type & (IS_CONST|IS_TMP_VAR))) {
- /* Function call was converted into builtin instruction */
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
- original_op = op = ZEND_SEND_VAL;
- }
+int zend_compile_func_defined(znode *result, zend_ast_list *args TSRMLS_DC) /* {{{ */
+{
+ zend_string *name;
+ zend_op *opline;
- if (original_op == ZEND_SEND_REF) {
- if (function_ptr &&
- function_ptr->common.function_name &&
- function_ptr->common.type == ZEND_USER_FUNCTION &&
- !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Call-time pass-by-reference has been removed; "
- "If you would like to pass argument by reference, modify the declaration of %s().",
- function_ptr->common.function_name->val);
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed");
- }
- return;
+ if (args->children != 1 || args->child[0]->kind != ZEND_AST_ZVAL) {
+ return FAILURE;
}
- if (function_ptr) {
- if (ARG_MAY_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
- if (op == ZEND_SEND_VAR && param->op_type & (IS_VAR|IS_CV)) {
- send_by_reference = ZEND_ARG_SEND_BY_REF;
- if (zend_is_function_or_method_call(param)) {
- /* Method call */
- op = ZEND_SEND_VAR_NO_REF;
- send_function = ZEND_ARG_SEND_FUNCTION | ZEND_ARG_SEND_SILENT;
- }
- } else {
- op = ZEND_SEND_VAL;
- }
- } else if (ARG_SHOULD_BE_SENT_BY_REF(function_ptr, fcall->arg_num)) {
- send_by_reference = ZEND_ARG_SEND_BY_REF;
- }
+ name = zval_get_string(zend_ast_get_zval(args->child[0]));
+ if (zend_memrchr(name->val, '\\', name->len) || zend_memrchr(name->val, ':', name->len)) {
+ zend_string_release(name);
+ return FAILURE;
}
- if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
- /* Method call */
- op = ZEND_SEND_VAR_NO_REF;
- send_function = ZEND_ARG_SEND_FUNCTION;
- } else if (op == ZEND_SEND_VAL && (param->op_type & (IS_VAR|IS_CV))) {
- op = ZEND_SEND_VAR_NO_REF;
- }
+ opline = zend_emit_op_tmp(result, ZEND_DEFINED, NULL, NULL TSRMLS_CC);
+ opline->op1_type = IS_CONST;
+ LITERAL_STR(opline->op1, name);
+ zend_alloc_cache_slot(opline->op1.constant TSRMLS_CC);
- if (op!=ZEND_SEND_VAR_NO_REF && send_by_reference==ZEND_ARG_SEND_BY_REF) {
- /* change to passing by reference */
- switch (param->op_type) {
- case IS_VAR:
- case IS_CV:
- op = ZEND_SEND_REF;
- break;
- default:
- zend_error_noreturn(E_COMPILE_ERROR, "Only variables can be passed by reference");
- break;
- }
+ /* Lowercase constant name in a separate literal */
+ {
+ zval c;
+ zend_string *lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
+ ZVAL_NEW_STR(&c, lcname);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
}
+ return SUCCESS;
+}
+/* }}} */
- if (original_op == ZEND_SEND_VAR) {
- switch (op) {
- case ZEND_SEND_VAR_NO_REF:
- zend_do_end_variable_parse(param, BP_VAR_R, 0 TSRMLS_CC);
- break;
- case ZEND_SEND_VAR:
- if (function_ptr) {
- zend_do_end_variable_parse(param, BP_VAR_R, 0 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(param, BP_VAR_FUNC_ARG, fcall->arg_num TSRMLS_CC);
- }
- break;
- case ZEND_SEND_REF:
- zend_do_end_variable_parse(param, BP_VAR_W, 0 TSRMLS_CC);
- break;
- }
+static int zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t num_args TSRMLS_DC) /* {{{ */
+{
+ zend_string *name, *lcname;
+ zend_function *fbc;
+ zend_op *opline;
+
+ if (name_ast->kind != ZEND_AST_ZVAL || Z_TYPE_P(zend_ast_get_zval(name_ast)) != IS_STRING) {
+ return FAILURE;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ name = zend_ast_get_str(name_ast);
+ lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
- if (op == ZEND_SEND_VAR_NO_REF) {
- if (function_ptr) {
- opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference | send_function;
- } else {
- opline->extended_value = send_function;
- }
- } else {
- if (!function_ptr) {
- switch (op) {
- case ZEND_SEND_VAL:
- op = ZEND_SEND_VAL_EX;
- break;
- case ZEND_SEND_VAR:
- op = ZEND_SEND_VAR_EX;
- break;
- }
- }
+ fbc = zend_hash_find_ptr(CG(function_table), lcname);
+ if (!fbc || (fbc->type == ZEND_INTERNAL_FUNCTION &&
+ (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
+ ) {
+ zend_string_free(lcname);
+ return FAILURE;
}
- opline->opcode = op;
- SET_NODE(opline->op1, param);
- opline->op2.opline_num = fcall->arg_num;
- SET_UNUSED(opline->op2);
+
+ opline = zend_emit_op(NULL, ZEND_INIT_FCALL, NULL, NULL TSRMLS_CC);
+ opline->extended_value = num_args;
+
+ opline->op2_type = IS_CONST;
+ LITERAL_STR(opline->op2, lcname);
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
+
+ return SUCCESS;
}
/* }}} */
-void zend_do_unpack_params(znode *params TSRMLS_DC) /* {{{ */
+static void zend_compile_init_user_func(zend_ast *name_ast, uint32_t num_args, zend_string *orig_func_name TSRMLS_DC) /* {{{ */
{
zend_op *opline;
- zend_function_call_entry *fcall = zend_stack_top(&CG(function_call_stack));
+ znode name_node;
- fcall->uses_argument_unpacking = 1;
+ if (zend_try_compile_ct_bound_init_user_func(name_ast, num_args TSRMLS_CC) == SUCCESS) {
+ return;
+ }
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_SEND_UNPACK;
- SET_NODE(opline->op1, params);
- SET_UNUSED(opline->op2);
- opline->op2.num = fcall->arg_num;
+ zend_compile_expr(&name_node, name_ast TSRMLS_CC);
+
+ opline = zend_emit_op(NULL, ZEND_INIT_USER_CALL, NULL, &name_node TSRMLS_CC);
+ opline->op1_type = IS_CONST;
+ LITERAL_STR(opline->op1, zend_string_copy(orig_func_name));
+ opline->extended_value = num_args;
}
/* }}} */
-static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC) /* {{{ */
+/* cufa = call_user_func_array */
+int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcname TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
+ znode arg_node;
- if (switch_entry->cond.op_type != IS_VAR && switch_entry->cond.op_type != IS_TMP_VAR) {
- return (switch_entry->cond.op_type == IS_UNUSED);
+ if (args->children != 2 || zend_args_contain_unpack(args)) {
+ return FAILURE;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = (switch_entry->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
- SET_NODE(opline->op1, &switch_entry->cond);
- SET_UNUSED(opline->op2);
+ zend_compile_init_user_func(args->child[0], 1, lcname TSRMLS_CC);
+ zend_compile_expr(&arg_node, args->child[1] TSRMLS_CC);
+ zend_emit_op(NULL, ZEND_SEND_ARRAY, &arg_node, NULL TSRMLS_CC);
+ zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
- return 0;
+ return SUCCESS;
}
/* }}} */
-static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /* {{{ */
+/* cuf = call_user_func */
+int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcname TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
+ uint32_t i;
- /* If we reach the separator then stop applying the stack */
- if (foreach_copy->result_type == IS_UNUSED) {
- return 1;
+ if (args->children < 1 || zend_args_contain_unpack(args)) {
+ return FAILURE;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_compile_init_user_func(args->child[0], args->children - 1, lcname TSRMLS_CC);
+ for (i = 1; i < args->children; ++i) {
+ zend_ast *arg_ast = args->child[i];
+ znode arg_node;
+ zend_op *opline;
+ zend_bool send_user = 0;
- opline->opcode = (foreach_copy->result_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
- COPY_NODE(opline->op1, foreach_copy->result);
- SET_UNUSED(opline->op2);
+ if (zend_is_variable(arg_ast) && !zend_is_call(arg_ast)) {
+ zend_compile_var(&arg_node, arg_ast, BP_VAR_FUNC_ARG | (i << BP_VAR_SHIFT) TSRMLS_CC);
+ send_user = 1;
+ } else {
+ zend_compile_expr(&arg_node, arg_ast TSRMLS_CC);
+ if (arg_node.op_type & (IS_VAR|IS_CV)) {
+ send_user = 1;
+ }
+ }
- return 0;
+ if (send_user) {
+ opline = zend_emit_op(NULL, ZEND_SEND_USER, &arg_node, NULL TSRMLS_CC);
+ } else {
+ opline = zend_emit_op(NULL, ZEND_SEND_VAL, &arg_node, NULL TSRMLS_CC);
+ }
+
+ opline->op2.opline_num = i;
+ }
+ zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
+
+ return SUCCESS;
}
/* }}} */
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC) /* {{{ */
+int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_list *args TSRMLS_DC) /* {{{ */
+{
+ if (zend_string_equals_literal(lcname, "strlen")) {
+ return zend_compile_func_strlen(result, args TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_null")) {
+ return zend_compile_func_typecheck(result, args, IS_NULL TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_bool")) {
+ return zend_compile_func_typecheck(result, args, _IS_BOOL TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_long")
+ || zend_string_equals_literal(lcname, "is_int")
+ || zend_string_equals_literal(lcname, "is_integer")
+ ) {
+ return zend_compile_func_typecheck(result, args, IS_LONG TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_float")
+ || zend_string_equals_literal(lcname, "is_double")
+ || zend_string_equals_literal(lcname, "is_real")
+ ) {
+ return zend_compile_func_typecheck(result, args, IS_DOUBLE TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_string")) {
+ return zend_compile_func_typecheck(result, args, IS_STRING TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_array")) {
+ return zend_compile_func_typecheck(result, args, IS_ARRAY TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_object")) {
+ return zend_compile_func_typecheck(result, args, IS_OBJECT TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "is_resource")) {
+ return zend_compile_func_typecheck(result, args, IS_RESOURCE TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "defined")) {
+ return zend_compile_func_defined(result, args TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "call_user_func_array")) {
+ return zend_compile_func_cufa(result, args, lcname TSRMLS_CC);
+ } else if (zend_string_equals_literal(lcname, "call_user_func")) {
+ return zend_compile_func_cuf(result, args, lcname TSRMLS_CC);
+ } else {
+ return FAILURE;
+ }
+}
+/* }}} */
+
+void zend_compile_call(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- int start_op_number, end_op_number;
- zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ zend_ast *name_ast = ast->child[0];
+ zend_ast *args_ast = ast->child[1];
- /* The error for use of return inside a generator is thrown in pass_two. */
+ znode name_node;
- if (do_end_vparse) {
- if (returns_reference && !zend_is_function_or_method_call(expr)) {
- zend_do_end_variable_parse(expr, BP_VAR_W, 1 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(expr, BP_VAR_R, 0 TSRMLS_CC);
+ if (name_ast->kind != ZEND_AST_ZVAL || Z_TYPE_P(zend_ast_get_zval(name_ast)) != IS_STRING) {
+ zend_compile_expr(&name_node, name_ast TSRMLS_CC);
+ zend_compile_dynamic_call(result, &name_node, args_ast TSRMLS_CC);
+ return;
+ }
+
+ {
+ zend_bool runtime_resolution = zend_compile_function_name(&name_node, name_ast TSRMLS_CC);
+ if (runtime_resolution) {
+ zend_compile_ns_call(result, &name_node, args_ast TSRMLS_CC);
+ return;
}
}
- start_op_number = get_next_op_number(CG(active_op_array));
+ {
+ zval *name = &name_node.u.constant;
+ zend_string *lcname = zend_string_alloc(Z_STRLEN_P(name), 0);
+ zend_function *fbc;
+ zend_op *opline;
-#ifdef ZTS
- zend_stack_apply_with_argument(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_switch_expr TSRMLS_CC);
- zend_stack_apply_with_argument(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_foreach_copy TSRMLS_CC);
-#else
- zend_stack_apply(&CG(switch_cond_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_switch_expr);
- zend_stack_apply(&CG(foreach_copy_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_foreach_copy);
-#endif
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRLEN_P(name));
- end_op_number = get_next_op_number(CG(active_op_array));
- while (start_op_number < end_op_number) {
- CG(active_op_array)->opcodes[start_op_number].extended_value |= EXT_TYPE_FREE_ON_RETURN;
- start_op_number++;
- }
+ fbc = zend_hash_find_ptr(CG(function_table), lcname);
+ if (!fbc || (fbc->type == ZEND_INTERNAL_FUNCTION &&
+ (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS))
+ ) {
+ zend_string_release(lcname);
+ zend_compile_dynamic_call(result, &name_node, args_ast TSRMLS_CC);
+ return;
+ }
- if (CG(context).in_finally) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DISCARD_EXCEPTION;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (zend_try_compile_special_func(result, lcname,
+ zend_ast_get_list(args_ast) TSRMLS_CC) == SUCCESS
+ ) {
+ zend_string_release(lcname);
+ zval_ptr_dtor(&name_node.u.constant);
+ return;
+ }
+
+ zval_ptr_dtor(&name_node.u.constant);
+ ZVAL_NEW_STR(&name_node.u.constant, lcname);
+
+ opline = zend_emit_op(NULL, ZEND_INIT_FCALL, NULL, &name_node TSRMLS_CC);
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
+
+ zend_compile_call_common(result, args_ast, fbc TSRMLS_CC);
}
+}
+/* }}} */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+void zend_compile_method_call(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
+{
+ zend_ast *obj_ast = ast->child[0];
+ zend_ast *method_ast = ast->child[1];
+ zend_ast *args_ast = ast->child[2];
- opline->opcode = returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN;
+ znode obj_node, method_node;
+ zend_op *opline;
- if (expr) {
- SET_NODE(opline->op1, expr);
+ if (is_this_fetch(obj_ast)) {
+ obj_node.op_type = IS_UNUSED;
+ } else {
+ zend_compile_expr(&obj_node, obj_ast TSRMLS_CC);
+ }
- if (!do_end_vparse) {
- opline->extended_value = ZEND_RETURNS_VALUE;
- } else if (zend_is_function_or_method_call(expr)) {
- opline->extended_value = ZEND_RETURNS_FUNCTION;
+ zend_compile_expr(&method_node, method_ast TSRMLS_CC);
+ opline = zend_emit_op(NULL, ZEND_INIT_METHOD_CALL, &obj_node, NULL TSRMLS_CC);
+
+ if (method_node.op_type == IS_CONST) {
+ if (Z_TYPE(method_node.u.constant) != IS_STRING) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string");
}
+
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_func_name_literal(CG(active_op_array),
+ Z_STR(method_node.u.constant) TSRMLS_CC);
+ zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
} else {
- opline->op1_type = IS_CONST;
- LITERAL_NULL(opline->op1);
+ SET_NODE(opline->op2, &method_node);
}
- SET_UNUSED(opline->op2);
+ zend_compile_call_common(result, args_ast, NULL TSRMLS_CC);
+}
+/* }}} */
+
+zend_bool zend_is_constructor(zend_string *name) /* {{{ */
+{
+ return zend_string_equals_literal_ci(name, ZEND_CONSTRUCTOR_FUNC_NAME);
}
/* }}} */
-void zend_do_yield(znode *result, znode *value, znode *key, zend_bool is_variable TSRMLS_DC) /* {{{ */
+void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *method_ast = ast->child[1];
+ zend_ast *args_ast = ast->child[2];
+
+ znode class_node, method_node;
zend_op *opline;
+ zend_ulong extended_value = 0;
- if (!CG(active_op_array)->function_name) {
- zend_error_noreturn(E_COMPILE_ERROR, "The \"yield\" expression can only be used inside a function");
+ if (zend_is_const_default_class_ref(class_ast)) {
+ class_node.op_type = IS_CONST;
+ ZVAL_STR(&class_node.u.constant, zend_resolve_class_name_ast(class_ast TSRMLS_CC));
+ } else {
+ opline = zend_compile_class_ref(&class_node, class_ast TSRMLS_CC);
+ extended_value = opline->extended_value;
}
- CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR;
-
- if (is_variable) {
- if ((CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) && !zend_is_function_or_method_call(value)) {
- zend_do_end_variable_parse(value, BP_VAR_W, 1 TSRMLS_CC);
- } else {
- zend_do_end_variable_parse(value, BP_VAR_R, 0 TSRMLS_CC);
+ zend_compile_expr(&method_node, method_ast TSRMLS_CC);
+ if (method_node.op_type == IS_CONST) {
+ zval *name = &method_node.u.constant;
+ if (Z_TYPE_P(name) != IS_STRING) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string");
+ }
+ if (zend_is_constructor(Z_STR_P(name))) {
+ zval_ptr_dtor(name);
+ method_node.op_type = IS_UNUSED;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
+ opline->extended_value = extended_value;
- opline->opcode = ZEND_YIELD;
-
- if (value) {
- SET_NODE(opline->op1, value);
+ zend_set_class_name_op1(opline, &class_node TSRMLS_CC);
- if (is_variable && zend_is_function_or_method_call(value)) {
- opline->extended_value = ZEND_RETURNS_FUNCTION;
+ if (method_node.op_type == IS_CONST) {
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_func_name_literal(CG(active_op_array),
+ Z_STR(method_node.u.constant) TSRMLS_CC);
+ if (opline->op1_type == IS_CONST) {
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
+ } else {
+ zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
}
} else {
- SET_UNUSED(opline->op1);
+ SET_NODE(opline->op2, &method_node);
}
- if (key) {
- SET_NODE(opline->op2, key);
- } else {
- SET_UNUSED(opline->op2);
- }
-
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
+ zend_compile_call_common(result, args_ast, NULL TSRMLS_CC);
}
/* }}} */
-static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */
+void zend_compile_new(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int try_catch_offset = CG(active_op_array)->last_try_catch++;
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *args_ast = ast->child[1];
- CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch);
- CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op;
- CG(active_op_array)->try_catch_array[try_catch_offset].catch_op = 0;
- CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0;
- CG(active_op_array)->try_catch_array[try_catch_offset].finally_end = 0;
- return try_catch_offset;
-}
-/* }}} */
+ znode class_node, ctor_result;
+ zend_op *opline;
+ uint32_t opnum;
-static void zend_add_catch_element(int offset, zend_uint catch_op TSRMLS_DC) /* {{{ */
-{
- CG(active_op_array)->try_catch_array[offset].catch_op = catch_op;
-}
-/* }}} */
+ zend_compile_class_ref(&class_node, class_ast TSRMLS_CC);
-void zend_do_first_catch(znode *open_parentheses TSRMLS_DC) /* {{{ */
-{
- open_parentheses->u.op.opline_num = get_next_op_number(CG(active_op_array));
+ opnum = get_next_op_number(CG(active_op_array));
+ zend_emit_op(result, ZEND_NEW, &class_node, NULL TSRMLS_CC);
+
+ zend_compile_call_common(&ctor_result, args_ast, NULL TSRMLS_CC);
+ zend_do_free(&ctor_result TSRMLS_CC);
+
+ /* New jumps over ctor call if ctor does not exist */
+ opline = &CG(active_op_array)->opcodes[opnum];
+ opline->op2.opline_num = get_next_op_number(CG(active_op_array));
}
/* }}} */
-void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC) /* {{{ */
+void zend_compile_clone(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int jmp_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_llist jmp_list;
- zend_llist *jmp_list_ptr;
+ zend_ast *obj_ast = ast->child[0];
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- /* save for backpatching */
+ znode obj_node;
+ zend_compile_expr(&obj_node, obj_ast TSRMLS_CC);
- zend_llist_init(&jmp_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &jmp_list);
- jmp_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_add_element(jmp_list_ptr, &jmp_op_number);
-
- catch_token->EA = get_next_op_number(CG(active_op_array));
+ zend_emit_op(result, ZEND_CLONE, &obj_node, NULL TSRMLS_CC);
}
/* }}} */
-void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC) /* {{{ */
+void zend_compile_global_var(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- CG(active_op_array)->last--;
- zend_do_if_end(TSRMLS_C);
- if (last_additional_catch->u.op.opline_num == -1) {
- CG(active_op_array)->opcodes[first_catch->u.op.opline_num].result.num = 1;
- CG(active_op_array)->opcodes[first_catch->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
+ zend_ast *var_ast = ast->child[0];
+ zend_ast *name_ast = var_ast->child[0];
+
+ znode name_node, result;
+
+ zend_compile_expr(&name_node, name_ast TSRMLS_CC);
+ if (name_node.op_type == IS_CONST) {
+ if (Z_TYPE(name_node.u.constant) != IS_STRING) {
+ convert_to_string(&name_node.u.constant);
+ }
+ }
+
+ if (zend_try_compile_cv(&result, var_ast TSRMLS_CC) == SUCCESS) {
+ zend_op *opline = zend_emit_op(NULL, ZEND_BIND_GLOBAL, &result, &name_node TSRMLS_CC);
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
} else {
- CG(active_op_array)->opcodes[last_additional_catch->u.op.opline_num].result.num = 1;
- CG(active_op_array)->opcodes[last_additional_catch->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
+ zend_emit_op(&result, ZEND_FETCH_W, &name_node, NULL TSRMLS_CC);
+
+ // TODO.AST Avoid double fetch
+ //opline->extended_value = ZEND_FETCH_GLOBAL_LOCK;
+
+ zend_emit_assign_ref_znode(var_ast, &result TSRMLS_CC);
}
- DEC_BPC(CG(active_op_array));
}
/* }}} */
-void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */
+static void zend_compile_static_var_common(zend_ast *var_ast, zval *value, zend_bool by_ref TSRMLS_DC) /* {{{ */
{
- try_token->u.op.opline_num = zend_add_try_element(get_next_op_number(CG(active_op_array)) TSRMLS_CC);
- INC_BPC(CG(active_op_array));
-}
-/* }}} */
+ znode var_node, result;
+ zend_op *opline;
-void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_compile_expr(&var_node, var_ast TSRMLS_CC);
- finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
- /* call the the "finally" block */
- opline->opcode = ZEND_FAST_CALL;
- SET_UNUSED(opline->op1);
- opline->op1.opline_num = finally_token->u.op.opline_num + 1;
- SET_UNUSED(opline->op2);
- /* jump to code after the "finally" block,
- * the actual jump address is going to be set in zend_do_end_finally()
- */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (!CG(active_op_array)->static_variables) {
+ if (CG(active_op_array)->scope) {
+ CG(active_op_array)->scope->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
+ }
+ ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
+ zend_hash_init(CG(active_op_array)->static_variables, 8, NULL, ZVAL_PTR_DTOR, 0);
+ }
- CG(context).in_finally++;
+ zend_hash_update(CG(active_op_array)->static_variables, Z_STR(var_node.u.constant), value);
+
+ opline = zend_emit_op(&result, by_ref ? ZEND_FETCH_W : ZEND_FETCH_R, &var_node, NULL TSRMLS_CC);
+ opline->extended_value = ZEND_FETCH_STATIC;
+
+ if (by_ref) {
+ zend_ast *fetch_ast = zend_ast_create(ZEND_AST_VAR, var_ast);
+ zend_emit_assign_ref_znode(fetch_ast, &result TSRMLS_CC);
+ } else {
+ zend_ast *fetch_ast = zend_ast_create(ZEND_AST_VAR, var_ast);
+ zend_emit_assign_znode(fetch_ast, &result TSRMLS_CC);
+ }
}
/* }}} */
-void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */
+void zend_compile_static_var(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_int_t catch_op_number;
- zend_op *opline;
- znode catch_class;
+ zend_ast *var_ast = ast->child[0];
+ zend_ast *value_ast = ast->child[1];
+ zval value_zv;
- if (class_name->op_type == IS_CONST &&
- ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) {
- zend_resolve_class_name(class_name TSRMLS_CC);
- catch_class = *class_name;
+ if (value_ast) {
+ zend_const_expr_to_zval(&value_zv, value_ast TSRMLS_CC);
} else {
- zend_error_noreturn(E_COMPILE_ERROR, "Bad class name in the catch statement");
+ ZVAL_NULL(&value_zv);
}
- catch_op_number = get_next_op_number(CG(active_op_array));
- if (first_catch) {
- first_catch->u.op.opline_num = catch_op_number;
- }
+ zend_compile_static_var_common(var_ast, &value_zv, 1 TSRMLS_CC);
+}
+/* }}} */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_CATCH;
- opline->op1_type = IS_CONST;
- opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), &catch_class.u.constant TSRMLS_CC);
- opline->op2_type = IS_CV;
- opline->op2.var = lookup_cv(CG(active_op_array), Z_STR(catch_var->u.constant) TSRMLS_CC);
- Z_STR(catch_var->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(opline->op2.var)];
- opline->result.num = 0; /* 1 means it's the last catch in the block */
+void zend_compile_unset(zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ zend_ast *var_ast = ast->child[0];
- catch_token->u.op.opline_num = catch_op_number;
+ znode var_node;
+ zend_op *opline;
+ switch (var_ast->kind) {
+ case ZEND_AST_VAR:
+ if (zend_try_compile_cv(&var_node, var_ast TSRMLS_CC) == SUCCESS) {
+ opline = zend_emit_op(NULL, ZEND_UNSET_VAR, &var_node, NULL TSRMLS_CC);
+ opline->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
+ } else {
+ opline = zend_compile_simple_var_no_cv(NULL, var_ast, BP_VAR_UNSET TSRMLS_CC);
+ opline->opcode = ZEND_UNSET_VAR;
+ }
+ return;
+ case ZEND_AST_DIM:
+ opline = zend_compile_dim_common(NULL, var_ast, BP_VAR_UNSET TSRMLS_CC);
+ opline->opcode = ZEND_UNSET_DIM;
+ return;
+ case ZEND_AST_PROP:
+ opline = zend_compile_prop_common(NULL, var_ast, BP_VAR_UNSET TSRMLS_CC);
+ opline->opcode = ZEND_UNSET_OBJ;
+ return;
+ case ZEND_AST_STATIC_PROP:
+ opline = zend_compile_static_prop_common(NULL, var_ast, BP_VAR_UNSET TSRMLS_CC);
+ opline->opcode = ZEND_UNSET_VAR;
+ return;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
}
/* }}} */
-void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */
+static void zend_free_foreach_and_switch_variables(TSRMLS_D) /* {{{ */
{
- int jmp_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_llist *jmp_list_ptr;
+ uint32_t opnum_start, opnum_end, i;
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- /* save for backpatching */
+ opnum_start = get_next_op_number(CG(active_op_array));
- jmp_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_add_element(jmp_list_ptr, &jmp_op_number);
+#ifdef ZTS
+ zend_stack_apply_with_argument(&CG(loop_var_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element, void *)) generate_free_loop_var TSRMLS_CC);
+#else
+ zend_stack_apply(&CG(loop_var_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_loop_var);
+#endif
- CG(active_op_array)->opcodes[catch_token->u.op.opline_num].extended_value = get_next_op_number(CG(active_op_array));
-}
-/* }}} */
+ opnum_end = get_next_op_number(CG(active_op_array));
-void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ {
- if (catch_token->op_type != IS_UNUSED) {
- zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
+ for (i = opnum_start; i < opnum_end; ++i) {
+ CG(active_op_array)->opcodes[i].extended_value |= EXT_TYPE_FREE_ON_RETURN;
}
}
/* }}} */
-void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */
+void zend_compile_return(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use try without catch or finally");
+ zend_ast *expr_ast = ast->child[0];
+ zend_bool by_ref = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+
+ znode expr_node;
+ zend_op *opline;
+
+ if (!expr_ast) {
+ expr_node.op_type = IS_CONST;
+ ZVAL_NULL(&expr_node.u.constant);
+ } else if (by_ref && zend_is_variable(expr_ast) && !zend_is_call(expr_ast)) {
+ zend_compile_var(&expr_node, expr_ast, BP_VAR_REF TSRMLS_CC);
+ } else {
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
}
- if (finally_token->op_type != IS_UNUSED) {
- zend_op *opline;
- CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num + 1;
- CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->has_finally_block = 1;
+ zend_free_foreach_and_switch_variables(TSRMLS_C);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FAST_RET;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (CG(context).in_finally) {
+ zend_emit_op(NULL, ZEND_DISCARD_EXCEPTION, NULL, NULL TSRMLS_CC);
+ }
- CG(active_op_array)->opcodes[finally_token->u.op.opline_num].op1.opline_num = get_next_op_number(CG(active_op_array));
+ opline = zend_emit_op(NULL, by_ref ? ZEND_RETURN_BY_REF : ZEND_RETURN,
+ &expr_node, NULL TSRMLS_CC);
- CG(context).in_finally--;
+ if (expr_ast) {
+ if (zend_is_call(expr_ast)) {
+ opline->extended_value = ZEND_RETURNS_FUNCTION;
+ } else if (!zend_is_variable(expr_ast)) {
+ opline->extended_value = ZEND_RETURNS_VALUE;
+ }
}
}
/* }}} */
-void zend_do_throw(znode *expr TSRMLS_DC) /* {{{ */
+void zend_compile_echo(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
+ zend_ast *expr_ast = ast->child[0];
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_THROW;
- SET_NODE(opline->op1, expr);
- SET_UNUSED(opline->op2);
+ znode expr_node;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ zend_emit_op(NULL, ZEND_ECHO, &expr_node, NULL TSRMLS_CC);
}
/* }}} */
-ZEND_API void function_add_ref(zend_function *function) /* {{{ */
+void zend_compile_throw(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if (function->type == ZEND_USER_FUNCTION) {
- zend_op_array *op_array = &function->op_array;
+ zend_ast *expr_ast = ast->child[0];
- (*op_array->refcount)++;
- if (op_array->static_variables) {
- HashTable *static_variables = op_array->static_variables;
+ znode expr_node;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
- ALLOC_HASHTABLE(op_array->static_variables);
- zend_array_dup(op_array->static_variables, static_variables);
- }
- op_array->run_time_cache = NULL;
- } else if (function->type == ZEND_INTERNAL_FUNCTION) {
- if (function->common.function_name) {
- STR_ADDREF(function->common.function_name);
- }
- }
+ zend_emit_op(NULL, ZEND_THROW, &expr_node, NULL TSRMLS_CC);
}
/* }}} */
-static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+void zend_compile_break_continue(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_function *function, *new_function;
+ zend_ast *depth_ast = ast->child[0];
- if (!ce->parent) {
- return;
- }
+ znode depth_node;
+ zend_op *opline;
- /* You cannot change create_object */
- ce->create_object = ce->parent->create_object;
+ ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE);
- /* Inherit special functions if needed */
- if (!ce->get_iterator) {
- ce->get_iterator = ce->parent->get_iterator;
- }
- if (!ce->iterator_funcs.funcs) {
- ce->iterator_funcs.funcs = ce->parent->iterator_funcs.funcs;
- }
- if (!ce->__get) {
- ce->__get = ce->parent->__get;
- }
- if (!ce->__set) {
- ce->__set = ce->parent->__set;
- }
- if (!ce->__unset) {
- ce->__unset = ce->parent->__unset;
- }
- if (!ce->__isset) {
- ce->__isset = ce->parent->__isset;
- }
- if (!ce->__call) {
- ce->__call = ce->parent->__call;
- }
- if (!ce->__callstatic) {
- ce->__callstatic = ce->parent->__callstatic;
- }
- if (!ce->__tostring) {
- ce->__tostring = ce->parent->__tostring;
- }
- if (!ce->clone) {
- ce->clone = ce->parent->clone;
- }
- if(!ce->serialize) {
- ce->serialize = ce->parent->serialize;
- }
- if(!ce->unserialize) {
- ce->unserialize = ce->parent->unserialize;
- }
- if (!ce->destructor) {
- ce->destructor = ce->parent->destructor;
- }
- if (!ce->__debugInfo) {
- ce->__debugInfo = ce->parent->__debugInfo;
- }
- if (ce->constructor) {
- if (ce->parent->constructor && ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL) {
- zend_error(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
- ce->parent->name->val, ce->parent->constructor->common.function_name->val,
- ce->name->val, ce->constructor->common.function_name->val
- );
+ if (depth_ast) {
+ if (depth_ast->kind != ZEND_AST_ZVAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator with non-constant operand "
+ "is no longer supported", ast->kind == ZEND_AST_BREAK ? "break" : "continue");
}
- return;
- }
- if ((function = zend_hash_str_find_ptr(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1)) != NULL) {
- /* inherit parent's constructor */
- if (function->type == ZEND_INTERNAL_FUNCTION) {
- new_function = pemalloc(sizeof(zend_internal_function), 1);
- memcpy(new_function, function, sizeof(zend_internal_function));
- } else {
- new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(new_function, function, sizeof(zend_op_array));
+ zend_compile_expr(&depth_node, depth_ast TSRMLS_CC);
+
+ if (Z_TYPE(depth_node.u.constant) != IS_LONG || Z_LVAL(depth_node.u.constant) < 1) {
+ zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers",
+ ast->kind == ZEND_AST_BREAK ? "break" : "continue");
}
- zend_hash_str_update_ptr(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1, new_function);
- function_add_ref(new_function);
} else {
- /* Don't inherit the old style constructor if we already have the new style constructor */
- zend_string *lc_class_name;
- zend_string *lc_parent_class_name;
-
- lc_class_name = STR_ALLOC(ce->name->len, 0);
- zend_str_tolower_copy(lc_class_name->val, ce->name->val, ce->name->len);
- if (!zend_hash_exists(&ce->function_table, lc_class_name)) {
- lc_parent_class_name = STR_ALLOC(ce->parent->name->len, 0);
- zend_str_tolower_copy(lc_parent_class_name->val, ce->parent->name->val, ce->parent->name->len);
- if (!zend_hash_exists(&ce->function_table, lc_parent_class_name) &&
- (function = zend_hash_find_ptr(&ce->parent->function_table, lc_parent_class_name)) != NULL) {
- if (function->common.fn_flags & ZEND_ACC_CTOR) {
- /* inherit parent's constructor */
- new_function = pemalloc(sizeof(zend_function), function->type == ZEND_INTERNAL_FUNCTION);
- memcpy(new_function, function, sizeof(zend_function));
- zend_hash_update_ptr(&ce->function_table, lc_parent_class_name, new_function);
- function_add_ref(new_function);
- }
- }
- STR_RELEASE(lc_parent_class_name);
- }
- STR_FREE(lc_class_name);
+ depth_node.op_type = IS_CONST;
+ ZVAL_LONG(&depth_node.u.constant, 1);
}
- ce->constructor = ce->parent->constructor;
+
+ opline = zend_emit_op(NULL, ast->kind == ZEND_AST_BREAK ? ZEND_BRK : ZEND_CONT,
+ NULL, &depth_node TSRMLS_CC);
+ opline->op1.opline_num = CG(context).current_brk_cont;
}
/* }}} */
-char *zend_visibility_string(zend_uint fn_flags) /* {{{ */
+void zend_compile_goto(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if (fn_flags & ZEND_ACC_PRIVATE) {
- return "private";
- }
- if (fn_flags & ZEND_ACC_PROTECTED) {
- return "protected";
- }
- if (fn_flags & ZEND_ACC_PUBLIC) {
- return "public";
- }
- return "";
+ zend_ast *label_ast = ast->child[0];
+ znode label_node;
+ zend_op *opline;
+
+ zend_compile_expr(&label_node, label_ast TSRMLS_CC);
+ opline = zend_emit_op(NULL, ZEND_GOTO, NULL, &label_node TSRMLS_CC);
+ opline->extended_value = CG(context).current_brk_cont;
+ zend_resolve_goto_label(CG(active_op_array), opline, 0 TSRMLS_CC);
}
/* }}} */
-static zend_function *do_inherit_method(zend_function *old_function TSRMLS_DC) /* {{{ */
+void zend_compile_label(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_function *new_function;
+ zend_string *label = zend_ast_get_str(ast->child[0]);
+ zend_label dest;
- if (old_function->type == ZEND_INTERNAL_FUNCTION) {
- new_function = pemalloc(sizeof(zend_internal_function), 1);
- memcpy(new_function, old_function, sizeof(zend_internal_function));
- } else {
- new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(new_function, old_function, sizeof(zend_op_array));
+ if (!CG(context).labels) {
+ ALLOC_HASHTABLE(CG(context).labels);
+ zend_hash_init(CG(context).labels, 8, NULL, ptr_dtor, 0);
+ }
+
+ dest.brk_cont = CG(context).current_brk_cont;
+ dest.opline_num = get_next_op_number(CG(active_op_array));
+
+ if (!zend_hash_add_mem(CG(context).labels, label, &dest, sizeof(zend_label))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", label->val);
}
- /* The class entry of the derived function intentionally remains the same
- * as that of the parent class. That allows us to know in which context
- * we're running, and handle private method calls properly.
- */
- function_add_ref(new_function);
- return new_function;
}
/* }}} */
-static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto TSRMLS_DC) /* {{{ */
+void zend_compile_while(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_uint i, num_args;
+ zend_ast *cond_ast = ast->child[0];
+ zend_ast *stmt_ast = ast->child[1];
- /* If it's a user function then arg_info == NULL means we don't have any parameters but
- * we still need to do the arg number checks. We are only willing to ignore this for internal
- * functions because extensions don't always define arg_info.
- */
- if (!proto || (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION)) {
- return 1;
- }
+ znode cond_node;
+ uint32_t opnum_start, opnum_jmpz;
- /* Checks for constructors only if they are declared in an interface,
- * or explicitly marked as abstract
- */
- if ((fe->common.fn_flags & ZEND_ACC_CTOR)
- && ((proto->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0
- && (proto->common.fn_flags & ZEND_ACC_ABSTRACT) == 0)) {
- return 1;
- }
+ opnum_start = get_next_op_number(CG(active_op_array));
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
- /* If both methods are private do not enforce a signature */
- if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
- return 1;
- }
+ opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0 TSRMLS_CC);
+ zend_begin_loop(TSRMLS_C);
- /* check number of arguments */
- if (proto->common.required_num_args < fe->common.required_num_args
- || proto->common.num_args > fe->common.num_args) {
- return 0;
- }
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
- /* by-ref constraints on return values are covariant */
- if ((proto->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && !(fe->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- return 0;
- }
+ zend_emit_jump(opnum_start TSRMLS_CC);
- if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
- && !(fe->common.fn_flags & ZEND_ACC_VARIADIC)) {
- return 0;
- }
+ zend_update_jump_target_to_next(opnum_jmpz TSRMLS_CC);
- /* For variadic functions any additional (optional) arguments that were added must be
- * checked against the signature of the variadic argument, so in this case we have to
- * go through all the parameters of the function and not just those present in the
- * prototype. */
- num_args = proto->common.num_args;
- if ((fe->common.fn_flags & ZEND_ACC_VARIADIC)
- && fe->common.num_args > proto->common.num_args) {
- num_args = fe->common.num_args;
- }
+ zend_end_loop(opnum_start, 0 TSRMLS_CC);
+}
+/* }}} */
- for (i = 0; i < num_args; i++) {
- zend_arg_info *fe_arg_info = &fe->common.arg_info[i];
+void zend_compile_do_while(zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ zend_ast *stmt_ast = ast->child[0];
+ zend_ast *cond_ast = ast->child[1];
- zend_arg_info *proto_arg_info;
- if (i < proto->common.num_args) {
- proto_arg_info = &proto->common.arg_info[i];
- } else {
- proto_arg_info = &proto->common.arg_info[proto->common.num_args-1];
- }
+ znode cond_node;
+ uint32_t opnum_start, opnum_cond;
- if (ZEND_LOG_XOR(fe_arg_info->class_name, proto_arg_info->class_name)) {
- /* Only one has a type hint and the other one doesn't */
- return 0;
- }
+ zend_begin_loop(TSRMLS_C);
- if (fe_arg_info->class_name) {
- zend_string *fe_class_name, *proto_class_name;
+ opnum_start = get_next_op_number(CG(active_op_array));
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
- if (!strcasecmp(fe_arg_info->class_name, "parent") && proto->common.scope) {
- fe_class_name = STR_COPY(proto->common.scope->name);
- } else if (!strcasecmp(fe_arg_info->class_name, "self") && fe->common.scope) {
- fe_class_name = STR_COPY(fe->common.scope->name);
- } else {
- fe_class_name = STR_INIT(
- fe_arg_info->class_name,
- fe_arg_info->class_name_len, 0);
- }
+ opnum_cond = get_next_op_number(CG(active_op_array));
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
- if (!strcasecmp(proto_arg_info->class_name, "parent") && proto->common.scope && proto->common.scope->parent) {
- proto_class_name = STR_COPY(proto->common.scope->parent->name);
- } else if (!strcasecmp(proto_arg_info->class_name, "self") && proto->common.scope) {
- proto_class_name = STR_COPY(proto->common.scope->name);
- } else {
- proto_class_name = STR_INIT(
- proto_arg_info->class_name,
- proto_arg_info->class_name_len, 0);
- }
+ zend_emit_cond_jump(ZEND_JMPNZ, &cond_node, opnum_start TSRMLS_CC);
- if (strcasecmp(fe_class_name->val, proto_class_name->val)!=0) {
- const char *colon;
+ zend_end_loop(opnum_cond, 0 TSRMLS_CC);
+}
+/* }}} */
- if (fe->common.type != ZEND_USER_FUNCTION) {
- STR_RELEASE(proto_class_name);
- STR_RELEASE(fe_class_name);
- return 0;
- } else if (strchr(proto_class_name->val, '\\') != NULL ||
- (colon = zend_memrchr(fe_class_name->val, '\\', fe_class_name->len)) == NULL ||
- strcasecmp(colon+1, proto_class_name->val) != 0) {
- zend_class_entry *fe_ce, *proto_ce;
-
- fe_ce = zend_lookup_class(fe_class_name TSRMLS_CC);
- proto_ce = zend_lookup_class(proto_class_name TSRMLS_CC);
-
- /* Check for class alias */
- if (!fe_ce || !proto_ce ||
- fe_ce->type == ZEND_INTERNAL_CLASS ||
- proto_ce->type == ZEND_INTERNAL_CLASS ||
- fe_ce != proto_ce) {
- STR_RELEASE(proto_class_name);
- STR_RELEASE(fe_class_name);
- return 0;
- }
- }
- }
- STR_RELEASE(proto_class_name);
- STR_RELEASE(fe_class_name);
- }
- if (fe_arg_info->type_hint != proto_arg_info->type_hint) {
- /* Incompatible type hint */
- return 0;
- }
+void zend_compile_expr_list(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ zend_ast_list *list;
+ uint32_t i;
- /* by-ref constraints on arguments are invariant */
- if (fe_arg_info->pass_by_reference != proto_arg_info->pass_by_reference) {
- return 0;
- }
+ result->op_type = IS_CONST;
+ ZVAL_TRUE(&result->u.constant);
+
+ if (!ast) {
+ return;
}
- return 1;
-}
-/* }}} */
+ list = zend_ast_get_list(ast);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *expr_ast = list->child[i];
-#define REALLOC_BUF_IF_EXCEED(buf, offset, length, size) \
- if (UNEXPECTED(offset - buf + size >= length)) { \
- length += size + 1; \
- buf = erealloc(buf, length); \
+ zend_do_free(result TSRMLS_CC);
+ zend_compile_expr(result, expr_ast TSRMLS_CC);
}
+}
+/* }}} */
-static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{{ */
+void zend_compile_for(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- char *offset, *buf;
- zend_uint length = 1024;
+ zend_ast *init_ast = ast->child[0];
+ zend_ast *cond_ast = ast->child[1];
+ zend_ast *loop_ast = ast->child[2];
+ zend_ast *stmt_ast = ast->child[3];
- offset = buf = (char *)emalloc(length * sizeof(char));
- if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
- *(offset++) = '&';
- *(offset++) = ' ';
- }
+ znode result;
+ uint32_t opnum_cond, opnum_jmpz, opnum_loop;
- if (fptr->common.scope) {
- memcpy(offset, fptr->common.scope->name->val, fptr->common.scope->name->len);
- offset += fptr->common.scope->name->len;
- *(offset++) = ':';
- *(offset++) = ':';
- }
+ zend_compile_expr_list(&result, init_ast TSRMLS_CC);
+ zend_do_free(&result TSRMLS_CC);
- {
- size_t name_len = fptr->common.function_name->len;
- REALLOC_BUF_IF_EXCEED(buf, offset, length, name_len);
- memcpy(offset, fptr->common.function_name->val, name_len);
- offset += name_len;
- }
-
- *(offset++) = '(';
- if (fptr->common.arg_info) {
- zend_uint i, required;
- zend_arg_info *arg_info = fptr->common.arg_info;
-
- required = fptr->common.required_num_args;
- for (i = 0; i < fptr->common.num_args;) {
- if (arg_info->class_name) {
- const char *class_name;
- zend_uint class_name_len;
- if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope ) {
- class_name = fptr->common.scope->name->val;
- class_name_len = fptr->common.scope->name->len;
- } else if (!strcasecmp(arg_info->class_name, "parent") && fptr->common.scope->parent) {
- class_name = fptr->common.scope->parent->name->val;
- class_name_len = fptr->common.scope->parent->name->len;
- } else {
- class_name = arg_info->class_name;
- class_name_len = arg_info->class_name_len;
- }
- REALLOC_BUF_IF_EXCEED(buf, offset, length, class_name_len);
- memcpy(offset, class_name, class_name_len);
- offset += class_name_len;
- *(offset++) = ' ';
- } else if (arg_info->type_hint) {
- zend_uint type_name_len;
- char *type_name = zend_get_type_by_const(arg_info->type_hint);
- type_name_len = strlen(type_name);
- REALLOC_BUF_IF_EXCEED(buf, offset, length, type_name_len);
- memcpy(offset, type_name, type_name_len);
- offset += type_name_len;
- *(offset++) = ' ';
- }
+ opnum_cond = get_next_op_number(CG(active_op_array));
+ zend_compile_expr_list(&result, cond_ast TSRMLS_CC);
+ zend_do_extended_info(TSRMLS_C);
- if (arg_info->pass_by_reference) {
- *(offset++) = '&';
- }
+ opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &result, 0 TSRMLS_CC);
+ zend_begin_loop(TSRMLS_C);
- if (arg_info->is_variadic) {
- *(offset++) = '.';
- *(offset++) = '.';
- *(offset++) = '.';
- }
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
- *(offset++) = '$';
+ opnum_loop = get_next_op_number(CG(active_op_array));
+ zend_compile_expr_list(&result, loop_ast TSRMLS_CC);
+ zend_do_free(&result TSRMLS_CC);
- if (arg_info->name) {
- REALLOC_BUF_IF_EXCEED(buf, offset, length, arg_info->name_len);
- memcpy(offset, arg_info->name, arg_info->name_len);
- offset += arg_info->name_len;
- } else {
- zend_uint idx = i;
- memcpy(offset, "param", 5);
- offset += 5;
- do {
- *(offset++) = (char) (idx % 10) + '0';
- idx /= 10;
- } while (idx > 0);
- }
- if (i >= required && !arg_info->is_variadic) {
- *(offset++) = ' ';
- *(offset++) = '=';
- *(offset++) = ' ';
- if (fptr->type == ZEND_USER_FUNCTION) {
- zend_op *precv = NULL;
- {
- zend_uint idx = i;
- zend_op *op = ((zend_op_array *)fptr)->opcodes;
- zend_op *end = op + ((zend_op_array *)fptr)->last;
-
- ++idx;
- while (op < end) {
- if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT)
- && op->op1.num == (zend_int_t)idx)
- {
- precv = op;
- }
- ++op;
- }
- }
- if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
- zval *zv = precv->op2.zv;
-
- if (Z_TYPE_P(zv) == IS_CONSTANT) {
- REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRSIZE_P(zv));
- memcpy(offset, Z_STRVAL_P(zv), Z_STRSIZE_P(zv));
- offset += Z_STRSIZE_P(zv);
- } else if (Z_TYPE_P(zv) == IS_FALSE) {
- memcpy(offset, "false", 5);
- offset += 5;
- } else if (Z_TYPE_P(zv) == IS_TRUE) {
- memcpy(offset, "true", 4);
- offset += 4;
- } else if (Z_TYPE_P(zv) == IS_NULL) {
- memcpy(offset, "NULL", 4);
- offset += 4;
- } else if (Z_TYPE_P(zv) == IS_STRING) {
- *(offset++) = '\'';
- REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRSIZE_P(zv), 10));
- memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 10));
- offset += MIN(Z_STRSIZE_P(zv), 10);
- if (Z_STRSIZE_P(zv) > 10) {
- *(offset++) = '.';
- *(offset++) = '.';
- *(offset++) = '.';
- }
- *(offset++) = '\'';
- } else if (Z_TYPE_P(zv) == IS_ARRAY) {
- memcpy(offset, "Array", 5);
- offset += 5;
- } else if (Z_TYPE_P(zv) == IS_CONSTANT_AST) {
- memcpy(offset, "<expression>", 12);
- offset += 12;
- } else {
- zend_string *str = zval_get_string(zv);
- REALLOC_BUF_IF_EXCEED(buf, offset, length, str->len);
- memcpy(offset, str->val, str->len);
- offset += str->len;
- STR_RELEASE(str);
- }
- }
- } else {
- memcpy(offset, "NULL", 4);
- offset += 4;
- }
- }
+ zend_emit_jump(opnum_cond TSRMLS_CC);
- if (++i < fptr->common.num_args) {
- *(offset++) = ',';
- *(offset++) = ' ';
- }
- arg_info++;
- REALLOC_BUF_IF_EXCEED(buf, offset, length, 32);
- }
- }
- *(offset++) = ')';
- *offset = '\0';
+ zend_update_jump_target_to_next(opnum_jmpz TSRMLS_CC);
- return buf;
+ zend_end_loop(opnum_loop, 0 TSRMLS_CC);
}
/* }}} */
-static void do_inheritance_check_on_method(zend_function *child, zend_function *parent TSRMLS_DC) /* {{{ */
+void zend_compile_foreach(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_uint child_flags;
- zend_uint parent_flags = parent->common.fn_flags;
+ zend_ast *expr_ast = ast->child[0];
+ zend_ast *value_ast = ast->child[1];
+ zend_ast *key_ast = ast->child[2];
+ zend_ast *stmt_ast = ast->child[3];
+ zend_bool by_ref = value_ast->kind == ZEND_AST_REF;
+ zend_bool is_variable = zend_is_variable(expr_ast) && !zend_is_call(expr_ast)
+ && zend_can_write_to_variable(expr_ast);
+
+ znode expr_node, reset_node, value_node, key_node;
+ zend_op *opline;
+ uint32_t opnum_reset, opnum_fetch;
- if ((parent->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0
- && parent->common.fn_flags & ZEND_ACC_ABSTRACT
- && parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
- && child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",
- parent->common.scope->name->val,
- child->common.function_name->val,
- child->common.prototype ? child->common.prototype->common.scope->name->val : child->common.scope->name->val);
+ if (key_ast) {
+ if (key_ast->kind == ZEND_AST_REF) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Key element cannot be a reference");
+ }
+ if (key_ast->kind == ZEND_AST_LIST) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use list as key element");
+ }
}
- if (parent_flags & ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val);
+ if (by_ref) {
+ value_ast = value_ast->child[0];
}
- child_flags = child->common.fn_flags;
- /* You cannot change from static to non static and vice versa.
- */
- if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) {
- if (child->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
- }
+ if (by_ref && is_variable) {
+ zend_compile_var(&expr_node, expr_ast, BP_VAR_W TSRMLS_CC);
+ } else {
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
}
- /* Disallow making an inherited method abstract. */
- if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
+ if (by_ref) {
+ zend_separate_if_call_and_write(&expr_node, expr_ast, BP_VAR_W TSRMLS_CC);
}
- if (parent_flags & ZEND_ACC_CHANGED) {
- child->common.fn_flags |= ZEND_ACC_CHANGED;
- } else {
- /* Prevent derived classes from restricting access that was available in parent classes
- */
- if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
- } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK))
- && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) {
- child->common.fn_flags |= ZEND_ACC_CHANGED;
- }
+ opnum_reset = get_next_op_number(CG(active_op_array));
+ opline = zend_emit_op(&reset_node, ZEND_FE_RESET, &expr_node, NULL TSRMLS_CC);
+ if (by_ref && is_variable) {
+ opline->extended_value = ZEND_FE_FETCH_BYREF;
}
- if (parent_flags & ZEND_ACC_PRIVATE) {
- child->common.prototype = NULL;
- } else if (parent_flags & ZEND_ACC_ABSTRACT) {
- child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
- child->common.prototype = parent;
- } else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
- /* ctors only have a prototype if it comes from an interface */
- child->common.prototype = parent->common.prototype ? parent->common.prototype : parent;
+ zend_stack_push(&CG(loop_var_stack), &reset_node);
+
+ opnum_fetch = get_next_op_number(CG(active_op_array));
+ opline = zend_emit_op(&value_node, ZEND_FE_FETCH, &reset_node, NULL TSRMLS_CC);
+ if (by_ref) {
+ opline->extended_value |= ZEND_FE_FETCH_BYREF;
+ }
+ if (key_ast) {
+ opline->extended_value |= ZEND_FE_FETCH_WITH_KEY;
}
- if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
- if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
- }
- } else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
- if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
- char *method_prototype = zend_get_function_declaration(parent TSRMLS_CC);
- zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, method_prototype);
- efree(method_prototype);
- }
+ opline = zend_emit_op(NULL, ZEND_OP_DATA, NULL, NULL TSRMLS_CC);
+
+ /* Allocate enough space to keep HashPointer on VM stack */
+ opline->op1_type = IS_TMP_VAR;
+ opline->op1.var = get_temporary_variable(CG(active_op_array));
+ if (sizeof(HashPointer) > sizeof(zval)) {
+ /* Make sure 1 zval is enough for HashPointer (2 must be enough) */
+ get_temporary_variable(CG(active_op_array));
}
-}
-/* }}} */
-static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, zend_string *key, zend_class_entry *child_ce) /* {{{ */
-{
- zend_uint parent_flags = parent->common.fn_flags;
- zend_function *child;
- TSRMLS_FETCH();
+ if (key_ast) {
+ zend_make_tmp_result(&key_node, opline TSRMLS_CC);
+ }
- if ((child = zend_hash_find_ptr(child_function_table, key)) == NULL) {
- if (parent_flags & (ZEND_ACC_ABSTRACT)) {
- child_ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
- }
- return 1; /* method doesn't exist in child, copy from parent */
+ if (by_ref) {
+ zend_emit_assign_ref_znode(value_ast, &value_node TSRMLS_CC);
+ } else {
+ zend_emit_assign_znode(value_ast, &value_node TSRMLS_CC);
}
- do_inheritance_check_on_method(child, parent TSRMLS_CC);
+ if (key_ast) {
+ zend_emit_assign_znode(key_ast, &key_node TSRMLS_CC);
+ }
- return 0;
+ zend_begin_loop(TSRMLS_C);
+
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
+
+ zend_emit_jump(opnum_fetch TSRMLS_CC);
+
+ opline = &CG(active_op_array)->opcodes[opnum_reset];
+ opline->op2.opline_num = get_next_op_number(CG(active_op_array));
+
+ opline = &CG(active_op_array)->opcodes[opnum_fetch];
+ opline->op2.opline_num = get_next_op_number(CG(active_op_array));
+
+ zend_end_loop(opnum_fetch, 1 TSRMLS_CC);
+
+ generate_free_loop_var(&reset_node TSRMLS_CC);
+ zend_stack_del_top(&CG(loop_var_stack));
}
/* }}} */
-static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */
+void zend_compile_if(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_property_info *child_info;
- zend_class_entry *parent_ce = ce->parent;
-
- if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
- if ((child_info = zend_hash_find_ptr(&ce->properties_info, key)) != NULL) {
- child_info->flags |= ZEND_ACC_CHANGED;
- } else {
- if(ce->type & ZEND_INTERNAL_CLASS) {
- child_info = zend_duplicate_property_info_internal(parent_info);
- } else {
- child_info = zend_duplicate_property_info(parent_info TSRMLS_CC);
- }
- zend_hash_update_ptr(&ce->properties_info, key, child_info);
- child_info->flags &= ~ZEND_ACC_PRIVATE; /* it's not private anymore */
- child_info->flags |= ZEND_ACC_SHADOW; /* but it's a shadow of private */
- }
- return 0; /* don't copy access information to child */
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ uint32_t *jmp_opnums;
+
+ if (list->children > 1) {
+ jmp_opnums = safe_emalloc(sizeof(uint32_t), list->children - 1, 0);
}
- if ((child_info = zend_hash_find_ptr(&ce->properties_info, key)) != NULL) {
- if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s",
- (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name->val, key->val,
- (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name->val, key->val);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *elem_ast = list->child[i];
+ zend_ast *cond_ast = elem_ast->child[0];
+ zend_ast *stmt_ast = elem_ast->child[1];
+ znode cond_node;
+ uint32_t opnum_jmpz;
+ if (cond_ast) {
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
+ opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0 TSRMLS_CC);
}
- if(parent_info->flags & ZEND_ACC_CHANGED) {
- child_info->flags |= ZEND_ACC_CHANGED;
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
+
+ if (i != list->children - 1) {
+ jmp_opnums[i] = zend_emit_jump(0 TSRMLS_CC);
}
- if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
- } else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
- zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
- ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
- ZVAL_UNDEF(&ce->default_properties_table[child_info->offset]);
- child_info->offset = parent_info->offset;
+ if (cond_ast) {
+ zend_update_jump_target_to_next(opnum_jmpz TSRMLS_CC);
}
- return 0; /* Don't copy from parent */
- } else {
- return 1; /* Copy from parent */
}
-}
-/* }}} */
-static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
-{
- if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
- zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name->val, iface->name->val);
- }
- if (ce == iface) {
- zend_error(E_ERROR, "Interface %s cannot implement itself", ce->name->val);
+ if (list->children > 1) {
+ for (i = 0; i < list->children - 1; ++i) {
+ zend_update_jump_target_to_next(jmp_opnums[i] TSRMLS_CC);
+ }
+ efree(jmp_opnums);
}
}
/* }}} */
-ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC) /* {{{ */
+void zend_compile_switch(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- /* expects interface to be contained in ce's interface list already */
- zend_uint i, ce_num, if_num = iface->num_interfaces;
- zend_class_entry *entry;
+ zend_ast *expr_ast = ast->child[0];
+ zend_ast_list *cases = zend_ast_get_list(ast->child[1]);
- if (if_num==0) {
- return;
- }
- ce_num = ce->num_interfaces;
+ uint32_t i;
+ zend_bool has_default_case = 0;
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
- } else {
- ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
- }
+ znode expr_node, case_node;
+ zend_op *opline;
+ uint32_t *jmpnz_opnums = safe_emalloc(sizeof(uint32_t), cases->children, 0);
+ uint32_t opnum_default_jmp;
- /* Inherit the interfaces, only if they're not already inherited by the class */
- while (if_num--) {
- entry = iface->interfaces[if_num];
- for (i = 0; i < ce_num; i++) {
- if (ce->interfaces[i] == entry) {
- break;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ zend_stack_push(&CG(loop_var_stack), &expr_node);
+
+ zend_begin_loop(TSRMLS_C);
+
+ case_node.op_type = IS_TMP_VAR;
+ case_node.u.op.var = get_temporary_variable(CG(active_op_array));
+
+ for (i = 0; i < cases->children; ++i) {
+ zend_ast *case_ast = cases->child[i];
+ zend_ast *cond_ast = case_ast->child[0];
+ znode cond_node;
+
+ if (!cond_ast) {
+ if (has_default_case) {
+ CG(zend_lineno) = case_ast->lineno;
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Switch statements may only contain one default clause");
}
+ has_default_case = 1;
+ continue;
}
- if (i == ce_num) {
- ce->interfaces[ce->num_interfaces++] = entry;
+
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
+
+ opline = zend_emit_op(NULL, ZEND_CASE, &expr_node, &cond_node TSRMLS_CC);
+ SET_NODE(opline->result, &case_node);
+ if (opline->op1_type == IS_CONST) {
+ zval_copy_ctor(&CONSTANT(opline->op1.constant));
}
- }
- /* and now call the implementing handlers */
- while (ce_num < ce->num_interfaces) {
- do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
+ jmpnz_opnums[i] = zend_emit_cond_jump(ZEND_JMPNZ, &case_node, 0 TSRMLS_CC);
}
-}
-/* }}} */
-#ifdef ZTS
-# define zval_property_ctor(parent_ce, ce) \
- (((parent_ce)->type != (ce)->type) ? ZVAL_COPY_CTOR : zval_add_ref)
-#else
-# define zval_property_ctor(parent_ce, ce) \
- zval_add_ref
-#endif
+ opnum_default_jmp = zend_emit_jump(0 TSRMLS_CC);
-static void do_inherit_class_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
-{
- if (!Z_ISREF_P(zv)) {
- if (parent_ce->type == ZEND_INTERNAL_CLASS) {
- ZVAL_NEW_PERSISTENT_REF(zv, zv);
+ for (i = 0; i < cases->children; ++i) {
+ zend_ast *case_ast = cases->child[i];
+ zend_ast *cond_ast = case_ast->child[0];
+ zend_ast *stmt_ast = case_ast->child[1];
+
+ if (cond_ast) {
+ zend_update_jump_target_to_next(jmpnz_opnums[i] TSRMLS_CC);
} else {
- ZVAL_NEW_REF(zv, zv);
+ zend_update_jump_target_to_next(opnum_default_jmp TSRMLS_CC);
}
+
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
}
- if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+
+ if (!has_default_case) {
+ zend_update_jump_target_to_next(opnum_default_jmp TSRMLS_CC);
}
- if (zend_hash_add(&ce->constants_table, name, zv)) {
- Z_ADDREF_P(zv);
+
+ zend_end_loop(get_next_op_number(CG(active_op_array)), 1 TSRMLS_CC);
+
+ if (expr_node.op_type == IS_VAR || expr_node.op_type == IS_TMP_VAR) {
+ zend_emit_op(NULL, ZEND_FREE,
+ &expr_node, NULL TSRMLS_CC);
+ } else if (expr_node.op_type == IS_CONST) {
+ zval_dtor(&expr_node.u.constant);
}
+
+ zend_stack_del_top(&CG(loop_var_stack));
+ efree(jmpnz_opnums);
}
/* }}} */
-ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
+void zend_compile_try(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_property_info *property_info;
- zend_function *func;
- zend_string *key;
- zval *zv;
+ zend_ast *try_ast = ast->child[0];
+ zend_ast_list *catches = zend_ast_get_list(ast->child[1]);
+ zend_ast *finally_ast = ast->child[2];
- if ((ce->ce_flags & ZEND_ACC_INTERFACE)
- && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val);
- }
- if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
- zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val);
- }
+ uint32_t i;
+ zend_op *opline;
+ uint32_t try_catch_offset = zend_add_try_element(
+ get_next_op_number(CG(active_op_array)) TSRMLS_CC);
+ uint32_t *jmp_opnums = safe_emalloc(sizeof(uint32_t), catches->children, 0);
- ce->parent = parent_ce;
- /* Copy serialize/unserialize callbacks */
- if (!ce->serialize) {
- ce->serialize = parent_ce->serialize;
+ if (catches->children == 0 && !finally_ast) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use try without catch or finally");
}
- if (!ce->unserialize) {
- ce->unserialize = parent_ce->unserialize;
+
+ zend_compile_stmt(try_ast TSRMLS_CC);
+
+ if (catches->children != 0) {
+ jmp_opnums[0] = zend_emit_jump(0 TSRMLS_CC);
}
- /* Inherit interfaces */
- zend_do_inherit_interfaces(ce, parent_ce TSRMLS_CC);
+ for (i = 0; i < catches->children; ++i) {
+ zend_ast *catch_ast = catches->child[i];
+ zend_ast *class_ast = catch_ast->child[0];
+ zend_ast *var_ast = catch_ast->child[1];
+ zend_ast *stmt_ast = catch_ast->child[2];
+ zval *var_name = zend_ast_get_zval(var_ast);
+ zend_bool is_last_catch = (i + 1 == catches->children);
- /* Inherit properties */
- if (parent_ce->default_properties_count) {
- int i = ce->default_properties_count + parent_ce->default_properties_count;
+ uint32_t opnum_catch;
- ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * i, ce->type == ZEND_INTERNAL_CLASS);
- if (ce->default_properties_count) {
- while (i-- > parent_ce->default_properties_count) {
- ce->default_properties_table[i] = ce->default_properties_table[i - parent_ce->default_properties_count];
- }
+ if (!zend_is_const_default_class_ref(class_ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Bad class name in the catch statement");
}
- for (i = 0; i < parent_ce->default_properties_count; i++) {
-#ifdef ZTS
- if (parent_ce->type != ce->type) {
- ZVAL_DUP(&ce->default_properties_table[i], &parent_ce->default_properties_table[i]);
- if (Z_OPT_CONSTANT(ce->default_properties_table[i])) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
- continue;
- }
-#endif
- ZVAL_COPY(&ce->default_properties_table[i], &parent_ce->default_properties_table[i]);
- if (Z_OPT_CONSTANT(ce->default_properties_table[i])) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
+ opnum_catch = get_next_op_number(CG(active_op_array));
+ if (i == 0) {
+ CG(active_op_array)->try_catch_array[try_catch_offset].catch_op = opnum_catch;
}
- ce->default_properties_count += parent_ce->default_properties_count;
- }
- if (parent_ce->type != ce->type) {
- /* User class extends internal class */
- zend_update_class_constants(parent_ce TSRMLS_CC);
- if (parent_ce->default_static_members_count) {
- int i = ce->default_static_members_count + parent_ce->default_static_members_count;
+ CG(zend_lineno) = catch_ast->lineno;
- ce->default_static_members_table = erealloc(ce->default_static_members_table, sizeof(zval) * i);
- if (ce->default_static_members_count) {
- while (i-- > parent_ce->default_static_members_count) {
- ce->default_static_members_table[i] = ce->default_static_members_table[i - parent_ce->default_static_members_count];
- }
- }
- for (i = 0; i < parent_ce->default_static_members_count; i++) {
- ZVAL_MAKE_REF(&CE_STATIC_MEMBERS(parent_ce)[i]);
- ce->default_static_members_table[i] = CE_STATIC_MEMBERS(parent_ce)[i];
- Z_ADDREF(ce->default_static_members_table[i]);
- if (Z_CONSTANT_P(Z_REFVAL(ce->default_static_members_table[i]))) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
- }
- ce->default_static_members_count += parent_ce->default_static_members_count;
- ce->static_members_table = ce->default_static_members_table;
- }
- } else {
- if (parent_ce->default_static_members_count) {
- int i = ce->default_static_members_count + parent_ce->default_static_members_count;
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_CATCH;
+ opline->op1_type = IS_CONST;
+ opline->op1.constant = zend_add_class_name_literal(CG(active_op_array),
+ zend_resolve_class_name_ast(class_ast TSRMLS_CC) TSRMLS_CC);
- ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval) * i, ce->type == ZEND_INTERNAL_CLASS);
- if (ce->default_static_members_count) {
- while (i-- > parent_ce->default_static_members_count) {
- ce->default_static_members_table[i] = ce->default_static_members_table[i - parent_ce->default_static_members_count];
- }
- }
- for (i = 0; i < parent_ce->default_static_members_count; i++) {
- ZVAL_MAKE_REF(&parent_ce->default_static_members_table[i]);
- ce->default_static_members_table[i] = parent_ce->default_static_members_table[i];
- Z_ADDREF(ce->default_static_members_table[i]);
- if (Z_CONSTANT_P(Z_REFVAL(ce->default_static_members_table[i]))) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
- }
- ce->default_static_members_count += parent_ce->default_static_members_count;
- if (ce->type == ZEND_USER_CLASS) {
- ce->static_members_table = ce->default_static_members_table;
- }
+ opline->op2_type = IS_CV;
+ opline->op2.var = lookup_cv(CG(active_op_array), zend_string_copy(Z_STR_P(var_name)) TSRMLS_CC);
+ opline->result.num = is_last_catch;
+
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
+
+ if (!is_last_catch) {
+ jmp_opnums[i + 1] = zend_emit_jump(0 TSRMLS_CC);
}
+
+ opline = &CG(active_op_array)->opcodes[opnum_catch];
+ opline->extended_value = get_next_op_number(CG(active_op_array));
}
- ZEND_HASH_FOREACH_PTR(&ce->properties_info, property_info) {
- if (property_info->ce == ce) {
- if (property_info->flags & ZEND_ACC_STATIC) {
- property_info->offset += parent_ce->default_static_members_count;
- } else {
- property_info->offset += parent_ce->default_properties_count;
- }
- }
- } ZEND_HASH_FOREACH_END();
+ for (i = 0; i < catches->children; ++i) {
+ zend_update_jump_target_to_next(jmp_opnums[i] TSRMLS_CC);
+ }
- ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->properties_info, key, property_info) {
- if (do_inherit_property_access_check(&ce->properties_info, property_info, key, ce TSRMLS_CC)) {
- if (ce->type & ZEND_INTERNAL_CLASS) {
- property_info = zend_duplicate_property_info_internal(property_info);
- } else {
- property_info = zend_duplicate_property_info(property_info TSRMLS_CC);
- }
- zend_hash_add_new_ptr(&ce->properties_info, key, property_info);
- }
- } ZEND_HASH_FOREACH_END();
+ if (finally_ast) {
+ uint32_t opnum_jmp = get_next_op_number(CG(active_op_array)) + 1;
- ZEND_HASH_FOREACH_STR_KEY_VAL(&parent_ce->constants_table, key, zv) {
- do_inherit_class_constant(key, zv, ce, parent_ce TSRMLS_CC);
- } ZEND_HASH_FOREACH_END();
+ opline = zend_emit_op(NULL, ZEND_FAST_CALL, NULL, NULL TSRMLS_CC);
+ opline->op1.opline_num = opnum_jmp + 1;
- ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->function_table, key, func) {
- if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
- zend_function *new_func = do_inherit_method(func TSRMLS_CC);
- zend_hash_add_new_ptr(&ce->function_table, key, new_func);
- }
- } ZEND_HASH_FOREACH_END();
+ zend_emit_op(NULL, ZEND_JMP, NULL, NULL TSRMLS_CC);
- do_inherit_parent_constructor(ce TSRMLS_CC);
+ CG(context).in_finally++;
+ zend_compile_stmt(finally_ast TSRMLS_CC);
+ CG(context).in_finally--;
- if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
- ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
- } else if (!(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
- /* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */
- zend_verify_abstract_class(ce TSRMLS_CC);
- }
- ce->ce_flags |= parent_ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS;
-}
-/* }}} */
+ CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = opnum_jmp + 1;
+ CG(active_op_array)->try_catch_array[try_catch_offset].finally_end
+ = get_next_op_number(CG(active_op_array));
+ CG(active_op_array)->fn_flags |= ZEND_ACC_HAS_FINALLY_BLOCK;
-static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval *parent_constant, zend_string *name, const zend_class_entry *iface) /* {{{ */
-{
- zval *old_constant;
+ zend_emit_op(NULL, ZEND_FAST_RET, NULL, NULL TSRMLS_CC);
- if ((old_constant = zend_hash_find(child_constants_table, name)) != NULL) {
- if (!Z_ISREF_P(old_constant) ||
- !Z_ISREF_P(parent_constant) ||
- Z_REFVAL_P(old_constant) != Z_REFVAL_P(parent_constant)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", name->val, iface->name->val);
- }
- return 0;
+ zend_update_jump_target_to_next(opnum_jmp TSRMLS_CC);
}
- return 1;
-}
-/* }}} */
-static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
-{
- if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
- ZVAL_MAKE_REF(zv);
- Z_ADDREF_P(zv);
- if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
- ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
- zend_hash_update(&ce->constants_table, name, zv);
- }
+ efree(jmp_opnums);
}
/* }}} */
-ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
+/* Encoding declarations must already be handled during parsing */
+void zend_handle_encoding_declaration(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_uint i, ignore = 0;
- zend_uint current_iface_num = ce->num_interfaces;
- zend_uint parent_iface_num = ce->parent ? ce->parent->num_interfaces : 0;
- zend_function *func;
- zend_string *key;
- zval *zv;
+ zend_ast_list *declares = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < declares->children; ++i) {
+ zend_ast *declare_ast = declares->child[i];
+ zend_ast *name_ast = declare_ast->child[0];
+ zend_ast *value_ast = declare_ast->child[1];
+ zend_string *name = zend_ast_get_str(name_ast);
- for (i = 0; i < ce->num_interfaces; i++) {
- if (ce->interfaces[i] == NULL) {
- memmove(ce->interfaces + i, ce->interfaces + i + 1, sizeof(zend_class_entry*) * (--ce->num_interfaces - i));
- i--;
- } else if (ce->interfaces[i] == iface) {
- if (i < parent_iface_num) {
- ignore = 1;
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name->val, iface->name->val);
- }
- }
- }
- if (ignore) {
- /* Check for attempt to redeclare interface constants */
- ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, zv) {
- do_inherit_constant_check(&iface->constants_table, zv, key, iface);
- } ZEND_HASH_FOREACH_END();
- } else {
- if (ce->num_interfaces >= current_iface_num) {
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
- } else {
- ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
+ if (zend_string_equals_literal_ci(name, "encoding")) {
+ if (value_ast->kind != ZEND_AST_ZVAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Encoding must be a literal");
}
- }
- ce->interfaces[ce->num_interfaces++] = iface;
- ZEND_HASH_FOREACH_STR_KEY_VAL(&iface->constants_table, key, zv) {
- do_inherit_iface_constant(key, zv, ce, iface TSRMLS_CC);
- } ZEND_HASH_FOREACH_END();
+ if (CG(multibyte)) {
+ zend_string *encoding_name = zval_get_string(zend_ast_get_zval(value_ast));
- ZEND_HASH_FOREACH_STR_KEY_PTR(&iface->function_table, key, func) {
- if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
- zend_function *new_func = do_inherit_method(func TSRMLS_CC);
- zend_hash_add_new_ptr(&ce->function_table, key, new_func);
- }
- } ZEND_HASH_FOREACH_END();
+ const zend_encoding *new_encoding, *old_encoding;
+ zend_encoding_filter old_input_filter;
- do_implement_interface(ce, iface TSRMLS_CC);
- zend_do_inherit_interfaces(ce, iface TSRMLS_CC);
- }
-}
-/* }}} */
+ CG(encoding_declared) = 1;
-ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
-{
- zend_uint i, ignore = 0;
- zend_uint current_trait_num = ce->num_traits;
- zend_uint parent_trait_num = ce->parent ? ce->parent->num_traits : 0;
+ new_encoding = zend_multibyte_fetch_encoding(encoding_name->val TSRMLS_CC);
+ if (!new_encoding) {
+ zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", encoding_name->val);
+ } else {
+ old_input_filter = LANG_SCNG(input_filter);
+ old_encoding = LANG_SCNG(script_encoding);
+ zend_multibyte_set_filter(new_encoding TSRMLS_CC);
+
+ /* need to re-scan if input filter changed */
+ if (old_input_filter != LANG_SCNG(input_filter) ||
+ (old_input_filter && new_encoding != old_encoding)) {
+ zend_multibyte_yyinput_again(old_input_filter, old_encoding TSRMLS_CC);
+ }
+ }
- for (i = 0; i < ce->num_traits; i++) {
- if (ce->traits[i] == NULL) {
- memmove(ce->traits + i, ce->traits + i + 1, sizeof(zend_class_entry*) * (--ce->num_traits - i));
- i--;
- } else if (ce->traits[i] == trait) {
- if (i < parent_trait_num) {
- ignore = 1;
- }
- }
- }
- if (!ignore) {
- if (ce->num_traits >= current_trait_num) {
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->traits = (zend_class_entry **) realloc(ce->traits, sizeof(zend_class_entry *) * (++current_trait_num));
+ zend_string_release(encoding_name);
} else {
- ce->traits = (zend_class_entry **) erealloc(ce->traits, sizeof(zend_class_entry *) * (++current_trait_num));
+ zend_error(E_COMPILE_WARNING, "declare(encoding=...) ignored because "
+ "Zend multibyte feature is turned off by settings");
}
}
- ce->traits[ce->num_traits++] = trait;
- }
-}
-/* }}} */
-
-static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_function *other_fn TSRMLS_DC) /* {{{ */
-{
- zend_uint fn_flags = fn->common.scope->ce_flags;
- zend_uint other_flags = other_fn->common.scope->ce_flags;
-
- return zend_do_perform_implementation_check(fn, other_fn TSRMLS_CC)
- && ((other_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) || zend_do_perform_implementation_check(other_fn, fn TSRMLS_CC))
- && ((fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC)) ==
- (other_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC))); /* equal final and static qualifier */
-}
-/* }}} */
-
-static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe TSRMLS_DC) /* {{{ */
-{
- if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) {
- ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
- } else if (!strncmp(mname->val, ZEND_CONSTRUCTOR_FUNC_NAME, mname->len)) {
- if (ce->constructor) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val);
- }
- ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
- } else if (!strncmp(mname->val, ZEND_DESTRUCTOR_FUNC_NAME, mname->len)) {
- ce->destructor = fe; fe->common.fn_flags |= ZEND_ACC_DTOR;
- } else if (!strncmp(mname->val, ZEND_GET_FUNC_NAME, mname->len)) {
- ce->__get = fe;
- } else if (!strncmp(mname->val, ZEND_SET_FUNC_NAME, mname->len)) {
- ce->__set = fe;
- } else if (!strncmp(mname->val, ZEND_CALL_FUNC_NAME, mname->len)) {
- ce->__call = fe;
- } else if (!strncmp(mname->val, ZEND_UNSET_FUNC_NAME, mname->len)) {
- ce->__unset = fe;
- } else if (!strncmp(mname->val, ZEND_ISSET_FUNC_NAME, mname->len)) {
- ce->__isset = fe;
- } else if (!strncmp(mname->val, ZEND_CALLSTATIC_FUNC_NAME, mname->len)) {
- ce->__callstatic = fe;
- } else if (!strncmp(mname->val, ZEND_TOSTRING_FUNC_NAME, mname->len)) {
- ce->__tostring = fe;
- } else if (!strncmp(mname->val, ZEND_DEBUGINFO_FUNC_NAME, mname->len)) {
- ce->__debugInfo = fe;
- } else if (ce->name->len == mname->len) {
- zend_string *lowercase_name = STR_ALLOC(ce->name->len, 0);
- zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len);
- lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
- if (!memcmp(mname->val, lowercase_name->val, mname->len)) {
- if (ce->constructor) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val);
- }
- ce->constructor = fe;
- fe->common.fn_flags |= ZEND_ACC_CTOR;
- }
- STR_RELEASE(lowercase_name);
}
}
/* }}} */
-static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
+void zend_compile_declare(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_function *existing_fn = NULL;
- zend_function *new_fn;
+ zend_ast_list *declares = zend_ast_get_list(ast->child[0]);
+ zend_ast *stmt_ast = ast->child[1];
+ zend_declarables orig_declarables = CG(declarables);
+ uint32_t i;
- if ((existing_fn = zend_hash_find_ptr(&ce->function_table, key)) != NULL) {
- if (existing_fn->common.scope == ce) {
- /* members from the current class override trait methods */
- /* use temporary *overriden HashTable to detect hidden conflict */
- if (*overriden) {
- if ((existing_fn = zend_hash_find_ptr(*overriden, key)) != NULL) {
- if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- /* Make sure the trait method is compatible with previosly declared abstract method */
- if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
- zend_get_function_declaration(fn TSRMLS_CC),
- zend_get_function_declaration(existing_fn TSRMLS_CC));
- }
- } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- /* Make sure the abstract declaration is compatible with previous declaration */
- if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
- zend_get_function_declaration(fn TSRMLS_CC),
- zend_get_function_declaration(existing_fn TSRMLS_CC));
- }
- return;
- }
- }
- } else {
- ALLOC_HASHTABLE(*overriden);
- zend_hash_init_ex(*overriden, 8, NULL, ptr_dtor, 0, 0);
- }
- fn = zend_hash_update_mem(*overriden, key, fn, sizeof(zend_function));
- return;
- } else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- /* Make sure the trait method is compatible with previosly declared abstract method */
- if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
- zend_get_function_declaration(fn TSRMLS_CC),
- zend_get_function_declaration(existing_fn TSRMLS_CC));
+ for (i = 0; i < declares->children; ++i) {
+ zend_ast *declare_ast = declares->child[i];
+ zend_ast *name_ast = declare_ast->child[0];
+ zend_ast *value_ast = declare_ast->child[1];
+
+ zend_string *name = zend_ast_get_str(name_ast);
+ if (zend_string_equals_literal_ci(name, "ticks")) {
+ zval value_zv;
+ zend_const_expr_to_zval(&value_zv, value_ast TSRMLS_CC);
+ convert_to_long(&value_zv);
+ ZVAL_COPY_VALUE(&CG(declarables).ticks, &value_zv);
+ zval_dtor(&value_zv);
+ } else if (zend_string_equals_literal_ci(name, "encoding")) {
+ /* Encoding declaration was already handled during parsing. Here we
+ * only check that it is the first statement in the file. */
+ uint32_t num = CG(active_op_array)->last;
+ while (num > 0 &&
+ (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
+ CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
+ --num;
}
- } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- /* Make sure the abstract declaration is compatible with previous declaration */
- if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
- zend_get_function_declaration(fn TSRMLS_CC),
- zend_get_function_declaration(existing_fn TSRMLS_CC));
+
+ if (num > 0) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be "
+ "the very first statement in the script");
}
- return;
- } else if ((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- /* two traits can't define the same non-abstract method */
-#if 1
- zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s",
- name, ce->name->val);
-#else /* TODO: better error message */
- zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s",
- fn->common.scope->name->val, fn->common.function_name->val,
- ce->name->val, name,
- existing_fn->common.scope->name->val, existing_fn->common.function_name->val);
-#endif
} else {
- /* inherited members are overridden by members inserted by traits */
- /* check whether the trait method fulfills the inheritance requirements */
- do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
+ zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", name->val);
}
}
- function_add_ref(fn);
- new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(new_fn, fn, sizeof(zend_op_array));
- fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
- zend_add_magic_methods(ce, key, fn TSRMLS_CC);
+ if (stmt_ast) {
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
+
+ CG(declarables) = orig_declarables;
+ }
}
/* }}} */
-static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /* {{{ */
+void zend_compile_stmt_list(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if ((fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
-
- fn->common.scope = ce;
-
- if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
- ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
- }
- if (fn->op_array.static_variables) {
- ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
- }
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; ++i) {
+ zend_compile_stmt(list->child[i] TSRMLS_CC);
}
}
/* }}} */
-static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, zend_class_entry *ce, HashTable **overriden, HashTable *exclude_table TSRMLS_DC) /* {{{ */
+void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_trait_alias *alias, **alias_ptr;
- zend_string *lcname;
- zend_function fn_copy;
-
- /* apply aliases which are qualified with a class name, there should not be any ambiguity */
- if (ce->trait_aliases) {
- alias_ptr = ce->trait_aliases;
- alias = *alias_ptr;
- while (alias) {
- /* Scope unset or equal to the function we compare to, and the alias applies to fn */
- if (alias->alias != NULL
- && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
- && alias->trait_method->method_name->len == fnname->len
- && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) {
- fn_copy = *fn;
-
- /* if it is 0, no modifieres has been changed */
- if (alias->modifiers) {
- fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
- }
-
- lcname = STR_ALLOC(alias->alias->len, 0);
- zend_str_tolower_copy(lcname->val, alias->alias->val, alias->alias->len);
- zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden TSRMLS_CC);
- STR_RELEASE(lcname);
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ zend_op_array *op_array = CG(active_op_array);
+ zend_arg_info *arg_infos;
- /* Record the trait from which this alias was resolved. */
- if (!alias->trait_method->ce) {
- alias->trait_method->ce = fn->common.scope;
- }
- }
- alias_ptr++;
- alias = *alias_ptr;
- }
+ if (list->children == 0) {
+ return;
}
+
+ arg_infos = safe_emalloc(sizeof(zend_arg_info), list->children, 0);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *param_ast = list->child[i];
+ zend_ast *type_ast = param_ast->child[0];
+ zend_ast *var_ast = param_ast->child[1];
+ zend_ast *default_ast = param_ast->child[2];
+ zend_string *name = zend_ast_get_str(var_ast);
+ zend_bool is_ref = (param_ast->attr & ZEND_PARAM_REF) != 0;
+ zend_bool is_variadic = (param_ast->attr & ZEND_PARAM_VARIADIC) != 0;
+
+ znode var_node, default_node;
+ zend_uchar opcode;
+ zend_op *opline;
+ zend_arg_info *arg_info;
- if (exclude_table == NULL || zend_hash_find(exclude_table, fnname) == NULL) {
- /* is not in hashtable, thus, function is not to be excluded */
- fn_copy = *fn;
-
- /* apply aliases which have not alias name, just setting visibility */
- if (ce->trait_aliases) {
- alias_ptr = ce->trait_aliases;
- alias = *alias_ptr;
- while (alias) {
- /* Scope unset or equal to the function we compare to, and the alias applies to fn */
- if (alias->alias == NULL && alias->modifiers != 0
- && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
- && (alias->trait_method->method_name->len == fnname->len)
- && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) {
+ if (zend_is_auto_global(name TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s",
+ name->val);
+ }
- fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
+ var_node.op_type = IS_CV;
+ var_node.u.op.var = lookup_cv(CG(active_op_array), zend_string_copy(name) TSRMLS_CC);
- /** Record the trait from which this alias was resolved. */
- if (!alias->trait_method->ce) {
- alias->trait_method->ce = fn->common.scope;
- }
- }
- alias_ptr++;
- alias = *alias_ptr;
+ if (EX_VAR_TO_NUM(var_node.u.op.var) != i) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s",
+ name->val);
+ } else if (zend_string_equals_literal(name, "this")) {
+ if (op_array->scope && (op_array->fn_flags & ZEND_ACC_STATIC) == 0) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
}
+ op_array->this_var = var_node.u.op.var;
}
- zend_add_trait_method(ce, fn->common.function_name->val, fnname, &fn_copy, overriden TSRMLS_CC);
- }
-
- return ZEND_HASH_APPLY_KEEP;
-}
-/* }}} */
-
-static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
-{
- zend_uint i;
-
- if ((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name->val);
- }
-
- for (i = 0; i < ce->num_traits; i++) {
- if (ce->traits[i] == trait) {
- return;
+ if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Only the last parameter can be variadic");
}
- }
- zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name->val, ce->name->val);
-}
-/* }}} */
-static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* {{{ */
-{
- size_t i, j = 0;
- zend_trait_precedence *cur_precedence;
- zend_trait_method_reference *cur_method_ref;
- zend_string *lcname;
- zend_bool method_exists;
-
- /* resolve class references */
- if (ce->trait_precedences) {
- i = 0;
- while ((cur_precedence = ce->trait_precedences[i])) {
- /** Resolve classes for all precedence operations. */
- if (cur_precedence->exclude_from_classes) {
- cur_method_ref = cur_precedence->trait_method;
- if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name,
- ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
- }
- zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
-
- /** Ensure that the prefered method is actually available. */
- lcname = STR_ALLOC(cur_method_ref->method_name->len, 0);
- zend_str_tolower_copy(lcname->val,
- cur_method_ref->method_name->val,
- cur_method_ref->method_name->len);
- method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
- lcname);
- STR_FREE(lcname);
- if (!method_exists) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "A precedence rule was defined for %s::%s but this method does not exist",
- cur_method_ref->ce->name->val,
- cur_method_ref->method_name->val);
- }
+ if (is_variadic) {
+ opcode = ZEND_RECV_VARIADIC;
+ default_node.op_type = IS_UNUSED;
+ op_array->fn_flags |= ZEND_ACC_VARIADIC;
- /** With the other traits, we are more permissive.
- We do not give errors for those. This allows to be more
- defensive in such definitions.
- However, we want to make sure that the insteadof declaration
- is consistent in itself.
- */
- j = 0;
- while (cur_precedence->exclude_from_classes[j].class_name) {
- zend_string* class_name = cur_precedence->exclude_from_classes[j].class_name;
-
- if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name->val);
+ if (default_ast) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Variadic parameter cannot have a default value");
+ }
+ } else if (default_ast) {
+ opcode = ZEND_RECV_INIT;
+ default_node.op_type = IS_CONST;
+ zend_const_expr_to_zval(&default_node.u.constant, default_ast TSRMLS_CC);
+ } else {
+ opcode = ZEND_RECV;
+ default_node.op_type = IS_UNUSED;
+ op_array->required_num_args = i + 1;
+ }
+
+ opline = zend_emit_op(NULL, opcode, NULL, &default_node TSRMLS_CC);
+ SET_NODE(opline->result, &var_node);
+ opline->op1.num = i + 1;
+
+ arg_info = &arg_infos[i];
+ arg_info->name = estrndup(name->val, name->len);
+ arg_info->name_len = name->len;
+ arg_info->pass_by_reference = is_ref;
+ arg_info->is_variadic = is_variadic;
+ arg_info->type_hint = 0;
+ arg_info->allow_null = 1;
+ arg_info->class_name = NULL;
+ arg_info->class_name_len = 0;
+
+ if (type_ast) {
+ zend_bool has_null_default = default_ast
+ && (Z_TYPE(default_node.u.constant) == IS_NULL
+ || (Z_TYPE(default_node.u.constant) == IS_CONSTANT
+ && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)
+ || Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST); // ???
+
+ op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
+ arg_info->allow_null = has_null_default;
+
+ if (type_ast->kind == ZEND_AST_TYPE) {
+ arg_info->type_hint = type_ast->attr;
+ if (arg_info->type_hint == IS_ARRAY) {
+ if (default_ast && !has_null_default
+ && Z_TYPE(default_node.u.constant) != IS_ARRAY
+ ) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
+ "with array type hint can only be an array or NULL");
}
- zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce TSRMLS_CC);
-
- /* make sure that the trait method is not from a class mentioned in
- exclude_from_classes, for consistency */
- if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i].ce) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Inconsistent insteadof definition. "
- "The method %s is to be used from %s, but %s is also on the exclude list",
- cur_method_ref->method_name->val,
- cur_precedence->trait_method->ce->name->val,
- cur_precedence->trait_method->ce->name->val);
+ } else if (arg_info->type_hint == IS_CALLABLE && default_ast) {
+ if (!has_null_default) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
+ "with callable type hint can only be NULL");
}
-
- STR_RELEASE(class_name);
- j++;
}
- }
- i++;
- }
- }
+ } else {
+ zend_string *class_name = zend_ast_get_str(type_ast);
- if (ce->trait_aliases) {
- i = 0;
- while (ce->trait_aliases[i]) {
- /** For all aliases with an explicit class name, resolve the class now. */
- if (ce->trait_aliases[i]->trait_method->class_name) {
- cur_method_ref = ce->trait_aliases[i]->trait_method;
- if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
- }
- zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC);
-
- /** And, ensure that the referenced method is resolvable, too. */
- lcname = STR_ALLOC(cur_method_ref->method_name->len, 0);
- zend_str_tolower_copy(lcname->val,
- cur_method_ref->method_name->val,
- cur_method_ref->method_name->len);
- method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
- lcname);
- STR_FREE(lcname);
-
- if (!method_exists) {
- zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name->val, cur_method_ref->method_name->val);
+ if (zend_is_const_default_class_ref(type_ast)) {
+ class_name = zend_resolve_class_name_ast(type_ast TSRMLS_CC);
+ } else {
+ zend_string_addref(class_name);
}
- }
- i++;
- }
- }
-}
-/* }}} */
-static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_trait_precedence **precedences, zend_class_entry *trait) /* {{{ */
-{
- size_t i = 0, j;
+ arg_info->type_hint = IS_OBJECT;
+ arg_info->class_name = estrndup(class_name->val, class_name->len);
+ arg_info->class_name_len = class_name->len;
- if (!precedences) {
- return;
- }
- while (precedences[i]) {
- if (precedences[i]->exclude_from_classes) {
- j = 0;
- while (precedences[i]->exclude_from_classes[j].ce) {
- if (precedences[i]->exclude_from_classes[j].ce == trait) {
- zend_string *lcname = STR_ALLOC(precedences[i]->trait_method->method_name->len, 0);
-
- zend_str_tolower_copy(lcname->val,
- precedences[i]->trait_method->method_name->val,
- precedences[i]->trait_method->method_name->len);
- if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) {
- STR_RELEASE(lcname);
- zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name->val, trait->name->val);
- }
- STR_RELEASE(lcname);
+ zend_string_release(class_name);
+
+ if (default_ast && !has_null_default) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
+ "with a class type hint can only be NULL");
}
- ++j;
}
}
- ++i;
}
+
+ /* These are assigned at the end to avoid unitialized memory in case of an error */
+ op_array->num_args = list->children;
+ op_array->arg_info = arg_infos;
}
/* }}} */
-static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+void zend_compile_closure_uses(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_uint i;
- HashTable *overriden = NULL;
- zend_string *key;
- zend_function *fn;
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
- for (i = 0; i < ce->num_traits; i++) {
- if (ce->trait_precedences) {
- HashTable exclude_table;
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *var_ast = list->child[i];
+ zend_string *name = zend_ast_get_str(var_ast);
+ zend_bool by_ref = var_ast->attr;
+ zval zv;
- /* TODO: revisit this start size, may be its not optimal */
- zend_hash_init_ex(&exclude_table, 8, NULL, NULL, 0, 0);
-
- zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
-
- /* copies functions, applies defined aliasing, and excludes unused trait methods */
- ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
- zend_traits_copy_functions(key, fn, ce, &overriden, &exclude_table TSRMLS_CC);
- } ZEND_HASH_FOREACH_END();
-
- zend_hash_destroy(&exclude_table);
- } else {
- ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
- zend_traits_copy_functions(key, fn, ce, &overriden, NULL TSRMLS_CC);
- } ZEND_HASH_FOREACH_END();
+ if (zend_string_equals_literal(name, "this")) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable");
}
- }
- ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) {
- zend_fixup_trait_method(fn, ce);
- } ZEND_HASH_FOREACH_END();
+ ZVAL_NULL(&zv);
+ Z_CONST_FLAGS(zv) = by_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
- if (overriden) {
- zend_hash_destroy(overriden);
- FREE_HASHTABLE(overriden);
+ zend_compile_static_var_common(var_ast, &zv, by_ref TSRMLS_CC);
}
}
/* }}} */
-static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, zend_string *prop_name, zend_class_entry *coliding_ce) /* {{{ */
+void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_bool has_body TSRMLS_DC) /* {{{ */
{
- size_t i;
+ zend_class_entry *ce = CG(active_class_entry);
+ zend_bool in_interface = (ce->ce_flags & ZEND_ACC_INTERFACE) != 0;
+ zend_bool in_trait = ZEND_CE_IS_TRAIT(ce);
+ zend_bool is_public = (op_array->fn_flags & ZEND_ACC_PUBLIC) != 0;
+ zend_bool is_static = (op_array->fn_flags & ZEND_ACC_STATIC) != 0;
- if (coliding_ce == ce) {
- for (i = 0; i < current_trait; i++) {
- if (zend_hash_exists(&ce->traits[i]->properties_info, prop_name)) {
- return ce->traits[i];
- }
+ zend_string *lcname;
+
+ if (in_interface) {
+ if ((op_array->fn_flags & ZEND_ACC_PPP_MASK) != ZEND_ACC_PUBLIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method "
+ "%s::%s() must be omitted", ce->name->val, name->val);
}
+ op_array->fn_flags |= ZEND_ACC_ABSTRACT;
+ } else if (is_static && (op_array->fn_flags & ZEND_ACC_ABSTRACT)) {
+ zend_error(E_STRICT, "Static function %s::%s() should not be abstract",
+ ce->name->val, name->val);
}
- return coliding_ce;
-}
-/* }}} */
-
-static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
-{
- size_t i;
- zend_property_info *property_info;
- zend_property_info *coliding_prop;
- zval compare_result;
- zend_string* prop_name;
- const char* class_name_unused;
- zend_bool not_compatible;
- zval* prop_value;
- zend_uint flags;
- zend_string *doc_comment;
-
- /* In the following steps the properties are inserted into the property table
- * for that, a very strict approach is applied:
- * - check for compatibility, if not compatible with any property in class -> fatal
- * - if compatible, then strict notice
- */
- for (i = 0; i < ce->num_traits; i++) {
- ZEND_HASH_FOREACH_PTR(&ce->traits[i]->properties_info, property_info) {
- /* first get the unmangeld name if necessary,
- * then check whether the property is already there
- */
- flags = property_info->flags;
- if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
- prop_name = STR_COPY(property_info->name);
- } else {
- const char *pname;
- int pname_len;
+ if (op_array->fn_flags & ZEND_ACC_ABSTRACT) {
+ if (op_array->fn_flags & ZEND_ACC_PRIVATE) {
+ zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private",
+ in_interface ? "Interface" : "Abstract", ce->name->val, name->val);
+ }
- /* for private and protected we need to unmangle the names */
- zend_unmangle_property_name_ex(property_info->name->val, property_info->name->len,
- &class_name_unused, &pname, &pname_len);
- prop_name = STR_INIT(pname, pname_len, 0);
- }
+ if (has_body) {
+ zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body",
+ in_interface ? "Interface" : "Abstract", ce->name->val, name->val);
+ }
- /* next: check for conflicts with current class */
- if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
- if (coliding_prop->flags & ZEND_ACC_SHADOW) {
- zend_hash_del(&ce->properties_info, prop_name);
- flags |= ZEND_ACC_CHANGED;
- } else {
- if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
- == (flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
- /* flags are identical, now the value needs to be checked */
- if (flags & ZEND_ACC_STATIC) {
- not_compatible = (FAILURE == compare_function(&compare_result,
- &ce->default_static_members_table[coliding_prop->offset],
- &ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
- || (Z_IVAL(compare_result) != 0);
- } else {
- not_compatible = (FAILURE == compare_function(&compare_result,
- &ce->default_properties_table[coliding_prop->offset],
- &ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
- || (Z_IVAL(compare_result) != 0);
- }
- } else {
- /* the flags are not identical, thus, we assume properties are not compatible */
- not_compatible = 1;
- }
+ ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ } else if (!has_body) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body",
+ ce->name->val, name->val);
+ }
- if (not_compatible) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
- find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
- property_info->ce->name->val,
- prop_name->val,
- ce->name->val);
- } else {
- zend_error(E_STRICT,
- "%s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed",
- find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
- property_info->ce->name->val,
- prop_name->val,
- ce->name->val);
- STR_RELEASE(prop_name);
- continue;
- }
- }
- }
+ op_array->scope = ce;
+ op_array->function_name = zend_string_copy(name);
- /* property not found, so lets add it */
- if (flags & ZEND_ACC_STATIC) {
- prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
- } else {
- prop_value = &ce->traits[i]->default_properties_table[property_info->offset];
- }
- if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value);
+ lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
+ lcname = zend_new_interned_string(lcname TSRMLS_CC);
- doc_comment = property_info->doc_comment ? STR_COPY(property_info->doc_comment) : NULL;
- zend_declare_property_ex(ce, prop_name,
- prop_value, flags,
- doc_comment TSRMLS_CC);
- STR_RELEASE(prop_name);
- } ZEND_HASH_FOREACH_END();
+ if (zend_hash_add_ptr(&ce->function_table, lcname, op_array) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()",
+ ce->name->val, name->val);
}
-}
-/* }}} */
-static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce TSRMLS_DC) /* {{{ */
-{
- int i = 0;
- zend_trait_alias* cur_alias;
- zend_string* lc_method_name;
-
- if (ce->trait_aliases) {
- while (ce->trait_aliases[i]) {
- cur_alias = ce->trait_aliases[i];
- /** The trait for this alias has not been resolved, this means, this
- alias was not applied. Abort with an error. */
- if (!cur_alias->trait_method->ce) {
- if (cur_alias->alias) {
- /** Plain old inconsistency/typo/bug */
- zend_error_noreturn(E_COMPILE_ERROR,
- "An alias (%s) was defined for method %s(), but this method does not exist",
- cur_alias->alias->val,
- cur_alias->trait_method->method_name->val);
- } else {
- /** Here are two possible cases:
- 1) this is an attempt to modifiy the visibility
- of a method introduce as part of another alias.
- Since that seems to violate the DRY principle,
- we check against it and abort.
- 2) it is just a plain old inconsitency/typo/bug
- as in the case where alias is set. */
-
- lc_method_name = STR_ALLOC(cur_alias->trait_method->method_name->len, 0);
- zend_str_tolower_copy(
- lc_method_name->val,
- cur_alias->trait_method->method_name->val,
- cur_alias->trait_method->method_name->len);
- if (zend_hash_exists(&ce->function_table,
- lc_method_name)) {
- STR_FREE(lc_method_name);
- zend_error_noreturn(E_COMPILE_ERROR,
- "The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error",
- cur_alias->trait_method->method_name->val);
- } else {
- STR_FREE(lc_method_name);
- zend_error_noreturn(E_COMPILE_ERROR,
- "The modifiers of the trait method %s() are changed, but this method does not exist. Error",
- cur_alias->trait_method->method_name->val);
-
- }
- }
+ if (in_interface) {
+ if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __call() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
+ if (!is_public || !is_static) {
+ zend_error(E_WARNING, "The magic method __callStatic() must have "
+ "public visibility and be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __get() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __set() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __unset() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __isset() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __toString() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __invoke() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __debugInfo() must have "
+ "public visibility and cannot be static");
+ }
+ }
+ } else {
+ if (!in_trait && zend_string_equals_str_ci(lcname, ce->name)) {
+ if (!ce->constructor) {
+ ce->constructor = (zend_function *) op_array;
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
+ if (CG(active_class_entry)->constructor) {
+ zend_error(E_STRICT, "Redefining already defined constructor for class %s",
+ ce->name->val);
+ }
+ ce->constructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) {
+ ce->destructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
+ ce->clone = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __call() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__call = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
+ if (!is_public || !is_static) {
+ zend_error(E_WARNING, "The magic method __callStatic() must have "
+ "public visibility and be static");
+ }
+ ce->__callstatic = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __get() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__get = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __set() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__set = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __unset() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__unset = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __isset() must have "
+ "public visibility and cannot be static");
}
- i++;
+ ce->__isset = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __toString() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__tostring = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __invoke() must have "
+ "public visibility and cannot be static");
+ }
+ } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
+ if (!is_public || is_static) {
+ zend_error(E_WARNING, "The magic method __debugInfo() must have "
+ "public visibility and cannot be static");
+ }
+ ce->__debugInfo = (zend_function *) op_array;
+ } else if (!is_static) {
+ op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;
}
}
+
+ zend_string_release(lcname);
}
/* }}} */
-ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl TSRMLS_DC) /* {{{ */
{
+ zend_ast *params_ast = decl->child[0];
+ zend_string *name = decl->name, *lcname;
+ zend_op *opline;
- if (ce->num_traits <= 0) {
- return;
- }
+ op_array->function_name = name = zend_prefix_with_ns(name TSRMLS_CC);
- /* complete initialization of trait strutures in ce */
- zend_traits_init_trait_structures(ce TSRMLS_CC);
+ lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
- /* first care about all methods to be flattened into the class */
- zend_do_traits_method_binding(ce TSRMLS_CC);
+ if (CG(current_import_function)) {
+ zend_string *import_name = zend_hash_find_ptr(CG(current_import_function), lcname);
+ if (import_name && !zend_string_equals_str_ci(lcname, import_name)) {
+ zend_error(E_COMPILE_ERROR, "Cannot declare function %s "
+ "because the name is already in use", name->val);
+ }
+ }
+
+ if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)
+ && zend_ast_get_list(params_ast)->children != 1
+ ) {
+ zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
+ ZEND_AUTOLOAD_FUNC_NAME);
+ }
- /* Aliases which have not been applied indicate typos/bugs. */
- zend_do_check_for_inconsistent_traits_aliasing(ce TSRMLS_CC);
+ if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
+ opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL TSRMLS_CC);
+ } else {
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_DECLARE_FUNCTION;
+ opline->op2_type = IS_CONST;
+ LITERAL_STR(opline->op2, zend_string_copy(lcname));
+ }
- /* then flatten the properties into it, to, mostly to notfiy developer about problems */
- zend_do_traits_property_binding(ce TSRMLS_CC);
+ {
+ zend_string *key = zend_build_runtime_definition_key(lcname, decl->lex_pos TSRMLS_CC);
- /* verify that all abstract methods from traits have been implemented */
- zend_verify_abstract_class(ce TSRMLS_CC);
+ opline->op1_type = IS_CONST;
+ LITERAL_STR(opline->op1, key);
- /* now everything should be fine and an added ZEND_ACC_IMPLICIT_ABSTRACT_CLASS should be removed */
- if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) {
- ce->ce_flags -= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ zend_hash_update_ptr(CG(function_table), key, op_array);
}
+
+ zend_string_release(lcname);
}
/* }}} */
-ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time TSRMLS_DC) /* {{{ */
+void zend_compile_func_decl(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_function *function, *new_function;
- zval *op1, *op2;
+ zend_ast_decl *decl = (zend_ast_decl *) ast;
+ zend_ast *params_ast = decl->child[0];
+ zend_ast *uses_ast = decl->child[1];
+ zend_ast *stmt_ast = decl->child[2];
+ zend_bool is_method = decl->kind == ZEND_AST_METHOD;
- if (compile_time) {
- op1 = &CONSTANT_EX(op_array, opline->op1.constant);
- op2 = &CONSTANT_EX(op_array, opline->op2.constant);
- } else {
- op1 = opline->op1.zv;
- op2 = opline->op2.zv;
- }
+ zend_op_array *orig_op_array = CG(active_op_array);
+ zend_op_array *op_array = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- function = zend_hash_find_ptr(function_table, Z_STR_P(op1));
- new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(new_function, function, sizeof(zend_op_array));
- if (zend_hash_add_ptr(function_table, Z_STR_P(op2), new_function) == NULL) {
- int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
- zend_function *old_function;
+ // TODO.AST interactive (not just here - also bpc etc!)
+
+ init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- efree(new_function);
- if ((old_function = zend_hash_find_ptr(function_table, Z_STR_P(op2))) != NULL
- && old_function->type == ZEND_USER_FUNCTION
- && old_function->op_array.last > 0) {
- zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
- function->common.function_name->val,
- old_function->op_array.filename->val,
- old_function->op_array.opcodes[0].lineno);
- } else {
- zend_error(error_level, "Cannot redeclare %s()", function->common.function_name->val);
- }
- return FAILURE;
- } else {
- (*function->op_array.refcount)++;
- function->op_array.static_variables = NULL; /* NULL out the unbound function */
- return SUCCESS;
+ op_array->fn_flags |= decl->flags;
+ op_array->line_start = decl->start_lineno;
+ op_array->line_end = decl->end_lineno;
+ if (decl->doc_comment) {
+ op_array->doc_comment = zend_string_copy(decl->doc_comment);
+ }
+ if (decl->kind == ZEND_AST_CLOSURE) {
+ op_array->fn_flags |= ZEND_ACC_CLOSURE;
}
-}
-/* }}} */
-
-void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC) /* {{{ */
-{
- zend_trait_method_reference *method_ref = emalloc(sizeof(zend_trait_method_reference));
- method_ref->ce = NULL;
- /* REM: There should not be a need for copying,
- zend_do_begin_class_declaration is also just using that string */
- if (class_name) {
- zend_resolve_class_name(class_name TSRMLS_CC);
- method_ref->class_name = Z_STR(class_name->u.constant);
+ if (is_method) {
+ zend_bool has_body = stmt_ast != NULL;
+ zend_begin_method_decl(op_array, decl->name, has_body TSRMLS_CC);
} else {
- method_ref->class_name = NULL;
+ zend_begin_func_decl(result, op_array, decl TSRMLS_CC);
}
- method_ref->method_name = Z_STR(method_name->u.constant);
+ CG(active_op_array) = op_array;
+ zend_stack_push(&CG(context_stack), (void *) &CG(context));
+ zend_init_compiler_context(TSRMLS_C);
- result->u.op.ptr = method_ref;
- result->op_type = IS_TMP_VAR;
-}
-/* }}} */
+ if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
+ zend_op *opline_ext = zend_emit_op(NULL, ZEND_EXT_NOP, NULL, NULL TSRMLS_CC);
+ opline_ext->lineno = decl->start_lineno;
+ }
-void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC) /* {{{ */
-{
- zend_class_entry *ce = CG(active_class_entry);
- zend_trait_alias *trait_alias;
+ {
+ /* Push a separator to the loop variable stack */
+ znode dummy_var;
+ dummy_var.op_type = IS_UNUSED;
- if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier");
- return;
- } else if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier");
- return;
- } else if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier");
- return;
+ zend_stack_push(&CG(loop_var_stack), (void *) &dummy_var);
}
- trait_alias = emalloc(sizeof(zend_trait_alias));
- trait_alias->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
- trait_alias->modifiers = Z_IVAL(modifiers->u.constant);
- if (alias) {
- trait_alias->alias = Z_STR(alias->u.constant);
- } else {
- trait_alias->alias = NULL;
+ zend_compile_params(params_ast TSRMLS_CC);
+ if (uses_ast) {
+ zend_compile_closure_uses(uses_ast TSRMLS_CC);
}
- zend_add_to_list(&ce->trait_aliases, trait_alias TSRMLS_CC);
-}
-/* }}} */
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
-void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS_DC) /* {{{ */
-{
- zend_class_entry *ce = CG(active_class_entry);
- zend_trait_precedence *trait_precedence = emalloc(sizeof(zend_trait_precedence));
+ if (is_method) {
+ zend_check_magic_method_implementation(
+ CG(active_class_entry), (zend_function *) op_array, E_COMPILE_ERROR TSRMLS_CC);
+ }
- trait_precedence->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
- trait_precedence->exclude_from_classes = trait_list->u.op.ptr;
+ zend_do_extended_info(TSRMLS_C);
+ zend_emit_final_return(NULL TSRMLS_CC);
- zend_add_to_list(&ce->trait_precedences, trait_precedence TSRMLS_CC);
+ pass_two(CG(active_op_array) TSRMLS_CC);
+ zend_release_labels(0 TSRMLS_CC);
+
+ /* Pop the loop variable stack separator */
+ zend_stack_del_top(&CG(loop_var_stack));
+
+ CG(active_op_array) = orig_op_array;
}
/* }}} */
-ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC) /* {{{ */
+void zend_compile_prop_decl(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce;
- zval *op1, *op2;
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t flags = list->attr;
+ zend_class_entry *ce = CG(active_class_entry);
+ uint32_t i, children = list->children;
+ zend_string *doc_comment = NULL;
- if (compile_time) {
- op1 = &CONSTANT_EX(op_array, opline->op1.constant);
- op2 = &CONSTANT_EX(op_array, opline->op2.constant);
- } else {
- op1 = opline->op1.zv;
- op2 = opline->op2.zv;
- }
- if ((ce = zend_hash_find_ptr(class_table, Z_STR_P(op1))) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1));
- return NULL;
- }
- ce->refcount++;
- if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
- ce->refcount--;
- if (!compile_time) {
- /* If we're in compile time, in practice, it's quite possible
- * that we'll never reach this class declaration at runtime,
- * so we shut up about it. This allows the if (!defined('FOO')) { return; }
- * approach to work.
- */
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
- }
- return NULL;
- } else {
- if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
- zend_verify_abstract_class(ce TSRMLS_CC);
- }
- return ce;
+ if (ce->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Interfaces may not include member variables");
}
-}
-/* }}} */
-ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC) /* {{{ */
-{
- zend_class_entry *ce;
- zval *op1, *op2;
+ if (flags & ZEND_ACC_ABSTRACT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Properties cannot be declared abstract");
+ }
- if (compile_time) {
- op1 = &CONSTANT_EX(op_array, opline->op1.constant);
- op2 = &CONSTANT_EX(op_array, opline->op2.constant);
- } else {
- op1 = opline->op1.zv;
- op2 = opline->op2.zv;
+ /* Doc comment has been appended as last element in property list */
+ if (list->child[children - 1]->kind == ZEND_AST_ZVAL) {
+ doc_comment = zend_string_copy(zend_ast_get_str(list->child[children - 1]));
+ children -= 1;
}
- ce = zend_hash_find_ptr(class_table, Z_STR_P(op1));
+ for (i = 0; i < children; ++i) {
+ zend_ast *prop_ast = list->child[i];
+ zend_ast *name_ast = prop_ast->child[0];
+ zend_ast *value_ast = prop_ast->child[1];
+ zend_string *name = zend_ast_get_str(name_ast);
+ zval value_zv;
- if (!ce) {
- if (!compile_time) {
- /* If we're in compile time, in practice, it's quite possible
- * that we'll never reach this class declaration at runtime,
- * so we shut up about it. This allows the if (!defined('FOO')) { return; }
- * approach to work.
- */
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", Z_STRVAL_P(op2));
+ if (flags & ZEND_ACC_FINAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare property %s::$%s final, "
+ "the final modifier is allowed only for methods and classes",
+ ce->name->val, name->val);
}
- return NULL;
- }
- if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name->val, parent_ce->name->val);
- } else if ((parent_ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name->val, parent_ce->name->val);
- }
+ if (zend_hash_exists(&ce->properties_info, name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s",
+ ce->name->val, name->val);
+ }
- zend_do_inheritance(ce, parent_ce TSRMLS_CC);
+ if (value_ast) {
+ zend_const_expr_to_zval(&value_zv, value_ast TSRMLS_CC);
+ } else {
+ ZVAL_NULL(&value_zv);
+ }
- ce->refcount++;
+ name = zend_new_interned_string_safe(name TSRMLS_CC);
+ zend_declare_property_ex(ce, name, &value_zv, flags, doc_comment TSRMLS_CC);
- /* Register the derived class */
- if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
+ /* Doc comment is only assigned to first property */
+ doc_comment = NULL;
}
- return ce;
}
/* }}} */
-void zend_do_early_binding(TSRMLS_D) /* {{{ */
+void zend_compile_class_const_decl(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
- HashTable *table;
-
- while (opline->opcode == ZEND_TICKS && opline > CG(active_op_array)->opcodes) {
- opline--;
- }
-
- switch (opline->opcode) {
- case ZEND_DECLARE_FUNCTION:
- if (do_bind_function(CG(active_op_array), opline, CG(function_table), 1 TSRMLS_CC) == FAILURE) {
- return;
- }
- table = CG(function_table);
- break;
- case ZEND_DECLARE_CLASS:
- if (do_bind_class(CG(active_op_array), opline, CG(class_table), 1 TSRMLS_CC) == NULL) {
- return;
- }
- table = CG(class_table);
- break;
- case ZEND_DECLARE_INHERITED_CLASS:
- {
- zend_op *fetch_class_opline = opline-1;
- zval *parent_name;
- zend_class_entry *ce;
-
- parent_name = &CONSTANT(fetch_class_opline->op2.constant);
- if (((ce = zend_lookup_class(Z_STR_P(parent_name) TSRMLS_CC)) == NULL) ||
- ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) &&
- (ce->type == ZEND_INTERNAL_CLASS))) {
- if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) {
- zend_uint *opline_num = &CG(active_op_array)->early_binding;
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_class_entry *ce = CG(active_class_entry);
+ uint32_t i;
- while (*opline_num != -1) {
- opline_num = &CG(active_op_array)->opcodes[*opline_num].result.opline_num;
- }
- *opline_num = opline - CG(active_op_array)->opcodes;
- opline->opcode = ZEND_DECLARE_INHERITED_CLASS_DELAYED;
- opline->result_type = IS_UNUSED;
- opline->result.opline_num = -1;
- }
- return;
- }
- if (do_bind_inherited_class(CG(active_op_array), opline, CG(class_table), ce, 1 TSRMLS_CC) == NULL) {
- return;
- }
- /* clear unnecessary ZEND_FETCH_CLASS opcode */
- zend_del_literal(CG(active_op_array), fetch_class_opline->op2.constant);
- MAKE_NOP(fetch_class_opline);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *const_ast = list->child[i];
+ zend_ast *name_ast = const_ast->child[0];
+ zend_ast *value_ast = const_ast->child[1];
+ zend_string *name = zend_ast_get_str(name_ast);
+ zval value_zv;
- table = CG(class_table);
- break;
- }
- case ZEND_VERIFY_ABSTRACT_CLASS:
- case ZEND_ADD_INTERFACE:
- case ZEND_ADD_TRAIT:
- case ZEND_BIND_TRAITS:
- /* We currently don't early-bind classes that implement interfaces */
- /* Classes with traits are handled exactly the same, no early-bind here */
+ if (ZEND_CE_IS_TRAIT(ce)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants");
return;
- default:
- zend_error_noreturn(E_COMPILE_ERROR, "Invalid binding type");
- return;
- }
+ }
- zend_hash_del(table, Z_STR(CONSTANT(opline->op1.constant)));
- zend_del_literal(CG(active_op_array), opline->op1.constant);
- zend_del_literal(CG(active_op_array), opline->op2.constant);
- MAKE_NOP(opline);
-}
-/* }}} */
+ zend_const_expr_to_zval(&value_zv, value_ast TSRMLS_CC);
-ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC) /* {{{ */
-{
- if (op_array->early_binding != -1) {
- zend_bool orig_in_compilation = CG(in_compilation);
- zend_uint opline_num = op_array->early_binding;
- zend_class_entry *ce;
+ name = zend_new_interned_string_safe(name TSRMLS_CC);
+ if (zend_hash_add(&ce->constants_table, name, &value_zv) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s",
+ ce->name->val, name->val);
+ }
- CG(in_compilation) = 1;
- while (opline_num != -1) {
- if ((ce = zend_lookup_class(Z_STR_P(op_array->opcodes[opline_num-1].op2.zv) TSRMLS_CC)) != NULL) {
- do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0 TSRMLS_CC);
- }
- opline_num = op_array->opcodes[opline_num].result.opline_num;
+ if (Z_CONSTANT(value_zv)) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
}
- CG(in_compilation) = orig_in_compilation;
}
}
/* }}} */
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC) /* {{{ */
+static zend_trait_method_reference *zend_compile_method_ref(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *method_ast = ast->child[1];
+
+ zend_trait_method_reference *method_ref = emalloc(sizeof(zend_trait_method_reference));
+ method_ref->ce = NULL;
+ method_ref->method_name = zend_string_copy(zend_ast_get_str(method_ast));
- opline->opcode = ZEND_JMPNZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- SET_NODE(opline->result, expr1);
+ if (class_ast) {
+ method_ref->class_name = zend_resolve_class_name_ast(class_ast TSRMLS_CC);
} else {
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_TMP_VAR;
+ method_ref->class_name = NULL;
}
- SET_NODE(opline->op1, expr1);
- SET_UNUSED(opline->op2);
-
- op_token->u.op.opline_num = next_op_number;
-
- GET_NODE(expr1, opline->result);
-}
-/* }}} */
-
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, const znode *op_token TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- SET_NODE(opline->result, result);
- SET_NODE(opline->op1, expr2);
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
+ return method_ref;
}
/* }}} */
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC) /* {{{ */
+static zend_string **zend_compile_name_list(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_string **names = safe_emalloc(sizeof(zend_string *), list->children + 1, 0);
+ uint32_t i;
- opline->opcode = ZEND_JMPZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- SET_NODE(opline->result, expr1);
- } else {
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_TMP_VAR;
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *name_ast = list->child[i];
+ names[i] = zend_resolve_class_name_ast(name_ast TSRMLS_CC);
}
- SET_NODE(opline->op1, expr1);
- SET_UNUSED(opline->op2);
- op_token->u.op.opline_num = next_op_number;
+ names[list->children] = NULL;
- GET_NODE(expr1, opline->result);
+ return names;
}
/* }}} */
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, const znode *op_token TSRMLS_DC) /* {{{ */
+static void zend_compile_trait_precedence(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- SET_NODE(opline->result, result);
- SET_NODE(opline->op1, expr2);
- SET_UNUSED(opline->op2);
+ zend_ast *method_ref_ast = ast->child[0];
+ zend_ast *insteadof_ast = ast->child[1];
+
+ zend_trait_precedence *precedence = emalloc(sizeof(zend_trait_precedence));
+ precedence->trait_method = zend_compile_method_ref(method_ref_ast TSRMLS_CC);
+ precedence->exclude_from_classes
+ = (void *) zend_compile_name_list(insteadof_ast TSRMLS_CC);
- CG(active_op_array)->opcodes[op_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
+ zend_add_to_list(&CG(active_class_entry)->trait_precedences, precedence TSRMLS_CC);
}
/* }}} */
-void zend_do_do_while_begin(TSRMLS_D) /* {{{ */
+static void zend_compile_trait_alias(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
-}
-/* }}} */
+ zend_ast *method_ref_ast = ast->child[0];
+ zend_ast *alias_ast = ast->child[1];
+ uint32_t modifiers = ast->attr;
-void zend_do_do_while_end(const znode *do_token, const znode *expr_open_bracket, znode *expr TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_trait_alias *alias;
- opline->opcode = ZEND_JMPNZ;
- SET_NODE(opline->op1, expr);
- opline->op2.opline_num = do_token->u.op.opline_num;
- SET_UNUSED(opline->op2);
-
- do_end_loop(expr_open_bracket->u.op.opline_num, 0 TSRMLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-/* }}} */
+ if (modifiers == ZEND_ACC_STATIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier");
+ } else if (modifiers == ZEND_ACC_ABSTRACT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier");
+ } else if (modifiers == ZEND_ACC_FINAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier");
+ }
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ alias = emalloc(sizeof(zend_trait_alias));
+ alias->trait_method = zend_compile_method_ref(method_ref_ast TSRMLS_CC);
+ alias->modifiers = modifiers;
- opline->opcode = op;
- opline->op1.opline_num = CG(context).current_brk_cont;
- SET_UNUSED(opline->op1);
- if (expr) {
- if (expr->op_type != IS_CONST) {
- zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator with non-constant operand is no longer supported", op == ZEND_BRK ? "break" : "continue");
- } else if (Z_TYPE(expr->u.constant) != IS_INT || Z_IVAL(expr->u.constant) < 1) {
- zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers", op == ZEND_BRK ? "break" : "continue");
- }
- SET_NODE(opline->op2, expr);
+ if (alias_ast) {
+ alias->alias = zend_string_copy(zend_ast_get_str(alias_ast));
} else {
- LITERAL_INT(opline->op2, 1);
- opline->op2_type = IS_CONST;
+ alias->alias = NULL;
}
-}
-/* }}} */
-
-void zend_do_switch_cond(const znode *cond TSRMLS_DC) /* {{{ */
-{
- zend_switch_entry switch_entry;
- switch_entry.cond = *cond;
- switch_entry.default_case = -1;
- switch_entry.control_var = -1;
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry);
-
- do_begin_loop(TSRMLS_C);
-
- INC_BPC(CG(active_op_array));
+ zend_add_to_list(&CG(active_class_entry)->trait_aliases, alias TSRMLS_CC);
}
/* }}} */
-void zend_do_switch_end(const znode *case_list TSRMLS_DC) /* {{{ */
+void zend_compile_use_trait(zend_ast *ast TSRMLS_DC) /* {{{ */
{
+ zend_ast_list *traits = zend_ast_get_list(ast->child[0]);
+ zend_ast_list *adaptations = ast->child[1] ? zend_ast_get_list(ast->child[1]) : NULL;
+ zend_class_entry *ce = CG(active_class_entry);
zend_op *opline;
- zend_switch_entry *switch_entry_ptr = zend_stack_top(&CG(switch_cond_stack));
+ uint32_t i;
- /* add code to jmp to default case */
- if (switch_entry_ptr->default_case != -1) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- opline->op1.opline_num = switch_entry_ptr->default_case;
- }
+ for (i = 0; i < traits->children; ++i) {
+ zend_ast *trait_ast = traits->child[i];
+ zend_string *name = zend_ast_get_str(trait_ast);
- if (case_list->op_type != IS_UNUSED) { /* non-empty switch */
- int next_op_number = get_next_op_number(CG(active_op_array));
-
- CG(active_op_array)->opcodes[case_list->u.op.opline_num].op1.opline_num = next_op_number;
- }
+ if (ce->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use traits inside of interfaces. "
+ "%s is used in %s", name->val, ce->name->val);
+ }
- /* remember break/continue loop information */
- CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(context).current_brk_cont = CG(active_op_array)->brk_cont_array[CG(context).current_brk_cont].parent;
+ switch (zend_get_class_fetch_type(name)) {
+ case ZEND_FETCH_CLASS_SELF:
+ case ZEND_FETCH_CLASS_PARENT:
+ case ZEND_FETCH_CLASS_STATIC:
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as trait name "
+ "as it is reserved", name->val);
+ break;
+ }
- if (switch_entry_ptr->cond.op_type==IS_VAR || switch_entry_ptr->cond.op_type==IS_TMP_VAR) {
- /* emit free for the switch condition*/
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = (switch_entry_ptr->cond.op_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
- SET_NODE(opline->op1, &switch_entry_ptr->cond);
- SET_UNUSED(opline->op2);
- }
- if (switch_entry_ptr->cond.op_type == IS_CONST) {
- zval_dtor(&switch_entry_ptr->cond.u.constant);
- }
-
- zend_stack_del_top(&CG(switch_cond_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-/* }}} */
-
-void zend_do_case_before_statement(const znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- int next_op_number;
- zend_switch_entry *switch_entry_ptr = zend_stack_top(&CG(switch_cond_stack));
- znode result;
+ opline->opcode = ZEND_ADD_TRAIT;
+ SET_NODE(opline->op1, &CG(implementing_class));
+ opline->extended_value = ZEND_FETCH_CLASS_TRAIT;
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_class_name_literal(CG(active_op_array),
+ zend_resolve_class_name_ast(trait_ast TSRMLS_CC) TSRMLS_CC);
- if (switch_entry_ptr->control_var == -1) {
- switch_entry_ptr->control_var = get_temporary_variable(CG(active_op_array));
+ ce->num_traits++;
}
- opline->opcode = ZEND_CASE;
- opline->result.var = switch_entry_ptr->control_var;
- opline->result_type = IS_TMP_VAR;
- SET_NODE(opline->op1, &switch_entry_ptr->cond);
- SET_NODE(opline->op2, case_expr);
- if (opline->op1_type == IS_CONST) {
- zval_copy_ctor(&CONSTANT(opline->op1.constant));
- }
- GET_NODE(&result, opline->result);
- next_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMPZ;
- SET_NODE(opline->op1, &result);
- SET_UNUSED(opline->op2);
- case_token->u.op.opline_num = next_op_number;
-
- if (case_list->op_type==IS_UNUSED) {
+ if (!adaptations) {
return;
}
- next_op_number = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->opcodes[case_list->u.op.opline_num].op1.opline_num = next_op_number;
-}
-/* }}} */
-
-void zend_do_case_after_statement(znode *result, const znode *case_token TSRMLS_DC) /* {{{ */
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- result->u.op.opline_num = next_op_number;
-
- switch (CG(active_op_array)->opcodes[case_token->u.op.opline_num].opcode) {
- case ZEND_JMP:
- CG(active_op_array)->opcodes[case_token->u.op.opline_num].op1.opline_num = get_next_op_number(CG(active_op_array));
- break;
- case ZEND_JMPZ:
- CG(active_op_array)->opcodes[case_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
- break;
+ for (i = 0; i < adaptations->children; ++i) {
+ zend_ast *adaptation_ast = adaptations->child[i];
+ switch (adaptation_ast->kind) {
+ case ZEND_AST_TRAIT_PRECEDENCE:
+ zend_compile_trait_precedence(adaptation_ast TSRMLS_CC);
+ break;
+ case ZEND_AST_TRAIT_ALIAS:
+ zend_compile_trait_alias(adaptation_ast TSRMLS_CC);
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
}
}
/* }}} */
-void zend_do_default_before_statement(const znode *case_list, znode *default_token TSRMLS_DC) /* {{{ */
+void zend_compile_implements(znode *class_node, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_switch_entry *switch_entry_ptr = zend_stack_top(&CG(switch_cond_stack));
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *class_ast = list->child[i];
+ zend_string *name = zend_ast_get_str(class_ast);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- default_token->u.op.opline_num = next_op_number;
+ zend_op *opline;
+
+ /* Traits can not implement interfaces */
+ if (ZEND_CE_IS_TRAIT(CG(active_class_entry))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' "
+ "since it is a Trait", name->val, CG(active_class_entry)->name->val);
+ }
- next_op_number = get_next_op_number(CG(active_op_array));
- switch_entry_ptr->default_case = next_op_number;
+ if (!zend_is_const_default_class_ref(class_ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use '%s' as interface name as it is reserved", name->val);
+ }
- if (case_list->op_type==IS_UNUSED) {
- return;
+ opline = zend_emit_op(NULL, ZEND_ADD_INTERFACE, class_node, NULL TSRMLS_CC);
+ opline->extended_value = ZEND_FETCH_CLASS_INTERFACE;
+ opline->op2_type = IS_CONST;
+ opline->op2.constant = zend_add_class_name_literal(CG(active_op_array),
+ zend_resolve_class_name_ast(class_ast TSRMLS_CC) TSRMLS_CC);
+
+ CG(active_class_entry)->num_interfaces++;
}
- CG(active_op_array)->opcodes[case_list->u.op.opline_num].op1.opline_num = next_op_number;
}
/* }}} */
-void zend_do_begin_class_declaration(const znode *class_token, znode *class_name, const znode *parent_class_name TSRMLS_DC) /* {{{ */
+void zend_compile_class_decl(zend_ast *ast TSRMLS_DC) /* {{{ */
{
+ zend_ast_decl *decl = (zend_ast_decl *) ast;
+ zend_ast *extends_ast = decl->child[0];
+ zend_ast *implements_ast = decl->child[1];
+ zend_ast *stmt_ast = decl->child[2];
+
+ zend_string *name = decl->name, *lcname, *import_name = NULL;
+ zend_class_entry *ce = zend_arena_alloc(&CG(arena), sizeof(zend_class_entry));
zend_op *opline;
- int doing_inheritance = 0;
- zend_class_entry *new_class_entry;
- zend_string *lcname;
- int error = 0;
- zval *ns_name, key;
+ znode declare_node, extends_node;
if (CG(active_class_entry)) {
zend_error_noreturn(E_COMPILE_ERROR, "Class declarations may not be nested");
return;
}
- lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant));
-
- if (!(strcmp(lcname->val, "self") && strcmp(lcname->val, "parent"))) {
- STR_FREE(lcname);
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", Z_STRVAL(class_name->u.constant));
+ if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved",
+ name->val);
}
- /* Class name must not conflict with import names */
- if (CG(current_import) &&
- (ns_name = zend_hash_find(CG(current_import), lcname)) != NULL) {
- error = 1;
+ lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
+
+ if (CG(current_import)) {
+ import_name = zend_hash_find_ptr(CG(current_import), lcname);
}
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix class name with name of current namespace */
- znode tmp;
+ if (CG(current_namespace)) {
+ name = zend_prefix_with_ns(name TSRMLS_CC);
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
- zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
- *class_name = tmp;
- STR_FREE(lcname);
- lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant));
+ zend_string_release(lcname);
+ lcname = zend_string_alloc(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
+ } else {
+ zend_string_addref(name);
}
- if (error) {
- char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name));
-
- if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(class_name->u.constant) ||
- memcmp(tmp, lcname->val, Z_STRSIZE(class_name->u.constant))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant));
- }
- efree(tmp);
+ if (import_name && !zend_string_equals_str_ci(lcname, import_name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s "
+ "because the name is already in use", name->val);
}
- new_class_entry = zend_arena_alloc(&CG(arena), sizeof(zend_class_entry));
- new_class_entry->type = ZEND_USER_CLASS;
- new_class_entry->name = zend_new_interned_string(Z_STR(class_name->u.constant) TSRMLS_CC);
+ name = zend_new_interned_string(name TSRMLS_CC);
+ lcname = zend_new_interned_string(lcname TSRMLS_CC);
- zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC);
- new_class_entry->info.user.filename = zend_get_compiled_filename(TSRMLS_C);
- new_class_entry->info.user.line_start = class_token->u.op.opline_num;
- new_class_entry->ce_flags |= class_token->EA;
+ ce->type = ZEND_USER_CLASS;
+ ce->name = name;
+ zend_initialize_class_data(ce, 1 TSRMLS_CC);
- if (parent_class_name && parent_class_name->op_type != IS_UNUSED) {
- switch (parent_class_name->EA) {
- case ZEND_FETCH_CLASS_SELF:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'self' as class name as it is reserved");
- break;
- case ZEND_FETCH_CLASS_PARENT:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved");
- break;
- case ZEND_FETCH_CLASS_STATIC:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as class name as it is reserved");
- break;
- default:
- break;
+ ce->ce_flags |= decl->flags;
+ ce->info.user.filename = zend_get_compiled_filename(TSRMLS_C);
+ ce->info.user.line_start = decl->start_lineno;
+ ce->info.user.line_end = decl->end_lineno;
+ if (decl->doc_comment) {
+ ce->info.user.doc_comment = zend_string_copy(decl->doc_comment);
+ }
+
+ if (extends_ast) {
+ if (ZEND_CE_IS_TRAIT(ce)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. "
+ "Traits can only be composed from other traits with the 'use' keyword. Error",
+ name->val);
+ }
+
+ if (!zend_is_const_default_class_ref(extends_ast)) {
+ zend_string *extends_name = zend_ast_get_str(extends_ast);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use '%s' as class name as it is reserved", extends_name->val);
}
- doing_inheritance = 1;
+
+ zend_compile_class_ref(&extends_node, extends_ast TSRMLS_CC);
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->op1_type = IS_CONST;
- build_runtime_defined_function_key(&key, lcname->val, lcname->len TSRMLS_CC);
- opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC);
+ zend_make_var_result(&declare_node, opline TSRMLS_CC);
- opline->op2_type = IS_CONST;
+ // TODO.AST drop this
+ GET_NODE(&CG(implementing_class), opline->result);
- if (doing_inheritance) {
- /* Make sure a trait does not try to extend a class */
- if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name->val);
- }
+ opline->op2_type = IS_CONST;
+ LITERAL_STR(opline->op2, lcname);
- opline->extended_value = parent_class_name->u.op.var;
+ if (extends_ast) {
opline->opcode = ZEND_DECLARE_INHERITED_CLASS;
+ opline->extended_value = extends_node.u.op.var;
} else {
opline->opcode = ZEND_DECLARE_CLASS;
}
- LITERAL_STR(opline->op2, lcname);
-
- zend_hash_update_ptr(CG(class_table), Z_STR(key), new_class_entry);
- CG(active_class_entry) = new_class_entry;
+ {
+ zend_string *key = zend_build_runtime_definition_key(lcname, decl->lex_pos TSRMLS_CC);
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_VAR;
- GET_NODE(&CG(implementing_class), opline->result);
+ opline->op1_type = IS_CONST;
+ LITERAL_STR(opline->op1, key);
- if (CG(doc_comment)) {
- CG(active_class_entry)->info.user.doc_comment = CG(doc_comment);
- CG(doc_comment) = NULL;
+ zend_hash_update_ptr(CG(class_table), key, ce);
}
-}
-/* }}} */
-static void do_verify_abstract_class(TSRMLS_D) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ CG(active_class_entry) = ce;
- opline->opcode = ZEND_VERIFY_ABSTRACT_CLASS;
- SET_NODE(opline->op1, &CG(implementing_class));
- SET_UNUSED(opline->op2);
-}
-/* }}} */
+ if (implements_ast) {
+ zend_compile_implements(&declare_node, implements_ast TSRMLS_CC);
+ }
-void zend_do_end_class_declaration(const znode *class_token, const znode *parent_token TSRMLS_DC) /* {{{ */
-{
- zend_class_entry *ce = CG(active_class_entry);
+ zend_compile_stmt(stmt_ast TSRMLS_CC);
if (ce->constructor) {
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name->val, ce->constructor->common.function_name->val);
+ zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static",
+ ce->name->val, ce->constructor->common.function_name->val);
}
}
if (ce->destructor) {
ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name->val, ce->destructor->common.function_name->val);
+ zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static",
+ ce->name->val, ce->destructor->common.function_name->val);
}
}
if (ce->clone) {
ce->clone->common.fn_flags |= ZEND_ACC_CLONE;
if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name->val, ce->clone->common.function_name->val);
+ zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static",
+ ce->name->val, ce->clone->common.function_name->val);
}
}
- ce->info.user.line_end = zend_get_compiled_lineno(TSRMLS_C);
-
/* Check for traits and proceed like with interfaces.
* The only difference will be a combined handling of them in the end.
* Thus, we need another opcode here. */
if (ce->num_traits > 0) {
- zend_op *opline;
-
ce->traits = NULL;
ce->num_traits = 0;
ce->ce_flags |= ZEND_ACC_IMPLEMENT_TRAITS;
- /* opcode generation: */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_BIND_TRAITS;
- SET_NODE(opline->op1, &CG(implementing_class));
+ zend_emit_op(NULL, ZEND_BIND_TRAITS, &declare_node, NULL TSRMLS_CC);
}
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))
- && (parent_token || (ce->num_interfaces > 0))) {
+ && (extends_ast || ce->num_interfaces > 0)
+ ) {
zend_verify_abstract_class(ce TSRMLS_CC);
if (ce->num_interfaces && !(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) {
- do_verify_abstract_class(TSRMLS_C);
+ zend_emit_op(NULL, ZEND_VERIFY_ABSTRACT_CLASS, &declare_node, NULL TSRMLS_CC);
}
}
+
/* Inherit interfaces; reset number to zero, we need it for above check and
* will restore it during actual implementation.
* The ZEND_ACC_IMPLEMENT_INTERFACES flag disables double call to
@@ -5675,2286 +4612,1757 @@ void zend_do_end_class_declaration(const znode *class_token, const znode *parent
}
/* }}} */
-void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */
+static HashTable *zend_get_import_ht(uint32_t type TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
-
- /* Traits can not implement interfaces */
- if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' since it is a Trait",
- Z_STRVAL(interface_name->u.constant),
- CG(active_class_entry)->name->val);
- }
-
- switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRSIZE(interface_name->u.constant))) {
- case ZEND_FETCH_CLASS_SELF:
- case ZEND_FETCH_CLASS_PARENT:
- case ZEND_FETCH_CLASS_STATIC:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface name as it is reserved", Z_STRVAL(interface_name->u.constant));
- break;
- default:
- break;
+ switch (type) {
+ case T_CLASS:
+ if (!CG(current_import)) {
+ CG(current_import) = emalloc(sizeof(HashTable));
+ zend_hash_init(CG(current_import), 8, NULL, str_dtor, 0);
+ }
+ return CG(current_import);
+ case T_FUNCTION:
+ if (!CG(current_import_function)) {
+ CG(current_import_function) = emalloc(sizeof(HashTable));
+ zend_hash_init(CG(current_import_function), 8, NULL, str_dtor, 0);
+ }
+ return CG(current_import_function);
+ case T_CONST:
+ if (!CG(current_import_const)) {
+ CG(current_import_const) = emalloc(sizeof(HashTable));
+ zend_hash_init(CG(current_import_const), 8, NULL, str_dtor, 0);
+ }
+ return CG(current_import_const);
+ EMPTY_SWITCH_DEFAULT_CASE()
}
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_INTERFACE;
- SET_NODE(opline->op1, &CG(implementing_class));
- zend_resolve_class_name(interface_name TSRMLS_CC);
- opline->extended_value = (opline->extended_value & ~ZEND_FETCH_CLASS_MASK) | ZEND_FETCH_CLASS_INTERFACE;
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_class_name_literal(CG(active_op_array), &interface_name->u.constant TSRMLS_CC);
- CG(active_class_entry)->num_interfaces++;
}
/* }}} */
-void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */
+static char *zend_get_use_type_str(uint32_t type) /* {{{ */
{
- zend_op *opline;
-
- if ((CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot use traits inside of interfaces. %s is used in %s",
- Z_STRVAL(trait_name->u.constant), CG(active_class_entry)->name->val);
+ switch (type) {
+ case T_CLASS:
+ return "";
+ case T_FUNCTION:
+ return " function";
+ case T_CONST:
+ return " const";
+ EMPTY_SWITCH_DEFAULT_CASE()
}
-
-
- switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRSIZE(trait_name->u.constant))) {
- case ZEND_FETCH_CLASS_SELF:
- case ZEND_FETCH_CLASS_PARENT:
- case ZEND_FETCH_CLASS_STATIC:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as trait name as it is reserved", Z_STRVAL(trait_name->u.constant));
- break;
- default:
- break;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ADD_TRAIT;
- SET_NODE(opline->op1, &CG(implementing_class));
- zend_resolve_class_name(trait_name TSRMLS_CC);
- opline->extended_value = ZEND_FETCH_CLASS_TRAIT;
- opline->op2_type = IS_CONST;
- opline->op2.constant = zend_add_class_name_literal(CG(active_op_array), &trait_name->u.constant TSRMLS_CC);
- CG(active_class_entry)->num_traits++;
}
/* }}} */
-ZEND_API zend_string *zend_mangle_property_name(const char *src1, int src1_length, const char *src2, int src2_length, int internal) /* {{{ */
+static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend_string *new_name, zend_string *check_name) /* {{{ */
{
- zend_string *prop_name;
- int prop_name_length;
+ if (zend_string_equals_str_ci(old_name, check_name)) {
+ return;
+ }
- prop_name_length = 1 + src1_length + 1 + src2_length;
- prop_name = STR_ALLOC(prop_name_length, internal);
- prop_name->val[0] = '\0';
- memcpy(prop_name->val + 1, src1, src1_length+1);
- memcpy(prop_name->val + 1 + src1_length + 1, src2, src2_length+1);
- return prop_name;
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name "
+ "is already in use", zend_get_use_type_str(type), old_name->val, new_name->val);
}
/* }}} */
-static int zend_strnlen(const char* s, int maxlen) /* {{{ */
+void zend_compile_use(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int len = 0;
- while (*s++ && maxlen--) len++;
- return len;
-}
-/* }}} */
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ zend_string *current_ns = CG(current_namespace);
+ uint32_t type = ast->attr;
+ HashTable *current_import = zend_get_import_ht(type TSRMLS_CC);
+ zend_bool case_sensitive = type == T_CONST;
-ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int len, const char **class_name, const char **prop_name, int *prop_len) /* {{{ */
-{
- int class_name_len;
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *use_ast = list->child[i];
+ zend_ast *old_name_ast = use_ast->child[0];
+ zend_ast *new_name_ast = use_ast->child[1];
+ zend_string *old_name = zend_ast_get_str(old_name_ast);
+ zend_string *new_name, *lookup_name;
- *class_name = NULL;
+ if (new_name_ast) {
+ new_name = zend_string_copy(zend_ast_get_str(new_name_ast));
+ } else {
+ const char *unqualified_name;
+ size_t unqualified_name_len;
+ if (zend_get_unqualified_name(old_name, &unqualified_name, &unqualified_name_len)) {
+ /* The form "use A\B" is eqivalent to "use A\B as B" */
+ new_name = zend_string_init(unqualified_name, unqualified_name_len, 0);
+ } else {
+ new_name = zend_string_copy(old_name);
- if (mangled_property[0]!=0) {
- *prop_name = mangled_property;
- if (prop_len) {
- *prop_len = len;
- }
- return SUCCESS;
- }
- if (len < 3 || mangled_property[1]==0) {
- zend_error(E_NOTICE, "Illegal member variable name");
- *prop_name = mangled_property;
- if (prop_len) {
- *prop_len = len;
- }
- return FAILURE;
- }
+ if (!current_ns) {
+ if (type == T_CLASS && zend_string_equals_literal(new_name, "strict")) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "You seem to be trying to use a different language...");
+ }
- class_name_len = zend_strnlen(mangled_property + 1, --len - 1) + 1;
- if (class_name_len >= len || mangled_property[class_name_len]!=0) {
- zend_error(E_NOTICE, "Corrupt member variable name");
- *prop_name = mangled_property;
- if (prop_len) {
- *prop_len = len + 1;
+ zend_error(E_WARNING, "The use statement with non-compound name '%s' "
+ "has no effect", new_name->val);
+ }
+ }
}
- return FAILURE;
- }
- *class_name = mangled_property + 1;
- *prop_name = (*class_name) + class_name_len;
- if (prop_len) {
- *prop_len = len - class_name_len;
- }
- return SUCCESS;
-}
-/* }}} */
-
-void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC) /* {{{ */
-{
- zval property;
- zend_property_info *existing_property_info;
- zend_string *comment = NULL;
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error_noreturn(E_COMPILE_ERROR, "Interfaces may not include member variables");
- }
+ if (case_sensitive) {
+ lookup_name = zend_string_copy(new_name);
+ } else {
+ lookup_name = zend_string_alloc(new_name->len, 0);
+ zend_str_tolower_copy(lookup_name->val, new_name->val, new_name->len);
+ }
- if (access_type & ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Properties cannot be declared abstract");
- }
+ if (type == T_CLASS && (zend_string_equals_literal(lookup_name, "self")
+ || zend_string_equals_literal(lookup_name, "parent"))
+ ) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' "
+ "is a special class name", old_name->val, new_name->val, new_name->val);
+ }
- if (access_type & ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare property %s::$%s final, the final modifier is allowed only for methods and classes",
- CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
- }
+ if (current_ns) {
+ zend_string *ns_name = zend_string_alloc(current_ns->len + 1 + new_name->len, 0);
+ zend_str_tolower_copy(ns_name->val, current_ns->val, current_ns->len);
+ ns_name->val[current_ns->len] = '\\';
+ memcpy(ns_name->val + current_ns->len + 1, lookup_name->val, lookup_name->len);
- if ((existing_property_info = zend_hash_find_ptr(&CG(active_class_entry)->properties_info, Z_STR(var_name->u.constant))) != NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
- }
+ if (zend_hash_exists(CG(class_table), ns_name)) {
+ zend_check_already_in_use(type, old_name, new_name, ns_name);
+ }
- if (value) {
- ZVAL_COPY_VALUE(&property, &value->u.constant);
- } else {
- ZVAL_NULL(&property);
- }
+ zend_string_free(ns_name);
+ } else {
+ switch (type) {
+ case T_CLASS:
+ {
+ zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name);
+ if (ce && ce->type == ZEND_USER_CLASS
+ && ce->info.user.filename == CG(compiled_filename)
+ ) {
+ zend_check_already_in_use(type, old_name, new_name, lookup_name);
+ }
+ break;
+ }
+ case T_FUNCTION:
+ {
+ zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name);
+ if (fn && fn->type == ZEND_USER_FUNCTION
+ && fn->op_array.filename == CG(compiled_filename)
+ ) {
+ zend_check_already_in_use(type, old_name, new_name, lookup_name);
+ }
+ break;
+ }
+ case T_CONST:
+ {
+ zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name);
+ if (filename && filename == CG(compiled_filename)) {
+ zend_check_already_in_use(type, old_name, new_name, lookup_name);
+ }
+ break;
+ }
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+ }
- if (CG(doc_comment)) {
- comment = CG(doc_comment);
- CG(doc_comment) = NULL;
- }
+ zend_string_addref(old_name);
+ if (!zend_hash_add_ptr(current_import, lookup_name, old_name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name "
+ "is already in use", zend_get_use_type_str(type), old_name->val, new_name->val);
+ }
- Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(var_name->u.constant))) {
- Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
+ zend_string_release(lookup_name);
+ zend_string_release(new_name);
}
- zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC);
- STR_RELEASE(Z_STR(var_name->u.constant));
}
/* }}} */
-void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) /* {{{ */
+void zend_compile_const_decl(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants");
- return;
- }
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *const_ast = list->child[i];
+ zend_ast *name_ast = const_ast->child[0];
+ zend_ast *value_ast = const_ast->child[1];
+ zend_string *name = zend_ast_get_str(name_ast);
- Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(var_name->u.constant))) {
- Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
- }
- if (Z_CONSTANT(value->u.constant)) {
- CG(active_class_entry)->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
- }
- if (zend_hash_add(&CG(active_class_entry)->constants_table, Z_STR(var_name->u.constant), &value->u.constant) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
- }
- FREE_PNODE(var_name);
+ zend_string *import_name;
+ znode name_node, value_node;
+ zval *value_zv = &value_node.u.constant;
- if (CG(doc_comment)) {
- STR_RELEASE(CG(doc_comment));
- CG(doc_comment) = NULL;
- }
-}
-/* }}} */
+ value_node.op_type = IS_CONST;
+ zend_const_expr_to_zval(value_zv, value_ast TSRMLS_CC);
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC) /* {{{ */
-{
- zend_op opline;
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
-
- if (object->op_type == IS_CV) {
- if (object->u.op.var == CG(active_op_array)->this_var) {
- object->op_type = IS_UNUSED; /* this means $this for objects */
+ if (zend_lookup_reserved_const(name->val, name->len TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", name->val);
}
- } else if (fetch_list_ptr->count == 1) {
- zend_llist_element *le = fetch_list_ptr->head;
- zend_op *opline_ptr = (zend_op *) le->data;
- if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) {
- zend_del_literal(CG(active_op_array), opline_ptr->op1.constant);
- SET_UNUSED(opline_ptr->op1); /* this means $this for objects */
- SET_NODE(opline_ptr->op2, property);
- /* if it was usual fetch, we change it to object fetch */
- switch (opline_ptr->opcode) {
- case ZEND_FETCH_W:
- opline_ptr->opcode = ZEND_FETCH_OBJ_W;
- break;
- case ZEND_FETCH_R:
- opline_ptr->opcode = ZEND_FETCH_OBJ_R;
- break;
- case ZEND_FETCH_RW:
- opline_ptr->opcode = ZEND_FETCH_OBJ_RW;
- break;
- case ZEND_FETCH_IS:
- opline_ptr->opcode = ZEND_FETCH_OBJ_IS;
- break;
- case ZEND_FETCH_UNSET:
- opline_ptr->opcode = ZEND_FETCH_OBJ_UNSET;
- break;
- case ZEND_FETCH_FUNC_ARG:
- opline_ptr->opcode = ZEND_FETCH_OBJ_FUNC_ARG;
- break;
- }
- if (opline_ptr->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline_ptr->op2.constant)) == IS_STRING) {
- GET_POLYMORPHIC_CACHE_SLOT(opline_ptr->op2.constant);
+ name = zend_prefix_with_ns(name TSRMLS_CC);
+ name = zend_new_interned_string(name TSRMLS_CC);
+
+ if (CG(current_import_const)
+ && (import_name = zend_hash_find_ptr(CG(current_import_const), name))
+ ) {
+ if (!zend_string_equals(import_name, name)) {
+ zend_error(E_COMPILE_ERROR, "Cannot declare const %s because "
+ "the name is already in use", name->val);
}
- GET_NODE(result, opline_ptr->result);
- return;
}
- }
- if (zend_is_function_or_method_call(object)) {
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_SEPARATE;
- SET_NODE(opline.op1, object);
- SET_UNUSED(opline.op2);
- opline.result_type = IS_VAR;
- opline.result.var = opline.op1.var;
- zend_llist_add_element(fetch_list_ptr, &opline);
- }
+ name_node.op_type = IS_CONST;
+ ZVAL_STR(&name_node.u.constant, name);
- init_op(&opline TSRMLS_CC);
- opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */
- opline.result_type = IS_VAR;
- opline.result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline.op1, object);
- SET_NODE(opline.op2, property);
- if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
- GET_POLYMORPHIC_CACHE_SLOT(opline.op2.constant);
- }
- GET_NODE(result, opline.result);
+ zend_emit_op(NULL, ZEND_DECLARE_CONST, &name_node, &value_node TSRMLS_CC);
- zend_llist_add_element(fetch_list_ptr, &opline);
+ zend_hash_add_ptr(&CG(const_filenames), name, CG(compiled_filename));
+ }
}
-/* }}} */
+/* }}}*/
-void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */
+void zend_compile_namespace(zend_ast *ast TSRMLS_DC) /* {{{ */
{
+ zend_ast *name_ast = ast->child[0];
+ zend_ast *stmt_ast = ast->child[1];
zend_string *name;
- zend_string *cfilename;
- char haltoff[] = "__COMPILER_HALT_OFFSET__";
+ zend_bool with_bracket = stmt_ast != NULL;
- if (CG(has_bracketed_namespaces) && CG(in_namespace)) {
- zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope");
+ /* handle mixed syntax declaration or nested namespaces */
+ if (!CG(has_bracketed_namespaces)) {
+ if (CG(current_namespace)) {
+ /* previous namespace declarations were unbracketed */
+ if (with_bracket) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations "
+ "with unbracketed namespace declarations");
+ }
+ }
+ } else {
+ /* previous namespace declarations were bracketed */
+ if (!with_bracket) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations "
+ "with unbracketed namespace declarations");
+ } else if (CG(current_namespace) || CG(in_namespace)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Namespace declarations cannot be nested");
+ }
}
- cfilename = zend_get_compiled_filename(TSRMLS_C);
- name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, cfilename->val, cfilename->len, 0);
- zend_register_int_constant(name->val, name->len, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC);
- STR_FREE(name);
+ if (((!with_bracket && !CG(current_namespace))
+ || (with_bracket && !CG(has_bracketed_namespaces))) && CG(active_op_array)->last > 0
+ ) {
+ /* ignore ZEND_EXT_STMT and ZEND_TICKS */
+ uint32_t num = CG(active_op_array)->last;
+ while (num > 0 &&
+ (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
+ CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
+ --num;
+ }
+ if (num > 0) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Namespace declaration statement has to be "
+ "the very first statement in the script");
+ }
+ }
- if (CG(in_namespace)) {
- zend_do_end_namespace(TSRMLS_C);
+ if (CG(current_namespace)) {
+ zend_string_release(CG(current_namespace));
}
-}
-/* }}} */
-void zend_do_push_object(const znode *object TSRMLS_DC) /* {{{ */
-{
- zend_stack_push(&CG(object_stack), object);
-}
-/* }}} */
+ if (name_ast) {
+ name = zend_ast_get_str(name_ast);
-void zend_do_pop_object(znode *object TSRMLS_DC) /* {{{ */
-{
- if (object) {
- znode *tmp = zend_stack_top(&CG(object_stack));
- *object = *tmp;
+ if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", name->val);
+ }
+
+ CG(current_namespace) = zend_string_copy(name);
+ } else {
+ CG(current_namespace) = NULL;
}
- zend_stack_del_top(&CG(object_stack));
-}
-/* }}} */
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC) /* {{{ */
-{
- zend_op *opline;
+ zend_reset_import_tables(TSRMLS_C);
- new_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_NEW;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, class_type);
- SET_UNUSED(opline->op2);
+ CG(in_namespace) = 1;
+ if (with_bracket) {
+ CG(has_bracketed_namespaces) = 1;
+ }
- zend_push_function_call_entry(NULL, new_token->u.op.opline_num TSRMLS_CC);
+ if (stmt_ast) {
+ zend_compile_top_stmt(stmt_ast TSRMLS_CC);
+ zend_end_namespace(TSRMLS_C);
+ }
}
/* }}} */
-void zend_do_end_new_object(znode *result, const znode *new_token TSRMLS_DC) /* {{{ */
+void zend_compile_halt_compiler(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- znode ctor_result;
+ zend_ast *offset_ast = ast->child[0];
+ zend_long offset = Z_LVAL_P(zend_ast_get_zval(offset_ast));
- zend_do_end_function_call(NULL, &ctor_result, 1, 0 TSRMLS_CC);
- zend_do_free(&ctor_result TSRMLS_CC);
+ zend_string *filename, *name;
+ const char const_name[] = "__COMPILER_HALT_OFFSET__";
- CG(active_op_array)->opcodes[new_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
- GET_NODE(result, CG(active_op_array)->opcodes[new_token->u.op.opline_num].result);
-}
-/* }}} */
+ if (CG(has_bracketed_namespaces) && CG(in_namespace)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "__HALT_COMPILER() can only be used from the outermost scope");
+ }
-static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */
-{
- zend_constant *c = NULL;
- char *lookup_name;
+ filename = zend_get_compiled_filename(TSRMLS_C);
+ name = zend_mangle_property_name(const_name, sizeof(const_name) - 1,
+ filename->val, filename->len, 0);
- if (Z_STRVAL_P(const_name)[0] == '\\') {
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1)) == NULL) {
- lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name)-1)) != NULL) {
- if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) {
- efree(lookup_name);
- return c;
- }
- }
- efree(lookup_name);
- return NULL;
- }
- } else if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(const_name))) == NULL) {
- lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name));
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name))) != NULL) {
- if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) {
- efree(lookup_name);
- return c;
- }
- }
- efree(lookup_name);
- return NULL;
- }
- if (c->flags & CONST_CT_SUBST) {
- return c;
- }
- if (all_internal_constants_substitution &&
- (c->flags & CONST_PERSISTENT) &&
- !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION) &&
- !Z_CONSTANT(c->value)) {
- return c;
- }
- return NULL;
+ zend_register_long_constant(name->val, name->len, offset, CONST_CS, 0 TSRMLS_CC);
+ zend_string_release(name);
}
/* }}} */
-static int zend_constant_ct_subst(znode *result, zval *const_name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */
+static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_constant *c = zend_get_ct_const(const_name, all_internal_constants_substitution TSRMLS_CC);
+ zend_op_array *op_array = CG(active_op_array);
+ zend_class_entry *ce = CG(active_class_entry);
- if (c) {
- zval_dtor(const_name);
- result->op_type = IS_CONST;
- result->u.constant = c->value;
- zval_copy_ctor(&result->u.constant);
- return 1;
- }
- return 0;
-}
-/* }}} */
+ switch (ast->attr) {
+ case T_LINE:
+ ZVAL_LONG(zv, ast->lineno);
+ break;
+ case T_FILE:
+ ZVAL_STR_COPY(zv, CG(compiled_filename));
+ break;
+ case T_DIR:
+ {
+ zend_string *filename = CG(compiled_filename);
+ zend_string *dirname = zend_string_init(filename->val, filename->len, 0);
+ zend_dirname(dirname->val, dirname->len);
+
+ if (strcmp(dirname->val, ".") == 0) {
+ dirname = zend_string_realloc(dirname, MAXPATHLEN, 0);
+#if HAVE_GETCWD
+ VCWD_GETCWD(dirname->val, MAXPATHLEN);
+#elif HAVE_GETWD
+ VCWD_GETWD(dirname->val);
+#endif
+ }
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC) /* {{{ */
-{
- znode tmp;
- zend_op *opline;
- int type;
- char *compound;
- zend_uint_t fetch_type = 0;
-
- if (constant_container) {
- switch (mode) {
- case ZEND_CT:
- /* this is a class constant */
- type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant));
-
- if (ZEND_FETCH_CLASS_STATIC == type) {
- zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants");
- } else if (ZEND_FETCH_CLASS_DEFAULT == type) {
- zend_resolve_class_name(constant_container TSRMLS_CC);
- }
- zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
- *result = *constant_container;
- Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
- if (IS_INTERNED(Z_STR(result->u.constant))) {
- Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
- }
- Z_CONST_FLAGS(result->u.constant) = fetch_type;
- break;
- case ZEND_RT:
- if (constant_container->op_type == IS_CONST &&
- ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant))) {
- zend_resolve_class_name(constant_container TSRMLS_CC);
- } else {
- zend_do_fetch_class(&tmp, constant_container TSRMLS_CC);
- constant_container = &tmp;
- }
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_CONSTANT;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- if (constant_container->op_type == IS_CONST) {
- opline->op1_type = IS_CONST;
- opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), &constant_container->u.constant TSRMLS_CC);
+ dirname->len = strlen(dirname->val);
+ ZVAL_STR(zv, dirname);
+ break;
+ }
+ case T_FUNC_C:
+ if (op_array && op_array->function_name) {
+ ZVAL_STR_COPY(zv, op_array->function_name);
+ } else {
+ ZVAL_EMPTY_STRING(zv);
+ }
+ break;
+ case T_METHOD_C:
+ if (ce) {
+ if (op_array && op_array->function_name) {
+ ZVAL_NEW_STR(zv, zend_concat3(ce->name->val, ce->name->len, "::", 2,
+ op_array->function_name->val, op_array->function_name->len));
} else {
- SET_NODE(opline->op1, constant_container);
+ ZVAL_STR_COPY(zv, ce->name);
}
- SET_NODE(opline->op2, constant_name);
- if (opline->op1_type == IS_CONST) {
- GET_CACHE_SLOT(opline->op2.constant);
+ } else if (op_array && op_array->function_name) {
+ ZVAL_STR_COPY(zv, op_array->function_name);
+ } else {
+ ZVAL_EMPTY_STRING(zv);
+ }
+ break;
+ case T_CLASS_C:
+ if (ce) {
+ if (ZEND_CE_IS_TRAIT(ce)) {
+ return 0;
} else {
- GET_POLYMORPHIC_CACHE_SLOT(opline->op2.constant);
+ ZVAL_STR_COPY(zv, ce->name);
}
- GET_NODE(result, opline->result);
- break;
- }
- return;
- }
- /* namespace constant */
- /* only one that did not contain \ from the start can be converted to string if unknown */
- switch (mode) {
- case ZEND_CT:
- compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant));
- /* this is a namespace constant, or an unprefixed constant */
-
- if (zend_constant_ct_subst(result, &constant_name->u.constant, 0 TSRMLS_CC)) {
- break;
- }
-
- zend_resolve_const_name(constant_name, &check_namespace TSRMLS_CC);
-
- if(!compound) {
- fetch_type |= IS_CONSTANT_UNQUALIFIED;
- }
-
- *result = *constant_name;
- Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
- if (IS_INTERNED(Z_STR(result->u.constant))) {
- Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
+ } else {
+ ZVAL_EMPTY_STRING(zv);
}
- Z_CONST_FLAGS(result->u.constant) = fetch_type;
break;
- case ZEND_RT:
- compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant));
-
- zend_resolve_const_name(constant_name, &check_namespace TSRMLS_CC);
-
- if(zend_constant_ct_subst(result, &constant_name->u.constant, 1 TSRMLS_CC)) {
- break;
+ case T_TRAIT_C:
+ if (ce && ZEND_CE_IS_TRAIT(ce)) {
+ ZVAL_STR_COPY(zv, ce->name);
+ } else {
+ ZVAL_EMPTY_STRING(zv);
}
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_CONSTANT;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
- SET_UNUSED(opline->op1);
- opline->op2_type = IS_CONST;
- if (compound) {
- /* the name is unambiguous */
- opline->extended_value = 0;
- opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 0 TSRMLS_CC);
+ break;
+ case T_NS_C:
+ if (CG(current_namespace)) {
+ ZVAL_STR_COPY(zv, CG(current_namespace));
} else {
- opline->extended_value = IS_CONSTANT_UNQUALIFIED;
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
- opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 1 TSRMLS_CC);
- } else {
- opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 0 TSRMLS_CC);
- }
+ ZVAL_EMPTY_STRING(zv);
}
- GET_CACHE_SLOT(opline->op2.constant);
break;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
+
+ return 1;
}
/* }}} */
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) /* {{{ */
+static inline void zend_ct_eval_binary_op(zval *result, uint32_t opcode, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_INIT_FCALL;
- opline->extended_value = 1;
- SET_UNUSED(opline->op1);
- opline->op2_type = IS_CONST;
- LITERAL_STR(opline->op2, STR_INIT("shell_exec", sizeof("shell_exec")-1, 0));
- GET_CACHE_SLOT(opline->op2.constant);
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- switch (cmd->op_type) {
- case IS_CONST:
- case IS_TMP_VAR:
- opline->opcode = ZEND_SEND_VAL;
- break;
- default:
- opline->opcode = ZEND_SEND_VAR;
- break;
- }
- SET_NODE(opline->op1, cmd);
- opline->op2.opline_num = 1;
- SET_UNUSED(opline->op2);
-
- /* FIXME: exception support not added to this op2 */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DO_FCALL;
- opline->extended_value = 1;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_VAR;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- GET_NODE(result, opline->result);
+ binary_op_type fn = get_binary_op(opcode);
+ fn(result, op1, op2 TSRMLS_CC);
}
/* }}} */
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) /* {{{ */
+static inline void zend_ct_eval_unary_pm(zval *result, zend_ast_kind kind, zval *op TSRMLS_DC) /* {{{ */
{
- int op_num = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- result->u.op.opline_num = op_num;
+ binary_op_type fn = kind == ZEND_AST_UNARY_PLUS
+ ? add_function : sub_function;
- opline->opcode = ZEND_INIT_ARRAY;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->result_type = IS_TMP_VAR;
- opline->extended_value = is_ref; /* extval = size << 2 | not_packed << 1 | is_ref */
-
- if (expr) {
- opline->extended_value += 1 << ZEND_ARRAY_SIZE_SHIFT; /* increment size */
- SET_NODE(opline->op1, expr);
- if (offset) {
- SET_NODE(opline->op2, offset);
- if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
- zend_uint_t index;
-
- opline->extended_value |= ZEND_ARRAY_NOT_PACKED;
- if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline->op2.constant)), index)) {
- zval_dtor(&CONSTANT(opline->op2.constant));
- ZVAL_INT(&CONSTANT(opline->op2.constant), index);
- }
- }
- } else {
- SET_UNUSED(opline->op2);
- }
- } else {
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
+ zval left;
+ ZVAL_LONG(&left, 0);
+ fn(result, &left, op TSRMLS_CC);
}
/* }}} */
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) /* {{{ */
+static inline void zend_ct_eval_greater(zval *result, zend_ast_kind kind, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- zend_op *init_opline = &CG(active_op_array)->opcodes[result->u.op.opline_num];
- init_opline->extended_value += 1 << ZEND_ARRAY_SIZE_SHIFT; /* increment size */
-
- opline->opcode = ZEND_ADD_ARRAY_ELEMENT;
- COPY_NODE(opline->result, init_opline->result);
- SET_NODE(opline->op1, expr);
- if (offset) {
- SET_NODE(opline->op2, offset);
- if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
- zend_uint_t index;
-
- init_opline->extended_value |= ZEND_ARRAY_NOT_PACKED;
- if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline->op2.constant)), index)) {
- zval_dtor(&CONSTANT(opline->op2.constant));
- ZVAL_INT(&CONSTANT(opline->op2.constant), index);
- }
- }
- } else {
- SET_UNUSED(opline->op2);
- }
- opline->extended_value = is_ref;
+ binary_op_type fn = kind == ZEND_AST_GREATER
+ ? is_smaller_function : is_smaller_or_equal_function;
+ fn(result, op2, op1 TSRMLS_CC);
}
/* }}} */
-void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC) /* {{{ */
+static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int next_op_num = get_next_op_number(CG(active_op_array));
- zend_op *init_opline = &CG(active_op_array)->opcodes[array_node->u.op.opline_num];
- zend_op *opline;
- int i;
- int constant_array = 0;
- zval array;
-
- /* check if constructed array consists only from constants */
- if ((init_opline->op1_type & (IS_UNUSED | IS_CONST)) &&
- (init_opline->op2_type & (IS_UNUSED | IS_CONST))) {
- if (next_op_num == array_node->u.op.opline_num + 1) {
- constant_array = 1;
- } else if ((init_opline->extended_value >> ZEND_ARRAY_SIZE_SHIFT) == next_op_num - array_node->u.op.opline_num) {
- opline = init_opline + 1;
- i = next_op_num - array_node->u.op.opline_num - 1;
- while (i > 0) {
- if (opline->opcode != ZEND_ADD_ARRAY_ELEMENT ||
- opline->op1_type != IS_CONST ||
- !(opline->op2_type & (IS_UNUSED | IS_CONST))) {
- break;
- }
- opline++;
- i--;
- }
- if (i == 0) {
- constant_array = 1;
- }
- }
- }
-
- if (constant_array) {
- /* try to construct constant array */
- zend_uint size;
- zend_int_t num;
- zend_string *str;
-
- if (init_opline->op1_type != IS_UNUSED) {
- size = init_opline->extended_value >> ZEND_ARRAY_SIZE_SHIFT;
- } else {
- size = 0;
- }
- ZVAL_NEW_ARR(&array);
- zend_hash_init(Z_ARRVAL(array), size, NULL, ZVAL_PTR_DTOR, 0);
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
- if (init_opline->op1_type != IS_UNUSED) {
- /* Explicitly initialize array as not-packed if flag is set */
- if (init_opline->extended_value & ZEND_ARRAY_NOT_PACKED) {
- zend_hash_real_init(Z_ARRVAL(array), 0);
- }
+ /* First ensure that *all* child nodes are constant and by-val */
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *elem_ast = list->child[i];
+ zend_bool by_ref = elem_ast->attr;
+ zend_eval_const_expr(&elem_ast->child[0] TSRMLS_CC);
+ zend_eval_const_expr(&elem_ast->child[1] TSRMLS_CC);
- opline = init_opline;
- i = next_op_num - array_node->u.op.opline_num;
- while (i > 0 && constant_array) {
- if (opline->op2_type == IS_CONST) {
- switch (Z_TYPE(CONSTANT(opline->op2.constant))) {
- case IS_INT:
- num = Z_IVAL(CONSTANT(opline->op2.constant));
-num_index:
- zend_hash_index_update(Z_ARRVAL(array), num, &CONSTANT(opline->op1.constant));
- if (Z_REFCOUNTED(CONSTANT(opline->op1.constant))) Z_ADDREF(CONSTANT(opline->op1.constant));
- break;
- case IS_STRING:
- str = Z_STR(CONSTANT(opline->op2.constant));
-str_index:
- zend_hash_update(Z_ARRVAL(array), str, &CONSTANT(opline->op1.constant));
- if (Z_REFCOUNTED(CONSTANT(opline->op1.constant))) Z_ADDREF(CONSTANT(opline->op1.constant));
- break;
- case IS_DOUBLE:
- num = zend_dval_to_ival(Z_DVAL(CONSTANT(opline->op2.constant)));
- goto num_index;
- case IS_FALSE:
- num = 0;
- goto num_index;
- case IS_TRUE:
- num = 1;
- goto num_index;
- case IS_NULL:
- str = STR_EMPTY_ALLOC();
- goto str_index;
- default:
- constant_array = 0;
- break;
- }
- } else {
- zend_hash_next_index_insert(Z_ARRVAL(array), &CONSTANT(opline->op1.constant));
- if (Z_REFCOUNTED(CONSTANT(opline->op1.constant))) Z_ADDREF(CONSTANT(opline->op1.constant));
- }
- opline++;
- i--;
- }
- if (!constant_array) {
- zval_dtor(&array);
- }
+ if (by_ref || elem_ast->child[0]->kind != ZEND_AST_ZVAL
+ || (elem_ast->child[1] && elem_ast->child[1]->kind != ZEND_AST_ZVAL)
+ ) {
+ return 0;
}
}
- if (constant_array) {
- /* remove run-time array construction and use constant array instead */
- opline = &CG(active_op_array)->opcodes[next_op_num-1];
- while (1) {
- if (opline->op2_type == IS_CONST) {
- zend_del_literal(CG(active_op_array), opline->op2.constant);
- }
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_ARRAY &&
- Z_REFCOUNTED(CONSTANT(opline->op1.constant)) &&
- Z_REFCOUNT(CONSTANT(opline->op1.constant)) == 2) {
- /* don't delete nested arrays */
- Z_DELREF(CONSTANT(opline->op1.constant));
- ZVAL_UNDEF(&CONSTANT(opline->op1.constant));
- }
- zend_del_literal(CG(active_op_array), opline->op1.constant);
- }
- if (opline == init_opline) {
- break;
+ array_init_size(result, list->children);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *elem_ast = list->child[i];
+ zend_ast *value_ast = elem_ast->child[0];
+ zend_ast *key_ast = elem_ast->child[1];
+
+ zval *value = zend_ast_get_zval(value_ast);
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+
+ if (key_ast) {
+ zval *key = zend_ast_get_zval(key_ast);
+ switch (Z_TYPE_P(key)) {
+ case IS_LONG:
+ zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(key), value);
+ break;
+ case IS_STRING:
+ zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(key), value);
+ break;
+ case IS_DOUBLE:
+ zend_hash_index_update(Z_ARRVAL_P(result),
+ zend_dval_to_lval(Z_DVAL_P(key)), value);
+ break;
+ case IS_FALSE:
+ zend_hash_index_update(Z_ARRVAL_P(result), 0, value);
+ break;
+ case IS_TRUE:
+ zend_hash_index_update(Z_ARRVAL_P(result), 1, value);
+ break;
+ case IS_NULL:
+ zend_hash_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), value);
+ break;
+ default:
+ zend_error(E_COMPILE_ERROR, "Illegal offset type");
+ break;
}
- opline--;
+ } else {
+ zend_hash_next_index_insert(Z_ARRVAL_P(result), value);
}
- CG(active_op_array)->last = array_node->u.op.opline_num;
-
- result->op_type = IS_CONST;
- ZVAL_COPY_VALUE(&result->u.constant, &array);
- } else {
- GET_NODE(result, init_opline->result);
}
- result->EA = 0;
+
+ return 1;
}
/* }}} */
-void zend_do_add_list_element(const znode *element TSRMLS_DC) /* {{{ */
+void zend_compile_binary_op(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- list_llist_element lle;
+ zend_ast *left_ast = ast->child[0];
+ zend_ast *right_ast = ast->child[1];
+ uint32_t opcode = ast->attr;
- if (element) {
- zend_check_writable_variable(element);
+ znode left_node, right_node;
+ zend_compile_expr(&left_node, left_ast TSRMLS_CC);
+ zend_compile_expr(&right_node, right_ast TSRMLS_CC);
- lle.var = *element;
- zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
- zend_llist_prepend_element(&CG(list_llist), &lle);
+ if (left_node.op_type == IS_CONST && right_node.op_type == IS_CONST) {
+ result->op_type = IS_CONST;
+ zend_ct_eval_binary_op(&result->u.constant, opcode,
+ &left_node.u.constant, &right_node.u.constant TSRMLS_CC);
+ zval_ptr_dtor(&left_node.u.constant);
+ zval_ptr_dtor(&right_node.u.constant);
+ return;
}
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-/* }}} */
-void zend_do_new_list_begin(TSRMLS_D) /* {{{ */
-{
- int current_dimension = 0;
- zend_llist_add_element(&CG(dimension_llist), &current_dimension);
+ zend_emit_op_tmp(result, opcode, &left_node, &right_node TSRMLS_CC);
}
/* }}} */
-void zend_do_new_list_end(TSRMLS_D) /* {{{ */
+/* We do not use zend_compile_binary_op for this because we want to retain the left-to-right
+ * evaluation order. */
+void zend_compile_greater(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_llist_remove_tail(&CG(dimension_llist));
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-/* }}} */
+ zend_ast *left_ast = ast->child[0];
+ zend_ast *right_ast = ast->child[1];
+ znode left_node, right_node;
-void zend_do_list_init(TSRMLS_D) /* {{{ */
-{
- zend_stack_push(&CG(list_stack), &CG(list_llist));
- zend_stack_push(&CG(list_stack), &CG(dimension_llist));
- zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
- zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_do_new_list_begin(TSRMLS_C);
-}
-/* }}} */
+ ZEND_ASSERT(ast->kind == ZEND_AST_GREATER || ast->kind == ZEND_AST_GREATER_EQUAL);
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) /* {{{ */
-{
- zend_llist_element *le;
- zend_llist_element *dimension;
- zend_op *opline;
- znode last_container;
+ zend_compile_expr(&left_node, left_ast TSRMLS_CC);
+ zend_compile_expr(&right_node, right_ast TSRMLS_CC);
- le = CG(list_llist).head;
- while (le) {
- zend_llist *tmp_dimension_llist = &((list_llist_element *)le->data)->dimensions;
- dimension = tmp_dimension_llist->head;
- while (dimension) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (dimension == tmp_dimension_llist->head) { /* first */
- last_container = *expr;
- switch (expr->op_type) {
- case IS_VAR:
- case IS_CV:
- opline->opcode = ZEND_FETCH_DIM_R;
- break;
- case IS_TMP_VAR:
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- case IS_CONST: /* fetch_dim_tmp_var will handle this bogus fetch */
- zval_copy_ctor(&expr->u.constant);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- break;
- }
- opline->extended_value |= ZEND_FETCH_ADD_LOCK;
- } else {
- opline->opcode = ZEND_FETCH_DIM_R;
- }
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, &last_container);
- opline->op2_type = IS_CONST;
- LITERAL_INT(opline->op2, *((int *) dimension->data));
- GET_NODE(&last_container, opline->result);
- dimension = dimension->next;
- }
- ((list_llist_element *) le->data)->value = last_container;
- zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
- zend_do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value TSRMLS_CC);
- zend_do_free(result TSRMLS_CC);
- le = le->next;
+ if (left_node.op_type == IS_CONST && right_node.op_type == IS_CONST) {
+ result->op_type = IS_CONST;
+ zend_ct_eval_greater(&result->u.constant, ast->kind,
+ &left_node.u.constant, &right_node.u.constant TSRMLS_CC);
+ zval_ptr_dtor(&left_node.u.constant);
+ zval_ptr_dtor(&right_node.u.constant);
+ return;
}
- zend_llist_destroy(&CG(dimension_llist));
- zend_llist_destroy(&CG(list_llist));
- *result = *expr;
- {
- zend_llist *p;
- /* restore previous lists */
- p = zend_stack_top(&CG(list_stack));
- CG(dimension_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- p = zend_stack_top(&CG(list_stack));
- CG(list_llist) = *p;
- zend_stack_del_top(&CG(list_stack));
- }
+ zend_emit_op_tmp(result,
+ ast->kind == ZEND_AST_GREATER ? ZEND_IS_SMALLER : ZEND_IS_SMALLER_OR_EQUAL,
+ &right_node, &left_node TSRMLS_CC);
}
/* }}} */
-void zend_init_list(void *result, void *item TSRMLS_DC) /* {{{ */
+void zend_compile_unary_op(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- void** list = emalloc(sizeof(void*) * 2);
+ zend_ast *expr_ast = ast->child[0];
+ uint32_t opcode = ast->attr;
- list[0] = item;
- list[1] = NULL;
+ znode expr_node;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
- *(void**)result = list;
+ zend_emit_op_tmp(result, opcode, &expr_node, NULL TSRMLS_CC);
}
/* }}} */
-void zend_add_to_list(void *result, void *item TSRMLS_DC) /* {{{ */
+void zend_compile_unary_pm(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- void** list = *(void**)result;
- size_t n = 0;
+ zend_ast *expr_ast = ast->child[0];
+ znode zero_node, expr_node;
- if (list) {
- while (list[n]) {
- n++;
- }
- }
+ ZEND_ASSERT(ast->kind == ZEND_AST_UNARY_PLUS || ast->kind == ZEND_AST_UNARY_MINUS);
- list = erealloc(list, sizeof(void*) * (n+2));
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
- list[n] = item;
- list[n+1] = NULL;
+ if (expr_node.op_type == IS_CONST) {
+ result->op_type = IS_CONST;
+ zend_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant TSRMLS_CC);
+ zval_ptr_dtor(&expr_node.u.constant);
+ return;
+ }
- *(void**)result = list;
+ zero_node.op_type = IS_CONST;
+ ZVAL_LONG(&zero_node.u.constant, 0);
+
+ zend_emit_op_tmp(result, ast->kind == ZEND_AST_UNARY_PLUS ? ZEND_ADD : ZEND_SUB,
+ &zero_node, &expr_node TSRMLS_CC);
}
/* }}} */
-void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) /* {{{ */
+void zend_compile_short_circuiting(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zval tmp;
- zend_op *opline;
- znode lval;
- znode result;
+ zend_ast *left_ast = ast->child[0];
+ zend_ast *right_ast = ast->child[1];
- if (static_assignment) {
- ZVAL_COPY_VALUE(&tmp, &static_assignment->u.constant);
- } else {
- ZVAL_NULL(&tmp);
- Z_CONST_FLAGS(tmp) = 0;
- }
- if (!CG(active_op_array)->static_variables) {
- if (CG(active_op_array)->scope) {
- CG(active_op_array)->scope->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
- }
- ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
- zend_hash_init(CG(active_op_array)->static_variables, 8, NULL, ZVAL_PTR_DTOR, 0);
- }
- zend_hash_update(CG(active_op_array)->static_variables, Z_STR(varname->u.constant), &tmp);
-
- if (varname->op_type == IS_CONST) {
- if (Z_TYPE(varname->u.constant) != IS_STRING) {
- convert_to_string(&varname->u.constant);
- }
- }
+ znode left_node, right_node;
+ zend_op *opline_jmpz, *opline_bool;
+ uint32_t opnum_jmpz;
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = (fetch_type == ZEND_FETCH_LEXICAL) ? ZEND_FETCH_R : ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, varname);
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_STATIC;
- GET_NODE(&result, opline->result);
+ ZEND_ASSERT(ast->kind == ZEND_AST_AND || ast->kind == ZEND_AST_OR);
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
+ zend_compile_expr(&left_node, left_ast TSRMLS_CC);
- if (fetch_type == ZEND_FETCH_LEXICAL) {
- znode dummy;
+ opnum_jmpz = get_next_op_number(CG(active_op_array));
+ opline_jmpz = zend_emit_op(NULL, ast->kind == ZEND_AST_AND ? ZEND_JMPZ_EX : ZEND_JMPNZ_EX,
+ &left_node, NULL TSRMLS_CC);
- zend_do_begin_variable_parse(TSRMLS_C);
- zend_do_assign(&dummy, &lval, &result TSRMLS_CC);
- zend_do_free(&dummy TSRMLS_CC);
+ if (left_node.op_type == IS_TMP_VAR) {
+ SET_NODE(opline_jmpz->result, &left_node);
} else {
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
+ opline_jmpz->result.var = get_temporary_variable(CG(active_op_array));
+ opline_jmpz->result_type = IS_TMP_VAR;
}
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result_type |= EXT_TYPE_UNUSED;
-}
-/* }}} */
+ GET_NODE(result, opline_jmpz->result);
-void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) /* {{{ */
-{
- znode value;
+ zend_compile_expr(&right_node, right_ast TSRMLS_CC);
- if (Z_STRSIZE(varname->u.constant) == sizeof("this") - 1 &&
- memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable");
- return;
- }
+ opline_bool = zend_emit_op(NULL, ZEND_BOOL, &right_node, NULL TSRMLS_CC);
+ SET_NODE(opline_bool->result, result);
- value.op_type = IS_CONST;
- ZVAL_NULL(&value.u.constant);
- Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
- zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC);
+ zend_update_jump_target_to_next(opnum_jmpz TSRMLS_CC);
}
/* }}} */
-void zend_do_fetch_global_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC) /* {{{ */
+void zend_compile_post_incdec(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- znode lval;
- znode result;
-
- if (varname->op_type == IS_CONST) {
- if (Z_TYPE(varname->u.constant) != IS_STRING) {
- convert_to_string(&varname->u.constant);
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *var_ast = ast->child[0];
+ ZEND_ASSERT(ast->kind == ZEND_AST_POST_INC || ast->kind == ZEND_AST_POST_DEC);
- if (varname->op_type == IS_CONST &&
- !zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) &&
- !(Z_STRSIZE(varname->u.constant) == (sizeof("this")-1) &&
- !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1))) {
- opline->opcode = ZEND_BIND_GLOBAL;
- SET_NODE(opline->op2, varname);
- opline->op1_type = IS_CV;
- zval_copy_ctor(&varname->u.constant);
- opline->op1.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
+ if (var_ast->kind == ZEND_AST_PROP) {
+ zend_op *opline = zend_compile_prop_common(NULL, var_ast, BP_VAR_RW TSRMLS_CC);
+ opline->opcode = ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC_OBJ : ZEND_POST_DEC_OBJ;
+ zend_make_tmp_result(result, opline TSRMLS_CC);
} else {
- opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, varname);
- SET_UNUSED(opline->op2);
- opline->extended_value = fetch_type;
- GET_NODE(&result, opline->result);
-
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
-
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result_type |= EXT_TYPE_UNUSED;
+ znode var_node;
+ zend_compile_var(&var_node, var_ast, BP_VAR_RW TSRMLS_CC);
+ zend_emit_op_tmp(result, ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC : ZEND_POST_DEC,
+ &var_node, NULL TSRMLS_CC);
}
}
/* }}} */
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC) /* {{{ */
+void zend_compile_pre_incdec(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *var_ast = ast->child[0];
+ ZEND_ASSERT(ast->kind == ZEND_AST_PRE_INC || ast->kind == ZEND_AST_PRE_DEC);
- opline->opcode = ZEND_CAST;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, expr);
- SET_UNUSED(opline->op2);
- opline->extended_value = type;
- GET_NODE(result, opline->result);
+ if (var_ast->kind == ZEND_AST_PROP) {
+ zend_op *opline = zend_compile_prop_common(result, var_ast, BP_VAR_RW TSRMLS_CC);
+ opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_OBJ : ZEND_PRE_DEC_OBJ;
+ } else {
+ znode var_node;
+ zend_compile_var(&var_node, var_ast, BP_VAR_RW TSRMLS_CC);
+ zend_emit_op(result, ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC : ZEND_PRE_DEC,
+ &var_node, NULL TSRMLS_CC);
+ }
}
/* }}} */
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC) /* {{{ */
+void zend_compile_cast(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_do_extended_fcall_begin(TSRMLS_C);
- {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *expr_ast = ast->child[0];
+ znode expr_node;
+ zend_op *opline;
- opline->opcode = ZEND_INCLUDE_OR_EVAL;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, op1);
- SET_UNUSED(opline->op2);
- opline->extended_value = type;
- GET_NODE(result, opline->result);
- }
- zend_do_extended_fcall_end(TSRMLS_C);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+
+ opline = zend_emit_op_tmp(result, ZEND_CAST, &expr_node, NULL TSRMLS_CC);
+ opline->extended_value = ast->attr;
}
/* }}} */
-void zend_do_indirect_references(znode *result, const znode *num_references, znode *variable TSRMLS_DC) /* {{{ */
+static void zend_compile_shorthand_conditional(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int i;
+ zend_ast *cond_ast = ast->child[0];
+ zend_ast *false_ast = ast->child[2];
- zend_do_end_variable_parse(variable, BP_VAR_R, 0 TSRMLS_CC);
- for (i=1; i<Z_IVAL(num_references->u.constant); i++) {
- fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC);
- *variable = *result;
- }
- zend_do_begin_variable_parse(TSRMLS_C);
- fetch_simple_variable(result, variable, 1 TSRMLS_CC);
- /* there is a chance someone is accessing $this */
- if (CG(active_op_array)->scope && CG(active_op_array)->this_var == -1) {
- zend_string *key = STR_INIT("this", sizeof("this")-1, 0);
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC);
- }
-}
-/* }}} */
+ znode cond_node, false_node;
+ zend_op *opline_jmp_set, *opline_qm_assign;
+ uint32_t opnum_jmp_set;
-void zend_do_unset(znode *variable TSRMLS_DC) /* {{{ */
-{
- zend_op *last_op;
+ ZEND_ASSERT(ast->child[1] == NULL);
- zend_check_writable_variable(variable);
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
- if (variable->op_type == IS_CV) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_UNSET_VAR;
- SET_NODE(opline->op1, variable);
- SET_UNUSED(opline->op2);
- SET_UNUSED(opline->result);
- opline->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
- } else {
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
+ opnum_jmp_set = get_next_op_number(CG(active_op_array));
+ zend_emit_op_tmp(result, ZEND_JMP_SET, &cond_node, NULL TSRMLS_CC);
- switch (last_op->opcode) {
- case ZEND_FETCH_UNSET:
- last_op->opcode = ZEND_UNSET_VAR;
- SET_UNUSED(last_op->result);
- break;
- case ZEND_FETCH_DIM_UNSET:
- last_op->opcode = ZEND_UNSET_DIM;
- SET_UNUSED(last_op->result);
- break;
- case ZEND_FETCH_OBJ_UNSET:
- last_op->opcode = ZEND_UNSET_OBJ;
- SET_UNUSED(last_op->result);
- break;
+ zend_compile_expr(&false_node, false_ast TSRMLS_CC);
- }
- }
+ opline_jmp_set = &CG(active_op_array)->opcodes[opnum_jmp_set];
+ opline_jmp_set->op2.opline_num = get_next_op_number(CG(active_op_array)) + 1;
+ opline_qm_assign = zend_emit_op_tmp(NULL, ZEND_QM_ASSIGN, &false_node, NULL TSRMLS_CC);
+ SET_NODE(opline_qm_assign->result, result);
}
/* }}} */
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC) /* {{{ */
+void zend_compile_conditional(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *last_op;
+ zend_ast *cond_ast = ast->child[0];
+ zend_ast *true_ast = ast->child[1];
+ zend_ast *false_ast = ast->child[2];
- zend_do_end_variable_parse(variable, BP_VAR_IS, 0 TSRMLS_CC);
-
- if (zend_is_function_or_method_call(variable)) {
- if (type == ZEND_ISEMPTY) {
- /* empty(func()) can be transformed to !func() */
- zend_do_unary_op(ZEND_BOOL_NOT, result, variable TSRMLS_CC);
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of a function call (you can use \"null !== func()\" instead)");
- }
+ znode cond_node, true_node, false_node;
+ zend_op *opline_qm_assign1, *opline_qm_assign2;
+ uint32_t opnum_jmpz, opnum_jmp, opnum_qm_assign1;
+ if (!true_ast) {
+ zend_compile_shorthand_conditional(result, ast TSRMLS_CC);
return;
}
+
+ zend_compile_expr(&cond_node, cond_ast TSRMLS_CC);
- if (variable->op_type == IS_CV) {
- last_op = get_next_op(CG(active_op_array) TSRMLS_CC);
- last_op->opcode = ZEND_ISSET_ISEMPTY_VAR;
- SET_NODE(last_op->op1, variable);
- SET_UNUSED(last_op->op2);
- last_op->result.var = get_temporary_variable(CG(active_op_array));
- last_op->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
- } else {
- last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1];
+ opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0 TSRMLS_CC);
- switch (last_op->opcode) {
- case ZEND_FETCH_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_VAR;
- break;
- case ZEND_FETCH_DIM_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ;
- break;
- case ZEND_FETCH_OBJ_IS:
- last_op->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ;
- break;
- }
- }
- last_op->result_type = IS_TMP_VAR;
- last_op->extended_value |= type;
+ zend_compile_expr(&true_node, true_ast TSRMLS_CC);
- GET_NODE(result, last_op->result);
-}
-/* }}} */
+ opnum_qm_assign1 = get_next_op_number(CG(active_op_array));
+ zend_emit_op_tmp(result, ZEND_QM_ASSIGN, &true_node, NULL TSRMLS_CC);
-void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC) /* {{{ */
-{
- int last_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
+ opnum_jmp = zend_emit_jump(0 TSRMLS_CC);
- if (last_op_number > 0) {
- opline = &CG(active_op_array)->opcodes[last_op_number-1];
- if (opline->opcode == ZEND_FETCH_CLASS) {
- opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
- }
- }
+ zend_update_jump_target_to_next(opnum_jmpz TSRMLS_CC);
- if (expr->op_type == IS_CONST) {
- zend_error_noreturn(E_COMPILE_ERROR, "instanceof expects an object instance, constant given");
- }
+ zend_compile_expr(&false_node, false_ast TSRMLS_CC);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_INSTANCEOF;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, expr);
+ opline_qm_assign1 = &CG(active_op_array)->opcodes[opnum_qm_assign1];
+ opline_qm_assign2 = zend_emit_op(NULL, opline_qm_assign1->opcode, &false_node, NULL TSRMLS_CC);
+ SET_NODE(opline_qm_assign2->result, result);
- SET_NODE(opline->op2, class_znode);
-
- GET_NODE(result, opline->result);
+ zend_update_jump_target_to_next(opnum_jmp TSRMLS_CC);
}
/* }}} */
-void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, znode *array, znode *as_token, int variable TSRMLS_DC) /* {{{ */
+void zend_compile_coalesce(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- zend_bool is_variable;
- zend_op dummy_opline;
+ zend_ast *expr_ast = ast->child[0];
+ zend_ast *default_ast = ast->child[1];
- if (variable) {
- if (zend_is_function_or_method_call(array)) {
- is_variable = 0;
- } else {
- is_variable = 1;
- }
- /* save the location of FETCH_W instruction(s) */
- open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
- zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
- } else {
- is_variable = 0;
- open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
- }
-
- /* save the location of FE_RESET */
- foreach_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ znode expr_node, default_node;
+ zend_op *opline;
+ uint32_t opnum;
- /* Preform array reset */
- opline->opcode = ZEND_FE_RESET;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, array);
- SET_UNUSED(opline->op2);
- opline->extended_value = is_variable ? ZEND_FE_RESET_VARIABLE : 0;
+ zend_compile_var(&expr_node, expr_ast, BP_VAR_IS TSRMLS_CC);
- COPY_NODE(dummy_opline.result, opline->result);
- zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline);
+ opnum = get_next_op_number(CG(active_op_array));
+ zend_emit_op_tmp(result, ZEND_COALESCE, &expr_node, NULL TSRMLS_CC);
- /* save the location of FE_FETCH */
- as_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
+ zend_compile_expr(&default_node, default_ast TSRMLS_CC);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FE_FETCH;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- COPY_NODE(opline->op1, dummy_opline.result);
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
+ opline = zend_emit_op_tmp(NULL, ZEND_QM_ASSIGN, &default_node, NULL TSRMLS_CC);
+ SET_NODE(opline->result, result);
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_OP_DATA;
- /* Allocate enough space to keep HashPointer on VM stack */
- opline->op1_type = IS_TMP_VAR;
- opline->op1.var = get_temporary_variable(CG(active_op_array));
- if (sizeof(HashPointer) > sizeof(zval)) {
- /* Make shure 1 zval is enough for HashPointer (2 must be enough) */
- get_temporary_variable(CG(active_op_array));
- }
- SET_UNUSED(opline->op2);
- SET_UNUSED(opline->result);
+ opline = &CG(active_op_array)->opcodes[opnum];
+ opline->op2.opline_num = get_next_op_number(CG(active_op_array));
}
/* }}} */
-void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token, const znode *as_token, znode *value, znode *key TSRMLS_DC) /* {{{ */
+void zend_compile_print(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- znode dummy, value_node;
- zend_bool assign_by_ref=0;
-
- opline = &CG(active_op_array)->opcodes[as_token->u.op.opline_num];
- if (key->op_type != IS_UNUSED) {
- znode *tmp;
-
- /* switch between the key and value... */
- tmp = key;
- key = value;
- value = tmp;
-
- /* Mark extended_value in case both key and value are being used */
- opline->extended_value |= ZEND_FE_FETCH_WITH_KEY;
- }
-
- if ((key->op_type != IS_UNUSED)) {
- if (key->EA & ZEND_PARSED_REFERENCE_VARIABLE) {
- zend_error_noreturn(E_COMPILE_ERROR, "Key element cannot be a reference");
- }
- if (key->EA & ZEND_PARSED_LIST_EXPR) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use list as key element");
- }
- }
-
- if (value->EA & ZEND_PARSED_REFERENCE_VARIABLE) {
- assign_by_ref = 1;
-
- /* Mark extended_value for assign-by-reference */
- opline->extended_value |= ZEND_FE_FETCH_BYREF;
- CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE;
- } else {
- zend_op *fetch = &CG(active_op_array)->opcodes[foreach_token->u.op.opline_num];
- zend_op *end = &CG(active_op_array)->opcodes[open_brackets_token->u.op.opline_num];
-
- /* Change "write context" into "read context" */
- fetch->extended_value = 0; /* reset ZEND_FE_RESET_VARIABLE */
- while (fetch != end) {
- --fetch;
- if (fetch->opcode == ZEND_FETCH_DIM_W && fetch->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- if (fetch->opcode == ZEND_SEPARATE) {
- MAKE_NOP(fetch);
- } else {
- fetch->opcode -= 3; /* FETCH_W -> FETCH_R */
- }
- }
- }
-
- GET_NODE(&value_node, opline->result);
-
- if (value->EA & ZEND_PARSED_LIST_EXPR) {
- if (!CG(list_llist).head) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list");
- }
- zend_do_list_end(&dummy, &value_node TSRMLS_CC);
- zend_do_free(&dummy TSRMLS_CC);
- } else {
- if (assign_by_ref) {
- zend_do_end_variable_parse(value, BP_VAR_W, 0 TSRMLS_CC);
- /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
- zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
- } else {
- zend_do_assign(&dummy, value, &value_node TSRMLS_CC);
- zend_do_free(&dummy TSRMLS_CC);
- }
- }
+ zend_ast *expr_ast = ast->child[0];
- if (key->op_type != IS_UNUSED) {
- znode key_node;
+ znode expr_node;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
- opline = &CG(active_op_array)->opcodes[as_token->u.op.opline_num+1];
- opline->result_type = IS_TMP_VAR;
- opline->result.opline_num = get_temporary_variable(CG(active_op_array));
- GET_NODE(&key_node, opline->result);
-
- zend_do_assign(&dummy, key, &key_node TSRMLS_CC);
- zend_do_free(&dummy TSRMLS_CC);
- }
-
- do_begin_loop(TSRMLS_C);
- INC_BPC(CG(active_op_array));
+ zend_emit_op_tmp(result, ZEND_PRINT, &expr_node, NULL TSRMLS_CC);
}
/* }}} */
-void zend_do_foreach_end(const znode *foreach_token, const znode *as_token TSRMLS_DC) /* {{{ */
+void zend_compile_exit(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *container_ptr;
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.opline_num = as_token->u.op.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ zend_ast *expr_ast = ast->child[0];
- CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array)); /* FE_RESET */
- CG(active_op_array)->opcodes[as_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array)); /* FE_FETCH */
-
- do_end_loop(as_token->u.op.opline_num, 1 TSRMLS_CC);
-
- container_ptr = zend_stack_top(&CG(foreach_copy_stack));
- generate_free_foreach_copy(container_ptr TSRMLS_CC);
- zend_stack_del_top(&CG(foreach_copy_stack));
-
- DEC_BPC(CG(active_op_array));
-}
-/* }}} */
+ if (expr_ast) {
+ znode expr_node;
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
+ zend_emit_op(NULL, ZEND_EXIT, &expr_node, NULL TSRMLS_CC);
+ } else {
+ zend_emit_op(NULL, ZEND_EXIT, NULL, NULL TSRMLS_CC);
+ }
-void zend_do_declare_begin(TSRMLS_D) /* {{{ */
-{
- zend_stack_push(&CG(declare_stack), &CG(declarables));
+ result->op_type = IS_CONST;
+ ZVAL_BOOL(&result->u.constant, 1);
}
/* }}} */
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */
+void zend_compile_yield(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRSIZE(var->u.constant), "ticks", sizeof("ticks")-1)) {
- convert_to_int(&val->u.constant);
- CG(declarables).ticks = val->u.constant;
- } else if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRSIZE(var->u.constant), "encoding", sizeof("encoding")-1)) {
- if (Z_TYPE(val->u.constant) == IS_CONSTANT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use constants as encoding");
- }
+ zend_ast *value_ast = ast->child[0];
+ zend_ast *key_ast = ast->child[1];
- /*
- * Check that the pragma comes before any opcodes. If the compilation
- * got as far as this, the previous portion of the script must have been
- * parseable according to the .ini script_encoding setting. We still
- * want to tell them to put declare() at the top.
- */
- {
- int num = CG(active_op_array)->last;
- /* ignore ZEND_EXT_STMT and ZEND_TICKS */
- while (num > 0 &&
- (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
- CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
- --num;
- }
+ znode value_node, key_node;
+ znode *value_node_ptr = NULL, *key_node_ptr = NULL;
+ zend_op *opline;
+ zend_bool returns_by_ref = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
- if (num > 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be the very first statement in the script");
- }
- }
+ if (!CG(active_op_array)->function_name) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "The \"yield\" expression can only be used inside a function");
+ }
- if (CG(multibyte)) {
- const zend_encoding *new_encoding, *old_encoding;
- zend_encoding_filter old_input_filter;
+ CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR;
- CG(encoding_declared) = 1;
+ if (key_ast) {
+ zend_compile_expr(&key_node, key_ast TSRMLS_CC);
+ key_node_ptr = &key_node;
+ }
- convert_to_string(&val->u.constant);
- new_encoding = zend_multibyte_fetch_encoding(Z_STRVAL(val->u.constant) TSRMLS_CC);
- if (!new_encoding) {
- zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", Z_STRVAL(val->u.constant));
- } else {
- old_input_filter = LANG_SCNG(input_filter);
- old_encoding = LANG_SCNG(script_encoding);
- zend_multibyte_set_filter(new_encoding TSRMLS_CC);
-
- /* need to re-scan if input filter changed */
- if (old_input_filter != LANG_SCNG(input_filter) ||
- (old_input_filter && new_encoding != old_encoding)) {
- zend_multibyte_yyinput_again(old_input_filter, old_encoding TSRMLS_CC);
- }
- }
+ if (value_ast) {
+ if (returns_by_ref && zend_is_variable(value_ast) && !zend_is_call(value_ast)) {
+ zend_compile_var(&value_node, value_ast, BP_VAR_REF TSRMLS_CC);
} else {
- zend_error(E_COMPILE_WARNING, "declare(encoding=...) ignored because Zend multibyte feature is turned off by settings");
+ zend_compile_expr(&value_node, value_ast TSRMLS_CC);
}
- zval_dtor(&val->u.constant);
- } else {
- zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", Z_STRVAL(var->u.constant));
- zval_dtor(&val->u.constant);
+ value_node_ptr = &value_node;
}
- zval_dtor(&var->u.constant);
-}
-/* }}} */
-void zend_do_declare_end(const znode *declare_token TSRMLS_DC) /* {{{ */
-{
- zend_declarables *declarables = zend_stack_top(&CG(declare_stack));
- /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */
- if ((get_next_op_number(CG(active_op_array)) - declare_token->u.op.opline_num) - ((Z_IVAL(CG(declarables).ticks))?1:0)) {
- CG(declarables) = *declarables;
+ opline = zend_emit_op(result, ZEND_YIELD, value_node_ptr, key_node_ptr TSRMLS_CC);
+
+ if (value_ast && returns_by_ref && zend_is_call(value_ast)) {
+ opline->extended_value = ZEND_RETURNS_FUNCTION;
}
}
/* }}} */
-void zend_do_exit(znode *result, znode *message TSRMLS_DC) /* {{{ */
+void zend_compile_instanceof(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_EXIT;
- SET_NODE(opline->op1, message);
- SET_UNUSED(opline->op2);
+ zend_ast *obj_ast = ast->child[0];
+ zend_ast *class_ast = ast->child[1];
- result->op_type = IS_CONST;
- ZVAL_BOOL(&result->u.constant, 1);
-}
-/* }}} */
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ znode obj_node, class_node;
+ zend_op *opline;
- opline->opcode = ZEND_BEGIN_SILENCE;
- opline->result_type = IS_TMP_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- GET_NODE(strudel_token, opline->result);
-}
-/* }}} */
+ zend_compile_expr(&obj_node, obj_ast TSRMLS_CC);
+ if (obj_node.op_type == IS_CONST) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "instanceof expects an object instance, constant given");
+ }
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC) /* {{{ */
-{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline = zend_compile_class_ref(&class_node, class_ast TSRMLS_CC);
+ opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
- opline->opcode = ZEND_END_SILENCE;
- SET_NODE(opline->op1, strudel_token);
- SET_UNUSED(opline->op2);
+ zend_emit_op_tmp(result, ZEND_INSTANCEOF, &obj_node, &class_node TSRMLS_CC);
}
/* }}} */
-void zend_do_jmp_set(znode *value, znode *jmp_token, znode *colon_token TSRMLS_DC) /* {{{ */
+void zend_compile_include_or_eval(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- int op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (value->op_type == IS_VAR || value->op_type == IS_CV) {
- opline->opcode = ZEND_JMP_SET_VAR;
- opline->result_type = IS_VAR;
- } else {
- opline->opcode = ZEND_JMP_SET;
- opline->result_type = IS_TMP_VAR;
- }
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, value);
- SET_UNUSED(opline->op2);
+ zend_ast *expr_ast = ast->child[0];
+ znode expr_node;
+ zend_op *opline;
- GET_NODE(colon_token, opline->result);
+ zend_do_extended_fcall_begin(TSRMLS_C);
+ zend_compile_expr(&expr_node, expr_ast TSRMLS_CC);
- jmp_token->u.op.opline_num = op_number;
+ opline = zend_emit_op(result, ZEND_INCLUDE_OR_EVAL, &expr_node, NULL TSRMLS_CC);
+ opline->extended_value = ast->attr;
- INC_BPC(CG(active_op_array));
+ zend_do_extended_fcall_end(TSRMLS_C);
}
/* }}} */
-void zend_do_jmp_set_else(znode *result, znode *false_value, const znode *jmp_token, znode *colon_token TSRMLS_DC) /* {{{ */
+void zend_compile_isset_or_empty(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *var_ast = ast->child[0];
- SET_NODE(opline->result, colon_token);
- if (colon_token->op_type == IS_TMP_VAR) {
- if (false_value->op_type == IS_VAR || false_value->op_type == IS_CV) {
- CG(active_op_array)->opcodes[jmp_token->u.op.opline_num].opcode = ZEND_JMP_SET_VAR;
- CG(active_op_array)->opcodes[jmp_token->u.op.opline_num].result_type = IS_VAR;
- opline->opcode = ZEND_QM_ASSIGN_VAR;
- opline->result_type = IS_VAR;
+ znode var_node;
+ zend_op *opline;
+
+ ZEND_ASSERT(ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY);
+
+ if (!zend_is_variable(var_ast) || zend_is_call(var_ast)) {
+ if (ast->kind == ZEND_AST_EMPTY) {
+ /* empty(expr) can be transformed to !expr */
+ zend_ast *not_ast = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BOOL_NOT, var_ast);
+ zend_compile_expr(result, not_ast TSRMLS_CC);
+ return;
} else {
- opline->opcode = ZEND_QM_ASSIGN;
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use isset() on the result of an expression "
+ "(you can use \"null !== expression\" instead)");
}
- } else {
- opline->opcode = ZEND_QM_ASSIGN_VAR;
}
- opline->extended_value = 0;
- SET_NODE(opline->op1, false_value);
- SET_UNUSED(opline->op2);
- GET_NODE(result, opline->result);
-
- CG(active_op_array)->opcodes[jmp_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array));
-
- DEC_BPC(CG(active_op_array));
-}
-/* }}} */
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC) /* {{{ */
-{
- int jmpz_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline;
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- SET_NODE(opline->op1, cond);
- SET_UNUSED(opline->op2);
- opline->op2.opline_num = jmpz_op_number;
- GET_NODE(qm_token, opline->op2);
+ switch (var_ast->kind) {
+ case ZEND_AST_VAR:
+ if (zend_try_compile_cv(&var_node, var_ast TSRMLS_CC) == SUCCESS) {
+ opline = zend_emit_op(result, ZEND_ISSET_ISEMPTY_VAR, &var_node, NULL TSRMLS_CC);
+ opline->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
+ } else {
+ opline = zend_compile_simple_var_no_cv(result, var_ast, BP_VAR_IS TSRMLS_CC);
+ opline->opcode = ZEND_ISSET_ISEMPTY_VAR;
+ }
+ break;
+ case ZEND_AST_DIM:
+ opline = zend_compile_dim_common(result, var_ast, BP_VAR_IS TSRMLS_CC);
+ opline->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ;
+ break;
+ case ZEND_AST_PROP:
+ opline = zend_compile_prop_common(result, var_ast, BP_VAR_IS TSRMLS_CC);
+ opline->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ;
+ break;
+ case ZEND_AST_STATIC_PROP:
+ opline = zend_compile_static_prop_common(result, var_ast, BP_VAR_IS TSRMLS_CC);
+ opline->opcode = ZEND_ISSET_ISEMPTY_VAR;
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
- INC_BPC(CG(active_op_array));
+ result->op_type = opline->result_type = IS_TMP_VAR;
+ opline->extended_value |= ast->kind == ZEND_AST_ISSET ? ZEND_ISSET : ZEND_ISEMPTY;
}
/* }}} */
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC) /* {{{ */
+void zend_compile_silence(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *expr_ast = ast->child[0];
+ znode silence_node;
+ uint32_t opline_num;
+ zend_op *begin_silence, *end_silence;
- CG(active_op_array)->opcodes[qm_token->u.op.opline_num].op2.opline_num = get_next_op_number(CG(active_op_array))+1; /* jmp over the ZEND_JMP */
+ opline_num = get_next_op_number(CG(active_op_array));
+ begin_silence = zend_emit_op_tmp(&silence_node, ZEND_BEGIN_SILENCE, NULL, NULL TSRMLS_CC);
+ /* pair BEGIN_SILENCE and END_SILENCE opcodes */
+ begin_silence->op2.num = opline_num;
- if (true_value->op_type == IS_VAR || true_value->op_type == IS_CV) {
- opline->opcode = ZEND_QM_ASSIGN_VAR;
- opline->result_type = IS_VAR;
+ if (expr_ast->kind == ZEND_AST_VAR) {
+ /* For @$var we need to force a FETCH instruction, otherwise the CV access will
+ * happen outside the silenced section. */
+ zend_compile_simple_var_no_cv(result, expr_ast, BP_VAR_R TSRMLS_CC);
} else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->result_type = IS_TMP_VAR;
+ zend_compile_expr(result, expr_ast TSRMLS_CC);
}
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, true_value);
- SET_UNUSED(opline->op2);
- GET_NODE(qm_token, opline->result);
- colon_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_JMP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ end_silence = zend_emit_op(NULL, ZEND_END_SILENCE, &silence_node, NULL TSRMLS_CC);
+ /* pair BEGIN_SILENCE and END_SILENCE opcodes */
+ end_silence->op2.num = opline_num;
}
/* }}} */
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, const znode *colon_token TSRMLS_DC) /* {{{ */
+void zend_compile_shell_exec(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_ast *expr_ast = ast->child[0];
- SET_NODE(opline->result, qm_token);
- if (qm_token->op_type == IS_TMP_VAR) {
- if (false_value->op_type == IS_VAR || false_value->op_type == IS_CV) {
- CG(active_op_array)->opcodes[colon_token->u.op.opline_num - 1].opcode = ZEND_QM_ASSIGN_VAR;
- CG(active_op_array)->opcodes[colon_token->u.op.opline_num - 1].result_type = IS_VAR;
- opline->opcode = ZEND_QM_ASSIGN_VAR;
- opline->result_type = IS_VAR;
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- }
- } else {
- opline->opcode = ZEND_QM_ASSIGN_VAR;
- }
- SET_NODE(opline->op1, false_value);
- SET_UNUSED(opline->op2);
+ zval fn_name;
+ zend_ast *name_ast, *args_ast, *call_ast;
- CG(active_op_array)->opcodes[colon_token->u.op.opline_num].op1.opline_num = get_next_op_number(CG(active_op_array));
+ ZVAL_STRING(&fn_name, "shell_exec");
+ name_ast = zend_ast_create_zval(&fn_name);
+ args_ast = zend_ast_create_list(1, ZEND_AST_ARG_LIST, expr_ast);
+ call_ast = zend_ast_create(ZEND_AST_CALL, name_ast, args_ast);
- GET_NODE(result, opline->result);
+ zend_compile_expr(result, call_ast TSRMLS_CC);
- DEC_BPC(CG(active_op_array));
+ zval_ptr_dtor(&fn_name);
}
/* }}} */
-void zend_do_extended_info(TSRMLS_D) /* {{{ */
+void zend_compile_array(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
+ zend_ast_list *list = zend_ast_get_list(ast);
zend_op *opline;
+ uint32_t i, opnum_init = -1;
+ zend_bool packed = 1;
- if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
+ if (zend_try_ct_eval_array(&result->u.constant, ast TSRMLS_CC)) {
+ result->op_type = IS_CONST;
return;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *elem_ast = list->child[i];
+ zend_ast *value_ast = elem_ast->child[0];
+ zend_ast *key_ast = elem_ast->child[1];
+ zend_bool by_ref = elem_ast->attr;
- opline->opcode = ZEND_EXT_STMT;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-/* }}} */
+ znode value_node, key_node, *key_node_ptr = NULL;
-void zend_do_extended_fcall_begin(TSRMLS_D) /* {{{ */
-{
- zend_op *opline;
+ if (key_ast) {
+ zend_compile_expr(&key_node, key_ast TSRMLS_CC);
+ zend_handle_numeric_op(&key_node TSRMLS_CC);
+ key_node_ptr = &key_node;
+ }
- if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
- return;
+ if (by_ref) {
+ zend_ensure_writable_variable(value_ast);
+ zend_compile_var(&value_node, value_ast, BP_VAR_W TSRMLS_CC);
+ } else {
+ zend_compile_expr(&value_node, value_ast TSRMLS_CC);
+ }
+
+ if (i == 0) {
+ opnum_init = get_next_op_number(CG(active_op_array));
+ opline = zend_emit_op_tmp(result, ZEND_INIT_ARRAY, &value_node, key_node_ptr TSRMLS_CC);
+ opline->extended_value = list->children << ZEND_ARRAY_SIZE_SHIFT;
+ } else {
+ opline = zend_emit_op(NULL, ZEND_ADD_ARRAY_ELEMENT,
+ &value_node, key_node_ptr TSRMLS_CC);
+ SET_NODE(opline->result, result);
+ }
+ opline->extended_value |= by_ref;
+
+ if (key_ast && key_node.op_type == IS_CONST && Z_TYPE(key_node.u.constant) == IS_STRING) {
+ packed = 0;
+ }
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ /* Handle empty array */
+ if (!list->children) {
+ zend_emit_op_tmp(result, ZEND_INIT_ARRAY, NULL, NULL TSRMLS_CC);
+ }
- opline->opcode = ZEND_EXT_FCALL_BEGIN;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ /* Add a flag to INIT_ARRAY if we know this array cannot be packed */
+ if (!packed) {
+ ZEND_ASSERT(opnum_init != -1);
+ opline = &CG(active_op_array)->opcodes[opnum_init];
+ opline->extended_value |= ZEND_ARRAY_NOT_PACKED;
+ }
}
/* }}} */
-void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */
+void zend_compile_const(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
+ zend_ast *name_ast = ast->child[0];
+
zend_op *opline;
- if (!(CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO)) {
+ zend_bool is_fully_qualified;
+ zend_string *orig_name = zend_ast_get_str(name_ast);
+ zend_string *resolved_name = zend_resolve_const_name(
+ orig_name, name_ast->attr, &is_fully_qualified TSRMLS_CC);
+
+ if (zend_try_ct_eval_const(&result->u.constant, resolved_name, is_fully_qualified TSRMLS_CC)) {
+ result->op_type = IS_CONST;
+ zend_string_release(resolved_name);
return;
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, NULL TSRMLS_CC);
+ opline->op2_type = IS_CONST;
- opline->opcode = ZEND_EXT_FCALL_END;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
+ if (is_fully_qualified) {
+ opline->op2.constant = zend_add_const_name_literal(
+ CG(active_op_array), resolved_name, 0 TSRMLS_CC);
+ } else {
+ opline->extended_value = IS_CONSTANT_UNQUALIFIED;
+ if (CG(current_namespace)) {
+ opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
+ opline->op2.constant = zend_add_const_name_literal(
+ CG(active_op_array), resolved_name, 1 TSRMLS_CC);
+ } else {
+ opline->op2.constant = zend_add_const_name_literal(
+ CG(active_op_array), resolved_name, 0 TSRMLS_CC);
+ }
+ }
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
}
/* }}} */
-void zend_do_ticks(TSRMLS_D) /* {{{ */
+void zend_compile_class_const(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_TICKS;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- opline->extended_value = Z_IVAL(CG(declarables).ticks);
-}
-/* }}} */
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *const_ast = ast->child[1];
-zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC) /* {{{ */
-{
- zend_auto_global *auto_global;
+ znode class_node, const_node;
+ zend_op *opline;
- if ((auto_global = zend_hash_find_ptr(CG(auto_globals), name)) != NULL) {
- if (auto_global->armed) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
- }
- return 1;
+ if (zend_is_const_default_class_ref(class_ast)) {
+ class_node.op_type = IS_CONST;
+ ZVAL_STR(&class_node.u.constant, zend_resolve_class_name_ast(class_ast TSRMLS_CC));
+ } else {
+ zend_compile_class_ref(&class_node, class_ast TSRMLS_CC);
}
- return 0;
-}
-/* }}} */
-int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */
-{
- zend_auto_global auto_global;
- int retval;
+ zend_compile_expr(&const_node, const_ast TSRMLS_CC);
- auto_global.name = zend_new_interned_string(name TSRMLS_CC);
- auto_global.auto_global_callback = auto_global_callback;
- auto_global.jit = jit;
+ opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, &const_node TSRMLS_CC);
- retval = zend_hash_add_mem(CG(auto_globals), name, &auto_global, sizeof(zend_auto_global)) != NULL ? SUCCESS : FAILURE;
+ zend_set_class_name_op1(opline, &class_node TSRMLS_CC);
- STR_RELEASE(auto_global.name);
- return retval;
+ if (opline->op1_type == IS_CONST) {
+ zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);
+ } else {
+ zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
+ }
}
/* }}} */
-ZEND_API void zend_activate_auto_globals(TSRMLS_D) /* {{{ */
+void zend_compile_resolve_class_name(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_auto_global *auto_global;
-
- ZEND_HASH_FOREACH_PTR(CG(auto_globals), auto_global) {
- if (auto_global->jit) {
- auto_global->armed = 1;
- } else if (auto_global->auto_global_callback) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
- } else {
- auto_global->armed = 0;
- }
- } ZEND_HASH_FOREACH_END();
-}
-/* }}} */
+ zend_ast *name_ast = ast->child[0];
+ uint32_t fetch_type = zend_get_class_fetch_type(zend_ast_get_str(name_ast));
-int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */
-{
- int retval;
+ switch (fetch_type) {
+ case ZEND_FETCH_CLASS_SELF:
+ if (!CG(active_class_entry)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot access self::class when no class scope is active");
+ }
+ result->op_type = IS_CONST;
+ ZVAL_STR_COPY(&result->u.constant, CG(active_class_entry)->name);
+ break;
+ case ZEND_FETCH_CLASS_STATIC:
+ case ZEND_FETCH_CLASS_PARENT:
+ if (!CG(active_class_entry)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot access %s::class when no class scope is active",
+ fetch_type == ZEND_FETCH_CLASS_STATIC ? "static" : "parent");
+ } else {
+ zval class_str_zv;
+ zend_ast *class_str_ast, *class_const_ast;
- if (CG(increment_lineno)) {
- CG(zend_lineno)++;
- CG(increment_lineno) = 0;
- }
+ ZVAL_STRING(&class_str_zv, "class");
+ class_str_ast = zend_ast_create_zval(&class_str_zv);
+ class_const_ast = zend_ast_create(
+ ZEND_AST_CLASS_CONST, name_ast, class_str_ast);
-again:
- Z_TYPE_INFO(zendlval->u.constant) = IS_INT;
- retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
- switch (retval) {
- case T_COMMENT:
- case T_DOC_COMMENT:
- case T_OPEN_TAG:
- case T_WHITESPACE:
- goto again;
+ zend_compile_expr(result, class_const_ast TSRMLS_CC);
- case T_CLOSE_TAG:
- if (LANG_SCNG(yy_text)[LANG_SCNG(yy_leng)-1] != '>') {
- CG(increment_lineno) = 1;
- }
- if (CG(has_bracketed_namespaces) && !CG(in_namespace)) {
- goto again;
+ zval_ptr_dtor(&class_str_zv);
}
- retval = ';'; /* implicit ; */
break;
- case T_OPEN_TAG_WITH_ECHO:
- retval = T_ECHO;
+ case ZEND_FETCH_CLASS_DEFAULT:
+ result->op_type = IS_CONST;
+ ZVAL_STR(&result->u.constant, zend_resolve_class_name_ast(name_ast TSRMLS_CC));
break;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
-
- zendlval->op_type = IS_CONST;
- return retval;
}
/* }}} */
-ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC) /* {{{ */
+void zend_compile_encaps_list(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_bool persistent_hashes = (ce->type == ZEND_INTERNAL_CLASS) ? 1 : 0;
- dtor_func_t zval_ptr_dtor_func = ((persistent_hashes) ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR);
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
- ce->refcount = 1;
- ce->ce_flags = ZEND_ACC_CONSTANTS_UPDATED;
+ ZEND_ASSERT(list->children > 0);
- ce->default_properties_table = NULL;
- ce->default_static_members_table = NULL;
- zend_hash_init_ex(&ce->properties_info, 8, NULL, (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
- zend_hash_init_ex(&ce->constants_table, 8, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
- zend_hash_init_ex(&ce->function_table, 8, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
+ result->op_type = IS_TMP_VAR;
+ result->u.op.var = get_temporary_variable(CG(active_op_array));
- if (ce->type == ZEND_INTERNAL_CLASS) {
-#ifdef ZTS
- int n = zend_hash_num_elements(CG(class_table));
+ for (i = 0; i < list->children; ++i) {
+ zend_ast *elem_ast = list->child[i];
+ znode elem_node;
+ zend_op *opline;
- if (CG(static_members_table) && n >= CG(last_static_member)) {
- /* Support for run-time declaration: dl() */
- CG(last_static_member) = n+1;
- CG(static_members_table) = realloc(CG(static_members_table), (n+1)*sizeof(zval*));
- CG(static_members_table)[n] = NULL;
- }
- ce->static_members_table = (zval*)(zend_intptr_t)n;
-#else
- ce->static_members_table = NULL;
-#endif
- } else {
- ce->static_members_table = ce->default_static_members_table;
- ce->info.user.doc_comment = NULL;
- }
+ zend_compile_expr(&elem_node, elem_ast TSRMLS_CC);
- ce->default_properties_count = 0;
- ce->default_static_members_count = 0;
+ if (elem_ast->kind == ZEND_AST_ZVAL) {
+ zval *zv = &elem_node.u.constant;
+ ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
- if (nullify_handlers) {
- ce->constructor = NULL;
- ce->destructor = NULL;
- ce->clone = NULL;
- ce->__get = NULL;
- ce->__set = NULL;
- ce->__unset = NULL;
- ce->__isset = NULL;
- ce->__call = NULL;
- ce->__callstatic = NULL;
- ce->__tostring = NULL;
- ce->create_object = NULL;
- ce->get_iterator = NULL;
- ce->iterator_funcs.funcs = NULL;
- ce->interface_gets_implemented = NULL;
- ce->get_static_method = NULL;
- ce->parent = NULL;
- ce->num_interfaces = 0;
- ce->interfaces = NULL;
- ce->num_traits = 0;
- ce->traits = NULL;
- ce->trait_aliases = NULL;
- ce->trait_precedences = NULL;
- ce->serialize = NULL;
- ce->unserialize = NULL;
- ce->serialize_func = NULL;
- ce->unserialize_func = NULL;
- ce->__debugInfo = NULL;
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->info.internal.module = NULL;
- ce->info.internal.builtin_functions = NULL;
+ if (Z_STRLEN_P(zv) > 1) {
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_ADD_STRING;
+ } else if (Z_STRLEN_P(zv) == 1) {
+ char ch = *Z_STRVAL_P(zv);
+ zend_string_release(Z_STR_P(zv));
+ ZVAL_LONG(zv, ch);
+
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_ADD_CHAR;
+ } else {
+ /* String can be empty after a variable at the end of a heredoc */
+ zend_string_release(Z_STR_P(zv));
+ continue;
+ }
+ } else {
+ opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ opline->opcode = ZEND_ADD_VAR;
+ ZEND_ASSERT(elem_node.op_type != IS_CONST);
+ }
+
+ if (i == 0) {
+ SET_UNUSED(opline->op1);
+ } else {
+ SET_NODE(opline->op1, result);
}
+ SET_NODE(opline->op2, &elem_node);
+ SET_NODE(opline->result, result);
}
}
/* }}} */
-int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{{ */
+void zend_compile_magic_const(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if ((class_name_len == sizeof("self")-1) &&
- !strncasecmp(class_name, "self", sizeof("self")-1)) {
- return ZEND_FETCH_CLASS_SELF;
- } else if ((class_name_len == sizeof("parent")-1) &&
- !strncasecmp(class_name, "parent", sizeof("parent")-1)) {
- return ZEND_FETCH_CLASS_PARENT;
- } else if ((class_name_len == sizeof("static")-1) &&
- !strncasecmp(class_name, "static", sizeof("static")-1)) {
- return ZEND_FETCH_CLASS_STATIC;
- } else {
- return ZEND_FETCH_CLASS_DEFAULT;
+ zend_class_entry *ce = CG(active_class_entry);
+
+ if (zend_try_ct_eval_magic_const(&result->u.constant, ast TSRMLS_CC)) {
+ result->op_type = IS_CONST;
+ return;
}
-}
-/* }}} */
-ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var) /* {{{ */
-{
- return op_array->vars[EX_VAR_TO_NUM(var)];
+ ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce));
+
+ {
+ zend_ast *const_ast = zend_ast_create(ZEND_AST_CONST,
+ zend_ast_create_zval_from_str(zend_string_init("__CLASS__", sizeof("__CLASS__") - 1, 0)));
+ zend_compile_const(result, const_ast TSRMLS_CC);
+ zend_ast_destroy(const_ast);
+ }
}
/* }}} */
-void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRMLS_DC) /* {{{ */
+zend_bool zend_is_allowed_in_const_expr(zend_ast_kind kind) /* {{{ */
{
- if (prefix) {
- *result = *prefix;
- if (Z_TYPE(result->u.constant) == IS_STRING &&
- Z_STRSIZE(result->u.constant) == 0) {
- /* namespace\ */
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- znode tmp;
-
- zval_dtor(&result->u.constant);
- tmp.op_type = IS_CONST;
- ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
- zend_do_build_namespace_name(result, NULL, &tmp TSRMLS_CC);
- }
- }
- } else {
- result->op_type = IS_CONST;
- ZVAL_EMPTY_STRING(&result->u.constant);
- }
- /* prefix = result */
- zend_do_build_full_name(NULL, result, name, 0 TSRMLS_CC);
+ return kind == ZEND_AST_ZVAL || kind == ZEND_AST_BINARY_OP
+ || kind == ZEND_AST_GREATER || kind == ZEND_AST_GREATER_EQUAL
+ || kind == ZEND_AST_AND || kind == ZEND_AST_OR
+ || kind == ZEND_AST_UNARY_OP
+ || kind == ZEND_AST_UNARY_PLUS || kind == ZEND_AST_UNARY_MINUS
+ || kind == ZEND_AST_CONDITIONAL || kind == ZEND_AST_DIM
+ || kind == ZEND_AST_ARRAY || kind == ZEND_AST_ARRAY_ELEM
+ || kind == ZEND_AST_CONST || kind == ZEND_AST_CLASS_CONST
+ || kind == ZEND_AST_RESOLVE_CLASS_NAME || kind == ZEND_AST_MAGIC_CONST;
}
/* }}} */
-void zend_do_begin_namespace(znode *name, zend_bool with_bracket TSRMLS_DC) /* {{{ */
+void zend_compile_const_expr_class_const(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
- char *lcname;
+ zend_ast *ast = *ast_ptr;
+ zend_ast *class_ast = ast->child[0];
+ zend_ast *const_ast = ast->child[1];
+ zend_string *class_name;
+ zend_string *const_name = zend_ast_get_str(const_ast);
+ zval result;
+ int fetch_type;
- /* handle mixed syntax declaration or nested namespaces */
- if (!CG(has_bracketed_namespaces)) {
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* previous namespace declarations were unbracketed */
- if (with_bracket) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations");
- }
- }
- } else {
- /* previous namespace declarations were bracketed */
- if (!with_bracket) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations");
- } else if (Z_TYPE(CG(current_namespace)) != IS_UNDEF || CG(in_namespace)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Namespace declarations cannot be nested");
- }
+ if (class_ast->kind != ZEND_AST_ZVAL) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Dynamic class names are not allowed in compile-time class constant references");
}
- if (((!with_bracket && Z_TYPE(CG(current_namespace)) == IS_UNDEF) || (with_bracket && !CG(has_bracketed_namespaces))) && CG(active_op_array)->last > 0) {
- /* ignore ZEND_EXT_STMT and ZEND_TICKS */
- int num = CG(active_op_array)->last;
- while (num > 0 &&
- (CG(active_op_array)->opcodes[num-1].opcode == ZEND_EXT_STMT ||
- CG(active_op_array)->opcodes[num-1].opcode == ZEND_TICKS)) {
- --num;
- }
- if (num > 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Namespace declaration statement has to be the very first statement in the script");
- }
- }
+ class_name = zend_ast_get_str(class_ast);
+ fetch_type = zend_get_class_fetch_type(class_name);
- CG(in_namespace) = 1;
- if (with_bracket) {
- CG(has_bracketed_namespaces) = 1;
+ if (ZEND_FETCH_CLASS_STATIC == fetch_type) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "\"static::\" is not allowed in compile-time constants");
}
-
- if (name) {
- lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant));
- if (((Z_STRSIZE(name->u.constant) == sizeof("self")-1) &&
- !memcmp(lcname, "self", sizeof("self")-1)) ||
- ((Z_STRSIZE(name->u.constant) == sizeof("parent")-1) &&
- !memcmp(lcname, "parent", sizeof("parent")-1))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant));
- }
- efree(lcname);
-
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- zval_dtor(&CG(current_namespace));
- }
- ZVAL_COPY_VALUE(&CG(current_namespace), &name->u.constant);
+
+ if (ZEND_FETCH_CLASS_DEFAULT == fetch_type) {
+ class_name = zend_resolve_class_name_ast(class_ast TSRMLS_CC);
} else {
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- zval_dtor(&CG(current_namespace));
- ZVAL_UNDEF(&CG(current_namespace));
- }
+ zend_string_addref(class_name);
}
- if (CG(current_import)) {
- zend_hash_destroy(CG(current_import));
- efree(CG(current_import));
- CG(current_import) = NULL;
- }
+ Z_STR(result) = zend_concat3(
+ class_name->val, class_name->len, "::", 2, const_name->val, const_name->len);
- if (CG(current_import_function)) {
- zend_hash_destroy(CG(current_import_function));
- efree(CG(current_import_function));
- CG(current_import_function) = NULL;
- }
+ Z_TYPE_INFO(result) = IS_CONSTANT_EX;
+ Z_CONST_FLAGS(result) = fetch_type;
- if (CG(current_import_const)) {
- zend_hash_destroy(CG(current_import_const));
- efree(CG(current_import_const));
- CG(current_import_const) = NULL;
- }
+ zend_ast_destroy(ast);
+ zend_string_release(class_name);
- if (CG(doc_comment)) {
- STR_RELEASE(CG(doc_comment));
- CG(doc_comment) = NULL;
- }
+ *ast_ptr = zend_ast_create_zval(&result);
}
/* }}} */
-void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
+void zend_compile_const_expr_const(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
- zend_string *lcname;
- zval *name, ns, tmp;
- zend_bool warn = 0;
- zend_class_entry *ce;
+ zend_ast *ast = *ast_ptr;
+ zend_ast *name_ast = ast->child[0];
+ zend_string *orig_name = zend_ast_get_str(name_ast);
+ zend_bool is_fully_qualified;
- if (!CG(current_import)) {
- CG(current_import) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import), 8, NULL, ZVAL_PTR_DTOR, 0);
- }
+ zval result, resolved_name;
+ ZVAL_STR(&resolved_name, zend_resolve_const_name(
+ orig_name, name_ast->attr, &is_fully_qualified TSRMLS_CC));
- ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
- if (new_name) {
- name = &new_name->u.constant;
- } else {
- const char *p;
-
- /* The form "use A\B" is eqivalent to "use A\B as B".
- So we extract the last part of compound name to use as a new_name */
- name = &tmp;
- p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRSIZE(ns));
- if (p) {
- ZVAL_STRING(name, p+1);
- } else {
- ZVAL_ZVAL(name, &ns, 1, 0);
- warn = !is_global && Z_TYPE(CG(current_namespace)) == IS_UNDEF;
- }
+ if (zend_try_ct_eval_const(&result, Z_STR(resolved_name), is_fully_qualified TSRMLS_CC)) {
+ zend_string_release(Z_STR(resolved_name));
+ zend_ast_destroy(ast);
+ *ast_ptr = zend_ast_create_zval(&result);
+ return;
}
- lcname = STR_ALLOC(Z_STRSIZE_P(name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRSIZE_P(name));
-
- if (((Z_STRSIZE_P(name) == sizeof("self")-1) &&
- !memcmp(lcname->val, "self", sizeof("self")-1)) ||
- ((Z_STRSIZE_P(name) == sizeof("parent")-1) &&
- !memcmp(lcname->val, "parent", sizeof("parent")-1))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
+ Z_TYPE_INFO(resolved_name) = IS_CONSTANT_EX;
+ if (!is_fully_qualified) {
+ Z_CONST_FLAGS(resolved_name) = IS_CONSTANT_UNQUALIFIED;
}
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix import name with current namespace name to avoid conflicts with classes */
- zend_string *c_ns_name = STR_ALLOC(Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name), 0);
+ zend_ast_destroy(ast);
+ *ast_ptr = zend_ast_create_zval(&resolved_name);
+}
+/* }}} */
- zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace)));
- c_ns_name->val[Z_STRSIZE(CG(current_namespace))] = '\\';
- memcpy(c_ns_name->val+Z_STRSIZE(CG(current_namespace))+1, lcname->val, Z_STRSIZE_P(name)+1);
- if (zend_hash_exists(CG(class_table), c_ns_name)) {
- char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns));
+void zend_compile_const_expr_resolve_class_name(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
+{
+ zend_ast *ast = *ast_ptr;
+ zend_ast *name_ast = ast->child[0];
+ uint32_t fetch_type = zend_get_class_fetch_type(zend_ast_get_str(name_ast));
+ zval result;
- if (Z_STRSIZE(ns) != Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) ||
- memcmp(tmp2, c_ns_name->val, Z_STRSIZE(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
+ switch (fetch_type) {
+ case ZEND_FETCH_CLASS_SELF:
+ if (!CG(active_class_entry)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot access self::class when no class scope is active");
}
- efree(tmp2);
- }
- STR_FREE(c_ns_name);
- } else if ((ce = zend_hash_find_ptr(CG(class_table), lcname)) != NULL &&
- ce->type == ZEND_USER_CLASS &&
- ce->info.user.filename == CG(compiled_filename)) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns));
-
- if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) ||
- memcmp(c_tmp, lcname->val, Z_STRSIZE(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(c_tmp);
+ ZVAL_STR_COPY(&result, CG(active_class_entry)->name);
+ break;
+ case ZEND_FETCH_CLASS_STATIC:
+ case ZEND_FETCH_CLASS_PARENT:
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "%s::class cannot be used for compile-time class name resolution",
+ fetch_type == ZEND_FETCH_CLASS_STATIC ? "static" : "parent"
+ );
+ break;
+ case ZEND_FETCH_CLASS_DEFAULT:
+ ZVAL_STR(&result, zend_resolve_class_name_ast(name_ast TSRMLS_CC));
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
- if (zend_hash_add(CG(current_import), lcname, &ns) == NULL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- if (warn) {
- if (!strcmp(Z_STRVAL_P(name), "strict")) {
- zend_error_noreturn(E_COMPILE_ERROR, "You seem to be trying to use a different language...");
- }
- zend_error(E_WARNING, "The use statement with non-compound name '%s' has no effect", Z_STRVAL_P(name));
- }
- STR_RELEASE(lcname);
- zval_dtor(name);
+ zend_ast_destroy(ast);
+ *ast_ptr = zend_ast_create_zval(&result);
}
/* }}} */
-void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */
+void zend_compile_const_expr_magic_const(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
- zend_string *lookup_name;
- zval *name, ns, tmp;
- zend_bool warn = 0;
-
- ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
- if (new_name) {
- name = &new_name->u.constant;
- } else {
- const char *p;
-
- /* The form "use A\B" is eqivalent to "use A\B as B".
- So we extract the last part of compound name to use as a new_name */
- name = &tmp;
- p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRSIZE(ns));
- if (p) {
- ZVAL_STRING(name, p+1);
- } else {
- ZVAL_ZVAL(name, &ns, 1, 0);
- warn = !is_global && Z_TYPE(CG(current_namespace)) == IS_UNDEF;
- }
- }
-
- if (case_sensitive) {
- lookup_name = STR_COPY(Z_STR_P(name));
- } else {
- lookup_name = STR_ALLOC(Z_STRSIZE_P(name), 0);
- zend_str_tolower_copy(lookup_name->val, Z_STRVAL_P(name), Z_STRSIZE_P(name));
- }
-
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix import name with current namespace name to avoid conflicts with functions/consts */
- zend_string *c_ns_name = STR_ALLOC(Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name), 0);
-
- zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace)));
- c_ns_name->val[Z_STRSIZE(CG(current_namespace))] = '\\';
- memcpy(c_ns_name->val+Z_STRSIZE(CG(current_namespace))+1, lookup_name, Z_STRSIZE_P(name)+1);
- if (zend_hash_exists(lookup_table, c_ns_name)) {
- char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns));
-
- if (Z_STRSIZE(ns) != Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) ||
- memcmp(tmp2, c_ns_name->val, Z_STRSIZE(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(tmp2);
- }
- STR_FREE(c_ns_name);
- } else if (is_function) {
- zend_function *function;
-
- if ((function = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename->val, CG(compiled_filename)->val) == 0) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns));
-
- if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) ||
- memcmp(c_tmp, lookup_name->val, Z_STRSIZE(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(c_tmp);
- }
- } else {
- zend_string *filename;
+ zend_ast *ast = *ast_ptr;
+ zend_class_entry *ce = CG(active_class_entry);
- if ((filename = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && strcmp(filename->val, CG(compiled_filename)->val) == 0) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns));
+ /* Other cases already resolved by constant folding */
+ ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce));
- if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) ||
- memcmp(c_tmp, lookup_name->val, Z_STRSIZE(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- efree(c_tmp);
- }
- }
+ {
+ zval const_zv;
+ ZVAL_STRING(&const_zv, "__CLASS__");
+ Z_TYPE_INFO(const_zv) = IS_CONSTANT_EX;
- if (zend_hash_add(current_import_sub, lookup_name, &ns) == NULL) {
- zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL(ns), Z_STRVAL_P(name));
- }
- if (warn) {
- zend_error(E_WARNING, "The use %s statement with non-compound name '%s' has no effect", is_function ? "function" : "const", Z_STRVAL_P(name));
+ zend_ast_destroy(ast);
+ *ast_ptr = zend_ast_create_zval(&const_zv);
}
- STR_RELEASE(lookup_name);
- zval_dtor(name);
}
/* }}} */
-void zend_do_use_function(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
+void zend_compile_const_expr(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
- if (!CG(current_import_function)) {
- CG(current_import_function) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import_function), 8, NULL, ZVAL_PTR_DTOR, 0);
+ zend_ast *ast = *ast_ptr;
+ if (ast == NULL || ast->kind == ZEND_AST_ZVAL) {
+ return;
}
- zend_do_use_non_class(ns_name, new_name, is_global, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC);
+ if (!zend_is_allowed_in_const_expr(ast->kind)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Constant expression contains invalid operations");
+ }
+
+ switch (ast->kind) {
+ case ZEND_AST_CLASS_CONST:
+ zend_compile_const_expr_class_const(ast_ptr TSRMLS_CC);
+ break;
+ case ZEND_AST_CONST:
+ zend_compile_const_expr_const(ast_ptr TSRMLS_CC);
+ break;
+ case ZEND_AST_RESOLVE_CLASS_NAME:
+ zend_compile_const_expr_resolve_class_name(ast_ptr TSRMLS_CC);
+ break;
+ case ZEND_AST_MAGIC_CONST:
+ zend_compile_const_expr_magic_const(ast_ptr TSRMLS_CC);
+ break;
+ default:
+ zend_ast_apply(ast, zend_compile_const_expr TSRMLS_CC);
+ break;
+ }
}
/* }}} */
-void zend_do_use_const(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
+void zend_const_expr_to_zval(zval *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- if (!CG(current_import_const)) {
- CG(current_import_const) = emalloc(sizeof(HashTable));
- zend_hash_init(CG(current_import_const), 8, NULL, ZVAL_PTR_DTOR, 0);
- }
+ zend_ast *orig_ast = ast;
+ zend_eval_const_expr(&ast TSRMLS_CC);
+ zend_compile_const_expr(&ast TSRMLS_CC);
+ if (ast->kind == ZEND_AST_ZVAL) {
+ ZVAL_COPY_VALUE(result, zend_ast_get_zval(ast));
- zend_do_use_non_class(ns_name, new_name, is_global, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC);
+ /* Kill this branch of the original AST, as it was already destroyed.
+ * It would be nice to find a better solution to this problem in the
+ * future. */
+ orig_ast->kind = 0;
+ } else {
+ ZVAL_NEW_AST(result, zend_ast_copy(ast));
+ }
}
/* }}} */
-void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
+/* Same as compile_stmt, but with early binding */
+void zend_compile_top_stmt(zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_op *opline;
- zval *ns_name;
+ if (!ast) {
+ return;
+ }
- if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant));
+ if (ast->kind == ZEND_AST_STMT_LIST) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ uint32_t i;
+ for (i = 0; i < list->children; ++i) {
+ zend_compile_top_stmt(list->child[i] TSRMLS_CC);
+ }
+ return;
}
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- /* Prefix constant name with name of current namespace, lowercased */
- znode tmp;
+ zend_compile_stmt(ast TSRMLS_CC);
- tmp.op_type = IS_CONST;
- ZVAL_NEW_STR(&tmp.u.constant, STR_ALLOC(Z_STRSIZE(CG(current_namespace)), 0));
- zend_str_tolower_copy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace)));
- zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC);
- *name = tmp;
+ if (ast->kind != ZEND_AST_NAMESPACE && ast->kind != ZEND_AST_HALT_COMPILER) {
+ zend_verify_namespace(TSRMLS_C);
+ }
+ if (ast->kind == ZEND_AST_FUNC_DECL || ast->kind == ZEND_AST_CLASS) {
+ CG(zend_lineno) = ((zend_ast_decl *) ast)->end_lineno;
+ zend_do_early_binding(TSRMLS_C);
}
+}
+/* }}} */
- /* Constant name must not conflict with import names */
- if (CG(current_import_const) &&
- (ns_name = zend_hash_find(CG(current_import_const), Z_STR(name->u.constant))) != NULL) {
+void zend_compile_stmt(zend_ast *ast TSRMLS_DC) /* {{{ */
+{
+ if (!ast) {
+ return;
+ }
- char *tmp = estrndup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name));
+ CG(zend_lineno) = ast->lineno;
- if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(name->u.constant) ||
- memcmp(tmp, Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant))) {
- zend_error(E_COMPILE_ERROR, "Cannot declare const %s because the name is already in use", Z_STRVAL(name->u.constant));
+ switch (ast->kind) {
+ case ZEND_AST_STMT_LIST:
+ zend_compile_stmt_list(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_GLOBAL:
+ zend_compile_global_var(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_STATIC:
+ zend_compile_static_var(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_UNSET:
+ zend_compile_unset(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_RETURN:
+ zend_compile_return(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_ECHO:
+ zend_compile_echo(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_THROW:
+ zend_compile_throw(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_BREAK:
+ case ZEND_AST_CONTINUE:
+ zend_compile_break_continue(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_GOTO:
+ zend_compile_goto(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_LABEL:
+ zend_compile_label(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_WHILE:
+ zend_compile_while(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_DO_WHILE:
+ zend_compile_do_while(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_FOR:
+ zend_compile_for(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_FOREACH:
+ zend_compile_foreach(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_IF:
+ zend_compile_if(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_SWITCH:
+ zend_compile_switch(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_TRY:
+ zend_compile_try(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_DECLARE:
+ zend_compile_declare(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_FUNC_DECL:
+ case ZEND_AST_METHOD:
+ zend_compile_func_decl(NULL, ast TSRMLS_CC);
+ break;
+ case ZEND_AST_PROP_DECL:
+ zend_compile_prop_decl(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_CLASS_CONST_DECL:
+ zend_compile_class_const_decl(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_USE_TRAIT:
+ zend_compile_use_trait(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_CLASS:
+ zend_compile_class_decl(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_USE:
+ zend_compile_use(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_CONST_DECL:
+ zend_compile_const_decl(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_NAMESPACE:
+ zend_compile_namespace(ast TSRMLS_CC);
+ break;
+ case ZEND_AST_HALT_COMPILER:
+ zend_compile_halt_compiler(ast TSRMLS_CC);
+ break;
+ default:
+ {
+ znode result;
+ zend_compile_expr(&result, ast TSRMLS_CC);
+ zend_do_free(&result TSRMLS_CC);
}
- efree(tmp);
}
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_DECLARE_CONST;
- SET_UNUSED(opline->result);
- SET_NODE(opline->op1, name);
- SET_NODE(opline->op2, value);
-
- zend_hash_add_ptr(&CG(const_filenames), Z_STR(name->u.constant), CG(compiled_filename));
-}
-/* }}} */
-
-void zend_verify_namespace(TSRMLS_D) /* {{{ */
-{
- if (CG(has_bracketed_namespaces) && !CG(in_namespace)) {
- zend_error_noreturn(E_COMPILE_ERROR, "No code may exist outside of namespace {}");
+ if (Z_LVAL(CG(declarables).ticks) && !zend_is_unticked_stmt(ast)) {
+ zend_emit_tick(TSRMLS_C);
}
}
/* }}} */
-void zend_do_end_namespace(TSRMLS_D) /* {{{ */
+void zend_compile_expr(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- CG(in_namespace) = 0;
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- zval_dtor(&CG(current_namespace));
- ZVAL_UNDEF(&CG(current_namespace));
- }
- if (CG(current_import)) {
- zend_hash_destroy(CG(current_import));
- efree(CG(current_import));
- CG(current_import) = NULL;
- }
- if (CG(current_import_function)) {
- zend_hash_destroy(CG(current_import_function));
- efree(CG(current_import_function));
- CG(current_import_function) = NULL;
- }
- if (CG(current_import_const)) {
- zend_hash_destroy(CG(current_import_const));
- efree(CG(current_import_const));
- CG(current_import_const) = NULL;
+ /* CG(zend_lineno) = ast->lineno; */
+ CG(zend_lineno) = zend_ast_get_lineno(ast);
+
+ switch (ast->kind) {
+ case ZEND_AST_ZVAL:
+ ZVAL_COPY(&result->u.constant, zend_ast_get_zval(ast));
+ result->op_type = IS_CONST;
+ return;
+ case ZEND_AST_ZNODE:
+ *result = *zend_ast_get_znode(ast);
+ return;
+ case ZEND_AST_VAR:
+ case ZEND_AST_DIM:
+ case ZEND_AST_PROP:
+ case ZEND_AST_STATIC_PROP:
+ case ZEND_AST_CALL:
+ case ZEND_AST_METHOD_CALL:
+ case ZEND_AST_STATIC_CALL:
+ zend_compile_var(result, ast, BP_VAR_R TSRMLS_CC);
+ return;
+ case ZEND_AST_ASSIGN:
+ zend_compile_assign(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_ASSIGN_REF:
+ zend_compile_assign_ref(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_NEW:
+ zend_compile_new(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CLONE:
+ zend_compile_clone(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_ASSIGN_OP:
+ zend_compile_compound_assign(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_BINARY_OP:
+ zend_compile_binary_op(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_GREATER:
+ case ZEND_AST_GREATER_EQUAL:
+ zend_compile_greater(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_UNARY_OP:
+ zend_compile_unary_op(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_UNARY_PLUS:
+ case ZEND_AST_UNARY_MINUS:
+ zend_compile_unary_pm(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_AND:
+ case ZEND_AST_OR:
+ zend_compile_short_circuiting(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_POST_INC:
+ case ZEND_AST_POST_DEC:
+ zend_compile_post_incdec(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_PRE_INC:
+ case ZEND_AST_PRE_DEC:
+ zend_compile_pre_incdec(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CAST:
+ zend_compile_cast(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CONDITIONAL:
+ zend_compile_conditional(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_COALESCE:
+ zend_compile_coalesce(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_PRINT:
+ zend_compile_print(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_EXIT:
+ zend_compile_exit(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_YIELD:
+ zend_compile_yield(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_INSTANCEOF:
+ zend_compile_instanceof(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_INCLUDE_OR_EVAL:
+ zend_compile_include_or_eval(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_ISSET:
+ case ZEND_AST_EMPTY:
+ zend_compile_isset_or_empty(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_SILENCE:
+ zend_compile_silence(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_SHELL_EXEC:
+ zend_compile_shell_exec(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_ARRAY:
+ zend_compile_array(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CONST:
+ zend_compile_const(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CLASS_CONST:
+ zend_compile_class_const(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_RESOLVE_CLASS_NAME:
+ zend_compile_resolve_class_name(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_ENCAPS_LIST:
+ zend_compile_encaps_list(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_MAGIC_CONST:
+ zend_compile_magic_const(result, ast TSRMLS_CC);
+ return;
+ case ZEND_AST_CLOSURE:
+ zend_compile_func_decl(result, ast TSRMLS_CC);
+ return;
+ default:
+ ZEND_ASSERT(0 /* not supported */);
}
}
/* }}} */
-void zend_do_end_compilation(TSRMLS_D) /* {{{ */
+void zend_compile_var(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- CG(has_bracketed_namespaces) = 0;
- zend_do_end_namespace(TSRMLS_C);
+ switch (ast->kind) {
+ case ZEND_AST_VAR:
+ zend_compile_simple_var(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_DIM:
+ zend_compile_dim(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_PROP:
+ zend_compile_prop(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_STATIC_PROP:
+ zend_compile_static_prop(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_CALL:
+ zend_compile_call(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_METHOD_CALL:
+ zend_compile_method_call(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_STATIC_CALL:
+ zend_compile_static_call(result, ast, type TSRMLS_CC);
+ return;
+ case ZEND_AST_ZNODE:
+ *result = *zend_ast_get_znode(ast);
+ return;
+ default:
+ if (type == BP_VAR_W || type == BP_VAR_REF
+ || type == BP_VAR_RW || type == BP_VAR_UNSET
+ ) {
+ /* For BC reasons =& new Foo is allowed */
+ if (type != BP_VAR_REF || ast->kind != ZEND_AST_NEW) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use temporary expression in write context");
+ }
+ }
+
+ zend_compile_expr(result, ast TSRMLS_CC);
+ return;
+ }
}
/* }}} */
-void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
+void zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
- if (ast->kind == ZEND_CONST) {
- ZVAL_COPY_VALUE(&result->u.constant, &ast->u.val);
- efree(ast);
- } else if (zend_ast_is_ct_constant(ast)) {
- zend_ast_evaluate(&result->u.constant, ast, NULL TSRMLS_CC);
- zend_ast_destroy(ast);
- } else {
- ZVAL_NEW_AST(&result->u.constant, ast);
+ zend_op *opline;
+ switch (ast->kind) {
+ case ZEND_AST_DIM:
+ opline = zend_delayed_compile_dim(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
+ return;
+ case ZEND_AST_PROP:
+ opline = zend_delayed_compile_prop(result, ast, type TSRMLS_CC);
+ zend_adjust_for_fetch_type(opline, type);
+ return;
+ default:
+ zend_compile_var(result, ast, type TSRMLS_CC);
+ return;
}
}
/* }}} */
-/* {{{ zend_dirname
- Returns directory name component of path */
-ZEND_API size_t zend_dirname(char *path, size_t len)
+void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
- register char *end = path + len - 1;
- unsigned int len_adjust = 0;
+ zend_ast *ast = *ast_ptr;
+ zval result;
-#ifdef PHP_WIN32
- /* Note that on Win32 CWD is per drive (heritage from CP/M).
- * This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
- */
- if ((2 <= len) && isalpha((int)((unsigned char *)path)[0]) && (':' == path[1])) {
- /* Skip over the drive spec (if any) so as not to change */
- path += 2;
- len_adjust += 2;
- if (2 == len) {
- /* Return "c:" on Win32 for dirname("c:").
- * It would be more consistent to return "c:."
- * but that would require making the string *longer*.
- */
- return len;
- }
- }
-#elif defined(NETWARE)
- /*
- * Find the first occurrence of : from the left
- * move the path pointer to the position just after :
- * increment the len_adjust to the length of path till colon character(inclusive)
- * If there is no character beyond : simple return len
- */
- char *colonpos = NULL;
- colonpos = strchr(path, ':');
- if (colonpos != NULL) {
- len_adjust = ((colonpos - path) + 1);
- path += len_adjust;
- if (len_adjust == len) {
- return len;
- }
+ if (!ast) {
+ return;
}
-#endif
- if (len == 0) {
- /* Illegal use of this function */
- return 0;
- }
+ switch (ast->kind) {
+ case ZEND_AST_BINARY_OP:
+ zend_eval_const_expr(&ast->child[0] TSRMLS_CC);
+ zend_eval_const_expr(&ast->child[1] TSRMLS_CC);
+ if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
+ return;
+ }
- /* Strip trailing slashes */
- while (end >= path && IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- /* The path only contained slashes */
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return 1 + len_adjust;
- }
+ zend_ct_eval_binary_op(&result, ast->attr,
+ zend_ast_get_zval(ast->child[0]), zend_ast_get_zval(ast->child[1]) TSRMLS_CC);
+ break;
+ case ZEND_AST_GREATER:
+ case ZEND_AST_GREATER_EQUAL:
+ zend_eval_const_expr(&ast->child[0] TSRMLS_CC);
+ zend_eval_const_expr(&ast->child[1] TSRMLS_CC);
+ if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
+ return;
+ }
- /* Strip filename */
- while (end >= path && !IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- /* No slash found, therefore return '.' */
-#ifdef NETWARE
- if (len_adjust == 0) {
- path[0] = '.';
- path[1] = '\0';
- return 1; /* only one character */
- } else {
- path[0] = '\0';
- return len_adjust;
- }
-#else
- path[0] = '.';
- path[1] = '\0';
- return 1 + len_adjust;
-#endif
- }
+ zend_ct_eval_greater(&result, ast->kind,
+ zend_ast_get_zval(ast->child[0]), zend_ast_get_zval(ast->child[1]) TSRMLS_CC);
+ break;
+ case ZEND_AST_UNARY_PLUS:
+ case ZEND_AST_UNARY_MINUS:
+ zend_eval_const_expr(&ast->child[0] TSRMLS_CC);
+ if (ast->child[0]->kind != ZEND_AST_ZVAL) {
+ return;
+ }
- /* Strip slashes which came before the file name */
- while (end >= path && IS_SLASH_P(end)) {
- end--;
- }
- if (end < path) {
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return 1 + len_adjust;
+ zend_ct_eval_unary_pm(&result, ast->kind,
+ zend_ast_get_zval(ast->child[0]) TSRMLS_CC);
+ break;
+ case ZEND_AST_ARRAY:
+ if (!zend_try_ct_eval_array(&result, ast TSRMLS_CC)) {
+ return;
+ }
+ break;
+ case ZEND_AST_MAGIC_CONST:
+ if (!zend_try_ct_eval_magic_const(&result, ast TSRMLS_CC)) {
+ return;
+ }
+ break;
+ case ZEND_AST_CONST:
+ {
+ zend_ast *name_ast = ast->child[0];
+ zend_bool is_fully_qualified;
+ zend_string *resolved_name = zend_resolve_const_name(
+ zend_ast_get_str(name_ast), name_ast->attr, &is_fully_qualified TSRMLS_CC);
+
+ if (!zend_try_ct_eval_const(&result, resolved_name, is_fully_qualified TSRMLS_CC)) {
+ zend_string_release(resolved_name);
+ return;
+ }
+
+ zend_string_release(resolved_name);
+ break;
+ }
+ default:
+ return;
}
- *(end+1) = '\0';
- return (size_t)(end + 1 - path) + len_adjust;
+ zend_ast_destroy(ast);
+ *ast_ptr = zend_ast_create_zval(&result);
}
/* }}} */
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 6317ceb7cb..e9ee6e56d7 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -33,28 +33,20 @@
#define DEBUG_ZEND 0
-#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
-
#define SET_UNUSED(op) op ## _type = IS_UNUSED
-#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); }
-#define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); }
-#define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); }
-#define DO_TICKS() if (Z_IVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
-
-#define RESET_DOC_COMMENT() \
- { \
- if (CG(doc_comment)) { \
- STR_RELEASE(CG(doc_comment)); \
- CG(doc_comment) = NULL; \
- } \
- }
+#define RESET_DOC_COMMENT() do { \
+ if (CG(doc_comment)) { \
+ zend_string_release(CG(doc_comment)); \
+ CG(doc_comment) = NULL; \
+ } \
+} while (0)
typedef struct _zend_op_array zend_op_array;
typedef struct _zend_op zend_op;
typedef struct _zend_compiler_context {
- zend_uint opcodes_size;
+ uint32_t opcodes_size;
int vars_size;
int literals_size;
int current_brk_cont;
@@ -64,14 +56,12 @@ typedef struct _zend_compiler_context {
} zend_compiler_context;
typedef union _znode_op {
- zend_uint constant;
- zend_uint var;
- zend_uint num;
- zend_uint_t hash;
- zend_uint opline_num; /* Needs to be signed */
+ uint32_t constant;
+ uint32_t var;
+ uint32_t num;
+ uint32_t opline_num; /* Needs to be signed */
zend_op *jmp_addr;
zval *zv;
- void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
} znode_op;
typedef struct _znode { /* used only during compilation */
@@ -79,13 +69,34 @@ typedef struct _znode { /* used only during compilation */
union {
znode_op op;
zval constant; /* replaced by literal/zv */
- zend_op_array *op_array;
- zend_ast *ast;
} u;
- zend_uint EA; /* extended attributes */
} znode;
-typedef struct _zend_execute_data zend_execute_data;
+/* Temporarily defined here, to avoid header ordering issues */
+typedef struct _zend_ast_znode {
+ zend_ast_kind kind;
+ zend_ast_attr attr;
+ uint32_t lineno;
+ znode node;
+} zend_ast_znode;
+ZEND_API zend_ast *zend_ast_create_znode(znode *node);
+
+static zend_always_inline znode *zend_ast_get_znode(zend_ast *ast) {
+ return &((zend_ast_znode *) ast)->node;
+}
+
+typedef union _zend_parser_stack_elem {
+ zend_ast *ast;
+ zend_string *str;
+ zend_ulong num;
+} zend_parser_stack_elem;
+
+void zend_compile_top_stmt(zend_ast *ast TSRMLS_DC);
+void zend_compile_stmt(zend_ast *ast TSRMLS_DC);
+void zend_compile_expr(znode *node, zend_ast *ast TSRMLS_DC);
+void zend_compile_var(znode *node, zend_ast *ast, uint32_t type TSRMLS_DC);
+void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC);
+void zend_const_expr_to_zval(zval *result, zend_ast *ast TSRMLS_DC);
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data TSRMLS_DC
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data TSRMLS_CC
@@ -100,7 +111,7 @@ struct _zend_op {
znode_op op1;
znode_op op2;
znode_op result;
- zend_uint_t extended_value;
+ zend_ulong extended_value;
uint lineno;
zend_uchar opcode;
zend_uchar op1_type;
@@ -118,17 +129,17 @@ typedef struct _zend_brk_cont_element {
typedef struct _zend_label {
int brk_cont;
- zend_uint opline_num;
+ uint32_t opline_num;
} zend_label;
typedef struct _zend_try_catch_element {
- zend_uint try_op;
- zend_uint catch_op; /* ketchup! */
- zend_uint finally_op;
- zend_uint finally_end;
+ uint32_t try_op;
+ uint32_t catch_op; /* ketchup! */
+ uint32_t finally_op;
+ uint32_t finally_end;
} zend_try_catch_element;
-#if SIZEOF_ZEND_INT == 8
+#if SIZEOF_ZEND_LONG == 8
# ifdef _WIN32
# define THIS_HASHVAL 6385726429Ui64
# else
@@ -153,9 +164,6 @@ typedef struct _zend_try_catch_element {
#define ZEND_ACC_INTERFACE 0x80
#define ZEND_ACC_TRAIT 0x120
-/* op_array flags */
-#define ZEND_ACC_INTERACTIVE 0x10
-
/* method flags (visibility) */
/* The order of those must be kept - public < protected < private */
#define ZEND_ACC_PUBLIC 0x100
@@ -208,23 +216,29 @@ typedef struct _zend_try_catch_element {
/* function has arguments with type hinting */
#define ZEND_ACC_HAS_TYPE_HINTS 0x10000000
-char *zend_visibility_string(zend_uint fn_flags);
+/* op_array has finally blocks */
+#define ZEND_ACC_HAS_FINALLY_BLOCK 0x20000000
+
+/* internal function is allocated at arena */
+#define ZEND_ACC_ARENA_ALLOCATED 0x20000000
+
+#define ZEND_CE_IS_TRAIT(ce) (((ce)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)
+char *zend_visibility_string(uint32_t fn_flags);
typedef struct _zend_property_info {
- zend_uint flags;
- zend_string *name;
- zend_uint_t h;
+ uint32_t flags;
int offset;
+ zend_string *name;
zend_string *doc_comment;
zend_class_entry *ce;
} zend_property_info;
typedef struct _zend_arg_info {
const char *name; // TODO: convert into zend_string ???
- zend_uint name_len;
+ uint32_t name_len;
const char *class_name; // TODO: convert into zend_string ???
- zend_uint class_name_len;
+ uint32_t class_name_len;
zend_uchar type_hint;
zend_uchar pass_by_reference;
zend_bool allow_null;
@@ -237,9 +251,9 @@ typedef struct _zend_arg_info {
*/
typedef struct _zend_internal_function_info {
const char *_name;
- zend_uint _name_len;
+ uint32_t _name_len;
const char *_class_name;
- zend_uint required_num_args;
+ uint32_t required_num_args;
zend_uchar _type_hint;
zend_bool return_reference;
zend_bool _allow_null;
@@ -249,48 +263,45 @@ typedef struct _zend_internal_function_info {
struct _zend_op_array {
/* Common elements */
zend_uchar type;
+ uint32_t fn_flags;
zend_string *function_name;
zend_class_entry *scope;
- zend_uint fn_flags;
zend_function *prototype;
- zend_uint num_args;
- zend_uint required_num_args;
+ uint32_t num_args;
+ uint32_t required_num_args;
zend_arg_info *arg_info;
/* END of common elements */
- zend_uint *refcount;
+ uint32_t *refcount;
+ uint32_t this_var;
+
+ uint32_t last;
zend_op *opcodes;
- zend_uint last;
- zend_string **vars;
int last_var;
+ uint32_t T;
+ zend_string **vars;
- zend_uint T;
-
- zend_brk_cont_element *brk_cont_array;
int last_brk_cont;
-
- zend_try_catch_element *try_catch_array;
int last_try_catch;
- zend_bool has_finally_block;
+ zend_brk_cont_element *brk_cont_array;
+ zend_try_catch_element *try_catch_array;
/* static variables support */
HashTable *static_variables;
- zend_uint this_var;
-
zend_string *filename;
- zend_uint line_start;
- zend_uint line_end;
+ uint32_t line_start;
+ uint32_t line_end;
zend_string *doc_comment;
- zend_uint early_binding; /* the linked list of delayed declarations */
+ uint32_t early_binding; /* the linked list of delayed declarations */
- zval *literals;
int last_literal;
+ zval *literals;
- void **run_time_cache;
int last_cache_slot;
+ void **run_time_cache;
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};
@@ -302,12 +313,12 @@ struct _zend_op_array {
typedef struct _zend_internal_function {
/* Common elements */
zend_uchar type;
+ uint32_t fn_flags;
zend_string* function_name;
zend_class_entry *scope;
- zend_uint fn_flags;
zend_function *prototype;
- zend_uint num_args;
- zend_uint required_num_args;
+ uint32_t num_args;
+ uint32_t required_num_args;
zend_arg_info *arg_info;
/* END of common elements */
@@ -322,12 +333,12 @@ union _zend_function {
struct {
zend_uchar type; /* never used */
+ uint32_t fn_flags;
zend_string *function_name;
zend_class_entry *scope;
- zend_uint fn_flags;
union _zend_function *prototype;
- zend_uint num_args;
- zend_uint required_num_args;
+ uint32_t num_args;
+ uint32_t required_num_args;
zend_arg_info *arg_info;
} common;
@@ -335,26 +346,6 @@ union _zend_function {
zend_internal_function internal_function;
};
-typedef struct _zend_function_call_entry {
- zend_function *fbc;
- zend_uint op_number;
- zend_uint arg_num;
- zend_bool uses_argument_unpacking;
-} zend_function_call_entry;
-
-typedef struct _zend_switch_entry {
- znode cond;
- int default_case;
- int control_var;
-} zend_switch_entry;
-
-
-typedef struct _list_llist_element {
- znode var;
- zend_llist dimensions;
- znode value;
-} list_llist_element;
-
typedef enum _vm_frame_kind {
VM_FRAME_NESTED_FUNCTION, /* stackless VM call to function */
VM_FRAME_NESTED_CODE, /* stackless VM call to include/require/eval */
@@ -363,27 +354,33 @@ typedef enum _vm_frame_kind {
} vm_frame_kind;
struct _zend_execute_data {
- struct _zend_op *opline; /* executed opline */
+ const zend_op *opline; /* executed opline */
zend_execute_data *call; /* current call */
void **run_time_cache;
zend_function *func; /* executed op_array */
- zend_uint num_args;
- zend_uchar flags;
- zend_uchar frame_kind;
+ zval This;
zend_class_entry *called_scope;
- zend_object *object;
- zend_execute_data *prev_nested_call;
zend_execute_data *prev_execute_data;
+ uint32_t frame_info;
+ uint32_t num_args;
zval *return_value;
zend_class_entry *scope; /* function scope (self) */
zend_array *symbol_table;
- struct _zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */
+ const zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */
zend_object *delayed_exception;
- zval old_error_reporting;
+ uint32_t silence_op_num;
+ uint32_t old_error_reporting;
};
-#define ZEND_CALL_CTOR (1 << 0)
-#define ZEND_CALL_CTOR_RESULT_UNUSED (1 << 1)
+#define VM_FRAME_KIND_MASK 0x000000ff
+#define VM_FRAME_FLAGS_MASK 0xffffff00
+
+#define ZEND_CALL_CTOR (1 << 8)
+#define ZEND_CALL_CTOR_RESULT_UNUSED (1 << 9)
+
+#define VM_FRAME_INFO(kind, flags) ((kind) | (flags))
+#define VM_FRAME_KIND(info) ((info) & VM_FRAME_KIND_MASK)
+#define VM_FRAME_FLAGS(info) ((info) & VM_FRAME_FLAGS_MASK)
#define ZEND_CALL_FRAME_SLOT \
((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
@@ -391,7 +388,7 @@ struct _zend_execute_data {
#define ZEND_CALL_ARG(call, n) \
(((zval*)(call)) + ((n) + (ZEND_CALL_FRAME_SLOT - 1)))
-#define EX(element) execute_data.element
+#define EX(element) ((execute_data)->element)
#define EX_VAR_2(ex, n) ((zval*)(((char*)(ex)) + ((int)(n))))
#define EX_VAR_NUM_2(ex, n) (((zval*)(ex)) + (ZEND_CALL_FRAME_SLOT + ((int)(n))))
@@ -431,11 +428,7 @@ ZEND_API zend_string *zend_get_compiled_filename(TSRMLS_D);
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
-void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace, zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC);
-void zend_resolve_function_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
-void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
-void zend_resolve_class_name(znode *class_name TSRMLS_DC);
-ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var);
+ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, uint32_t var);
#ifdef ZTS
const char *zend_get_zendtext(TSRMLS_D);
@@ -443,213 +436,43 @@ int zend_get_zendleng(TSRMLS_D);
#endif
-/* parser-driven code generators */
-void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC);
-void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC);
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC);
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC);
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC);
-void zend_do_indirect_references(znode *result, const znode *num_references, znode *variable TSRMLS_DC);
-void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
-void zend_do_fetch_global_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC);
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
-void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
-void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
-void zend_do_fetch_static_member(znode *result, znode *class_znode TSRMLS_DC);
-void zend_do_print(znode *result, znode *arg TSRMLS_DC);
-void zend_do_echo(znode *arg TSRMLS_DC);
typedef int (*unary_op_type)(zval *, zval * TSRMLS_DC);
typedef int (*binary_op_type)(zval *, zval *, zval * TSRMLS_DC);
ZEND_API unary_op_type get_unary_op(int opcode);
ZEND_API binary_op_type get_binary_op(int opcode);
-void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC);
-void zend_do_while_end(const znode *while_token, const znode *close_bracket_token TSRMLS_DC);
-void zend_do_do_while_begin(TSRMLS_D);
-void zend_do_do_while_end(const znode *do_token, const znode *expr_open_bracket, znode *expr TSRMLS_DC);
-
-
-void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC);
-void zend_do_if_after_statement(const znode *closing_bracket_token, unsigned char initialize TSRMLS_DC);
-void zend_do_if_end(TSRMLS_D);
-
-void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_before_statement(const znode *cond_start, const znode *second_semicolon_token TSRMLS_DC);
-void zend_do_for_end(const znode *second_semicolon_token TSRMLS_DC);
-
-void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
-
-void zend_do_begin_variable_parse(TSRMLS_D);
-void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS_DC);
-
-void zend_check_writable_variable(const znode *variable);
+void zend_stop_lexing(TSRMLS_D);
+void zend_emit_final_return(zval *zv TSRMLS_DC);
+zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right);
+uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag);
+zend_ast *zend_ast_append_doc_comment(zend_ast *list TSRMLS_DC);
+void zend_handle_encoding_declaration(zend_ast *ast TSRMLS_DC);
+/* parser-driven code generators */
void zend_do_free(znode *op1 TSRMLS_DC);
-void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
-
-int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier);
-void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC);
-void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC);
-void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, znode *class_type, zend_bool pass_by_reference, zend_bool is_variadic TSRMLS_DC);
-int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC);
-void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
-void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
-void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TSRMLS_DC);
-void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
-void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC);
-int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
-void zend_do_end_function_call(znode *function_name, znode *result, int is_method, int is_dynamic_fcall TSRMLS_DC);
-void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
-void zend_do_yield(znode *result, znode *value, znode *key, zend_bool is_variable TSRMLS_DC);
-void zend_do_handle_exception(TSRMLS_D);
-
-void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC);
-void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC);
-
-void zend_do_try(znode *try_token TSRMLS_DC);
-void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC);
-void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC);
-void zend_do_end_catch(znode *catch_token TSRMLS_DC);
-void zend_do_finally(znode *finally_token TSRMLS_DC);
-void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC);
-void zend_do_throw(znode *expr TSRMLS_DC);
-
-ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time TSRMLS_DC);
+ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opline, HashTable *function_table, zend_bool compile_time TSRMLS_DC);
ZEND_API zend_class_entry *do_bind_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC);
ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC);
-ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC);
-ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC);
-void zend_do_implements_interface(znode *interface_znode TSRMLS_DC);
-
-/* Trait related functions */
-void zend_do_use_trait(znode *trait_znode TSRMLS_DC);
-void zend_prepare_reference(znode *result, znode *class_name, znode *method_name TSRMLS_DC);
-void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS_DC);
-void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alias TSRMLS_DC);
-
-ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC);
-ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC);
-
-ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
-void zend_do_early_binding(TSRMLS_D);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC);
-void zend_do_pass_param(znode *param, zend_uchar op TSRMLS_DC);
-void zend_do_unpack_params(znode *params TSRMLS_DC);
-
-
-void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, const znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC);
-void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, const znode *op_token TSRMLS_DC);
-
-void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC);
-
-void zend_do_switch_cond(const znode *cond TSRMLS_DC);
-void zend_do_switch_end(const znode *case_list TSRMLS_DC);
-void zend_do_case_before_statement(const znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC);
-void zend_do_case_after_statement(znode *result, const znode *case_token TSRMLS_DC);
-void zend_do_default_before_statement(const znode *case_list, znode *default_token TSRMLS_DC);
-
-void zend_do_begin_class_declaration(const znode *class_token, znode *class_name, const znode *parent_class_name TSRMLS_DC);
-void zend_do_end_class_declaration(const znode *class_token, const znode *parent_token TSRMLS_DC);
-void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC);
-void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC);
-
-void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
-
-void zend_do_halt_compiler_register(TSRMLS_D);
-
-void zend_do_push_object(const znode *object TSRMLS_DC);
-void zend_do_pop_object(znode *object TSRMLS_DC);
-
-
-void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
-void zend_do_end_new_object(znode *result, const znode *new_token TSRMLS_DC);
-
-void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC);
-
-void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
-
-void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
-void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC);
-void zend_do_list_init(TSRMLS_D);
-void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
-void zend_do_add_list_element(const znode *element TSRMLS_DC);
-void zend_do_new_list_begin(TSRMLS_D);
-void zend_do_new_list_end(TSRMLS_D);
-
/* Functions for a null terminated pointer list, used for traits parsing and compilation */
void zend_init_list(void *result, void *item TSRMLS_DC);
void zend_add_to_list(void *result, void *item TSRMLS_DC);
-
-void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC);
-void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC);
-
-void zend_do_unset(znode *variable TSRMLS_DC);
-void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC);
-
-void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC);
-
-void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, znode *array, znode *as_token, int variable TSRMLS_DC);
-void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token, const znode *as_token, znode *value, znode *key TSRMLS_DC);
-void zend_do_foreach_end(const znode *foreach_token, const znode *as_token TSRMLS_DC);
-
-void zend_do_declare_begin(TSRMLS_D);
-void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC);
-void zend_do_declare_end(const znode *declare_token TSRMLS_DC);
-
-void zend_do_exit(znode *result, znode *message TSRMLS_DC);
-
-void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
-void zend_do_end_silence(znode *strudel_token TSRMLS_DC);
-
-void zend_do_jmp_set(znode *value, znode *jmp_token, znode *colon_token TSRMLS_DC);
-void zend_do_jmp_set_else(znode *result, znode *false_value, const znode *jmp_token, znode *colon_token TSRMLS_DC);
-
-void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC);
-void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC);
-void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, const znode *colon_token TSRMLS_DC);
-
void zend_do_extended_info(TSRMLS_D);
void zend_do_extended_fcall_begin(TSRMLS_D);
void zend_do_extended_fcall_end(TSRMLS_D);
-void zend_do_ticks(TSRMLS_D);
-
-void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC);
-
-void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC);
-void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRMLS_DC);
-void zend_do_begin_namespace(znode *name, zend_bool with_brackets TSRMLS_DC);
-void zend_do_end_namespace(TSRMLS_D);
void zend_verify_namespace(TSRMLS_D);
-void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC);
-void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC);
-void zend_do_use_function(znode *name, znode *new_name, int is_global TSRMLS_DC);
-void zend_do_use_const(znode *name, znode *new_name, int is_global TSRMLS_DC);
void zend_do_end_compilation(TSRMLS_D);
-void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC);
-void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC);
-
-void zend_do_label(znode *label TSRMLS_DC);
-void zend_do_goto(znode *label TSRMLS_DC);
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC);
void zend_release_labels(int temporary TSRMLS_DC);
ZEND_API void function_add_ref(zend_function *function);
#define INITIAL_OP_ARRAY_SIZE 64
-#define INITIAL_INTERACTIVE_OP_ARRAY_SIZE 8192
/* helper functions in zend_language_scanner.l */
@@ -665,16 +488,18 @@ ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array);
+ZEND_API int clean_non_persistent_function_full(zval *zv TSRMLS_DC);
+ZEND_API int clean_non_persistent_class_full(zval *zv TSRMLS_DC);
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void zend_function_dtor(zval *zv);
ZEND_API void destroy_zend_class(zval *zv);
void zend_class_add_ref(zval *zv);
-ZEND_API zend_string *zend_mangle_property_name(const char *src1, int src1_length, const char *src2, int src2_length, int internal);
-#define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \
- zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL)
-ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len);
+ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal);
+#define zend_unmangle_property_name(mangled_property, class_name, prop_name) \
+ zend_unmangle_property_name_ex(mangled_property, class_name, prop_name, NULL)
+ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len);
#define ZEND_FUNCTION_DTOR zend_function_dtor
#define ZEND_CLASS_DTOR destroy_zend_class
@@ -686,13 +511,10 @@ int print_class(zend_class_entry *class_entry TSRMLS_DC);
void print_op_array(zend_op_array *op_array, int optimizations);
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC);
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
-void zend_do_first_catch(znode *open_parentheses TSRMLS_DC);
-void zend_initialize_try_catch_element(znode *catch_token TSRMLS_DC);
-void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additional_catch TSRMLS_DC);
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
-int zend_get_class_fetch_type(const char *class_name, uint class_name_len);
+uint32_t zend_get_class_fetch_type(zend_string *name);
typedef zend_bool (*zend_auto_global_callback)(zend_string *name TSRMLS_DC);
typedef struct _zend_auto_global {
@@ -707,7 +529,7 @@ ZEND_API void zend_activate_auto_globals(TSRMLS_D);
ZEND_API zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC);
ZEND_API size_t zend_dirname(char *path, size_t len);
-int zendlex(znode *zendlval TSRMLS_DC);
+int zendlex(zend_parser_stack_elem *elem TSRMLS_DC);
int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
@@ -741,6 +563,13 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define ZEND_PARSED_NEW (1<<6)
#define ZEND_PARSED_LIST_EXPR (1<<7)
+#define ZEND_PARAM_REF (1<<0)
+#define ZEND_PARAM_VARIADIC (1<<1)
+
+#define ZEND_NAME_FQ 0
+#define ZEND_NAME_NOT_FQ 1
+#define ZEND_NAME_RELATIVE 2
+
/* unset types */
#define ZEND_UNSET_REG 0
@@ -749,9 +578,13 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define BP_VAR_W 1
#define BP_VAR_RW 2
#define BP_VAR_IS 3
-#define BP_VAR_NA 4 /* if not applicable */
-#define BP_VAR_FUNC_ARG 5
-#define BP_VAR_UNSET 6
+#define BP_VAR_FUNC_ARG 4
+#define BP_VAR_UNSET 5
+#define BP_VAR_REF 6 /* right-hand side of by-ref assignment */
+
+/* Bottom 3 bits are the type, top bits are arg num for BP_VAR_FUNC_ARG */
+#define BP_VAR_SHIFT 3
+#define BP_VAR_MASK 7
#define ZEND_INTERNAL_FUNCTION 1
@@ -786,7 +619,6 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define ZEND_FETCH_TYPE_MASK 0x70000000
#define ZEND_FETCH_STANDARD 0x00000000
-#define ZEND_FETCH_ADD_LOCK 0x08000000
#define ZEND_FETCH_MAKE_REF 0x04000000
#define ZEND_ISSET 0x02000000
@@ -799,8 +631,6 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define ZEND_FE_FETCH_BYREF 1
#define ZEND_FE_FETCH_WITH_KEY 2
-#define ZEND_FE_RESET_VARIABLE (1<<0)
-#define ZEND_FE_RESET_REFERENCE (1<<1)
#define EXT_TYPE_FREE_ON_RETURN (1<<2)
#define ZEND_MEMBER_FUNC_CALL 1<<0
@@ -814,21 +644,28 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define ZEND_SEND_BY_REF 1
#define ZEND_SEND_PREFER_REF 2
-#define CHECK_ARG_SEND_TYPE(zf, arg_num, m) \
- (EXPECTED((zf)->common.arg_info != NULL) && \
- (EXPECTED(arg_num <= (zf)->common.num_args) \
- ? ((zf)->common.arg_info[arg_num-1].pass_by_reference & (m)) \
- : (UNEXPECTED((zf)->common.fn_flags & ZEND_ACC_VARIADIC) != 0) && \
- ((zf)->common.arg_info[(zf)->common.num_args-1].pass_by_reference & (m))))
+static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask)
+{
+ if (UNEXPECTED(zf->common.arg_info == NULL)) {
+ return 0;
+ }
+ if (UNEXPECTED(arg_num > zf->common.num_args)) {
+ if (EXPECTED((zf->common.fn_flags & ZEND_ACC_VARIADIC) == 0)) {
+ return 0;
+ }
+ arg_num = zf->common.num_args;
+ }
+ return UNEXPECTED((zf->common.arg_info[arg_num-1].pass_by_reference & mask) != 0);
+}
#define ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \
- CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF)
+ zend_check_arg_send_type(zf, arg_num, ZEND_SEND_BY_REF)
#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
- CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)
+ zend_check_arg_send_type(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)
#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \
- CHECK_ARG_SEND_TYPE(zf, arg_num, ZEND_SEND_PREFER_REF)
+ zend_check_arg_send_type(zf, arg_num, ZEND_SEND_PREFER_REF)
#define ZEND_RETURN_VAL 0
#define ZEND_RETURN_REF 1
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 9c52056d10..164901f898 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -37,7 +37,7 @@ void free_zend_constant(zval *zv)
zval_internal_dtor(&c->value);
}
if (c->name) {
- STR_RELEASE(c->name);
+ zend_string_release(c->name);
}
pefree(c, c->flags & CONST_PERSISTENT);
}
@@ -51,12 +51,12 @@ static void copy_zend_constant(zval *zv)
memcpy(Z_PTR_P(zv), c, sizeof(zend_constant));
c = Z_PTR_P(zv);
- c->name = STR_COPY(c->name);
+ c->name = zend_string_copy(c->name);
if (!(c->flags & CONST_PERSISTENT)) {
zval_copy_ctor(&c->value);
} else {
if (Z_TYPE(c->value) == IS_STRING) {
- Z_STR(c->value) = STR_DUP(Z_STR(c->value), 1);
+ Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1);
}
}
}
@@ -113,26 +113,26 @@ int zend_startup_constants(TSRMLS_D)
void zend_register_standard_constants(TSRMLS_D)
{
- REGISTER_MAIN_INT_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_INT_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
+
+ REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
+
+ REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
/* true/false constants */
{
REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST);
@@ -167,7 +167,7 @@ ZEND_API void zend_register_null_constant(const char *name, uint name_len, int f
ZVAL_NULL(&c.value);
c.flags = flags;
- c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
+ c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -178,18 +178,18 @@ ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_
ZVAL_BOOL(&c.value, bval);
c.flags = flags;
- c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
+ c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
-ZEND_API void zend_register_int_constant(const char *name, uint name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC)
+ZEND_API void zend_register_long_constant(const char *name, uint name_len, zend_long lval, int flags, int module_number TSRMLS_DC)
{
zend_constant c;
- ZVAL_INT(&c.value, lval);
+ ZVAL_LONG(&c.value, lval);
c.flags = flags;
- c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
+ c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -201,7 +201,7 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou
ZVAL_DOUBLE(&c.value, dval);
c.flags = flags;
- c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
+ c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -211,9 +211,9 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch
{
zend_constant c;
- ZVAL_NEW_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT));
+ ZVAL_NEW_STR(&c.value, zend_string_init(strval, strlen, flags & CONST_PERSISTENT));
c.flags = flags;
- c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT);
+ c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -240,25 +240,25 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
zend_string *const_name;
const_name_len = sizeof("\0__CLASS__") + EG(scope)->name->len;
- const_name = STR_ALLOC(const_name_len, 0);
+ const_name = zend_string_alloc(const_name_len, 0);
memcpy(const_name->val, "\0__CLASS__", sizeof("\0__CLASS__")-1);
zend_str_tolower_copy(const_name->val + sizeof("\0__CLASS__")-1, EG(scope)->name->val, EG(scope)->name->len);
if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
c = emalloc(sizeof(zend_constant));
memset(c, 0, sizeof(zend_constant));
- ZVAL_STR(&c->value, STR_COPY(EG(scope)->name));
+ ZVAL_STR_COPY(&c->value, EG(scope)->name);
zend_hash_add_ptr(EG(zend_constants), const_name, c);
}
- STR_RELEASE(const_name);
+ zend_string_release(const_name);
} else {
- zend_string *const_name = STR_INIT("\0__CLASS__", sizeof("\0__CLASS__")-1, 0);
+ zend_string *const_name = zend_string_init("\0__CLASS__", sizeof("\0__CLASS__")-1, 0);
if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
c = emalloc(sizeof(zend_constant));
memset(c, 0, sizeof(zend_constant));
ZVAL_EMPTY_STRING(&c->value);
zend_hash_add_ptr(EG(zend_constants), const_name, c);
}
- STR_RELEASE(const_name);
+ zend_string_release(const_name);
}
return c;
} else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 &&
@@ -273,7 +273,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
haltname = zend_mangle_property_name(haltoff,
sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0);
c = zend_hash_find_ptr(EG(zend_constants), haltname);
- STR_FREE(haltname);
+ zend_string_free(haltname);
return c;
} else {
return NULL;
@@ -323,7 +323,7 @@ ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC)
return c ? &c->value : NULL;
}
-ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC)
+ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_ulong flags TSRMLS_DC)
{
zend_constant *c;
const char *colon;
@@ -343,12 +343,12 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
colon > name && (*(colon - 1) == ':')) {
int class_name_len = colon - name - 1;
int const_name_len = name_len - class_name_len - 2;
- zend_string *constant_name = STR_INIT(colon + 1, const_name_len, 0);
+ zend_string *constant_name = zend_string_init(colon + 1, const_name_len, 0);
char *lcname;
zval *ret_constant = NULL;
ALLOCA_FLAG(use_heap)
- class_name = STR_INIT(name, class_name_len, 0);
+ class_name = zend_string_init(name, class_name_len, 0);
lcname = do_alloca(class_name_len + 1, use_heap);
zend_str_tolower_copy(lcname, name, class_name_len);
if (!scope) {
@@ -396,8 +396,8 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
ret_constant = Z_REFVAL_P(ret_constant);
}
}
- STR_RELEASE(class_name);
- STR_FREE(constant_name);
+ zend_string_release(class_name);
+ zend_string_free(constant_name);
if (ret_constant && Z_CONSTANT_P(ret_constant)) {
zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC);
}
@@ -449,7 +449,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
}
}
-zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS_DC)
+zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC)
{
zend_constant *c;
@@ -465,12 +465,12 @@ zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS
(c->flags & CONST_CS) != 0) {
key--;
- c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRSIZE_P(key) TSRMLS_CC);
+ c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
}
}
} else {
key--;
- c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRSIZE_P(key) TSRMLS_CC);
+ c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC);
}
}
}
@@ -501,14 +501,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
#endif
if (!(c->flags & CONST_CS)) {
- lowercase_name = STR_ALLOC(c->name->len, c->flags & CONST_PERSISTENT);
+ lowercase_name = zend_string_alloc(c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name;
} else {
char *slash = strrchr(c->name->val, '\\');
if (slash) {
- lowercase_name = STR_INIT(c->name->val, c->name->len, c->flags & CONST_PERSISTENT);
+ lowercase_name = zend_string_init(c->name->val, c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower(lowercase_name->val, slash - c->name->val);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name;
@@ -527,14 +527,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
&& memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
}
zend_error(E_NOTICE,"Constant %s already defined", name->val);
- STR_RELEASE(c->name);
+ zend_string_release(c->name);
if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
ret = FAILURE;
}
if (lowercase_name) {
- STR_RELEASE(lowercase_name);
+ zend_string_release(lowercase_name);
}
return ret;
}
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index d36584d20f..d81476f3f4 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -32,28 +32,28 @@
typedef struct _zend_constant {
zval value;
- int flags;
zend_string *name;
+ int flags;
int module_number;
} zend_constant;
#define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), module_number TSRMLS_CC)
#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), module_number TSRMLS_CC)
-#define REGISTER_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name)-1, (lval), (flags), module_number TSRMLS_CC)
+#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number TSRMLS_CC)
#define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_INT_CONSTANT(ns, name, lval, flags) zend_register_int_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC)
#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC)
#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0 TSRMLS_CC)
-#define REGISTER_MAIN_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name)-1, (lval), (flags), 0 TSRMLS_CC)
+#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), 0 TSRMLS_CC)
#define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), 0 TSRMLS_CC)
@@ -67,16 +67,16 @@ void zend_register_standard_constants(TSRMLS_D);
void clean_non_persistent_constants(TSRMLS_D);
ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC);
ZEND_API zval *zend_get_constant_str(const char *name, uint name_len TSRMLS_DC);
-ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC);
+ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_ulong flags TSRMLS_DC);
ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC);
-ZEND_API void zend_register_int_constant(const char *name, uint name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC);
+ZEND_API void zend_register_long_constant(const char *name, uint name_len, zend_long lval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
void zend_copy_constants(HashTable *target, HashTable *sourc);
-zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS_DC);
+zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC);
END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant
diff --git a/Zend/zend_dynamic_array.c b/Zend/zend_dynamic_array.c
deleted file mode 100644
index db81b00a73..0000000000
--- a/Zend/zend_dynamic_array.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend.h"
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int current;
- unsigned int allocated;
-} dynamic_array;
-
-ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size)
-{
- da->element_size = element_size;
- da->allocated = size;
- da->current = 0;
- da->array = (char *) emalloc(size*element_size);
- if (da->array == NULL) {
- return 1;
- }
- return 0;
-}
-
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da)
-{
- if (da->current == da->allocated) {
- da->allocated *= 2;
- da->array = (char *) erealloc(da->array, da->allocated*da->element_size);
- }
- return (void *)(da->array+(da->current++)*da->element_size);
-}
-
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da)
-{
- return (void *)(da->array+(--(da->current))*da->element_size);
-
-}
-
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index)
-{
- if (index >= da->current) {
- return NULL;
- }
- return (void *)(da->array+index*da->element_size);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 6d5aa720fa..f9c1a509a6 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -28,6 +28,7 @@
#include "zend_exceptions.h"
#include "zend_vm.h"
#include "zend_dtrace.h"
+#include "zend_smart_str.h"
static zend_class_entry *default_exception_ce;
static zend_class_entry *error_exception_ce;
@@ -84,15 +85,12 @@ void zend_exception_restore(TSRMLS_D) /* {{{ */
}
/* }}} */
-void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
+ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
- zend_string *classname;
-
if (exception != NULL) {
- classname = zend_get_object_classname(Z_OBJ_P(exception) TSRMLS_CC);
- DTRACE_EXCEPTION_THROWN(classname->val);
+ DTRACE_EXCEPTION_THROWN(Z_OBJ_P(exception)->ce->val);
} else {
DTRACE_EXCEPTION_THROWN(NULL);
}
@@ -163,7 +161,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type,
Z_SET_REFCOUNT(trace, 0);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
- zend_update_property_int(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC);
return object;
@@ -196,7 +194,7 @@ ZEND_METHOD(exception, __clone)
ZEND_METHOD(exception, __construct)
{
zend_string *message = NULL;
- long code = 0;
+ zend_long code = 0;
zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS();
@@ -211,7 +209,7 @@ ZEND_METHOD(exception, __construct)
}
if (code) {
- zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
if (previous) {
@@ -225,9 +223,10 @@ ZEND_METHOD(exception, __construct)
ZEND_METHOD(error_exception, __construct)
{
char *message = NULL, *filename = NULL;
- long code = 0, severity = E_ERROR, lineno;
+ zend_long code = 0, severity = E_ERROR, lineno;
zval *object, *previous = NULL;
- int argc = ZEND_NUM_ARGS(), message_len, filename_len;
+ int argc = ZEND_NUM_ARGS();
+ size_t message_len, filename_len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) {
zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])");
@@ -240,21 +239,21 @@ ZEND_METHOD(error_exception, __construct)
}
if (code) {
- zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
}
if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC);
}
- zend_update_property_int(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
if (argc >= 4) {
zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC);
if (argc < 5) {
lineno = 0; /* invalidate lineno */
}
- zend_update_property_int(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
}
}
/* }}} */
@@ -264,14 +263,10 @@ ZEND_METHOD(error_exception, __construct)
return; \
}
-static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */
-{
- zval *value;
-
- value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
- ZVAL_COPY(return_value, value);
-}
-/* }}} */
+#define GET_PROPERTY(object, name) \
+ zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 0 TSRMLS_CC)
+#define GET_PROPERTY_SILENT(object, name) \
+ zend_read_property(default_exception_ce, (object), name, sizeof(name) - 1, 1 TSRMLS_CC)
/* {{{ proto string Exception::getFile()
Get the file in which the exception occurred */
@@ -279,7 +274,7 @@ ZEND_METHOD(exception, getFile)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "file", sizeof("file")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "file"));
}
/* }}} */
@@ -289,7 +284,7 @@ ZEND_METHOD(exception, getLine)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "line", sizeof("line")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "line"));
}
/* }}} */
@@ -299,7 +294,7 @@ ZEND_METHOD(exception, getMessage)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "message", sizeof("message")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "message"));
}
/* }}} */
@@ -309,7 +304,7 @@ ZEND_METHOD(exception, getCode)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "code", sizeof("code")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "code"));
}
/* }}} */
@@ -319,7 +314,7 @@ ZEND_METHOD(exception, getTrace)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "trace", sizeof("trace")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "trace"));
}
/* }}} */
@@ -329,50 +324,83 @@ ZEND_METHOD(error_exception, getSeverity)
{
DEFAULT_0_PARAMS;
- _default_exception_get_entry(getThis(), "severity", sizeof("severity")-1, return_value TSRMLS_CC);
+ ZVAL_COPY(return_value, GET_PROPERTY(getThis(), "severity"));
}
/* }}} */
-/* {{{ gettraceasstring() macros */
-#define TRACE_APPEND_CHR(chr) \
- str = STR_REALLOC(str, str->len + 1, 0); \
- str->val[str->len - 1] = chr
-
-#define TRACE_APPEND_STRL(v, l) \
- { \
- str = STR_REALLOC(str, str->len + (l), 0); \
- memcpy(str->val + str->len - (l), (v), (l)); \
- }
-
-#define TRACE_APPEND_STR(v) \
- TRACE_APPEND_STRL((v), sizeof((v))-1)
-
#define TRACE_APPEND_KEY(key) do { \
tmp = zend_hash_str_find(ht, key, sizeof(key)-1); \
if (tmp) { \
if (Z_TYPE_P(tmp) != IS_STRING) { \
zend_error(E_WARNING, "Value for %s is no string", key); \
- TRACE_APPEND_STR("[unknown]"); \
+ smart_str_appends(str, "[unknown]"); \
} else { \
- TRACE_APPEND_STRL(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); \
+ smart_str_append(str, Z_STR_P(tmp)); \
} \
} \
} while (0)
+/* Windows uses VK_ESCAPE instead of \e */
+#ifndef VK_ESCAPE
+#define VK_ESCAPE '\e'
+#endif
-#define TRACE_ARG_APPEND(vallen) do { \
- int len = str->len; \
- str = STR_REALLOC(str, len + vallen, 0); \
- memmove(str->val + len - l_added + 1 + vallen, str->val + len - l_added + 1, l_added); \
- } while (0)
+static size_t compute_escaped_string_len(const char *s, size_t l) {
+ size_t i, len = l;
+ for (i = 0; i < l; ++i) {
+ char c = s[i];
+ if (c == '\n' || c == '\r' || c == '\t' ||
+ c == '\f' || c == '\v' || c == '\\' || c == VK_ESCAPE) {
+ len += 1;
+ } else if (c < 32 || c > 126) {
+ len += 3;
+ }
+ }
+ return len;
+}
-/* }}} */
+static void smart_str_append_escaped(smart_str *str, const char *s, size_t l) {
+ char *res;
+ size_t i, len = compute_escaped_string_len(s, l);
+
+ smart_str_alloc(str, len, 0);
+ res = &str->s->val[str->s->len];
+ str->s->len += len;
+
+ for (i = 0; i < l; ++i) {
+ char c = s[i];
+ if (c < 32 || c == '\\' || c > 126) {
+ *res++ = '\\';
+ switch (c) {
+ case '\n': *res++ = 'n'; break;
+ case '\r': *res++ = 'r'; break;
+ case '\t': *res++ = 't'; break;
+ case '\f': *res++ = 'f'; break;
+ case '\v': *res++ = 'v'; break;
+ case '\\': *res++ = '\\'; break;
+ case VK_ESCAPE: *res++ = 'e'; break;
+ default:
+ *res++ = 'x';
+ if ((c >> 4) < 10) {
+ *res++ = (c >> 4) + '0';
+ } else {
+ *res++ = (c >> 4) + 'A' - 10;
+ }
+ if ((c & 0xf) < 10) {
+ *res++ = (c & 0xf) + '0';
+ } else {
+ *res++ = (c & 0xf) + 'A' - 10;
+ }
+ }
+ } else {
+ *res++ = c;
+ }
+ }
+}
-static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ */
+static void _build_trace_args(zval *arg, smart_str *str TSRMLS_DC) /* {{{ */
{
- zend_string *str = *str_ptr;
-
- /* the trivial way would be to do:
+ /* the trivial way would be to do
* convert_to_string_ex(arg);
* append it and kill the now tmp arg.
* but that could cause some E_NOTICE and also damn long lines.
@@ -381,163 +409,72 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{
ZVAL_DEREF(arg);
switch (Z_TYPE_P(arg)) {
case IS_NULL:
- TRACE_APPEND_STR("NULL, ");
+ smart_str_appends(str, "NULL, ");
break;
- case IS_STRING: {
- int l_added;
- TRACE_APPEND_CHR('\'');
- if (Z_STRSIZE_P(arg) > 15) {
- TRACE_APPEND_STRL(Z_STRVAL_P(arg), 15);
- TRACE_APPEND_STR("...', ");
- l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
+ case IS_STRING:
+ smart_str_appendc(str, '\'');
+ smart_str_append_escaped(str, Z_STRVAL_P(arg), MIN(Z_STRLEN_P(arg), 15));
+ if (Z_STRLEN_P(arg) > 15) {
+ smart_str_appends(str, "...', ");
} else {
- l_added = Z_STRSIZE_P(arg);
- TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added);
- TRACE_APPEND_STR("', ");
- l_added += 3 + 1;
- }
- while (--l_added) {
- unsigned char chr = str->val[str->len - l_added];
- if (chr < 32 || chr == '\\' || chr > 126) {
- str->val[str->len - l_added] = '\\';
-
- switch (chr) {
- case '\n':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 'n';
- break;
- case '\r':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 'r';
- break;
- case '\t':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 't';
- break;
- case '\f':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 'f';
- break;
- case '\v':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 'v';
- break;
-#ifndef PHP_WIN32
- case '\e':
-#else
- case VK_ESCAPE:
-#endif
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = 'e';
- break;
- case '\\':
- TRACE_ARG_APPEND(1);
- str->val[str->len - l_added] = '\\';
- break;
- default:
- TRACE_ARG_APPEND(3);
- str->val[str->len - l_added - 2] = 'x';
- if ((chr >> 4) < 10) {
- str->val[str->len - l_added - 1] = (chr >> 4) + '0';
- } else {
- str->val[str->len - l_added - 1] = (chr >> 4) + 'A' - 10;
- }
- if (chr % 16 < 10) {
- str->val[str->len - l_added] = chr % 16 + '0';
- } else {
- str->val[str->len - l_added] = chr % 16 + 'A' - 10;
- }
- }
- }
+ smart_str_appends(str, "', ");
}
break;
- }
case IS_FALSE:
- TRACE_APPEND_STR("false, ");
+ smart_str_appends(str, "false, ");
break;
case IS_TRUE:
- TRACE_APPEND_STR("true, ");
+ smart_str_appends(str, "true, ");
break;
- case IS_RESOURCE: {
- zend_int_t lval = Z_RES_HANDLE_P(arg);
- char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1];
- int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
- TRACE_APPEND_STR("Resource id #");
- TRACE_APPEND_STRL(s_tmp, l_tmp);
- TRACE_APPEND_STR(", ");
+ case IS_RESOURCE:
+ smart_str_appends(str, "Resource id #");
+ smart_str_append_long(str, Z_RES_HANDLE_P(arg));
+ smart_str_appends(str, ", ");
break;
- }
- case IS_INT: {
- zend_int_t lval = Z_IVAL_P(arg);
- char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1];
- int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
- TRACE_APPEND_STRL(s_tmp, l_tmp);
- TRACE_APPEND_STR(", ");
+ case IS_LONG:
+ smart_str_append_long(str, Z_LVAL_P(arg));
+ smart_str_appends(str, ", ");
break;
- }
case IS_DOUBLE: {
double dval = Z_DVAL_P(arg);
- char *s_tmp;
- int l_tmp;
-
- s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
- TRACE_APPEND_STRL(s_tmp, l_tmp);
- /* %G already handles removing trailing zeros from the fractional part, yay */
+ char *s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
+ int l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */
+ smart_str_appendl(str, s_tmp, l_tmp);
+ smart_str_appends(str, ", ");
efree(s_tmp);
- TRACE_APPEND_STR(", ");
break;
}
case IS_ARRAY:
- TRACE_APPEND_STR("Array, ");
+ smart_str_appends(str, "Array, ");
break;
- case IS_OBJECT: {
- zend_string *class_name;
-
- TRACE_APPEND_STR("Object(");
-
- class_name = zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC);
-
- TRACE_APPEND_STRL(class_name->val, class_name->len);
- TRACE_APPEND_STR("), ");
- break;
- }
- default:
+ case IS_OBJECT:
+ smart_str_appends(str, "Object(");
+ smart_str_append(str, Z_OBJCE_P(arg)->name);
+ smart_str_appends(str, "), ");
break;
}
- *str_ptr = str;
}
/* }}} */
-static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **str_ptr, int *num TSRMLS_DC) /* {{{ */
+static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num TSRMLS_DC) /* {{{ */
{
- char *s_tmp;
- int len;
- long line;
- HashTable *ht;
zval *file, *tmp;
- zend_string *str = *str_ptr;
- if (Z_TYPE_P(frame) != IS_ARRAY) {
- zend_error(E_WARNING, "Expected array for frame %lu", index);
- return;
- }
+ smart_str_appendc(str, '#');
+ smart_str_append_long(str, num);
+ smart_str_appendc(str, ' ');
- ht = Z_ARRVAL_P(frame);
- s_tmp = emalloc(1 + MAX_LENGTH_OF_ZEND_INT + 1 + 1);
- len = sprintf(s_tmp, "#%d ", (*num)++);
- TRACE_APPEND_STRL(s_tmp, len);
- efree(s_tmp);
file = zend_hash_str_find(ht, "file", sizeof("file")-1);
if (file) {
if (Z_TYPE_P(file) != IS_STRING) {
zend_error(E_WARNING, "Function name is no string");
- TRACE_APPEND_STR("[unknown function]");
+ smart_str_appends(str, "[unknown function]");
} else{
+ zend_long line;
tmp = zend_hash_str_find(ht, "line", sizeof("line")-1);
if (tmp) {
- if (Z_TYPE_P(tmp) == IS_INT) {
- line = Z_IVAL_P(tmp);
+ if (Z_TYPE_P(tmp) == IS_LONG) {
+ line = Z_LVAL_P(tmp);
} else {
zend_error(E_WARNING, "Line is no long");
line = 0;
@@ -545,37 +482,36 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st
} else {
line = 0;
}
- s_tmp = emalloc(Z_STRSIZE_P(file) + MAX_LENGTH_OF_ZEND_INT + 4 + 1);
- len = sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_P(file), line);
- TRACE_APPEND_STRL(s_tmp, len);
- efree(s_tmp);
+ smart_str_append(str, Z_STR_P(file));
+ smart_str_appendc(str, '(');
+ smart_str_append_long(str, line);
+ smart_str_appends(str, "): ");
}
} else {
- TRACE_APPEND_STR("[internal function]: ");
+ smart_str_appends(str, "[internal function]: ");
}
TRACE_APPEND_KEY("class");
TRACE_APPEND_KEY("type");
TRACE_APPEND_KEY("function");
- TRACE_APPEND_CHR('(');
+ smart_str_appendc(str, '(');
tmp = zend_hash_str_find(ht, "args", sizeof("args")-1);
if (tmp) {
if (Z_TYPE_P(tmp) == IS_ARRAY) {
- int last_len = str->len;
+ size_t last_len = str->s->len;
zval *arg;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmp), arg) {
- _build_trace_args(arg, &str TSRMLS_CC);
+ _build_trace_args(arg, str TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
- if (last_len != str->len) {
- str->len -= 2; /* remove last ', ' */
+ if (last_len != str->s->len) {
+ str->s->len -= 2; /* remove last ', ' */
}
} else {
zend_error(E_WARNING, "args element is no array");
}
}
- TRACE_APPEND_STR(")\n");
- *str_ptr = str;
+ smart_str_appends(str, ")\n");
}
/* }}} */
@@ -584,26 +520,28 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st
ZEND_METHOD(exception, getTraceAsString)
{
zval *trace, *frame;
- zend_uint_t index;
- zend_string *str, *key;
- int num = 0, len;
- char s_tmp[MAX_LENGTH_OF_ZEND_INT + 7 + 1 + 1];
+ zend_ulong index;
+ smart_str str = {0};
+ uint32_t num = 0;
DEFAULT_0_PARAMS;
- str = STR_ALLOC(0, 0);
-
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(trace), index, key, frame) {
- _build_trace_string(frame, index, &str, &num TSRMLS_CC);
- } ZEND_HASH_FOREACH_END();
+ ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
+ if (Z_TYPE_P(frame) != IS_ARRAY) {
+ zend_error(E_WARNING, "Expected array for frame %pu", index);
+ continue;
+ }
- len = sprintf(s_tmp, "#%d {main}", num);
- TRACE_APPEND_STRL(s_tmp, len);
+ _build_trace_string(&str, Z_ARRVAL_P(frame), num++ TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
- str->val[str->len] = '\0';
+ smart_str_appendc(&str, '#');
+ smart_str_append_long(&str, num);
+ smart_str_appends(&str, " {main}");
+ smart_str_0(&str);
- RETURN_NEW_STR(str);
+ RETURN_NEW_STR(str.s);
}
/* }}} */
@@ -611,18 +549,15 @@ ZEND_METHOD(exception, getTraceAsString)
Return previous Exception or NULL. */
ZEND_METHOD(exception, getPrevious)
{
- zval *previous;
-
DEFAULT_0_PARAMS;
- previous = zend_read_property(default_exception_ce, getThis(), "previous", sizeof("previous")-1, 1 TSRMLS_CC);
- RETURN_ZVAL(previous, 1, 0);
+ ZVAL_COPY(return_value, GET_PROPERTY_SILENT(getThis(), "previous"));
} /* }}} */
-int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
+size_t zend_spprintf(char **message, size_t max_len, const char *format, ...) /* {{{ */
{
va_list arg;
- int len;
+ size_t len;
va_start(arg, format);
len = zend_vspprintf(message, max_len, format, arg);
@@ -631,7 +566,7 @@ int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ *
}
/* }}} */
-zend_string *zend_strpprintf(int max_len, const char *format, ...) /* {{{ */
+zend_string *zend_strpprintf(size_t max_len, const char *format, ...) /* {{{ */
{
va_list arg;
zend_string *str;
@@ -647,8 +582,8 @@ zend_string *zend_strpprintf(int max_len, const char *format, ...) /* {{{ */
Obtain the string representation of the Exception object */
ZEND_METHOD(exception, __toString)
{
- zval message, file, line, trace, *exception;
- zend_string *str, *prev_str;
+ zval trace, *exception;
+ zend_string *str;
zend_fcall_info fci;
zval fname;
@@ -660,14 +595,10 @@ ZEND_METHOD(exception, __toString)
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1);
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
- prev_str = str;
- _default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
- _default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
- _default_exception_get_entry(exception, "line", sizeof("line")-1, &line TSRMLS_CC);
-
- convert_to_string_ex(&message);
- convert_to_string_ex(&file);
- convert_to_int_ex(&line);
+ zend_string *prev_str = str;
+ zend_string *message = zval_get_string(GET_PROPERTY(exception, "message"));
+ zend_string *file = zval_get_string(GET_PROPERTY(exception, "file"));
+ zend_long line = zval_get_long(GET_PROPERTY(exception, "line"));
fci.size = sizeof(fci);
fci.function_table = &Z_OBJCE_P(exception)->function_table;
@@ -686,26 +617,26 @@ ZEND_METHOD(exception, __toString)
ZVAL_UNDEF(&trace);
}
- if (Z_STRSIZE(message) > 0) {
- str = zend_strpprintf(0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s",
- Z_OBJCE_P(exception)->name->val, Z_STRVAL(message), Z_STRVAL(file), Z_IVAL(line),
- (Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
+ if (message->len > 0) {
+ str = zend_strpprintf(0, "exception '%s' with message '%s' in %s:" ZEND_LONG_FMT
+ "\nStack trace:\n%s%s%s",
+ Z_OBJCE_P(exception)->name->val, message->val, file->val, line,
+ (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
prev_str->len ? "\n\nNext " : "", prev_str->val);
} else {
- str = zend_strpprintf(0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s",
- Z_OBJCE_P(exception)->name->val, Z_STRVAL(file), Z_IVAL(line),
- (Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
+ str = zend_strpprintf(0, "exception '%s' in %s:" ZEND_LONG_FMT
+ "\nStack trace:\n%s%s%s",
+ Z_OBJCE_P(exception)->name->val, file->val, line,
+ (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
prev_str->len ? "\n\nNext " : "", prev_str->val);
}
- STR_RELEASE(prev_str);
- zval_dtor(&message);
- zval_dtor(&file);
- zval_dtor(&line);
-
- exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC);
+ zend_string_release(prev_str);
+ zend_string_release(message);
+ zend_string_release(file);
zval_ptr_dtor(&trace);
+ exception = GET_PROPERTY(exception, "previous");
}
zval_dtor(&fname);
@@ -775,7 +706,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
- zend_declare_property_int(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
@@ -784,7 +715,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions);
error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC);
error_exception_ce->create_object = zend_error_exception_new;
- zend_declare_property_int(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
}
/* }}} */
@@ -800,7 +731,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code TSRMLS_DC) /* {{{ */
{
zval ex;
@@ -819,7 +750,7 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const
zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC);
}
if (code) {
- zend_update_property_int(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC);
}
zend_throw_exception_internal(&ex TSRMLS_CC);
@@ -827,7 +758,7 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const
}
/* }}} */
-ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
+ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code TSRMLS_DC, const char *format, ...) /* {{{ */
{
va_list arg;
char *message;
@@ -842,12 +773,12 @@ ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, lo
}
/* }}} */
-ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity TSRMLS_DC) /* {{{ */
{
zval ex;
zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
ZVAL_OBJ(&ex, obj);
- zend_update_property_int(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
return obj;
}
/* }}} */
@@ -871,7 +802,9 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {
ZVAL_OBJ(&exception, ex);
ce_exception = Z_OBJCE(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
- zval tmp, *str, *file, *line;
+ zval tmp;
+ zend_string *str, *file = NULL;
+ zend_long line = 0;
EG(exception) = NULL;
@@ -891,28 +824,28 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {
ZVAL_OBJ(&zv, EG(exception));
/* do the best we can to inform about the inner exception */
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
- file = zend_read_property(default_exception_ce, &zv, "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(default_exception_ce, &zv, "line", sizeof("line")-1, 1 TSRMLS_CC);
+ file = zval_get_string(GET_PROPERTY_SILENT(&zv, "file"));
+ line = zval_get_long(GET_PROPERTY_SILENT(&zv, "line"));
+ }
- convert_to_string_ex(file);
- file = (Z_STRSIZE_P(file) > 0) ? file : NULL;
- line = (Z_TYPE_P(line) == IS_INT) ? line : NULL;
- } else {
- file = NULL;
- line = NULL;
+ zend_error_va(E_WARNING, (file && file->len > 0) ? file->val : NULL, line,
+ "Uncaught %s in exception handling during call to %s::__tostring()",
+ Z_OBJCE(zv)->name->val, ce_exception->name->val);
+
+ if (file) {
+ zend_string_release(file);
}
- zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_IVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE(zv)->name->val, ce_exception->name->val);
}
- str = zend_read_property(default_exception_ce, &exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
- file = zend_read_property(default_exception_ce, &exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(default_exception_ce, &exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
+ str = zval_get_string(GET_PROPERTY_SILENT(&exception, "string"));
+ file = zval_get_string(GET_PROPERTY_SILENT(&exception, "file"));
+ line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line"));
- convert_to_string_ex(str);
- convert_to_string_ex(file);
- convert_to_int_ex(line);
+ zend_error_va(severity, (file && file->len > 0) ? file->val : NULL, line,
+ "Uncaught %s\n thrown", str->val);
- zend_error_va(severity, (Z_STRSIZE_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_IVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
+ zend_string_release(str);
+ zend_string_release(file);
} else {
zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val);
}
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index a799786751..3118ce1053 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -30,7 +30,7 @@ ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *a
ZEND_API void zend_exception_save(TSRMLS_D);
ZEND_API void zend_exception_restore(TSRMLS_D);
-void zend_throw_exception_internal(zval *exception TSRMLS_DC);
+ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC);
void zend_register_default_exception(TSRMLS_D);
@@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D);
/* exception_ce NULL or zend_exception_get_default() or a derived class
* message NULL or the message of the exception */
-ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
-ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
+ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code TSRMLS_DC);
+ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code TSRMLS_DC, const char *format, ...);
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
ZEND_API void zend_clear_exception(TSRMLS_D);
-ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
+ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity TSRMLS_DC);
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
@@ -53,8 +53,8 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
ZEND_API void zend_exception_error(zend_object *exception, int severity TSRMLS_DC);
/* do not export, in php it's available thru spprintf directly */
-int zend_spprintf(char **message, int max_len, const char *format, ...);
-zend_string *zend_strpprintf(int max_len, const char *format, ...);
+size_t zend_spprintf(char **message, size_t max_len, const char *format, ...);
+zend_string *zend_strpprintf(size_t max_len, const char *format, ...);
END_EXTERN_C()
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 54397153c1..58038c94a4 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -38,6 +38,7 @@
#include "zend_generators.h"
#include "zend_vm.h"
#include "zend_dtrace.h"
+#include "zend_inheritance.h"
/* Virtual current working directory support */
#include "zend_virtual_cwd.h"
@@ -64,27 +65,15 @@ static void zend_extension_fcall_end_handler(const zend_extension *extension, ze
#define RETURN_VALUE_USED(opline) (!((opline)->result_type & EXT_TYPE_UNUSED))
-#define TEMP_VAR_STACK_LIMIT 2000
-
-static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free)
-{
- should_free->var = NULL;
- if (Z_REFCOUNTED_P(z) && !Z_DELREF_P(z)) {
- Z_SET_REFCOUNT_P(z, 1);
- should_free->var = z;
- /* should_free->is_var = 1; */
- }
-}
-
static ZEND_FUNCTION(pass)
{
}
static const zend_internal_function zend_pass_function = {
ZEND_INTERNAL_FUNCTION, /* type */
+ 0, /* fn_flags */
NULL, /* name */
NULL, /* scope */
- 0, /* fn_flags */
NULL, /* prototype */
0, /* num_args */
0, /* required_num_args */
@@ -95,12 +84,13 @@ static const zend_internal_function zend_pass_function = {
#undef zval_ptr_dtor
#define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC TSRMLS_CC)
-#define zval_ptr_dtor_nogc(zv) i_zval_ptr_dtor_nogc(zv ZEND_FILE_LINE_CC TSRMLS_CC)
-#define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f)
#define PZVAL_LOCK(z) if (Z_REFCOUNTED_P(z)) Z_ADDREF_P((z))
#define SELECTIVE_PZVAL_LOCK(pzv, opline) if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(pzv); }
+#define READY_TO_DESTROY(zv) \
+ (zv && Z_REFCOUNTED_P(zv) && Z_REFCOUNT_P(zv) == 1)
+
#define EXTRACT_ZVAL_PTR(zv) do { \
zval *__zv = (zv); \
if (Z_TYPE_P(__zv) == IS_INDIRECT) { \
@@ -110,15 +100,6 @@ static const zend_internal_function zend_pass_function = {
#define FREE_OP(should_free) \
if (should_free.var) { \
- if ((zend_uintptr_t)should_free.var & 1L) { \
- zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \
- } else { \
- zval_ptr_dtor_nogc(should_free.var); \
- } \
- }
-
-#define FREE_OP_IF_VAR(should_free) \
- if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \
zval_ptr_dtor_nogc(should_free.var); \
}
@@ -127,10 +108,6 @@ static const zend_internal_function zend_pass_function = {
zval_ptr_dtor_nogc(should_free.var); \
}
-#define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L)
-
-#define IS_TMP_FREE(should_free) ((zend_uintptr_t)should_free.var & 1L)
-
/* End of zend_execute_locks.h */
#define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
@@ -146,15 +123,67 @@ static const zend_internal_function zend_pass_function = {
#define DECODE_CTOR(ce) \
((zend_class_entry*)(((zend_uintptr_t)(ce)) & ~(CTOR_CALL_BIT|CTOR_USED_BIT)))
-#undef EX
-#define EX(element) execute_data->element
+#define ZEND_VM_STACK_PAGE_SLOTS (16 * 1024) /* should be a power of 2 */
+
+#define ZEND_VM_STACK_PAGE_SIZE (ZEND_VM_STACK_PAGE_SLOTS * sizeof(zval))
+
+#define ZEND_VM_STACK_FREE_PAGE_SIZE \
+ ((ZEND_VM_STACK_PAGE_SLOTS - ZEND_VM_STACK_HEADER_SLOTS) * sizeof(zval))
+
+#define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size) \
+ (((size) + (ZEND_VM_STACK_FREE_PAGE_SIZE - 1)) & ~ZEND_VM_STACK_PAGE_SIZE)
+
+static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) {
+ zend_vm_stack page = (zend_vm_stack)emalloc(size);
+
+ page->top = ZEND_VM_STACK_ELEMETS(page);
+ page->end = (zval*)((char*)page + size);
+ page->prev = prev;
+ return page;
+}
+
+ZEND_API void zend_vm_stack_init(TSRMLS_D)
+{
+ EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE, NULL);
+ EG(vm_stack)->top++;
+ EG(vm_stack_top) = EG(vm_stack)->top;
+ EG(vm_stack_end) = EG(vm_stack)->end;
+}
+
+ZEND_API void zend_vm_stack_destroy(TSRMLS_D)
+{
+ zend_vm_stack stack = EG(vm_stack);
+
+ while (stack != NULL) {
+ zend_vm_stack p = stack->prev;
+ efree(stack);
+ stack = p;
+ }
+}
+
+ZEND_API void* zend_vm_stack_extend(size_t size TSRMLS_DC)
+{
+ zend_vm_stack stack;
+ void *ptr;
+
+ stack = EG(vm_stack);
+ stack->top = EG(vm_stack_top);
+ EG(vm_stack) = stack = zend_vm_stack_new_page(
+ EXPECTED(size < ZEND_VM_STACK_FREE_PAGE_SIZE) ?
+ ZEND_VM_STACK_PAGE_SIZE : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size),
+ stack);
+ ptr = stack->top;
+ EG(vm_stack_top) = (void*)(((char*)ptr) + size);
+ EG(vm_stack_end) = stack->end;
+ return ptr;
+}
-ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data, zend_uint var)
+ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data, uint32_t var)
{
return EX_VAR(var);
}
-static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval *ret = EX_VAR(var);
should_free->var = ret;
@@ -164,7 +193,7 @@ static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const zend_exec
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -172,7 +201,7 @@ static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const zend_exec
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var_deref(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -181,7 +210,7 @@ static zend_always_inline zval *_get_zval_ptr_var_deref(zend_uint var, const zen
return ret;
}
-static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, zend_uint var, int type, const zend_execute_data *execute_data TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int type, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv;
@@ -205,7 +234,7 @@ static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, zend_uint var, int
return ptr;
}
-static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
+static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@@ -213,7 +242,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, zend_uin
return &EG(uninitialized_zval);
}
-static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
+static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@@ -221,12 +250,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, zend
return &EG(uninitialized_zval);
}
-static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_IS(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
-{
- return &EG(uninitialized_zval);
-}
-
-static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
+static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@@ -235,13 +259,13 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, zend_ui
return ptr;
}
-static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
+static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, uint32_t var, const zend_execute_data *execute_data TSRMLS_DC)
{
ZVAL_NULL(ptr);
return ptr;
}
-static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execute_data, zend_uint var, int type TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execute_data, uint32_t var, int type TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -251,7 +275,7 @@ static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execut
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, zend_uint var, int type TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, uint32_t var, int type TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -262,7 +286,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -272,7 +296,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_dat
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -283,7 +307,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execu
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -293,7 +317,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -304,28 +328,22 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_e
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
- if (Z_TYPE_P(ret) == IS_UNDEF) {
- return _get_zval_cv_lookup_BP_VAR_IS(ret, var, execute_data TSRMLS_CC);
- }
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
- if (Z_TYPE_P(ret) == IS_UNDEF) {
- return _get_zval_cv_lookup_BP_VAR_IS(ret, var, execute_data TSRMLS_CC);
- }
ZVAL_DEREF(ret);
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -335,7 +353,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_da
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -346,7 +364,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_exec
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -356,12 +374,12 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_dat
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
return EX_VAR(var);
}
-static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var TSRMLS_DC)
{
zval *ret = EX_VAR(var);
@@ -383,7 +401,7 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_
break;
case IS_TMP_VAR:
ret = EX_VAR(node->var);
- should_free->var = TMP_FREE(ret);
+ should_free->var = ret;
return ret;
break;
case IS_VAR:
@@ -413,7 +431,7 @@ static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const
break;
case IS_TMP_VAR:
ret = EX_VAR(node->var);
- should_free->var = TMP_FREE(ret);
+ should_free->var = ret;
return ret;
break;
case IS_VAR:
@@ -432,18 +450,19 @@ static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const
return NULL;
}
-static zend_always_inline zval *_get_zval_ptr_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval *ret = EX_VAR(var);
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
should_free->var = NULL;
return Z_INDIRECT_P(ret);
- } else if (!Z_REFCOUNTED_P(ret)) {
- should_free->var = ret; //???
+ } else if (!Z_REFCOUNTED_P(ret) || Z_REFCOUNT_P(ret) == 1) {
+ should_free->var = ret;
return ret;
} else {
- PZVAL_UNLOCK(ret, should_free);
+ Z_DELREF_P(ret);
+ should_free->var = NULL;
return ret;
}
}
@@ -459,22 +478,22 @@ static inline zval *_get_zval_ptr_ptr(int op_type, const znode_op *node, const z
}
}
-static zend_always_inline zval *_get_obj_zval_ptr_unused(TSRMLS_D)
+static zend_always_inline zval *_get_obj_zval_ptr_unused(zend_execute_data *execute_data TSRMLS_DC)
{
- if (EXPECTED(Z_OBJ(EG(This)) != NULL)) {
- return &EG(This);
+ if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
+ return &EX(This);
} else {
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
return NULL;
}
}
-static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
+static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
if (op_type == IS_UNUSED) {
- if (EXPECTED(Z_OBJ(EG(This)) != NULL)) {
+ if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
should_free->var = NULL;
- return &EG(This);
+ return &EX(This);
} else {
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
}
@@ -482,12 +501,12 @@ static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_exec
return get_zval_ptr(op_type, op, execute_data, should_free, type);
}
-static inline zval *_get_obj_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
+static inline zval *_get_obj_zval_ptr_ptr(int op_type, const znode_op *node, zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
if (op_type == IS_UNUSED) {
- if (EXPECTED(Z_OBJ(EG(This)) != NULL)) {
+ if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
should_free->var = NULL;
- return &EG(This);
+ return &EX(This);
} else {
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
}
@@ -498,10 +517,13 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, const znode_op *node, con
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr TSRMLS_DC)
{
if (EXPECTED(variable_ptr != value_ptr)) {
+ zend_reference *ref;
ZVAL_MAKE_REF(value_ptr);
Z_ADDREF_P(value_ptr);
+ ref = Z_REF_P(value_ptr);
+
zval_ptr_dtor(variable_ptr);
- ZVAL_REF(variable_ptr, Z_REF_P(value_ptr));
+ ZVAL_REF(variable_ptr, ref);
} else {
ZVAL_MAKE_REF(variable_ptr);
}
@@ -516,7 +538,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC)
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_TYPE_P(object) == IS_NULL
|| Z_TYPE_P(object) == IS_FALSE
- || (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) {
+ || (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
zval_ptr_dtor_nogc(object);
object_init(object);
zend_error(E_WARNING, "Creating default object from empty value");
@@ -525,7 +547,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC)
return object;
}
-ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC)
+ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC)
{
zend_string *key;
ALLOCA_FLAG(use_heap);
@@ -542,7 +564,7 @@ ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ze
}
}
-ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC)
+ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
const char *fname = zf->common.function_name->val;
@@ -574,7 +596,7 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, zen
}
}
-static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, zend_uint_t fetch_type TSRMLS_DC)
+static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zend_ulong fetch_type TSRMLS_DC)
{
zend_arg_info *cur_arg_info;
char *need_msg;
@@ -623,7 +645,7 @@ static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg
}
}
-static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_num, zend_uint_t fetch_type TSRMLS_DC)
+static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_num, zend_ulong fetch_type TSRMLS_DC)
{
zend_arg_info *cur_arg_info;
char *need_msg;
@@ -646,6 +668,7 @@ static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "", NULL TSRMLS_CC);
+ return 0;
} else if (cur_arg_info->type_hint) {
if (cur_arg_info->type_hint == IS_ARRAY) {
zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "", NULL TSRMLS_CC);
@@ -656,11 +679,12 @@ static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_
zend_error(E_ERROR, "Unknown typehint");
#endif
}
+ return 0;
}
- return 0;
+ return 1;
}
-static void zend_verify_missing_arg(zend_execute_data *execute_data, zend_uint arg_num TSRMLS_DC)
+static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num TSRMLS_DC)
{
if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) ||
zend_verify_missing_arg_type(EX(func), arg_num, EX(opline)->extended_value TSRMLS_CC)) {
@@ -677,49 +701,50 @@ static void zend_verify_missing_arg(zend_execute_data *execute_data, zend_uint a
}
}
-static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, void **cache_slot TSRMLS_DC)
+static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, int value_type, const znode_op *value_op, const zend_execute_data *execute_data, int opcode, void **cache_slot TSRMLS_DC)
{
zend_free_op free_value;
zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
zval tmp;
- zval *object = object_ptr;
- ZVAL_DEREF(object);
- if (Z_TYPE_P(object) != IS_OBJECT) {
- if (object == &EG(error_zval)) {
- if (retval) {
- ZVAL_NULL(retval);
+ if (object_op_type != IS_UNUSED) {
+ ZVAL_DEREF(object);
+ if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (UNEXPECTED(object == &EG(error_zval))) {
+ if (retval) {
+ ZVAL_NULL(retval);
+ }
+ FREE_OP(free_value);
+ return;
}
- FREE_OP(free_value);
- return;
- }
- if (Z_TYPE_P(object) == IS_NULL ||
- Z_TYPE_P(object) == IS_FALSE ||
- (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) {
- zend_object *obj;
-
- zval_ptr_dtor(object);
- object_init(object);
- Z_ADDREF_P(object);
- obj = Z_OBJ_P(object);
- zend_error(E_WARNING, "Creating default object from empty value");
- if (GC_REFCOUNT(obj) == 1) {
- /* the enclosing container was deleted, obj is unreferenced */
+ if (EXPECTED(Z_TYPE_P(object) == IS_NULL ||
+ Z_TYPE_P(object) == IS_FALSE ||
+ (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0))) {
+ zend_object *obj;
+
+ zval_ptr_dtor(object);
+ object_init(object);
+ Z_ADDREF_P(object);
+ obj = Z_OBJ_P(object);
+ zend_error(E_WARNING, "Creating default object from empty value");
+ if (GC_REFCOUNT(obj) == 1) {
+ /* the enclosing container was deleted, obj is unreferenced */
+ if (retval) {
+ ZVAL_NULL(retval);
+ }
+ FREE_OP(free_value);
+ OBJ_RELEASE(obj);
+ return;
+ }
+ Z_DELREF_P(object);
+ } else {
+ zend_error(E_WARNING, "Attempt to assign property of non-object");
if (retval) {
ZVAL_NULL(retval);
}
FREE_OP(free_value);
- OBJ_RELEASE(obj);
return;
}
- Z_DELREF_P(object);
- } else {
- zend_error(E_WARNING, "Attempt to assign property of non-object");
- if (retval) {
- ZVAL_NULL(retval);
- }
- FREE_OP(free_value);
- return;
}
}
@@ -762,18 +787,18 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
ZVAL_COPY(retval, value);
}
zval_ptr_dtor(value);
- FREE_OP_IF_VAR(free_value);
+ if (value_type == IS_VAR) {
+ FREE_OP(free_value);
+ }
}
-static void zend_assign_to_string_offset(zval *str_offset, zval *value, int value_type, zval *result TSRMLS_DC)
+static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, zval *result TSRMLS_DC)
{
- zval *str = Z_STR_OFFSET_STR_P(str_offset);
- zend_uint offset = Z_STR_OFFSET_IDX_P(str_offset);
zend_string *old_str;
- if ((int)offset < 0) {
- zend_error(E_WARNING, "Illegal string offset: %d", offset);
- STR_RELEASE(Z_STR_P(str));
+ if (offset < 0) {
+ zend_error(E_WARNING, "Illegal string offset: " ZEND_LONG_FMT, offset);
+ zend_string_release(Z_STR_P(str));
if (result) {
ZVAL_NULL(result);
}
@@ -781,14 +806,14 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu
}
old_str = Z_STR_P(str);
- if (offset >= Z_STRSIZE_P(str)) {
- int old_len = Z_STRSIZE_P(str);
- Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), offset + 1, 0);
+ if ((size_t)offset >= Z_STRLEN_P(str)) {
+ zend_long old_len = Z_STRLEN_P(str);
+ Z_STR_P(str) = zend_string_realloc(Z_STR_P(str), offset + 1, 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
Z_STRVAL_P(str)[offset+1] = 0;
- } else if (IS_INTERNED(Z_STR_P(str))) {
- Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRSIZE_P(str), 0);
+ } else if (!Z_REFCOUNTED_P(str)) {
+ Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
}
@@ -796,171 +821,81 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu
zend_string *tmp = zval_get_string(value);
Z_STRVAL_P(str)[offset] = tmp->val[0];
- STR_RELEASE(tmp);
+ zend_string_release(tmp);
} else {
Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0];
- if (value_type == IS_TMP_VAR) {
- /* we can safely free final_value here
- * because separation is done only
- * in case value_type == IS_VAR */
- zval_dtor(value);
- }
}
/*
* the value of an assignment to a string offset is undefined
T(result->u.var).var = &T->str_offset.str;
*/
- STR_RELEASE(old_str);
+ zend_string_release(old_str);
if (result) {
zend_uchar c = (zend_uchar)Z_STRVAL_P(str)[offset];
if (CG(one_char_string)[c]) {
- ZVAL_INT_STR(result, CG(one_char_string)[c]);
+ ZVAL_INTERNED_STR(result, CG(one_char_string)[c]);
} else {
- ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(str) + offset, 1, 0));
+ ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(str) + offset, 1, 0));
}
}
}
-static inline zval* zend_assign_tmp_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
+static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
{
- ZVAL_DEREF(variable_ptr);
-
- if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
- zend_refcounted *garbage;
-
- if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
- UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
- return variable_ptr;
- }
+ do {
+ if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
+ zend_refcounted *garbage;
- garbage = Z_COUNTED_P(variable_ptr);
- if (UNEXPECTED(GC_REFCOUNT(garbage) > 1)) {
- /* we need to split */
- GC_REFCOUNT(garbage)--;
- /* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
- if ((Z_COLLECTABLE_P(variable_ptr)) &&
- UNEXPECTED(!GC_INFO(garbage))) {
- gc_possible_root(garbage TSRMLS_CC);
+ if (Z_ISREF_P(variable_ptr)) {
+ variable_ptr = Z_REFVAL_P(variable_ptr);
+ if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
+ break;
+ }
}
- } else {
- ZVAL_COPY_VALUE(variable_ptr, value);
- _zval_dtor_func(garbage ZEND_FILE_LINE_CC);
- return variable_ptr;
- }
- }
-
- ZVAL_COPY_VALUE(variable_ptr, value);
-
- return variable_ptr;
-}
-
-static inline zval* zend_assign_const_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
-{
- ZVAL_DEREF(variable_ptr);
-
- if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {
- zend_refcounted *garbage;
-
- if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
- UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
- return variable_ptr;
- }
-
- garbage = Z_COUNTED_P(variable_ptr);
- if (UNEXPECTED(GC_REFCOUNT(garbage) > 1)) {
- /* we need to split */
- GC_REFCOUNT(garbage)--;
- /* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
- if (Z_COLLECTABLE_P(variable_ptr) &&
- UNEXPECTED(!GC_INFO(garbage))) {
- gc_possible_root(garbage TSRMLS_CC);
+ if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
+ UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
+ Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
+ return variable_ptr;
}
- } else {
- ZVAL_COPY_VALUE(variable_ptr, value);
- /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
- if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
- zval_copy_ctor_func(variable_ptr);
+ if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
+ return variable_ptr;
}
- _zval_dtor_func(garbage ZEND_FILE_LINE_CC);
- return variable_ptr;
- }
- }
-
- ZVAL_COPY_VALUE(variable_ptr, value);
- /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
- if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
- zval_copy_ctor_func(variable_ptr);
- }
-
- return variable_ptr;
-}
-
-static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
-{
- zend_refcounted *garbage;
-
- if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
- goto assign_simple;
- } else if (UNEXPECTED(variable_ptr == value)) {
- return variable_ptr;
- }
- if (Z_ISREF_P(variable_ptr)) {
- variable_ptr = Z_REFVAL_P(variable_ptr);
- if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
- goto assign_simple;
- } else if (UNEXPECTED(variable_ptr == value)) {
- return variable_ptr;
- }
- }
-
- if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
- UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
- } else {
- if (Z_REFCOUNT_P(variable_ptr)==1) {
garbage = Z_COUNTED_P(variable_ptr);
- if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
- if (EXPECTED(!Z_ISREF_P(value))) {
- Z_ADDREF_P(value);
- } else {
- if (Z_REFCOUNT_P(value) == 1) {
- ZVAL_UNREF(value);
- } else {
- value = Z_REFVAL_P(value);
+ if (--GC_REFCOUNT(garbage) == 0) {
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (value_type == IS_CONST) {
+ /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
+ zval_copy_ctor_func(variable_ptr);
}
- if (Z_REFCOUNTED_P(value)) {
- if (UNEXPECTED(variable_ptr == value)) {
- return variable_ptr;
- }
- Z_ADDREF_P(value);
+ } else if (value_type != IS_TMP_VAR) {
+ if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
+ Z_ADDREF_P(variable_ptr);
}
}
- }
- ZVAL_COPY_VALUE(variable_ptr, value);
- _zval_dtor_func(garbage ZEND_FILE_LINE_CC);
- } else { /* we need to split */
- Z_DELREF_P(variable_ptr);
- GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
-assign_simple:
- if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
- if (EXPECTED(!Z_ISREF_P(value))) {
- Z_ADDREF_P(value);
- } else {
- if (Z_REFCOUNT_P(value) == 1) {
- ZVAL_UNREF(value);
- } else {
- value = Z_REFVAL_P(value);
- }
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ return variable_ptr;
+ } else { /* we need to split */
+ /* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
+ if ((Z_COLLECTABLE_P(variable_ptr)) &&
+ UNEXPECTED(!GC_INFO(garbage))) {
+ gc_possible_root(garbage TSRMLS_CC);
}
}
- ZVAL_COPY_VALUE(variable_ptr, value);
+ }
+ } while (0);
+
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (value_type == IS_CONST) {
+ /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
+ zval_copy_ctor_func(variable_ptr);
+ }
+ } else if (value_type != IS_TMP_VAR) {
+ if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
+ Z_ADDREF_P(variable_ptr);
}
}
return variable_ptr;
@@ -1015,23 +950,23 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
{
zval *retval;
zend_string *offset_key;
- zend_uint_t hval;
+ zend_ulong hval;
- if (EXPECTED(Z_TYPE_P(dim) == IS_INT)) {
- hval = Z_IVAL_P(dim);
+ if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) {
+ hval = Z_LVAL_P(dim);
num_index:
retval = zend_hash_index_find(ht, hval);
if (retval == NULL) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval);
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
/* break missing intentionally */
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval);
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
/* break missing intentionally */
case BP_VAR_W:
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
@@ -1092,10 +1027,10 @@ str_index:
offset_key = STR_EMPTY_ALLOC();
goto str_index;
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(dim));
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
goto num_index;
case IS_RESOURCE:
- zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ zend_error(E_STRICT, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
hval = Z_RES_HANDLE_P(dim);
goto num_index;
case IS_FALSE:
@@ -1113,7 +1048,7 @@ str_index:
return retval;
}
-static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *container_ptr, zval *dim, int dim_type, int type, int is_ref TSRMLS_DC)
+static zend_always_inline zval *zend_fetch_dimension_address(zval *result, zval *container_ptr, zval *dim, int dim_type, int type, int is_ref, int allow_str_offset TSRMLS_DC)
{
zval *retval;
zval *container = container_ptr;
@@ -1124,7 +1059,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *
fetch_from_array:
if (dim == NULL) {
retval = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
- if (retval == NULL) {
+ if (UNEXPECTED(retval == NULL)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
retval = &EG(error_zval);
}
@@ -1133,33 +1068,27 @@ fetch_from_array:
}
if (is_ref) {
ZVAL_MAKE_REF(retval);
- Z_ADDREF_P(retval);
- ZVAL_REF(result, Z_REF_P(retval));
- } else {
- ZVAL_INDIRECT(result, retval);
}
+ ZVAL_INDIRECT(result, retval);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
- zend_int_t offset;
+ zend_long offset;
- if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRSIZE_P(container) == 0)) {
- zval_dtor(container);
+ if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRLEN_P(container) == 0)) {
+ zval_ptr_dtor_nogc(container);
convert_to_array:
ZVAL_NEW_ARR(container);
zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0);
goto fetch_from_array;
}
+
if (dim == NULL) {
zend_error_noreturn(E_ERROR, "[] operator not supported for strings");
}
- if (type != BP_VAR_UNSET) {
- SEPARATE_STRING(container);
- }
-
- if (UNEXPECTED(Z_TYPE_P(dim) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) {
case IS_STRING:
- if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) {
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
break;
}
if (type != BP_VAR_UNSET) {
@@ -1177,13 +1106,24 @@ convert_to_array:
break;
}
- offset = zval_get_int(dim);
+ offset = zval_get_long(dim);
} else {
- offset = Z_IVAL_P(dim);
+ offset = Z_LVAL_P(dim);
}
- if (!IS_INTERNED(Z_STR_P(container))) STR_ADDREF(Z_STR_P(container));
- ZVAL_STR_OFFSET(result, container, offset);
+ if (allow_str_offset) {
+ if (Z_REFCOUNTED_P(container)) {
+ if (Z_REFCOUNT_P(container) > 1) {
+ Z_DELREF_P(container);
+ zval_copy_ctor_func(container);
+ }
+ Z_ADDREF_P(container);
+ }
+ ZVAL_LONG(result, offset);
+ return container; /* assignment to string offset */
+ } else {
+ ZVAL_INDIRECT(result, NULL); /* wrong string offset */
+ }
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (!Z_OBJ_HT_P(container)->read_dimension) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
@@ -1195,7 +1135,7 @@ convert_to_array:
ZVAL_NULL(result);
zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name->val);
- } else if (retval && Z_TYPE_P(retval) != IS_UNDEF) {
+ } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) {
if (!Z_ISREF_P(retval)) {
if (Z_REFCOUNTED_P(retval) &&
Z_REFCOUNT_P(retval) > 1) {
@@ -1216,18 +1156,15 @@ convert_to_array:
if (result != retval) {
if (is_ref) {
ZVAL_MAKE_REF(retval);
- Z_ADDREF_P(retval);
- ZVAL_REF(result, Z_REF_P(retval));
- } else {
- ZVAL_INDIRECT(result, retval);
}
+ ZVAL_INDIRECT(result, retval);
}
} else {
ZVAL_INDIRECT(result, &EG(error_zval));
}
}
} else if (EXPECTED(Z_TYPE_P(container) == IS_NULL)) {
- if (container == &EG(error_zval)) {
+ if (UNEXPECTED(container == &EG(error_zval))) {
ZVAL_INDIRECT(result, &EG(error_zval));
} else if (type != BP_VAR_UNSET) {
goto convert_to_array;
@@ -1248,26 +1185,32 @@ convert_to_array:
ZVAL_INDIRECT(result, &EG(error_zval));
}
}
+ return NULL; /* not an assignment to string offset */
}
static zend_never_inline void zend_fetch_dimension_address_W(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
{
- zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W, 0, 0 TSRMLS_CC);
+}
+
+static zend_never_inline zval *zend_fetch_dimension_address_W_str(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
+{
+ return zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W, 0, 1 TSRMLS_CC);
}
static zend_never_inline void zend_fetch_dimension_address_W_ref(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
{
- zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W, 1 TSRMLS_CC);
+ zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W, 1, 0 TSRMLS_CC);
}
static zend_never_inline void zend_fetch_dimension_address_RW(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
{
- zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_RW, 0, 0 TSRMLS_CC);
}
static zend_never_inline void zend_fetch_dimension_address_UNSET(zval *result, zval *container_ptr, zval *dim, int dim_type TSRMLS_DC)
{
- zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET, 0, 0 TSRMLS_CC);
}
static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
@@ -1279,13 +1222,13 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
ZVAL_COPY(result, retval);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
- zend_int_t offset;
+ zend_long offset;
- if (UNEXPECTED(Z_TYPE_P(dim) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) {
- /* case IS_INT: */
+ /* case IS_LONG: */
case IS_STRING:
- if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) {
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
break;
}
if (type != BP_VAR_IS) {
@@ -1305,23 +1248,23 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
break;
}
- offset = zval_get_int(dim);
+ offset = zval_get_long(dim);
} else {
- offset = Z_IVAL_P(dim);
+ offset = Z_LVAL_P(dim);
}
- if (UNEXPECTED(offset < 0) || UNEXPECTED(Z_STRSIZE_P(container) <= offset)) {
+ if (UNEXPECTED(offset < 0) || UNEXPECTED(Z_STRLEN_P(container) <= (size_t)offset)) {
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Uninitialized string offset: %ld", offset);
+ zend_error(E_NOTICE, "Uninitialized string offset: %pd", offset);
}
ZVAL_EMPTY_STRING(result);
} else {
zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[offset];
if (CG(one_char_string)[c]) {
- ZVAL_INT_STR(result, CG(one_char_string)[c]);
+ ZVAL_INTERNED_STR(result, CG(one_char_string)[c]);
} else {
- ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(container) + offset, 1, 0));
+ ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(container) + offset, 1, 0));
}
}
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
@@ -1330,14 +1273,13 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
} else {
retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result TSRMLS_CC);
- if (result) {
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
+ ZEND_ASSERT(result != NULL);
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
}
+ } else {
+ ZVAL_NULL(result);
}
}
} else {
@@ -1360,32 +1302,31 @@ ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR TSRMLS_CC);
}
-static void zend_fetch_property_address(zval *result, zval *container_ptr, zval *prop_ptr, void **cache_slot, int type, int is_ref TSRMLS_DC)
+static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, void **cache_slot, int type, int is_ref TSRMLS_DC)
{
- zval *container = container_ptr;
-
- ZVAL_DEREF(container);
- if (Z_TYPE_P(container) != IS_OBJECT) {
- if (container == &EG(error_zval)) {
- ZVAL_INDIRECT(result, &EG(error_zval));
- return;
- }
+ if (container_op_type != IS_UNUSED) {
+ ZVAL_DEREF(container);
+ if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
+ if (UNEXPECTED(container == &EG(error_zval))) {
+ ZVAL_INDIRECT(result, &EG(error_zval));
+ return;
+ }
- /* this should modify object only if it's empty */
- if (type != BP_VAR_UNSET &&
- ((Z_TYPE_P(container) == IS_NULL ||
- Z_TYPE_P(container) == IS_FALSE ||
- (Z_TYPE_P(container) == IS_STRING && Z_STRSIZE_P(container)==0)))) {
- zval_ptr_dtor_nogc(container);
- object_init(container);
- } else {
- zend_error(E_WARNING, "Attempt to modify property of non-object");
- ZVAL_INDIRECT(result, &EG(error_zval));
- return;
+ /* this should modify object only if it's empty */
+ if (type != BP_VAR_UNSET &&
+ EXPECTED((Z_TYPE_P(container) == IS_NULL ||
+ Z_TYPE_P(container) == IS_FALSE ||
+ (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
+ zval_ptr_dtor_nogc(container);
+ object_init(container);
+ } else {
+ zend_error(E_WARNING, "Attempt to modify property of non-object");
+ ZVAL_INDIRECT(result, &EG(error_zval));
+ return;
+ }
}
}
-
- if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
if (NULL == ptr) {
if (Z_OBJ_HT_P(container)->read_property &&
@@ -1393,11 +1334,8 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
if (ptr != result) {
if (is_ref && ptr != &EG(uninitialized_zval)) {
ZVAL_MAKE_REF(ptr);
- Z_ADDREF_P(ptr);
- ZVAL_REF(result, Z_REF_P(ptr));
- } else {
- ZVAL_INDIRECT(result, ptr);
}
+ ZVAL_INDIRECT(result, ptr);
}
} else {
zend_error_noreturn(E_ERROR, "Cannot access undefined property for object with overloaded property access");
@@ -1405,22 +1343,16 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval
} else {
if (is_ref) {
ZVAL_MAKE_REF(ptr);
- Z_ADDREF_P(ptr);
- ZVAL_REF(result, Z_REF_P(ptr));
- } else {
- ZVAL_INDIRECT(result, ptr);
}
+ ZVAL_INDIRECT(result, ptr);
}
- } else if (Z_OBJ_HT_P(container)->read_property) {
+ } else if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result TSRMLS_CC);
if (ptr != result) {
if (is_ref && ptr != &EG(uninitialized_zval)) {
ZVAL_MAKE_REF(ptr);
- Z_ADDREF_P(ptr);
- ZVAL_REF(result, Z_REF_P(ptr));
- } else {
- ZVAL_INDIRECT(result, ptr);
}
+ ZVAL_INDIRECT(result, ptr);
}
} else {
zend_error(E_WARNING, "This object doesn't support property references");
@@ -1441,13 +1373,9 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of
if (nest_levels>1) {
zend_op *brk_opline = &op_array->opcodes[jmp_to->brk];
- if (brk_opline->opcode == ZEND_SWITCH_FREE) {
- if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
- }
- } else if (brk_opline->opcode == ZEND_FREE) {
+ if (brk_opline->opcode == ZEND_FREE) {
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_dtor(EX_VAR(brk_opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
}
}
}
@@ -1494,14 +1422,14 @@ ZEND_API opcode_handler_t *zend_opcode_handlers;
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC)
{
- execute_data->func->internal_function.handler(execute_data->num_args, return_value TSRMLS_CC);
+ execute_data->func->internal_function.handler(execute_data, return_value TSRMLS_CC);
}
-void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC) /* {{{ */
+ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC) /* {{{ */
{
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
zend_hash_destroy(&symbol_table->ht);
- FREE_HASHTABLE(symbol_table);
+ efree_size(symbol_table, sizeof(zend_array));
} else {
/* clean before putting into the cache, since clean
could call dtors, which could use cached hash */
@@ -1550,63 +1478,67 @@ void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /*
* +----------------------------------------+
*/
-static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
+static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
{
- zend_uint first_extra_arg;
+ uint32_t first_extra_arg, num_args;
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
- ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
+ ZEND_ASSERT(EX(scope) == EG(scope));
+ EX(opline) = op_array->opcodes;
+ EX(call) = NULL;
EX(return_value) = return_value;
- EX(frame_kind) = frame_kind;
- ZVAL_UNDEF(&EX(old_error_reporting));
EX(delayed_exception) = NULL;
- EX(call) = NULL;
-
- EX(opline) = op_array->opcodes;
- if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
- /* Skip useless ZEND_RECV opcodes */
- EX(opline) += MIN(EX(num_args), op_array->required_num_args);
- }
- EX(scope) = EG(scope);
+ EX(silence_op_num) = -1;
+ /* Handle arguments */
first_extra_arg = op_array->num_args;
-
if (UNEXPECTED((op_array->fn_flags & ZEND_ACC_VARIADIC) != 0)) {
first_extra_arg--;
}
- if (UNEXPECTED(EX(num_args) > first_extra_arg)) {
- /* move extra args into separate array after all CV and TMP vars */
- zval *extra_args = EX_VAR_NUM(op_array->last_var + op_array->T);
+ num_args = EX(num_args);
+ if (UNEXPECTED(num_args > first_extra_arg)) {
+ zval *end, *src, *dst;
- memmove(extra_args, EX_VAR_NUM(first_extra_arg), sizeof(zval) * (EX(num_args) - first_extra_arg));
- }
-
- do {
- /* Initialize CV variables (skip arguments) */
- int num_args = MIN(op_array->num_args, EX(num_args));
-
- if (EXPECTED(num_args < op_array->last_var)) {
- zval *var = EX_VAR_NUM(num_args);
- zval *end = EX_VAR_NUM(op_array->last_var);
+ if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+ EX(opline) += first_extra_arg;
+ }
+ /* move extra args into separate array after all CV and TMP vars */
+ end = EX_VAR_NUM(first_extra_arg - 1);
+ src = end + (num_args - first_extra_arg);
+ dst = src + (op_array->last_var + op_array->T - first_extra_arg);
+ if (EXPECTED(src != dst)) {
do {
- ZVAL_UNDEF(var);
- var++;
- } while (var != end);
+ ZVAL_COPY_VALUE(dst, src);
+ ZVAL_UNDEF(src);
+ src--;
+ dst--;
+ } while (src != end);
}
- } while (0);
+ } else if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+ EX(opline) += num_args;
+ }
- if (op_array->this_var != -1 && EX(object)) {
- ZVAL_OBJ(EX_VAR(op_array->this_var), EX(object));
- GC_REFCOUNT(EX(object))++;
+ /* Initialize CV variables (skip arguments) */
+ if (EXPECTED((int)num_args < op_array->last_var)) {
+ zval *var = EX_VAR_NUM(num_args);
+ zval *end = EX_VAR_NUM(op_array->last_var);
+
+ do {
+ ZVAL_UNDEF(var);
+ var++;
+ } while (var != end);
+ }
+
+ if (op_array->this_var != -1 && Z_OBJ(EX(This))) {
+ ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
+ GC_REFCOUNT(Z_OBJ(EX(This)))++;
}
if (!op_array->run_time_cache && op_array->last_cache_slot) {
- if (op_array->function_name) {
- op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
- } else {
- op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
- }
+ op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
}
EX(run_time_cache) = op_array->run_time_cache;
@@ -1614,28 +1546,26 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu
}
/* }}} */
-static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
+static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
- ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
- EX(return_value) = return_value;
- EX(frame_kind) = frame_kind;
- ZVAL_UNDEF(&EX(old_error_reporting));
- EX(delayed_exception) = NULL;
+ EX(opline) = op_array->opcodes;
EX(call) = NULL;
-
- EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
+ EX(return_value) = return_value;
EX(scope) = EG(scope);
+ EX(delayed_exception) = NULL;
+ EX(silence_op_num) = -1;
zend_attach_symbol_table(execute_data);
+ if (op_array->this_var != -1 && Z_OBJ(EX(This))) {
+ ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
+ GC_REFCOUNT(Z_OBJ(EX(This)))++;
+ }
+
if (!op_array->run_time_cache && op_array->last_cache_slot) {
- if (op_array->function_name) {
- op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
- } else {
- op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
- }
+ op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
}
EX(run_time_cache) = op_array->run_time_cache;
@@ -1643,56 +1573,70 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu
}
/* }}} */
-static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
+static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
- ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
- EX(return_value) = return_value;
- EX(frame_kind) = frame_kind;
- ZVAL_UNDEF(&EX(old_error_reporting));
- EX(delayed_exception) = NULL;
+ EX(opline) = op_array->opcodes;
EX(call) = NULL;
-
- EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
+ EX(return_value) = return_value;
EX(scope) = EG(scope);
+ EX(delayed_exception) = NULL;
+ EX(silence_op_num) = -1;
if (UNEXPECTED(EX(symbol_table) != NULL)) {
zend_attach_symbol_table(execute_data);
} else {
- zend_uint first_extra_arg = op_array->num_args;
+ uint32_t first_extra_arg, num_args;
+ /* Handle arguments */
+ first_extra_arg = op_array->num_args;
if (UNEXPECTED((op_array->fn_flags & ZEND_ACC_VARIADIC) != 0)) {
first_extra_arg--;
}
- if (UNEXPECTED(EX(num_args) > first_extra_arg)) {
- /* move extra args into separate array after all CV and TMP vars */
- zval *extra_args = EX_VAR_NUM(op_array->last_var + op_array->T);
-
- memmove(extra_args, EX_VAR_NUM(first_extra_arg), sizeof(zval) * (EX(num_args) - first_extra_arg));
- }
+ num_args = EX(num_args);
+ if (UNEXPECTED(num_args > first_extra_arg)) {
+ zval *end, *src, *dst;
- do {
- /* Initialize CV variables (skip arguments) */
- int num_args = MIN(op_array->num_args, EX(num_args));
-
- if (EXPECTED(num_args < op_array->last_var)) {
- zval *var = EX_VAR_NUM(num_args);
- zval *end = EX_VAR_NUM(op_array->last_var);
+ if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+ EX(opline) += first_extra_arg;
+ }
+ /* move extra args into separate array after all CV and TMP vars */
+ end = EX_VAR_NUM(first_extra_arg - 1);
+ src = end + (num_args - first_extra_arg);
+ dst = src + (op_array->last_var + op_array->T - first_extra_arg);
+ if (EXPECTED(src != dst)) {
do {
- ZVAL_UNDEF(var);
- var++;
- } while (var != end);
+ ZVAL_COPY_VALUE(dst, src);
+ ZVAL_UNDEF(src);
+ src--;
+ dst--;
+ } while (src != end);
}
- } while (0);
+ } else if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+ EX(opline) += num_args;
+ }
- if (op_array->this_var != -1 && EX(object)) {
- ZVAL_OBJ(EX_VAR(op_array->this_var), EX(object));
- GC_REFCOUNT(EX(object))++;
+ /* Initialize CV variables (skip arguments) */
+ if (EXPECTED((int)num_args < op_array->last_var)) {
+ zval *var = EX_VAR_NUM(num_args);
+ zval *end = EX_VAR_NUM(op_array->last_var);
+
+ do {
+ ZVAL_UNDEF(var);
+ var++;
+ } while (var != end);
}
}
+ if (op_array->this_var != -1 && Z_OBJ(EX(This))) {
+ ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
+ GC_REFCOUNT(Z_OBJ(EX(This)))++;
+ }
+
if (!op_array->run_time_cache && op_array->last_cache_slot) {
if (op_array->function_name) {
op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*));
@@ -1718,19 +1662,23 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
* restore it simply by replacing a pointer.
*/
zend_execute_data *execute_data;
- zend_uint num_args = call->num_args;
+ uint32_t num_args = call->num_args;
+ size_t stack_size = (ZEND_CALL_FRAME_SLOT + MAX(op_array->last_var + op_array->T, num_args)) * sizeof(zval);
- EG(argument_stack) = zend_vm_stack_new_page(
- MAX(ZEND_VM_STACK_PAGE_SIZE,
- ZEND_CALL_FRAME_SLOT + MAX(op_array->last_var + op_array->T, num_args)));
- EG(argument_stack)->prev = NULL;
+ EG(vm_stack) = zend_vm_stack_new_page(
+ EXPECTED(stack_size < ZEND_VM_STACK_FREE_PAGE_SIZE) ?
+ ZEND_VM_STACK_PAGE_SIZE :
+ ZEND_VM_STACK_PAGE_ALIGNED_SIZE(stack_size),
+ NULL);
+ EG(vm_stack_top) = EG(vm_stack)->top;
+ EG(vm_stack_end) = EG(vm_stack)->end;
execute_data = zend_vm_stack_push_call_frame(
+ VM_FRAME_TOP_FUNCTION,
(zend_function*)op_array,
num_args,
- call->flags,
call->called_scope,
- call->object,
+ Z_OBJ(call->This),
NULL TSRMLS_CC);
EX(num_args) = num_args;
@@ -1738,7 +1686,7 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
if (num_args > 0) {
zval *arg_src = ZEND_CALL_ARG(call, 1);
zval *arg_dst = ZEND_CALL_ARG(execute_data, 1);
- int i;
+ uint32_t i;
for (i = 0; i < num_args; i++) {
ZVAL_COPY_VALUE(arg_dst + i, arg_src + i);
@@ -1746,36 +1694,35 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
}
EX(symbol_table) = NULL;
+ EX(scope) = EG(scope);
- i_init_func_execute_data(execute_data, op_array, return_value, VM_FRAME_TOP_FUNCTION TSRMLS_CC);
+ i_init_func_execute_data(execute_data, op_array, return_value TSRMLS_CC);
return execute_data;
}
/* }}} */
-ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC) /* {{{ */
+ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
{
EX(prev_execute_data) = EG(current_execute_data);
- i_init_execute_data(execute_data, op_array, return_value, frame_kind TSRMLS_CC);
+ i_init_execute_data(execute_data, op_array, return_value TSRMLS_CC);
}
/* }}} */
-static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(zend_op *opline, zend_execute_data *call TSRMLS_DC) /* {{{ */
+static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(const zend_op *opline, zend_execute_data *call TSRMLS_DC) /* {{{ */
{
- zend_uint arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
+ uint32_t arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
return ARG_SHOULD_BE_SENT_BY_REF(call->func, arg_num);
}
/* }}} */
-static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call, zend_uint passed_args, zend_uint additional_args TSRMLS_DC) /* {{{ */
+static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call, uint32_t passed_args, uint32_t additional_args TSRMLS_DC) /* {{{ */
{
zend_execute_data *new_call;
- int used_stack = (EG(argument_stack)->top - (zval*)call) + additional_args;
+ int used_stack = (EG(vm_stack_top) - (zval*)call) + additional_args;
/* copy call frame into new stack segment */
- zend_vm_stack_extend(used_stack TSRMLS_CC);
- new_call = (zend_execute_data*)EG(argument_stack)->top;
- EG(argument_stack)->top += used_stack;
+ new_call = zend_vm_stack_extend(used_stack * sizeof(zval) TSRMLS_CC);
*new_call = *call;
if (passed_args) {
zval *src = ZEND_CALL_ARG(call, 1);
@@ -1789,13 +1736,13 @@ static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call,
}
/* delete old call_frame from previous stack segment */
- EG(argument_stack)->prev->top = (zval*)call;
+ EG(vm_stack)->prev->top = (zval*)call;
/* delete previous stack segment if it becames empty */
- if (UNEXPECTED(EG(argument_stack)->prev->top == ZEND_VM_STACK_ELEMETS(EG(argument_stack)->prev))) {
- zend_vm_stack r = EG(argument_stack)->prev;
+ if (UNEXPECTED(EG(vm_stack)->prev->top == ZEND_VM_STACK_ELEMETS(EG(vm_stack)->prev))) {
+ zend_vm_stack r = EG(vm_stack)->prev;
- EG(argument_stack)->prev = r->prev;
+ EG(vm_stack)->prev = r->prev;
efree(r);
}
@@ -1803,10 +1750,10 @@ static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call,
}
/* }}} */
-static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data **call, zend_uint passed_args, zend_uint additional_args TSRMLS_DC) /* {{{ */
+static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data **call, uint32_t passed_args, uint32_t additional_args TSRMLS_DC) /* {{{ */
{
- if (EXPECTED(EG(argument_stack)->end - EG(argument_stack)->top > additional_args)) {
- EG(argument_stack)->top += additional_args;
+ if (EXPECTED(EG(vm_stack_end) - EG(vm_stack_top) > additional_args)) {
+ EG(vm_stack_top) += additional_args;
} else {
*call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args TSRMLS_CC);
}
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 8ef2cb2f81..95421191f0 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -35,7 +35,7 @@ ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, z
void init_executor(TSRMLS_D);
void shutdown_executor(TSRMLS_D);
void shutdown_destructors(TSRMLS_D);
-ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC);
+ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
@@ -48,31 +48,21 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
-ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC);
-ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
+ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC);
+ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
{
if (Z_REFCOUNTED_P(zval_ptr)) {
if (!Z_DELREF_P(zval_ptr)) {
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
- _zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
+ _zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
} else {
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}
}
-static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
-{
- if (Z_REFCOUNTED_P(zval_ptr)) {
- if (!Z_DELREF_P(zval_ptr)) {
- ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
- _zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
- }
- }
-}
-
static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
{
int result;
@@ -87,8 +77,8 @@ again:
case IS_TRUE:
result = 1;
break;
- case IS_INT:
- result = (Z_IVAL_P(op)?1:0);
+ case IS_LONG:
+ result = (Z_LVAL_P(op)?1:0);
break;
case IS_RESOURCE:
result = (Z_RES_HANDLE_P(op)?1:0);
@@ -97,8 +87,8 @@ again:
result = (Z_DVAL_P(op) ? 1 : 0);
break;
case IS_STRING:
- if (Z_STRSIZE_P(op) == 0
- || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
+ if (Z_STRLEN_P(op) == 0
+ || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
result = 0;
} else {
result = 1;
@@ -108,24 +98,22 @@ again:
result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
break;
case IS_OBJECT:
- if (IS_ZEND_STD_OBJECT(*op)) {
- if (Z_OBJ_HT_P(op)->cast_object) {
- zval tmp;
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) {
- result = Z_TYPE(tmp) == IS_TRUE;
- break;
- }
- zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val);
- } else if (Z_OBJ_HT_P(op)->get) {
- zval rv;
- zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv TSRMLS_CC);
- if (Z_TYPE_P(tmp) != IS_OBJECT) {
- /* for safety - avoid loop */
- convert_to_boolean(tmp);
- result = Z_TYPE_P(tmp) == IS_TRUE;
- zval_ptr_dtor(tmp);
- break;
- }
+ if (Z_OBJ_HT_P(op)->cast_object) {
+ zval tmp;
+ if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) {
+ result = Z_TYPE(tmp) == IS_TRUE;
+ break;
+ }
+ zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val);
+ } else if (Z_OBJ_HT_P(op)->get) {
+ zval rv;
+ zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv TSRMLS_CC);
+ if (Z_TYPE_P(tmp) != IS_OBJECT) {
+ /* for safety - avoid loop */
+ convert_to_boolean(tmp);
+ result = Z_TYPE_P(tmp) == IS_TRUE;
+ zval_ptr_dtor(tmp);
+ break;
}
}
result = 1;
@@ -147,104 +135,68 @@ ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *s
ZEND_API int zval_update_constant_ex(zval *pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC);
/* dedicated Zend executor functions - do not use! */
-#define ZEND_VM_STACK_PAGE_SIZE (16 * 1024) /* should be a power of 2 */
-
struct _zend_vm_stack {
zval *top;
zval *end;
zend_vm_stack prev;
};
-#define ZEND_VM_STACK_HEADER_SLOT \
+#define ZEND_VM_STACK_HEADER_SLOTS \
((ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
#define ZEND_VM_STACK_ELEMETS(stack) \
- (((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOT)
-
-#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
- do { \
- if (UNEXPECTED(((count) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) > \
- (size_t)(((char*)EG(argument_stack)->end) - \
- ((char*)EG(argument_stack)->top)))) { \
- zend_vm_stack_extend((count) TSRMLS_CC); \
- } \
- } while (0)
-
-static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
- zend_vm_stack page = (zend_vm_stack)emalloc(count * ZEND_MM_ALIGNED_SIZE(sizeof(zval)));
+ (((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOTS)
- page->top = ZEND_VM_STACK_ELEMETS(page);
- page->end = (zval*)page + count;
- page->prev = NULL;
- return page;
-}
+ZEND_API void zend_vm_stack_init(TSRMLS_D);
+ZEND_API void zend_vm_stack_destroy(TSRMLS_D);
+ZEND_API void* zend_vm_stack_extend(size_t size TSRMLS_DC);
-static zend_always_inline void zend_vm_stack_init(TSRMLS_D)
+static zend_always_inline zval* zend_vm_stack_alloc(size_t size TSRMLS_DC)
{
- EG(argument_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE);
- EG(argument_stack)->top++;
-}
-
-static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D)
-{
- zend_vm_stack stack = EG(argument_stack);
+ char *top = (char*)EG(vm_stack_top);
- while (stack != NULL) {
- zend_vm_stack p = stack->prev;
- efree(stack);
- stack = p;
+ if (UNEXPECTED(size > (size_t)(((char*)EG(vm_stack_end)) - top))) {
+ return (zval*)zend_vm_stack_extend(size TSRMLS_CC);
}
+ EG(vm_stack_top) = (zval*)(top + size);
+ return (zval*)top;
}
-static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC)
-{
- int size = count * ZEND_MM_ALIGNED_SIZE(sizeof(zval));
- zend_vm_stack p = zend_vm_stack_new_page(
- (size >= (ZEND_VM_STACK_PAGE_SIZE - ZEND_VM_STACK_HEADER_SLOT) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) ?
- (size + ((ZEND_VM_STACK_HEADER_SLOT + ZEND_VM_STACK_PAGE_SIZE) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) &
- ~((ZEND_VM_STACK_PAGE_SIZE * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) :
- ZEND_VM_STACK_PAGE_SIZE);
- p->prev = EG(argument_stack);
- EG(argument_stack) = p;
-}
-
-static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(zend_function *func, zend_uint num_args, zend_uchar flags, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
+static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t frame_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
{
- int used_stack = ZEND_CALL_FRAME_SLOT + num_args;
+ uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args;
zend_execute_data *call;
if (ZEND_USER_CODE(func->type)) {
used_stack += func->op_array.last_var + func->op_array.T - MIN(func->op_array.num_args, num_args);
}
- ZEND_VM_STACK_GROW_IF_NEEDED(used_stack);
- call = (zend_execute_data*)EG(argument_stack)->top;
- EG(argument_stack)->top += used_stack;
+ call = (zend_execute_data*)zend_vm_stack_alloc(used_stack * sizeof(zval) TSRMLS_CC);
call->func = func;
- call->num_args = 0;
- call->flags = flags;
+ ZVAL_OBJ(&call->This, object);
call->called_scope = called_scope;
- call->object = object;
- call->prev_nested_call = prev;
+ call->prev_execute_data = prev;
+ call->frame_info = frame_info;
+ call->num_args = 0;
return call;
}
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call TSRMLS_DC)
{
- zend_uint first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
+ uint32_t first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
if (UNEXPECTED(call->num_args > first_extra_arg)) {
zval *end = EX_VAR_NUM_2(call, call->func->op_array.last_var + call->func->op_array.T);
zval *p = end + (call->num_args - first_extra_arg);
do {
p--;
- i_zval_ptr_dtor_nogc(p ZEND_FILE_LINE_CC TSRMLS_CC);
+ zval_ptr_dtor_nogc(p);
} while (p != end);
}
}
static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call TSRMLS_DC)
{
- zend_uint num_args = call->num_args;
+ uint32_t num_args = call->num_args;
if (num_args > 0) {
zval *end = ZEND_CALL_ARG(call, 1);
@@ -252,26 +204,26 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call T
do {
p--;
- i_zval_ptr_dtor_nogc(p ZEND_FILE_LINE_CC TSRMLS_CC);
+ zval_ptr_dtor_nogc(p);
} while (p != end);
}
}
static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call TSRMLS_DC)
{
- if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (zval*)call)) {
- zend_vm_stack p = EG(argument_stack);
+ zend_vm_stack p = EG(vm_stack);
+ if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(p) == (zval*)call)) {
+ zend_vm_stack prev = p->prev;
- EG(argument_stack) = p->prev;
+ EG(vm_stack_top) = prev->top;
+ EG(vm_stack_end) = prev->end;
+ EG(vm_stack) = prev;
efree(p);
} else {
- EG(argument_stack)->top = (zval*)call;
+ EG(vm_stack_top) = (zval*)call;
}
}
-void execute_new_code(TSRMLS_D);
-
-
/* services */
ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
ZEND_API const char *get_active_function_name(TSRMLS_D);
@@ -279,7 +231,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
-ZEND_API void zend_set_timeout(zend_int_t seconds, int reset_signals);
+ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals);
ZEND_API void zend_unset_timeout(TSRMLS_D);
ZEND_API void zend_timeout(int dummy);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);
@@ -295,12 +247,7 @@ void zend_shutdown_timeout_thread(void);
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
#endif
-/* The following tries to resolve the classname of a zval of type object.
- * Since it is slow it should be only used in error messages.
- */
-#define Z_OBJ_CLASS_NAME_P(obj) (((obj) && (obj)->handlers->get_class_entry != NULL && (obj)->handlers->get_class_entry) ? (obj)->handlers->get_class_entry(obj TSRMLS_CC)->name->val : "")
-
-ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var);
+ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var);
#define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
#define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
@@ -323,7 +270,7 @@ ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_e
ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
-void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC);
+ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC);
void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC);
#define CACHED_PTR(num) \
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index d2a704259b..cd2cc98b42 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -42,7 +42,7 @@ ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
/* true globals */
-ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, {{0}, {{0}}, {0}}, NULL, NULL, 0, NULL, NULL, 0 };
+ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, {{0}, {{0}}, {0}}, NULL, NULL, NULL, NULL, 0, 0 };
ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL };
#ifdef ZEND_WIN32
@@ -110,7 +110,7 @@ static int clean_non_persistent_function(zval *zv TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int clean_non_persistent_function_full(zval *zv TSRMLS_DC) /* {{{ */
+ZEND_API int clean_non_persistent_function_full(zval *zv TSRMLS_DC) /* {{{ */
{
zend_function *function = Z_PTR_P(zv);
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
@@ -124,7 +124,7 @@ static int clean_non_persistent_class(zval *zv TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int clean_non_persistent_class_full(zval *zv TSRMLS_DC) /* {{{ */
+ZEND_API int clean_non_persistent_class_full(zval *zv TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = Z_PTR_P(zv);
return (ce->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
@@ -187,10 +187,7 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(scope) = NULL;
- ZVAL_OBJ(&EG(This), NULL);
-
EG(active) = 1;
- EG(start_op) = NULL;
}
/* }}} */
@@ -524,43 +521,43 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
} else if (Z_TYPE_P(p) == IS_CONSTANT) {
int refcount;
- SEPARATE_ZVAL_IF_NOT_REF(p);
+ SEPARATE_ZVAL_NOREF(p);
MARK_CONSTANT_VISITED(p);
refcount = Z_REFCOUNTED_P(p) ? Z_REFCOUNT_P(p) : 1;
const_value = zend_get_constant_ex(Z_STR_P(p), scope, Z_CONST_FLAGS_P(p) TSRMLS_CC);
if (!const_value) {
char *actual = Z_STRVAL_P(p);
- if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRSIZE_P(p)))) {
+ if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
int len;
zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
- len = Z_STRSIZE_P(p) - ((colon - Z_STRVAL_P(p)) + 1);
+ len = Z_STRLEN_P(p) - ((colon - Z_STRVAL_P(p)) + 1);
if (inline_change) {
- zend_string *tmp = STR_INIT(colon + 1, len, 0);
- STR_RELEASE(Z_STR_P(p));
+ zend_string *tmp = zend_string_init(colon + 1, len, 0);
+ zend_string_release(Z_STR_P(p));
Z_STR_P(p) = tmp;
} else {
- Z_STR_P(p) = STR_INIT(colon + 1, len, 0);
+ Z_STR_P(p) = zend_string_init(colon + 1, len, 0);
}
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
} else {
zend_string *save = Z_STR_P(p);
char *slash;
- int actual_len = Z_STRSIZE_P(p);
+ int actual_len = Z_STRLEN_P(p);
if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
actual = slash + 1;
actual_len -= (actual - Z_STRVAL_P(p));
if (inline_change) {
- zend_string *s = STR_INIT(actual, actual_len, 0);
+ zend_string *s = zend_string_init(actual, actual_len, 0);
Z_STR_P(p) = s;
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
}
}
if (actual[0] == '\\') {
if (inline_change) {
- memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p));
- --Z_STRSIZE_P(p);
+ memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p));
+ --Z_STRLEN_P(p);
} else {
++actual;
}
@@ -573,7 +570,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
zend_error(E_ERROR, "Undefined constant '%s'", save->val);
}
if (inline_change) {
- STR_RELEASE(save);
+ zend_string_release(save);
}
save = NULL;
}
@@ -581,16 +578,16 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
if (!inline_change) {
ZVAL_STRINGL(p, actual, actual_len);
} else {
- Z_TYPE_INFO_P(p) = IS_INTERNED(Z_STR_P(p)) ?
- IS_INTERNED_STRING_EX : IS_STRING_EX;
+ Z_TYPE_INFO_P(p) = Z_REFCOUNTED_P(p) ?
+ IS_STRING_EX : IS_INTERNED_STRING_EX;
if (save && save->val != actual) {
- STR_RELEASE(save);
+ zend_string_release(save);
}
}
}
} else {
if (inline_change) {
- STR_RELEASE(Z_STR_P(p));
+ zend_string_release(Z_STR_P(p));
}
ZVAL_COPY_VALUE(p, const_value);
if (Z_OPT_CONSTANT_P(p)) {
@@ -602,12 +599,12 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
if (Z_REFCOUNTED_P(p)) Z_SET_REFCOUNT_P(p, refcount);
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
zval tmp;
- SEPARATE_ZVAL_IF_NOT_REF(p);
+ SEPARATE_ZVAL_NOREF(p);
zend_ast_evaluate(&tmp, Z_ASTVAL_P(p), scope TSRMLS_CC);
if (inline_change) {
- zend_ast_destroy(Z_ASTVAL_P(p));
- efree(Z_AST_P(p));
+ zend_ast_destroy_and_free(Z_ASTVAL_P(p));
+ efree_size(Z_AST_P(p), sizeof(zend_ast_ref));
}
ZVAL_COPY_VALUE(p, &tmp);
}
@@ -633,13 +630,13 @@ ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC) /
}
/* }}} */
-int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[] TSRMLS_DC) /* {{{ */
+int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[] TSRMLS_DC) /* {{{ */
{
return call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params, 1, NULL TSRMLS_CC);
}
/* }}} */
-int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC) /* {{{ */
+int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table TSRMLS_DC) /* {{{ */
{
zend_fcall_info fci;
@@ -659,12 +656,11 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */
{
- zend_uint i;
+ uint32_t i;
zend_class_entry *calling_scope = NULL;
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
- zend_object *orig_object;
zend_class_entry *orig_scope;
zval tmp;
@@ -686,7 +682,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
break;
}
- orig_object = Z_OBJ(EG(This));
orig_scope = EG(scope);
/* Initialize execute_data */
@@ -704,7 +699,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
dummy_execute_data = *EG(current_execute_data);
dummy_execute_data.prev_execute_data = EG(current_execute_data);
dummy_execute_data.call = NULL;
- dummy_execute_data.prev_nested_call = NULL;
dummy_execute_data.opline = NULL;
dummy_execute_data.func = NULL;
EG(current_execute_data) = &dummy_execute_data;
@@ -724,7 +718,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
efree(error);
}
if (callable_name) {
- STR_RELEASE(callable_name);
+ zend_string_release(callable_name);
}
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
@@ -738,11 +732,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_error(E_STRICT, "%s", error);
efree(error);
}
- STR_RELEASE(callable_name);
+ zend_string_release(callable_name);
}
func = fci_cache->function_handler;
- call = zend_vm_stack_push_call_frame(func, fci->param_count, 0, fci_cache->called_scope, fci_cache->object, NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_TOP_FUNCTION,
+ func, fci->param_count, fci_cache->called_scope, fci_cache->object, NULL TSRMLS_CC);
calling_scope = fci_cache->calling_scope;
fci->object = fci_cache->object;
if (fci->object &&
@@ -835,19 +830,22 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
call->num_args = fci->param_count;
EG(scope) = calling_scope;
- if (!fci->object ||
- (func->common.fn_flags & ZEND_ACC_STATIC)) {
- Z_OBJ(EG(This)) = call->object = NULL;
+ if (func->common.fn_flags & ZEND_ACC_STATIC) {
+ fci->object = NULL;
+ }
+ if (!fci->object) {
+ Z_OBJ(call->This) = NULL;
+ Z_TYPE_INFO(call->This) = IS_UNDEF;
} else {
- Z_OBJ(EG(This)) = fci->object;
- Z_ADDREF(EG(This));
+ ZVAL_OBJ(&call->This, fci->object);
+ GC_REFCOUNT(fci->object)++;
}
if (func->type == ZEND_USER_FUNCTION) {
EG(scope) = func->common.scope;
call->symbol_table = fci->symbol_table;
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
- zend_init_execute_data(call, &func->op_array, fci->retval, VM_FRAME_TOP_FUNCTION TSRMLS_CC);
+ zend_init_execute_data(call, &func->op_array, fci->retval TSRMLS_CC);
zend_execute_ex(call TSRMLS_CC);
} else {
zend_generator_create_zval(call, &func->op_array, fci->retval TSRMLS_CC);
@@ -863,7 +861,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(current_execute_data) = call;
if (EXPECTED(zend_execute_internal == NULL)) {
/* saves one function call if zend_execute_internal is not used */
- func->internal_function.handler(fci->param_count, fci->retval TSRMLS_CC);
+ func->internal_function.handler(call, fci->retval TSRMLS_CC);
} else {
zend_execute_internal(call, fci->retval TSRMLS_CC);
}
@@ -893,7 +891,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (fci->object) {
call->prev_execute_data = EG(current_execute_data);
EG(current_execute_data) = call;
- fci->object->handlers->call_method(func->common.function_name, fci->object, fci->param_count, fci->retval TSRMLS_CC);
+ fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval TSRMLS_CC);
EG(current_execute_data) = call->prev_execute_data;
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
@@ -903,7 +901,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_vm_stack_free_call_frame(call TSRMLS_CC);
if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- STR_RELEASE(func->common.function_name);
+ zend_string_release(func->common.function_name);
}
efree(func);
@@ -913,11 +911,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
}
- if (Z_OBJ(EG(This))) {
- zval_ptr_dtor(&EG(This));
+ if (fci->object) {
+ OBJ_RELEASE(fci->object);
}
- Z_OBJ(EG(This)) = orig_object;
EG(scope) = orig_scope;
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
@@ -948,10 +945,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
}
if (name->val[0] == '\\') {
- lc_name = STR_ALLOC(name->len - 1, 0);
+ lc_name = zend_string_alloc(name->len - 1, 0);
zend_str_tolower_copy(lc_name->val, name->val + 1, name->len - 1);
} else {
- lc_name = STR_ALLOC(name->len, 0);
+ lc_name = zend_string_alloc(name->len, 0);
zend_str_tolower_copy(lc_name->val, name->val, name->len);
}
}
@@ -959,7 +956,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
ce = zend_hash_find_ptr(EG(class_table), lc_name);
if (ce) {
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return ce;
}
@@ -969,7 +966,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return NULL;
}
@@ -980,7 +977,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
EG(autoload_func) = func;
} else {
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return NULL;
}
@@ -990,7 +987,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
/* Verify class name before passing it to __autoload() */
if (strspn(name->val, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name->len) {
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return NULL;
}
@@ -1002,7 +999,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return NULL;
}
@@ -1012,12 +1009,12 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
if (name->val[0] == '\\') {
ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1);
} else {
- ZVAL_STR(&args[0], STR_COPY(name));
+ ZVAL_STR_COPY(&args[0], name);
}
fcall_info.size = sizeof(fcall_info);
fcall_info.function_table = EG(function_table);
- ZVAL_STR(&fcall_info.function_name, STR_COPY(EG(autoload_func)->common.function_name));
+ ZVAL_STR_COPY(&fcall_info.function_name, EG(autoload_func)->common.function_name);
fcall_info.symbol_table = NULL;
fcall_info.retval = &local_retval;
fcall_info.param_count = 1;
@@ -1046,7 +1043,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
ce = zend_hash_find_ptr(EG(class_table), lc_name);
}
if (!key) {
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
}
return ce;
}
@@ -1062,15 +1059,15 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
{
zval pv;
zend_op_array *new_op_array;
- zend_uint original_compiler_options;
+ uint32_t original_compiler_options;
int retval;
if (retval_ptr) {
- ZVAL_NEW_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1));
+ ZVAL_NEW_STR(&pv, zend_string_alloc(str_len + sizeof("return ;")-1, 1));
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
- Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';';
- Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0';
+ Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
+ Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
} else {
ZVAL_STRINGL(&pv, str, str_len);
}
@@ -1084,21 +1081,18 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
if (new_op_array) {
zval local_retval;
- int orig_interactive = CG(interactive);
EG(no_extensions)=1;
- CG(interactive) = 0;
zend_try {
ZVAL_UNDEF(&local_retval);
zend_execute(new_op_array, &local_retval TSRMLS_CC);
} zend_catch {
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
zend_bailout();
} zend_end_try();
- CG(interactive) = orig_interactive;
if (Z_TYPE(local_retval) != IS_UNDEF) {
if (retval_ptr) {
ZVAL_COPY_VALUE(retval_ptr, &local_retval);
@@ -1113,7 +1107,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
EG(no_extensions)=0;
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
retval = SUCCESS;
} else {
retval = FAILURE;
@@ -1148,84 +1142,6 @@ ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name,
}
/* }}} */
-void execute_new_code(TSRMLS_D) /* {{{ */
-{
- zend_op *opline, *end;
- zend_op *ret_opline;
- int orig_interactive;
-
- if (!(CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE)
- || CG(context).backpatch_count>0
- || CG(active_op_array)->function_name
- || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
- return;
- }
-
- ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- ret_opline->opcode = ZEND_RETURN;
- ret_opline->op1_type = IS_CONST;
- ret_opline->op1.constant = zend_add_literal(CG(active_op_array), &EG(uninitialized_zval) TSRMLS_CC);
- SET_UNUSED(ret_opline->op2);
-
- if (!EG(start_op)) {
- EG(start_op) = CG(active_op_array)->opcodes;
- }
-
- opline=EG(start_op);
- end=CG(active_op_array)->opcodes+CG(active_op_array)->last;
-
- while (opline<end) {
- if (opline->op1_type == IS_CONST) {
- opline->op1.zv = &CG(active_op_array)->literals[opline->op1.constant];
- }
- if (opline->op2_type == IS_CONST) {
- opline->op2.zv = &CG(active_op_array)->literals[opline->op2.constant];
- }
- switch (opline->opcode) {
- case ZEND_GOTO:
- if (Z_TYPE_P(opline->op2.zv) != IS_INT) {
- zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC);
- }
- /* break omitted intentionally */
- case ZEND_JMP:
- opline->op1.jmp_addr = &CG(active_op_array)->opcodes[opline->op1.opline_num];
- break;
- case ZEND_JMPZNZ:
- /* absolute index to relative offset */
- opline->extended_value = (char*)(CG(active_op_array)->opcodes + opline->extended_value) - (char*)opline;
- /* break omitted intentionally */
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
- case ZEND_NEW:
- case ZEND_FE_RESET:
- case ZEND_FE_FETCH:
- opline->op2.jmp_addr = &CG(active_op_array)->opcodes[opline->op2.opline_num];
- break;
- }
- ZEND_VM_SET_OPCODE_HANDLER(opline);
- opline++;
- }
-
- zend_release_labels(1 TSRMLS_CC);
-
- orig_interactive = CG(interactive);
- CG(interactive) = 0;
- zend_execute(CG(active_op_array), NULL TSRMLS_CC);
- CG(interactive) = orig_interactive;
-
- if (EG(exception)) {
- zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
- }
-
- CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */
- EG(start_op) = CG(active_op_array)->opcodes+CG(active_op_array)->last;
-}
-/* }}} */
-
ZEND_API void zend_timeout(int dummy) /* {{{ */
{
TSRMLS_FETCH();
@@ -1243,7 +1159,7 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */
zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
}
- zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
+ zend_error(E_ERROR, "Maximum execution time of %pd second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
}
/* }}} */
@@ -1360,7 +1276,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */
#define SIGPROF 27
#endif
-void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */
+void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
{
TSRMLS_FETCH();
@@ -1468,7 +1384,7 @@ check_fetch_type:
}
return EG(current_execute_data)->called_scope;
case ZEND_FETCH_CLASS_AUTO: {
- fetch_type = zend_get_class_fetch_type(class_name->val, class_name->len);
+ fetch_type = zend_get_class_fetch_type(class_name);
if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
goto check_fetch_type;
}
@@ -1584,7 +1500,7 @@ ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC) /* {{{ */
ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
{
- zend_uint i;
+ int i;
zend_execute_data *ex;
zend_array *symbol_table;
@@ -1680,7 +1596,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS
if (execute_data) {
if (!execute_data->symbol_table) {
- zend_uint_t h = STR_HASH_VAL(name);
+ zend_ulong h = zend_string_hash_val(name);
zend_op_array *op_array = &execute_data->func->op_array;
int i;
@@ -1716,7 +1632,7 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int
if (execute_data) {
if (!execute_data->symbol_table) {
- zend_uint_t h = zend_hash_func(name, len);
+ zend_ulong h = zend_hash_func(name, len);
zend_op_array *op_array = &execute_data->func->op_array;
int i;
diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c
index 47284342fa..04150920af 100644
--- a/Zend/zend_extensions.c
+++ b/Zend/zend_extensions.c
@@ -105,6 +105,14 @@ int zend_load_extension(const char *path TSRMLS_DC)
#endif
DL_UNLOAD(handle);
return FAILURE;
+ } else if (zend_get_extension(new_extension->name)) {
+ fprintf(stderr, "Cannot load %s - it was already loaded\n", new_extension->name);
+/* See http://support.microsoft.com/kb/190351 */
+#ifdef PHP_WIN32
+ fflush(stderr);
+#endif
+ DL_UNLOAD(handle);
+ return FAILURE;
}
return zend_register_extension(new_extension, handle TSRMLS_CC);
@@ -187,7 +195,7 @@ void zend_shutdown_extensions(TSRMLS_D)
void zend_extension_dtor(zend_extension *extension)
{
#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
- if (extension->handle) {
+ if (extension->handle && !getenv("ZEND_DONT_UNLOAD_MODULES")) {
DL_UNLOAD(extension->handle);
}
#endif
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
index e210839870..792a8a6164 100644
--- a/Zend/zend_extensions.h
+++ b/Zend/zend_extensions.h
@@ -111,7 +111,7 @@ END_EXTERN_C()
ZEND_API extern zend_llist zend_extensions;
void zend_extension_dtor(zend_extension *extension);
-void zend_append_version_info(const zend_extension *extension);
+ZEND_API void zend_append_version_info(const zend_extension *extension);
int zend_startup_extensions_mechanism(void);
int zend_startup_extensions(void);
void zend_shutdown_extensions(TSRMLS_D);
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index adc02a3eb0..b331f979fd 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -99,6 +99,7 @@ ZEND_API void gc_reset(TSRMLS_D)
{
GC_G(gc_runs) = 0;
GC_G(collected) = 0;
+ GC_G(gc_full) = 0;
#if GC_BENCH
GC_G(root_buf_length) = 0;
@@ -185,14 +186,6 @@ ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC)
{
gc_root_buffer *root;
- if (UNEXPECTED(/*GC_ADDRESS(GC_INFO(ref)) &&*/
- GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK &&
- GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) {
- /* The given zval is a garbage that is going to be deleted by
- * currently running GC */
- return;
- }
-
root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref));
GC_BENCH_INC(zval_remove_from_buffer);
GC_REMOVE_FROM_ROOTS(root);
@@ -492,8 +485,11 @@ tail_call:
} else if (GC_G(first_unused) != GC_G(last_unused)) {
buf = GC_G(first_unused);
GC_G(first_unused)++;
+ } else {
+ /* TODO: find a perfect way to handle such case */
+ GC_G(gc_full) = 1;
}
- /* TODO: what should we do if we don't have room ??? */
+
if (buf) {
buf->ref = ref;
buf->next = GC_G(roots).next;
@@ -609,6 +605,18 @@ static int gc_collect_roots(TSRMLS_D)
}
current = current->next;
}
+
+ if (GC_G(gc_full) == 1) {
+ current = GC_G(roots).next;
+ while (current != &GC_G(roots)) {
+ GC_SET_ADDRESS(GC_INFO(current->ref), 0);
+ GC_SET_BLACK(GC_INFO(current->ref));
+ current = current->next;
+ }
+ gc_reset(TSRMLS_C);
+ return 0;
+ }
+
/* relink remaining roots into list to free */
if (GC_G(roots).next != &GC_G(roots)) {
if (GC_G(to_free).next == &GC_G(to_free)) {
diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h
index 8d619f2e5e..2eb8ea6ea3 100644
--- a/Zend/zend_gc.h
+++ b/Zend/zend_gc.h
@@ -77,12 +77,13 @@ typedef struct _gc_root_buffer {
zend_refcounted *ref;
struct _gc_root_buffer *next; /* double-linked list */
struct _gc_root_buffer *prev;
- zend_uint refcount;
+ uint32_t refcount;
} gc_root_buffer;
typedef struct _zend_gc_globals {
zend_bool gc_enabled;
zend_bool gc_active;
+ zend_bool gc_full;
gc_root_buffer *buf; /* preallocated arrays of buffers */
gc_root_buffer roots; /* list of possible roots of cycles */
@@ -93,16 +94,16 @@ typedef struct _zend_gc_globals {
gc_root_buffer to_free; /* list to free */
gc_root_buffer *next_to_free;
- zend_uint gc_runs;
- zend_uint collected;
+ uint32_t gc_runs;
+ uint32_t collected;
#if GC_BENCH
- zend_uint root_buf_length;
- zend_uint root_buf_peak;
- zend_uint zval_possible_root;
- zend_uint zval_buffered;
- zend_uint zval_remove_from_buffer;
- zend_uint zval_marked_grey;
+ uint32_t root_buf_length;
+ uint32_t root_buf_peak;
+ uint32_t zval_possible_root;
+ uint32_t zval_buffered;
+ uint32_t zval_remove_from_buffer;
+ uint32_t zval_marked_grey;
#endif
} zend_gc_globals;
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 922c6a3f2b..b38657f7b7 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -44,7 +44,7 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
{
/* -1 required because we want the last run opcode, not the
* next to-be-run one. */
- zend_uint op_num = execute_data->opline - op_array->opcodes - 1;
+ uint32_t op_num = execute_data->opline - op_array->opcodes - 1;
int i;
for (i = 0; i < op_array->last_brk_cont; ++i) {
@@ -52,24 +52,14 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
if (brk_cont->start < 0) {
continue;
- } else if (brk_cont->start > op_num) {
+ } else if ((uint32_t)brk_cont->start > op_num) {
break;
- } else if (brk_cont->brk > op_num) {
+ } else if (brk_cont->brk >= 0 && (uint32_t)brk_cont->brk > op_num) {
zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
- switch (brk_opline->opcode) {
- case ZEND_SWITCH_FREE:
- {
- zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
- zval_ptr_dtor(var);
- }
- break;
- case ZEND_FREE:
- {
- zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
- zval_dtor(var);
- }
- break;
+ if (brk_opline->opcode == ZEND_FREE) {
+ zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
+ zval_ptr_dtor_nogc(var);
}
}
}
@@ -78,10 +68,10 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
/* If yield was used as a function argument there may be active
* method calls those objects need to be freed */
while (execute_data->call) {
- if (execute_data->call->object) {
- OBJ_RELEASE(execute_data->call->object);
+ if (Z_OBJ(execute_data->call->This)) {
+ OBJ_RELEASE(Z_OBJ(execute_data->call->This));
}
- execute_data->call = execute_data->call->prev_nested_call;
+ execute_data->call = execute_data->call->prev_execute_data;
}
}
/* }}} */
@@ -108,8 +98,8 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
}
- if (execute_data->object) {
- OBJ_RELEASE(execute_data->object);
+ if (Z_OBJ(execute_data->This)) {
+ OBJ_RELEASE(Z_OBJ(execute_data->This));
}
/* A fatal error / die occurred during the generator execution. Trying to clean
@@ -130,7 +120,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
/* Free a clone of closure */
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
+ efree_size(op_array, sizeof(zend_op_array));
}
efree(generator->stack);
@@ -143,10 +133,10 @@ static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
zend_generator *generator = (zend_generator*) object;
zend_execute_data *ex = generator->execute_data;
- zend_uint op_num, finally_op_num;
+ uint32_t op_num, finally_op_num;
int i;
- if (!ex || !ex->func->op_array.has_finally_block) {
+ if (!ex || !(ex->func->op_array.fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
return;
}
@@ -227,8 +217,9 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
zend_generator *generator;
zend_execute_data *current_execute_data;
zend_execute_data *execute_data;
- zend_vm_stack current_stack = EG(argument_stack);
+ zend_vm_stack current_stack = EG(vm_stack);
+ current_stack->top = EG(vm_stack_top);
/* Create a clone of closure, because it may be destroyed */
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
zend_op_array *op_array_copy = (zend_op_array*)emalloc(sizeof(zend_op_array));
@@ -261,16 +252,19 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array
object_init_ex(return_value, zend_ce_generator);
- if (Z_OBJ(EG(This))) {
- Z_ADDREF(EG(This));
+ if (Z_OBJ(call->This)) {
+ Z_ADDREF(call->This);
}
/* Save execution context in generator object. */
generator = (zend_generator *) Z_OBJ_P(return_value);
execute_data->prev_execute_data = NULL;
generator->execute_data = execute_data;
- generator->stack = EG(argument_stack);
- EG(argument_stack) = current_stack;
+ generator->stack = EG(vm_stack);
+ generator->stack->top = EG(vm_stack_top);
+ EG(vm_stack_top) = current_stack->top;
+ EG(vm_stack_end) = current_stack->end;
+ EG(vm_stack) = current_stack;
/* EX(return_value) keeps pointer to zend_object (not a real zval) */
execute_data->return_value = (zval*)generator;
@@ -302,17 +296,16 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
{
/* Backup executor globals */
zend_execute_data *original_execute_data = EG(current_execute_data);
- zend_object *original_This;
zend_class_entry *original_scope = EG(scope);
- zend_vm_stack original_stack = EG(argument_stack);
-
- original_This = Z_OBJ(EG(This));
+ zend_vm_stack original_stack = EG(vm_stack);
+ original_stack->top = EG(vm_stack_top);
/* Set executor globals */
EG(current_execute_data) = generator->execute_data;
- Z_OBJ(EG(This)) = generator->execute_data->object;
EG(scope) = generator->execute_data->scope;
- EG(argument_stack) = generator->stack;
+ EG(vm_stack_top) = generator->stack->top;
+ EG(vm_stack_end) = generator->stack->end;
+ EG(vm_stack) = generator->stack;
/* We want the backtrace to look as if the generator function was
* called from whatever method we are current running (e.g. next()).
@@ -332,9 +325,10 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
/* Restore executor globals */
EG(current_execute_data) = original_execute_data;
- Z_OBJ(EG(This)) = original_This;
EG(scope) = original_scope;
- EG(argument_stack) = original_stack;
+ EG(vm_stack_top) = original_stack->top;
+ EG(vm_stack_end) = original_stack->end;
+ EG(vm_stack) = original_stack;
/* If an exception was thrown in the generator we have to internally
* rethrow it in the parent scope. */
diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h
index ba6fe1b8ca..a85b8dd976 100644
--- a/Zend/zend_generators.h
+++ b/Zend/zend_generators.h
@@ -43,7 +43,7 @@ typedef struct _zend_generator {
/* Variable to put sent value into */
zval *send_target;
/* Largest used integer key for auto-incrementing keys */
- zend_int_t largest_used_integer_key;
+ zend_long largest_used_integer_key;
/* ZEND_GENERATOR_* flags */
zend_uchar flags;
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 81ddfb9396..43abffd1ce 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -71,21 +71,10 @@ typedef struct _zend_ini_entry zend_ini_entry;
struct _zend_compiler_globals {
- zend_stack bp_stack;
- zend_stack switch_cond_stack;
- zend_stack foreach_copy_stack;
- zend_stack object_stack;
- zend_stack declare_stack;
+ zend_stack loop_var_stack;
zend_class_entry *active_class_entry;
- /* variables for list() compilation */
- zend_llist list_llist;
- zend_llist dimension_llist;
- zend_stack list_stack;
-
- zend_stack function_call_stack;
-
zend_string *compiled_filename;
int zend_lineno;
@@ -102,7 +91,6 @@ struct _zend_compiler_globals {
zend_bool parse_error;
zend_bool in_compilation;
zend_bool short_tags;
- zend_bool asp_tags;
zend_declarables declarables;
@@ -112,24 +100,18 @@ struct _zend_compiler_globals {
zend_llist open_files;
- zend_int_t catch_begin;
-
struct _zend_ini_parser_param *ini_parser_param;
- int interactive;
-
- zend_uint start_lineno;
+ uint32_t start_lineno;
zend_bool increment_lineno;
znode implementing_class;
- zend_uint access_type;
-
zend_string *doc_comment;
- zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */
+ uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */
- zval current_namespace;
+ zend_string *current_namespace;
HashTable *current_import;
HashTable *current_import_function;
HashTable *current_import_const;
@@ -154,6 +136,11 @@ struct _zend_compiler_globals {
zend_bool detect_unicode;
zend_bool encoding_declared;
+ zend_ast *ast;
+ zend_arena *ast_arena;
+
+ zend_stack delayed_oplines_stack;
+
#ifdef ZTS
zval **static_members_table;
int last_static_member;
@@ -177,18 +164,20 @@ struct _zend_executor_globals {
JMP_BUF *bailout;
int error_reporting;
- int orig_error_reporting;
int exit_status;
HashTable *function_table; /* function symbol table */
HashTable *class_table; /* class table */
HashTable *zend_constants; /* constants table */
- zend_class_entry *scope;
+ zval *vm_stack_top;
+ zval *vm_stack_end;
+ zend_vm_stack vm_stack;
- zval This;
+ struct _zend_execute_data *current_execute_data;
+ zend_class_entry *scope;
- zend_int_t precision;
+ zend_long precision;
int ticks_count;
@@ -207,8 +196,6 @@ struct _zend_executor_globals {
HashTable regular_list;
HashTable persistent_list;
- zend_vm_stack argument_stack;
-
int user_error_handler_error_reporting;
zval user_error_handler;
zval user_exception_handler;
@@ -220,7 +207,7 @@ struct _zend_executor_globals {
zend_class_entry *exception_class;
/* timeout support */
- zend_int_t timeout_seconds;
+ zend_long timeout_seconds;
int lambda_count;
@@ -230,11 +217,9 @@ struct _zend_executor_globals {
zend_objects_store objects_store;
zend_object *exception, *prev_exception;
- zend_op *opline_before_exception;
+ const zend_op *opline_before_exception;
zend_op exception_op[3];
- struct _zend_execute_data *current_execute_data;
-
struct _zend_module_entry *current_module;
zend_property_info std_property_info;
@@ -242,8 +227,6 @@ struct _zend_executor_globals {
zend_bool active;
zend_bool valid_symbol_table;
- zend_op *start_op;
-
void *saved_fpu_cw_ptr;
#if XPFPA_HAVE_CW
XPFPA_CW_DATATYPE saved_fpu_cw;
@@ -268,7 +251,7 @@ struct _zend_ini_scanner_globals {
char *filename;
int lineno;
- /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
+ /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
int scanner_mode;
};
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 3fe499c0c4..dfd63aa7e1 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -87,19 +87,19 @@ static void zend_hash_do_resize(HashTable *ht);
(ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket), 0, (ht)->u.flags & HASH_FLAG_PERSISTENT); \
(ht)->u.flags |= HASH_FLAG_PACKED; \
} else { \
- (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, (ht)->u.flags & HASH_FLAG_PERSISTENT); \
- (ht)->arHash = (zend_uint*)((ht)->arData + (ht)->nTableSize); \
- memset((ht)->arHash, INVALID_IDX, (ht)->nTableSize * sizeof(zend_uint)); \
+ (ht)->arData = (Bucket *) safe_pemalloc((ht)->nTableSize, sizeof(Bucket) + sizeof(uint32_t), 0, (ht)->u.flags & HASH_FLAG_PERSISTENT); \
+ (ht)->arHash = (uint32_t*)((ht)->arData + (ht)->nTableSize); \
+ memset((ht)->arHash, INVALID_IDX, (ht)->nTableSize * sizeof(uint32_t)); \
} \
(ht)->nTableMask = (ht)->nTableSize - 1; \
} \
} while (0)
-static const zend_uint uninitialized_bucket = {INVALID_IDX};
+static const uint32_t uninitialized_bucket = {INVALID_IDX};
-ZEND_API void _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
- uint i = 3;
+ uint32_t i = 3;
SET_INCONSISTENT(HT_OK);
@@ -118,7 +118,7 @@ ZEND_API void _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
ht->arData = NULL;
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
ht->pDestructor = pDestructor;
ht->nInternalPointer = INVALID_IDX;
if (persistent) {
@@ -137,7 +137,7 @@ static void zend_hash_packed_grow(HashTable *ht)
HANDLE_UNBLOCK_INTERRUPTIONS();
}
-ZEND_API void zend_hash_real_init(HashTable *ht, int packed)
+ZEND_API void zend_hash_real_init(HashTable *ht, zend_bool packed)
{
IS_CONSISTENT(ht);
@@ -148,8 +148,8 @@ ZEND_API void zend_hash_packed_to_hash(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
ht->u.flags &= ~HASH_FLAG_PACKED;
- ht->arData = (Bucket *) safe_perealloc(ht->arData, ht->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
- ht->arHash = (zend_uint*)(ht->arData + ht->nTableSize);
+ ht->arData = (Bucket *) safe_perealloc(ht->arData, ht->nTableSize, sizeof(Bucket) + sizeof(uint32_t), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
+ ht->arHash = (uint32_t*)(ht->arData + ht->nTableSize);
zend_hash_rehash(ht);
HANDLE_UNBLOCK_INTERRUPTIONS();
}
@@ -159,11 +159,11 @@ ZEND_API void zend_hash_to_packed(HashTable *ht)
HANDLE_BLOCK_INTERRUPTIONS();
ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
HANDLE_UNBLOCK_INTERRUPTIONS();
}
-ZEND_API void _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
{
_zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC);
if (!bApplyProtection) {
@@ -183,12 +183,12 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt
static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zend_string *key)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
- h = STR_HASH_VAL(key);
+ h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex];
while (idx != INVALID_IDX) {
@@ -205,10 +205,10 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zen
return NULL;
}
-static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, const char *str, int len, zend_uint_t h)
+static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, const char *str, size_t len, zend_ulong h)
{
- uint nIndex;
- uint idx;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
nIndex = h & ht->nTableMask;
@@ -227,10 +227,10 @@ static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht,
return NULL;
}
-static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *ht, zend_uint_t h)
+static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *ht, zend_ulong h)
{
- uint nIndex;
- uint idx;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
nIndex = h & ht->nTableMask;
@@ -246,11 +246,11 @@ static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *h
return NULL;
}
-static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC)
+static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -263,7 +263,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
zend_hash_packed_to_hash(ht);
}
- h = STR_HASH_VAL(key);
+ h = zend_string_hash_val(key);
if ((flag & HASH_ADD_NEW) == 0) {
p = zend_hash_find_bucket(ht, key);
@@ -300,7 +300,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
p = ht->arData + idx;
p->h = h;
p->key = key;
- STR_ADDREF(key);
+ zend_string_addref(key);
ZVAL_COPY_VALUE(&p->val, pData);
nIndex = h & ht->nTableMask;
Z_NEXT(p->val) = ht->arHash[nIndex];
@@ -310,7 +310,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
return &p->val;
}
-ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
return _zend_hash_add_or_update_i(ht, key, pData, flag ZEND_FILE_LINE_RELAY_CC);
}
@@ -335,47 +335,47 @@ ZEND_API zval *_zend_hash_add_new(HashTable *ht, zend_string *key, zval *pData Z
return _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, int len, zval *pData, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, size_t len, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update_i(ht, key, pData, flag ZEND_FILE_LINE_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
-ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *str, size_t len, zval *pData ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_UPDATE ZEND_FILE_LINE_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
-ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *str, size_t len, zval *pData ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_UPDATE | HASH_UPDATE_INDIRECT ZEND_FILE_LINE_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
-ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *str, size_t len, zval *pData ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
-ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *str, size_t len, zval *pData ZEND_FILE_LINE_DC)
{
- zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
+ zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT);
zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD_NEW ZEND_FILE_LINE_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
return ret;
}
-ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_uint_t h)
+ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_ulong h)
{
zval dummy;
@@ -393,7 +393,7 @@ ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key)
return zend_hash_add(ht, key, &dummy);
}
-ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *str, int len)
+ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *str, size_t len)
{
zval dummy;
@@ -402,85 +402,84 @@ ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *str, i
return zend_hash_str_add(ht, str, len, &dummy);
}
-static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC)
+static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht, zend_ulong h, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
- uint nIndex;
- uint idx;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
-
- if (flag & HASH_NEXT_INSERT) {
- h = ht->nNextFreeElement;
- }
- CHECK_INIT(ht, h >= 0 && h < ht->nTableSize);
+ CHECK_INIT(ht, h < ht->nTableSize);
if (ht->u.flags & HASH_FLAG_PACKED) {
- if (EXPECTED(h >= 0)) {
- if (h < ht->nNumUsed) {
- p = ht->arData + h;
- if (Z_TYPE(p->val) != IS_UNDEF) {
- if (flag & (HASH_NEXT_INSERT | HASH_ADD)) {
- return NULL;
- }
- if (ht->pDestructor) {
- ht->pDestructor(&p->val);
- }
- ZVAL_COPY_VALUE(&p->val, pData);
- if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
- }
- return &p->val;
- } else { /* we have to keep the order :( */
- goto convert_to_hash;
+ if (h < ht->nNumUsed) {
+ p = ht->arData + h;
+ if (Z_TYPE(p->val) != IS_UNDEF) {
+ if (flag & HASH_ADD) {
+ return NULL;
}
- } else if (EXPECTED(h < ht->nTableSize)) {
- p = ht->arData + h;
- } else if (h < ht->nTableSize * 2 &&
- ht->nTableSize - ht->nNumOfElements < ht->nTableSize / 2) {
- zend_hash_packed_grow(ht);
- p = ht->arData + h;
- } else {
- goto convert_to_hash;
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+ ZVAL_COPY_VALUE(&p->val, pData);
+ if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
+ }
+ return &p->val;
+ } else { /* we have to keep the order :( */
+ goto convert_to_hash;
}
- HANDLE_BLOCK_INTERRUPTIONS();
- /* incremental initialization of empty Buckets */
- if (h >= ht->nNumUsed) {
+ } else if (EXPECTED(h < ht->nTableSize)) {
+ p = ht->arData + h;
+ } else if (h < ht->nTableSize * 2 &&
+ ht->nTableSize - ht->nNumOfElements < ht->nTableSize / 2) {
+ zend_hash_packed_grow(ht);
+ p = ht->arData + h;
+ } else {
+ goto convert_to_hash;
+ }
+
+ HANDLE_BLOCK_INTERRUPTIONS();
+ /* incremental initialization of empty Buckets */
+ if ((flag & (HASH_ADD_NEW|HASH_ADD_NEXT)) == (HASH_ADD_NEW|HASH_ADD_NEXT)) {
+ ht->nNumUsed = h + 1;
+ } else if (h >= ht->nNumUsed) {
+ if (h > ht->nNumUsed) {
Bucket *q = ht->arData + ht->nNumUsed;
while (q != p) {
ZVAL_UNDEF(&q->val);
q++;
}
- ht->nNumUsed = h + 1;
- }
- ht->nNumOfElements++;
- if (ht->nInternalPointer == INVALID_IDX) {
- ht->nInternalPointer = h;
}
- if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
- }
- p->h = h;
- p->key = NULL;
- ZVAL_COPY_VALUE(&p->val, pData);
- Z_NEXT(p->val) = INVALID_IDX;
+ ht->nNumUsed = h + 1;
+ }
+ ht->nNumOfElements++;
+ if (ht->nInternalPointer == INVALID_IDX) {
+ ht->nInternalPointer = h;
+ }
+ if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
+ }
+ p->h = h;
+ p->key = NULL;
+ ZVAL_COPY_VALUE(&p->val, pData);
+ Z_NEXT(p->val) = INVALID_IDX;
- HANDLE_UNBLOCK_INTERRUPTIONS();
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+
+ return &p->val;
- return &p->val;
- } else {
convert_to_hash:
- zend_hash_packed_to_hash(ht);
- }
+ zend_hash_packed_to_hash(ht);
}
if ((flag & HASH_ADD_NEW) == 0) {
p = zend_hash_index_find_bucket(ht, h);
if (p) {
- if (flag & (HASH_NEXT_INSERT | HASH_ADD)) {
+ if (flag & HASH_ADD) {
return NULL;
}
ZEND_ASSERT(&p->val != pData);
@@ -490,8 +489,8 @@ convert_to_hash:
}
ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS();
- if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
+ if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
return &p->val;
}
@@ -505,8 +504,8 @@ convert_to_hash:
if (ht->nInternalPointer == INVALID_IDX) {
ht->nInternalPointer = idx;
}
- if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
+ if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
p = ht->arData + idx;
p->h = h;
@@ -520,34 +519,34 @@ convert_to_hash:
return &p->val;
}
-ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_index_add_or_update(HashTable *ht, zend_ulong h, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, h, pData, flag ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, h, pData, flag ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_ADD ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, h, pData, HASH_ADD ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_ADD | HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, h, pData, HASH_ADD | HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_RELAY_CC);
}
ZEND_API zval *_zend_hash_next_index_insert(HashTable *ht, zval *pData ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, ht->nNextFreeElement, pData, HASH_NEXT_INSERT ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD | HASH_ADD_NEXT ZEND_FILE_LINE_RELAY_CC);
}
ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_FILE_LINE_DC)
{
- return _zend_hash_index_update_or_next_insert_i(ht, ht->nNextFreeElement, pData, HASH_NEXT_INSERT | HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC);
+ return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD | HASH_ADD_NEW | HASH_ADD_NEXT ZEND_FILE_LINE_RELAY_CC);
}
static void zend_hash_do_resize(HashTable *ht)
@@ -564,8 +563,8 @@ static void zend_hash_do_resize(HashTable *ht)
HANDLE_UNBLOCK_INTERRUPTIONS();
} else if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket) + sizeof(zend_uint), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
- ht->arHash = (zend_uint*)(ht->arData + (ht->nTableSize << 1));
+ ht->arData = (Bucket *) safe_perealloc(ht->arData, (ht->nTableSize << 1), sizeof(Bucket) + sizeof(uint32_t), 0, ht->u.flags & HASH_FLAG_PERSISTENT);
+ ht->arHash = (uint32_t*)(ht->arData + (ht->nTableSize << 1));
ht->nTableSize = (ht->nTableSize << 1);
ht->nTableMask = ht->nTableSize - 1;
zend_hash_rehash(ht);
@@ -576,18 +575,18 @@ static void zend_hash_do_resize(HashTable *ht)
ZEND_API int zend_hash_rehash(HashTable *ht)
{
Bucket *p;
- uint nIndex, i, j;
+ uint32_t nIndex, i, j;
IS_CONSISTENT(ht);
if (UNEXPECTED(ht->nNumOfElements == 0)) {
if (ht->nTableMask) {
- memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
+ memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(uint32_t));
}
return SUCCESS;
}
- memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
+ memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(uint32_t));
for (i = 0, j = 0; i < ht->nNumUsed; i++) {
p = ht->arData + i;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
@@ -606,7 +605,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht)
return SUCCESS;
}
-static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Bucket *p, Bucket *prev)
+static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint32_t idx, Bucket *p, Bucket *prev)
{
if (!(ht->u.flags & HASH_FLAG_PACKED)) {
if (prev) {
@@ -634,7 +633,7 @@ static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Buc
}
}
if (p->key) {
- STR_RELEASE(p->key);
+ zend_string_release(p->key);
}
if (ht->pDestructor) {
zval tmp;
@@ -646,21 +645,20 @@ static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Buc
}
}
-static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint idx, Bucket *p)
+static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint32_t idx, Bucket *p)
{
- uint nIndex;
Bucket *prev = NULL;
if (!(ht->u.flags & HASH_FLAG_PACKED)) {
- nIndex = p->h & ht->nTableMask;
- idx = ht->arHash[nIndex];
- if (p != ht->arData + idx) {
- prev = ht->arData + idx;
- while (ht->arData + Z_NEXT(prev->val) != p) {
- idx = Z_NEXT(prev->val);
- prev = ht->arData + idx;
+ uint32_t nIndex = p->h & ht->nTableMask;
+ uint32_t i = ht->arHash[nIndex];
+
+ if (i != idx) {
+ prev = ht->arData + i;
+ while (Z_NEXT(prev->val) != idx) {
+ i = Z_NEXT(prev->val);
+ prev = ht->arData + i;
}
- idx = Z_NEXT(prev->val);
}
}
@@ -669,9 +667,9 @@ static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint idx, Bucket
ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
@@ -684,7 +682,7 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
return FAILURE;
}
- h = STR_HASH_VAL(key);
+ h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex];
@@ -708,9 +706,9 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
@@ -723,7 +721,7 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
return FAILURE;
}
- h = STR_HASH_VAL(key);
+ h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex];
@@ -758,11 +756,11 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
return FAILURE;
}
-ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len)
+ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
@@ -809,11 +807,11 @@ ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len)
return FAILURE;
}
-ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len)
+ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t h;
- uint nIndex;
- uint idx;
+ zend_ulong h;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
@@ -843,10 +841,10 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len)
return FAILURE;
}
-ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h)
+ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h)
{
- uint nIndex;
- uint idx;
+ uint32_t nIndex;
+ uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
@@ -856,7 +854,7 @@ ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h)
IS_CONSISTENT(ht);
if (ht->u.flags & HASH_FLAG_PACKED) {
- if (h >=0 && h < ht->nNumUsed) {
+ if (h < ht->nNumUsed) {
p = ht->arData + h;
if (Z_TYPE(p->val) != IS_UNDEF) {
HANDLE_BLOCK_INTERRUPTIONS();
@@ -886,34 +884,55 @@ ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h)
ZEND_API void zend_hash_destroy(HashTable *ht)
{
- uint idx;
- Bucket *p;
+ Bucket *p, *end;
IS_CONSISTENT(ht);
- SET_INCONSISTENT(HT_IS_DESTROYING);
-
- for (idx = 0 ; idx < ht->nNumUsed; idx++) {
- p = ht->arData + idx;
- if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (ht->nNumUsed) {
+ p = ht->arData;
+ end = p + ht->nNumUsed;
if (ht->pDestructor) {
- ht->pDestructor(&p->val);
- }
- if (p->key) {
- STR_RELEASE(p->key);
+ SET_INCONSISTENT(HT_IS_DESTROYING);
+
+ if (ht->u.flags & HASH_FLAG_PACKED) {
+ do {
+ if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+ ht->pDestructor(&p->val);
+ }
+ } while (++p != end);
+ } else {
+ do {
+ if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+ ht->pDestructor(&p->val);
+ if (EXPECTED(p->key)) {
+ zend_string_release(p->key);
+ }
+ }
+ } while (++p != end);
+ }
+
+ SET_INCONSISTENT(HT_DESTROYED);
+ } else {
+ if (!(ht->u.flags & HASH_FLAG_PACKED)) {
+ do {
+ if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+ if (EXPECTED(p->key)) {
+ zend_string_release(p->key);
+ }
+ }
+ } while (++p != end);
+ }
}
+ } else if (EXPECTED(!ht->nTableMask)) {
+ return;
}
- if (ht->nTableMask) {
- pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
- }
-
- SET_INCONSISTENT(HT_DESTROYED);
+ pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
}
ZEND_API void zend_hash_clean(HashTable *ht)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
IS_CONSISTENT(ht);
@@ -925,7 +944,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
ht->pDestructor(&p->val);
}
if (p->key) {
- STR_RELEASE(p->key);
+ zend_string_release(p->key);
}
}
ht->nNumUsed = 0;
@@ -934,7 +953,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
ht->nInternalPointer = INVALID_IDX;
if (ht->nTableMask) {
if (!(ht->u.flags & HASH_FLAG_PACKED)) {
- memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
+ memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(uint32_t));
}
}
}
@@ -944,7 +963,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
* next bucket. The hash *may* be altered during that time, the
* returned value will still be valid.
*/
-static void zend_hash_apply_deleter(HashTable *ht, uint idx, Bucket *p)
+static void zend_hash_apply_deleter(HashTable *ht, uint32_t idx, Bucket *p)
{
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -958,7 +977,7 @@ static void zend_hash_apply_deleter(HashTable *ht, uint idx, Bucket *p)
ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
IS_CONSISTENT(ht);
@@ -977,7 +996,7 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1008,7 +1027,7 @@ ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
int result;
@@ -1034,7 +1053,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
int result;
@@ -1060,7 +1079,7 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
va_list args;
zend_hash_key hash_key;
@@ -1095,7 +1114,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
int result;
@@ -1123,7 +1142,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
zval *new_entry, *data;
zend_bool setTargetPointer;
@@ -1168,8 +1187,8 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
{
- uint idx, target_idx;
- uint nIndex;
+ uint32_t idx, target_idx;
+ uint32_t nIndex;
Bucket *p, *q;
zval *data;
@@ -1188,7 +1207,7 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
target->nNumOfElements = source->nNumOfElements;
target->nNextFreeElement = source->nNextFreeElement;
target->arData = (Bucket *) safe_pemalloc(target->nTableSize, sizeof(Bucket), 0, 0);
- target->arHash = (zend_uint*)&uninitialized_bucket;
+ target->arHash = (uint32_t*)&uninitialized_bucket;
target->nInternalPointer = source->nInternalPointer;
for (idx = 0; idx < source->nNumUsed; idx++) {
@@ -1230,9 +1249,9 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
}
} else {
target->nNextFreeElement = source->nNextFreeElement;
- target->arData = (Bucket *) safe_pemalloc(target->nTableSize, sizeof(Bucket) + sizeof(zend_uint), 0, 0);
- target->arHash = (zend_uint*)(target->arData + target->nTableSize);
- memset(target->arHash, INVALID_IDX, target->nTableSize * sizeof(zend_uint));
+ target->arData = (Bucket *) safe_pemalloc(target->nTableSize, sizeof(Bucket) + sizeof(uint32_t), 0, 0);
+ target->arHash = (uint32_t*)(target->arData + target->nTableSize);
+ memset(target->arHash, INVALID_IDX, target->nTableSize * sizeof(uint32_t));
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
@@ -1254,7 +1273,7 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
q->h = p->h;
q->key = p->key;
if (q->key) {
- STR_ADDREF(q->key);
+ zend_string_addref(q->key);
}
nIndex = q->h & target->nTableMask;
Z_NEXT(q->val) = target->arHash[nIndex];
@@ -1282,17 +1301,17 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
target->nNumOfElements = 0;
target->nNextFreeElement = 0;
target->arData = NULL;
- target->arHash = (zend_uint*)&uninitialized_bucket;
+ target->arHash = (uint32_t*)&uninitialized_bucket;
}
}
-ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, zend_bool overwrite ZEND_FILE_LINE_DC)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
zval *t;
- int mode = (overwrite?HASH_UPDATE:HASH_ADD);
+ uint32_t mode = (overwrite?HASH_UPDATE:HASH_ADD);
IS_CONSISTENT(source);
IS_CONSISTENT(target);
@@ -1336,7 +1355,7 @@ static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, zval *sour
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam)
{
- uint idx;
+ uint32_t idx;
Bucket *p;
zval *t;
@@ -1381,9 +1400,9 @@ ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key)
return p ? &p->val : NULL;
}
-ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *str, int len)
+ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *str, size_t len)
{
- zend_uint_t h;
+ zend_ulong h;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1397,7 +1416,7 @@ ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *str, int len)
return p ? &p->val : NULL;
}
-ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key)
+ZEND_API zend_bool zend_hash_exists(const HashTable *ht, zend_string *key)
{
Bucket *p;
@@ -1411,9 +1430,9 @@ ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key)
return p ? 1 : 0;
}
-ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len)
+ZEND_API zend_bool zend_hash_str_exists(const HashTable *ht, const char *str, size_t len)
{
- zend_uint_t h;
+ zend_ulong h;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1427,14 +1446,14 @@ ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len)
return p ? 1 : 0;
}
-ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h)
+ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_ulong h)
{
Bucket *p;
IS_CONSISTENT(ht);
if (ht->u.flags & HASH_FLAG_PACKED) {
- if (h >= 0 && h < ht->nNumUsed) {
+ if (h < ht->nNumUsed) {
p = ht->arData + h;
if (Z_TYPE(p->val) != IS_UNDEF) {
return &p->val;
@@ -1448,14 +1467,14 @@ ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h)
}
-ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h)
+ZEND_API zend_bool zend_hash_index_exists(const HashTable *ht, zend_ulong h)
{
Bucket *p;
IS_CONSISTENT(ht);
if (ht->u.flags & HASH_FLAG_PACKED) {
- if (h >= 0 && h < ht->nNumUsed) {
+ if (h < ht->nNumUsed) {
if (Z_TYPE(ht->arData[h].val) != IS_UNDEF) {
return 1;
}
@@ -1468,61 +1487,9 @@ ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h)
}
-ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr)
-{
- ptr->pos = ht->nInternalPointer;
- ptr->ht = (HashTable*)ht;
- if (ht->nInternalPointer != INVALID_IDX) {
- ptr->h = ht->arData[ht->nInternalPointer].h;
- return 1;
- } else {
- ptr->h = 0;
- return 0;
- }
-}
-
-ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr)
-{
- uint idx;
-
- if (ptr->pos == INVALID_IDX) {
- ht->nInternalPointer = INVALID_IDX;
- } else if (ptr->ht != ht) {
- IS_CONSISTENT(ht);
- for (idx = 0; idx < ht->nNumUsed; idx++) {
- if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
- ht->nInternalPointer = idx;
- return 0;
- }
- }
- idx = INVALID_IDX;
- return 0;
- } else if (ht->nInternalPointer != ptr->pos) {
- IS_CONSISTENT(ht);
- if (ht->u.flags & HASH_FLAG_PACKED) {
- if (ptr->h < ht->nNumUsed &&
- Z_TYPE(ht->arData[ptr->h].val) != IS_UNDEF) {
- ht->nInternalPointer = ptr->h;
- return 1;
- }
- } else {
- idx = ht->arHash[ptr->h & ht->nTableMask];
- while (idx != INVALID_IDX) {
- if (ht->arData[idx].h == ptr->h && idx == ptr->pos) {
- ht->nInternalPointer = idx;
- return 1;
- }
- idx = Z_NEXT(ht->arData[idx].val);
- }
- }
- return 0;
- }
- return 1;
-}
-
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
{
- uint idx;
+ uint32_t idx;
IS_CONSISTENT(ht);
for (idx = 0; idx < ht->nNumUsed; idx++) {
@@ -1540,7 +1507,7 @@ ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *p
*/
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos)
{
- uint idx;
+ uint32_t idx;
IS_CONSISTENT(ht);
@@ -1558,7 +1525,7 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
IS_CONSISTENT(ht);
@@ -1581,7 +1548,7 @@ ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
IS_CONSISTENT(ht);
@@ -1602,9 +1569,9 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos)
+ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, zend_bool duplicate, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1612,14 +1579,14 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str
p = ht->arData + idx;
if (p->key) {
if (duplicate) {
- *str_index = STR_COPY(p->key);
+ *str_index = zend_string_copy(p->key);
} else {
*str_index = p->key;
}
return HASH_KEY_IS_STRING;
} else {
*num_index = p->h;
- return HASH_KEY_IS_INT;
+ return HASH_KEY_IS_LONG;
}
}
return HASH_KEY_NON_EXISTENT;
@@ -1627,7 +1594,7 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str
ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1636,17 +1603,16 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
} else {
p = ht->arData + idx;
if (p->key) {
- ZVAL_STR(key, p->key);
- STR_ADDREF(p->key);
+ ZVAL_STR_COPY(key, p->key);
} else {
- ZVAL_INT(key, p->h);
+ ZVAL_LONG(key, p->h);
}
}
}
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1655,7 +1621,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
if (p->key) {
return HASH_KEY_IS_STRING;
} else {
- return HASH_KEY_IS_INT;
+ return HASH_KEY_IS_LONG;
}
}
return HASH_KEY_NON_EXISTENT;
@@ -1664,7 +1630,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
{
- uint idx = *pos;
+ uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
@@ -1677,10 +1643,10 @@ ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
}
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
- compare_func_t compar, int renumber TSRMLS_DC)
+ compare_func_t compar, zend_bool renumber TSRMLS_DC)
{
Bucket *p;
- int i, j;
+ uint32_t i, j;
IS_CONSISTENT(ht);
@@ -1712,7 +1678,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
p = ht->arData + j;
p->h = j;
if (p->key) {
- STR_RELEASE(p->key);
+ zend_string_release(p->key);
p->key = NULL;
}
}
@@ -1728,7 +1694,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
if (renumber) {
ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
} else {
zend_hash_rehash(ht);
}
@@ -1742,7 +1708,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
{
- uint idx1, idx2;
+ uint32_t idx1, idx2;
Bucket *p1, *p2 = NULL;
int result;
zval *pData1, *pData2;
@@ -1846,9 +1812,9 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
}
-ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag TSRMLS_DC)
+ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag TSRMLS_DC)
{
- uint idx;
+ uint32_t idx;
Bucket *p, *res;
IS_CONSISTENT(ht);
@@ -1883,6 +1849,56 @@ ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, int
return &res->val;
}
+ZEND_API int _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx)
+{
+ register const char *tmp = key;
+ const char *end;
+
+ if (*tmp > '9') {
+ return 0;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ return 0;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ return 0;
+ }
+ }
+
+ /* possibly a numeric index */
+ end = key + length;
+
+ if ((*end != '\0') /* not a null terminated string */
+ || (*tmp == '0' && length > 1) /* numbers with leading zeros */
+ || (end - tmp > MAX_LENGTH_OF_LONG - 1) /* number too long */
+ || (SIZEOF_ZEND_LONG == 4 &&
+ end - tmp == MAX_LENGTH_OF_LONG - 1 &&
+ *tmp > '2')) { /* overflow */
+ return 0;
+ }
+ *idx = (*tmp - '0');
+ while (1) {
+ ++tmp;
+ if (tmp == end) {
+ if (*key == '-') {
+ if (*idx-1 > ZEND_LONG_MAX) { /* overflow */
+ return 0;
+ }
+ *idx = 0 - *idx;
+ } else if (*idx > ZEND_LONG_MAX) { /* overflow */
+ return 0;
+ }
+ return 1;
+ }
+ if (*tmp <= '9' && *tmp >= '0') {
+ *idx = (*idx * 10) + (*tmp - '0');
+ } else {
+ return 0;
+ }
+ }
+}
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index f9c7f02efe..2b9beca0fc 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -22,21 +22,19 @@
#ifndef ZEND_HASH_H
#define ZEND_HASH_H
-#include <sys/types.h>
#include "zend.h"
#define HASH_KEY_IS_STRING 1
-#define HASH_KEY_IS_INT 2
+#define HASH_KEY_IS_LONG 2
#define HASH_KEY_NON_EXISTENT 3
-#define HASH_KEY_NON_EXISTANT HASH_KEY_NON_EXISTENT /* Keeping old define (with typo) for backward compatibility */
#define HASH_UPDATE (1<<0)
#define HASH_ADD (1<<1)
-#define HASH_NEXT_INSERT (1<<2)
-#define HASH_UPDATE_INDIRECT (1<<3)
-#define HASH_ADD_NEW (1<<4)
+#define HASH_UPDATE_INDIRECT (1<<2)
+#define HASH_ADD_NEW (1<<3)
+#define HASH_ADD_NEXT (1<<4)
-#define INVALID_IDX ((uint)-1)
+#define INVALID_IDX ((uint32_t) -1)
#define HASH_FLAG_PERSISTENT (1<<0)
#define HASH_FLAG_APPLY_PROTECTION (1<<1)
@@ -45,30 +43,30 @@
#define HASH_MASK_CONSISTENCY 0x60
typedef struct _zend_hash_key {
- zend_uint_t h;
+ zend_ulong h;
zend_string *key;
} zend_hash_key;
typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, zval *source_data, zend_hash_key *hash_key, void *pParam);
-typedef uint HashPosition;
+typedef uint32_t HashPosition;
BEGIN_EXTERN_C()
/* startup/shutdown */
-ZEND_API void _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
-ZEND_API void _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
+ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC);
+ZEND_API void _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC);
ZEND_API void zend_hash_destroy(HashTable *ht);
ZEND_API void zend_hash_clean(HashTable *ht);
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
-ZEND_API void zend_hash_real_init(HashTable *ht, int packed);
+ZEND_API void zend_hash_real_init(HashTable *ht, zend_bool packed);
ZEND_API void zend_hash_packed_to_hash(HashTable *ht);
ZEND_API void zend_hash_to_packed(HashTable *ht);
/* additions/updates/changes */
-ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC);
ZEND_API zval *_zend_hash_update(HashTable *ht, zend_string *key,zval *pData ZEND_FILE_LINE_DC);
ZEND_API zval *_zend_hash_update_ind(HashTable *ht, zend_string *key,zval *pData ZEND_FILE_LINE_DC);
ZEND_API zval *_zend_hash_add(HashTable *ht, zend_string *key,zval *pData ZEND_FILE_LINE_DC);
@@ -83,11 +81,11 @@ ZEND_API zval *_zend_hash_add_new(HashTable *ht, zend_string *key,zval *pData ZE
#define zend_hash_add_new(ht, key, pData) \
_zend_hash_add_new(ht, key, pData ZEND_FILE_LINE_CC)
-ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *key, int len, zval *pData, int flag ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *key, size_t len, zval *pData, uint32_t flag ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
#define zend_hash_str_update(ht, key, len, pData) \
_zend_hash_str_update(ht, key, len, pData ZEND_FILE_LINE_CC)
@@ -98,10 +96,10 @@ ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *key, int len, z
#define zend_hash_str_add_new(ht, key, len, pData) \
_zend_hash_str_add_new(ht, key, len, pData ZEND_FILE_LINE_CC)
-ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC);
-ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_index_add_or_update(HashTable *ht, zend_ulong h, zval *pData, uint32_t flag ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC);
ZEND_API zval *_zend_hash_next_index_insert(HashTable *ht, zval *pData ZEND_FILE_LINE_DC);
ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_FILE_LINE_DC);
@@ -116,9 +114,9 @@ ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_
#define zend_hash_next_index_insert_new(ht, pData) \
_zend_hash_next_index_insert_new(ht, pData ZEND_FILE_LINE_CC)
-ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_uint_t h);
+ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_ulong h);
ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key);
-ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, int len);
+ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, size_t len);
#define ZEND_HASH_APPLY_KEEP 0
#define ZEND_HASH_APPLY_REMOVE 1<<0
@@ -146,26 +144,26 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
/* Deletes */
ZEND_API int zend_hash_del(HashTable *ht, zend_string *key);
ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key);
-ZEND_API int zend_hash_str_del(HashTable *ht, const char *key, int len);
-ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *key, int len);
-ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h);
+ZEND_API int zend_hash_str_del(HashTable *ht, const char *key, size_t len);
+ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *key, size_t len);
+ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h);
/* Data retreival */
ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key);
-ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *key, int len);
-ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h);
+ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *key, size_t len);
+ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_ulong h);
/* Misc */
-ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key);
-ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len);
-ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h);
+ZEND_API zend_bool zend_hash_exists(const HashTable *ht, zend_string *key);
+ZEND_API zend_bool zend_hash_str_exists(const HashTable *ht, const char *str, size_t len);
+ZEND_API zend_bool zend_hash_index_exists(const HashTable *ht, zend_ulong h);
/* traversing */
#define zend_hash_has_more_elements_ex(ht, pos) \
(zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS)
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos);
+ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, zend_bool duplicate, HashPosition *pos);
ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos);
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
@@ -173,14 +171,12 @@ ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *p
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
typedef struct _HashPointer {
- HashPosition pos;
- HashTable *ht;
- zend_uint_t h;
+ HashPosition pos;
+ HashTable *ht;
+ zend_ulong h;
+ zend_string *key;
} HashPointer;
-ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr);
-ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
-
#define zend_hash_has_more_elements(ht) \
zend_hash_has_more_elements_ex(ht, &(ht)->nInternalPointer)
#define zend_hash_move_forward(ht) \
@@ -202,11 +198,11 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
/* Copying, merging and sorting */
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor);
-ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite ZEND_FILE_LINE_DC);
+ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, zend_bool overwrite ZEND_FILE_LINE_DC);
ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
-ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
+ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber TSRMLS_DC);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag TSRMLS_DC);
+ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag TSRMLS_DC);
#define zend_hash_merge(target, source, pCopyConstructor, overwrite) \
_zend_hash_merge(target, source, pCopyConstructor, overwrite ZEND_FILE_LINE_CC)
@@ -227,6 +223,8 @@ void zend_hash_display_pListTail(const HashTable *ht);
void zend_hash_display(const HashTable *ht);
#endif
+ZEND_API int _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx);
+
END_EXTERN_C()
#define ZEND_INIT_SYMTABLE(ht) \
@@ -235,10 +233,9 @@ END_EXTERN_C()
#define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent)
-static inline int _zend_handle_numeric_str(const char *key, zend_size_t length, zend_uint_t *idx)
+static zend_always_inline int _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx)
{
register const char *tmp = key;
- const char *end;
if (*tmp > '9') {
return 0;
@@ -251,48 +248,17 @@ static inline int _zend_handle_numeric_str(const char *key, zend_size_t length,
return 0;
}
}
-
- /* possibly a numeric index */
- end = key + length;
-
- if ((*end != '\0') /* not a null terminated string */
- || (*tmp == '0' && length > 1) /* numbers with leading zeros */
- || (end - tmp > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */
- || (SIZEOF_ZEND_INT == 4 &&
- end - tmp == MAX_LENGTH_OF_ZEND_INT - 1 &&
- *tmp > '2')) { /* overflow */
- return 0;
- }
- *idx = (*tmp - '0');
- while (1) {
- ++tmp;
- if (tmp == end) {
- if (*key == '-') {
- if (*idx-1 > ZEND_INT_MAX) { /* overflow */
- return 0;
- }
- *idx = 0 - *idx;
- } else if (*idx > ZEND_INT_MAX) { /* overflow */
- return 0;
- }
- return 1;
- }
- if (*tmp <= '9' && *tmp >= '0') {
- *idx = (*idx * 10) + (*tmp - '0');
- } else {
- return 0;
- }
- }
+ return _zend_handle_numeric_str_ex(key, length, idx);
}
#define ZEND_HANDLE_NUMERIC_STR(key, length, idx) \
_zend_handle_numeric_str(key, length, &idx)
#define ZEND_HANDLE_NUMERIC(key, idx) \
- _zend_handle_numeric_str((key)->val, (key)->len, &idx)
+ ZEND_HANDLE_NUMERIC_STR((key)->val, (key)->len, idx)
-static inline zval *zend_hash_find_ind(const HashTable *ht, zend_string *key)
+static zend_always_inline zval *zend_hash_find_ind(const HashTable *ht, zend_string *key)
{
zval *zv;
@@ -301,7 +267,7 @@ static inline zval *zend_hash_find_ind(const HashTable *ht, zend_string *key)
}
-static inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key)
+static zend_always_inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key)
{
zval *zv;
@@ -311,7 +277,7 @@ static inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key)
}
-static inline zval *zend_hash_str_find_ind(const HashTable *ht, const char *str, int len)
+static zend_always_inline zval *zend_hash_str_find_ind(const HashTable *ht, const char *str, size_t len)
{
zval *zv;
@@ -320,9 +286,9 @@ static inline zval *zend_hash_str_find_ind(const HashTable *ht, const char *str,
}
-static inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
+static zend_always_inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_update(ht, idx, pData);
@@ -332,9 +298,9 @@ static inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *
}
-static inline zval *zend_symtable_update_ind(HashTable *ht, zend_string *key, zval *pData)
+static zend_always_inline zval *zend_symtable_update_ind(HashTable *ht, zend_string *key, zval *pData)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_update(ht, idx, pData);
@@ -344,9 +310,9 @@ static inline zval *zend_symtable_update_ind(HashTable *ht, zend_string *key, zv
}
-static inline int zend_symtable_del(HashTable *ht, zend_string *key)
+static zend_always_inline int zend_symtable_del(HashTable *ht, zend_string *key)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_del(ht, idx);
@@ -356,9 +322,9 @@ static inline int zend_symtable_del(HashTable *ht, zend_string *key)
}
-static inline int zend_symtable_del_ind(HashTable *ht, zend_string *key)
+static zend_always_inline int zend_symtable_del_ind(HashTable *ht, zend_string *key)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_del(ht, idx);
@@ -368,9 +334,9 @@ static inline int zend_symtable_del_ind(HashTable *ht, zend_string *key)
}
-static inline zval *zend_symtable_find(const HashTable *ht, zend_string *key)
+static zend_always_inline zval *zend_symtable_find(const HashTable *ht, zend_string *key)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_find(ht, idx);
@@ -380,9 +346,9 @@ static inline zval *zend_symtable_find(const HashTable *ht, zend_string *key)
}
-static inline zval *zend_symtable_find_ind(const HashTable *ht, zend_string *key)
+static zend_always_inline zval *zend_symtable_find_ind(const HashTable *ht, zend_string *key)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_find(ht, idx);
@@ -392,9 +358,9 @@ static inline zval *zend_symtable_find_ind(const HashTable *ht, zend_string *key
}
-static inline int zend_symtable_exists(HashTable *ht, zend_string *key)
+static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *key)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_exists(ht, idx);
@@ -404,9 +370,9 @@ static inline int zend_symtable_exists(HashTable *ht, zend_string *key)
}
-static inline zval *zend_symtable_str_update(HashTable *ht, const char *str, int len, zval *pData)
+static zend_always_inline zval *zend_symtable_str_update(HashTable *ht, const char *str, size_t len, zval *pData)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_update(ht, idx, pData);
@@ -416,9 +382,9 @@ static inline zval *zend_symtable_str_update(HashTable *ht, const char *str, int
}
-static inline zval *zend_symtable_str_update_ind(HashTable *ht, const char *str, int len, zval *pData)
+static zend_always_inline zval *zend_symtable_str_update_ind(HashTable *ht, const char *str, size_t len, zval *pData)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_update(ht, idx, pData);
@@ -428,9 +394,9 @@ static inline zval *zend_symtable_str_update_ind(HashTable *ht, const char *str,
}
-static inline int zend_symtable_str_del(HashTable *ht, const char *str, int len)
+static zend_always_inline int zend_symtable_str_del(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_del(ht, idx);
@@ -440,9 +406,9 @@ static inline int zend_symtable_str_del(HashTable *ht, const char *str, int len)
}
-static inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, int len)
+static zend_always_inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_del(ht, idx);
@@ -452,9 +418,9 @@ static inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, int
}
-static inline zval *zend_symtable_str_find(HashTable *ht, const char *str, int len)
+static zend_always_inline zval *zend_symtable_str_find(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_find(ht, idx);
@@ -464,9 +430,9 @@ static inline zval *zend_symtable_str_find(HashTable *ht, const char *str, int l
}
-static inline int zend_symtable_str_exists(HashTable *ht, const char *str, int len)
+static zend_always_inline int zend_symtable_str_exists(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_exists(ht, idx);
@@ -475,7 +441,7 @@ static inline int zend_symtable_str_exists(HashTable *ht, const char *str, int l
}
}
-static inline void *zend_hash_add_ptr(HashTable *ht, zend_string *key, void *pData)
+static zend_always_inline void *zend_hash_add_ptr(HashTable *ht, zend_string *key, void *pData)
{
zval tmp, *zv;
@@ -484,7 +450,7 @@ static inline void *zend_hash_add_ptr(HashTable *ht, zend_string *key, void *pDa
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_add_new_ptr(HashTable *ht, zend_string *key, void *pData)
+static zend_always_inline void *zend_hash_add_new_ptr(HashTable *ht, zend_string *key, void *pData)
{
zval tmp, *zv;
@@ -493,7 +459,7 @@ static inline void *zend_hash_add_new_ptr(HashTable *ht, zend_string *key, void
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_str_add_ptr(HashTable *ht, const char *str, int len, void *pData)
+static zend_always_inline void *zend_hash_str_add_ptr(HashTable *ht, const char *str, size_t len, void *pData)
{
zval tmp, *zv;
@@ -502,7 +468,7 @@ static inline void *zend_hash_str_add_ptr(HashTable *ht, const char *str, int le
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_update_ptr(HashTable *ht, zend_string *key, void *pData)
+static zend_always_inline void *zend_hash_update_ptr(HashTable *ht, zend_string *key, void *pData)
{
zval tmp, *zv;
@@ -511,7 +477,7 @@ static inline void *zend_hash_update_ptr(HashTable *ht, zend_string *key, void *
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_str_update_ptr(HashTable *ht, const char *str, int len, void *pData)
+static zend_always_inline void *zend_hash_str_update_ptr(HashTable *ht, const char *str, size_t len, void *pData)
{
zval tmp, *zv;
@@ -520,7 +486,7 @@ static inline void *zend_hash_str_update_ptr(HashTable *ht, const char *str, int
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_add_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
+static zend_always_inline void *zend_hash_add_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
{
zval tmp, *zv;
@@ -533,7 +499,7 @@ static inline void *zend_hash_add_mem(HashTable *ht, zend_string *key, void *pDa
return NULL;
}
-static inline void *zend_hash_str_add_mem(HashTable *ht, const char *str, int len, void *pData, size_t size)
+static zend_always_inline void *zend_hash_str_add_mem(HashTable *ht, const char *str, size_t len, void *pData, size_t size)
{
zval tmp, *zv;
@@ -546,7 +512,7 @@ static inline void *zend_hash_str_add_mem(HashTable *ht, const char *str, int le
return NULL;
}
-static inline void *zend_hash_update_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
+static zend_always_inline void *zend_hash_update_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
{
void *p;
@@ -555,7 +521,7 @@ static inline void *zend_hash_update_mem(HashTable *ht, zend_string *key, void *
return zend_hash_update_ptr(ht, key, p);
}
-static inline void *zend_hash_str_update_mem(HashTable *ht, const char *str, int len, void *pData, size_t size)
+static zend_always_inline void *zend_hash_str_update_mem(HashTable *ht, const char *str, size_t len, void *pData, size_t size)
{
void *p;
@@ -564,7 +530,7 @@ static inline void *zend_hash_str_update_mem(HashTable *ht, const char *str, int
return zend_hash_str_update_ptr(ht, str, len, p);
}
-static inline void *zend_hash_index_update_ptr(HashTable *ht, zend_uint_t h, void *pData)
+static zend_always_inline void *zend_hash_index_update_ptr(HashTable *ht, zend_ulong h, void *pData)
{
zval tmp, *zv;
@@ -573,7 +539,7 @@ static inline void *zend_hash_index_update_ptr(HashTable *ht, zend_uint_t h, voi
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
+static zend_always_inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
{
zval tmp, *zv;
@@ -582,7 +548,7 @@ static inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_index_update_mem(HashTable *ht, zend_uint_t h, void *pData, size_t size)
+static zend_always_inline void *zend_hash_index_update_mem(HashTable *ht, zend_ulong h, void *pData, size_t size)
{
void *p;
@@ -591,7 +557,7 @@ static inline void *zend_hash_index_update_mem(HashTable *ht, zend_uint_t h, voi
return zend_hash_index_update_ptr(ht, h, p);
}
-static inline void *zend_hash_next_index_insert_mem(HashTable *ht, void *pData, size_t size)
+static zend_always_inline void *zend_hash_next_index_insert_mem(HashTable *ht, void *pData, size_t size)
{
zval tmp, *zv;
@@ -604,7 +570,7 @@ static inline void *zend_hash_next_index_insert_mem(HashTable *ht, void *pData,
return NULL;
}
-static inline void *zend_hash_find_ptr(const HashTable *ht, zend_string *key)
+static zend_always_inline void *zend_hash_find_ptr(const HashTable *ht, zend_string *key)
{
zval *zv;
@@ -612,7 +578,7 @@ static inline void *zend_hash_find_ptr(const HashTable *ht, zend_string *key)
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_str_find_ptr(const HashTable *ht, const char *str, int len)
+static zend_always_inline void *zend_hash_str_find_ptr(const HashTable *ht, const char *str, size_t len)
{
zval *zv;
@@ -620,7 +586,7 @@ static inline void *zend_hash_str_find_ptr(const HashTable *ht, const char *str,
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_uint_t h)
+static zend_always_inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_ulong h)
{
zval *zv;
@@ -628,9 +594,9 @@ static inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_uint_t h)
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_symtable_str_find_ptr(HashTable *ht, const char *str, int len)
+static zend_always_inline void *zend_symtable_str_find_ptr(HashTable *ht, const char *str, size_t len)
{
- zend_uint_t idx;
+ zend_ulong idx;
if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_find_ptr(ht, idx);
@@ -639,7 +605,7 @@ static inline void *zend_symtable_str_find_ptr(HashTable *ht, const char *str, i
}
}
-static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPosition *pos)
+static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPosition *pos)
{
zval *zv;
@@ -702,6 +668,11 @@ static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPositio
ZEND_HASH_FOREACH(ht, 0); \
_h = _p->h; \
_key = _p->key;
+
+#define ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _h = _p->h; \
+ _val = _z;
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \
ZEND_HASH_FOREACH(ht, 0); \
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index 50a1edce38..26c34686a6 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -104,9 +104,15 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
break;
case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
case T_CLOSE_TAG:
+ case T_LINE:
+ case T_FILE:
+ case T_DIR:
+ case T_TRAIT_C:
+ case T_METHOD_C:
+ case T_FUNC_C:
+ case T_NS_C:
+ case T_CLASS_C:
next_color = syntax_highlighter_ini->highlight_default;
break;
case '"':
@@ -150,7 +156,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
case T_DOC_COMMENT:
break;
default:
- STR_RELEASE(Z_STR(token));
+ zend_string_release(Z_STR(token));
break;
}
}
@@ -211,7 +217,7 @@ ZEND_API void zend_strip(TSRMLS_D)
break;
default:
- STR_RELEASE(Z_STR(token));
+ zend_string_release(Z_STR(token));
break;
}
}
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
index 05254a30bc..93c10108f8 100644
--- a/Zend/zend_indent.c
+++ b/Zend/zend_indent.c
@@ -52,9 +52,9 @@ ZEND_API void zend_indent(TSRMLS_D)
zval token;
int token_type;
int in_string=0;
- int nest_level=0;
- int emit_whitespace[256];
- int i;
+ unsigned int nest_level=0;
+ unsigned int emit_whitespace[256];
+ unsigned int i;
memset(emit_whitespace, 0, sizeof(int)*256);
@@ -138,7 +138,7 @@ dflt_printout:
case T_WHITESPACE:
break;
default:
- STR_RELEASE(Z_STR(token));
+ zend_string_release(Z_STR(token));
break;
}
}
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
new file mode 100644
index 0000000000..f240ed7159
--- /dev/null
+++ b/Zend/zend_inheritance.c
@@ -0,0 +1,1559 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andi Gutmans <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "zend.h"
+#include "zend_API.h"
+#include "zend_compile.h"
+#include "zend_execute.h"
+#include "zend_smart_str.h"
+
+static void ptr_dtor(zval *zv) /* {{{ */
+{
+ efree(Z_PTR_P(zv));
+}
+/* }}} */
+
+static zend_property_info *zend_duplicate_property_info(zend_property_info *property_info TSRMLS_DC) /* {{{ */
+{
+ zend_property_info* new_property_info;
+
+ new_property_info = zend_arena_alloc(&CG(arena), sizeof(zend_property_info));
+ memcpy(new_property_info, property_info, sizeof(zend_property_info));
+ zend_string_addref(new_property_info->name);
+ if (new_property_info->doc_comment) {
+ zend_string_addref(new_property_info->doc_comment);
+ }
+ return new_property_info;
+}
+/* }}} */
+
+static zend_property_info *zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */
+{
+ zend_property_info* new_property_info = pemalloc(sizeof(zend_property_info), 1);
+ memcpy(new_property_info, property_info, sizeof(zend_property_info));
+ zend_string_addref(new_property_info->name);
+ return new_property_info;
+}
+/* }}} */
+
+static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ zend_function *function, *new_function;
+
+ if (!ce->parent) {
+ return;
+ }
+
+ /* You cannot change create_object */
+ ce->create_object = ce->parent->create_object;
+
+ /* Inherit special functions if needed */
+ if (!ce->get_iterator) {
+ ce->get_iterator = ce->parent->get_iterator;
+ }
+ if (!ce->iterator_funcs.funcs) {
+ ce->iterator_funcs.funcs = ce->parent->iterator_funcs.funcs;
+ }
+ if (!ce->__get) {
+ ce->__get = ce->parent->__get;
+ }
+ if (!ce->__set) {
+ ce->__set = ce->parent->__set;
+ }
+ if (!ce->__unset) {
+ ce->__unset = ce->parent->__unset;
+ }
+ if (!ce->__isset) {
+ ce->__isset = ce->parent->__isset;
+ }
+ if (!ce->__call) {
+ ce->__call = ce->parent->__call;
+ }
+ if (!ce->__callstatic) {
+ ce->__callstatic = ce->parent->__callstatic;
+ }
+ if (!ce->__tostring) {
+ ce->__tostring = ce->parent->__tostring;
+ }
+ if (!ce->clone) {
+ ce->clone = ce->parent->clone;
+ }
+ if(!ce->serialize) {
+ ce->serialize = ce->parent->serialize;
+ }
+ if(!ce->unserialize) {
+ ce->unserialize = ce->parent->unserialize;
+ }
+ if (!ce->destructor) {
+ ce->destructor = ce->parent->destructor;
+ }
+ if (!ce->__debugInfo) {
+ ce->__debugInfo = ce->parent->__debugInfo;
+ }
+ if (ce->constructor) {
+ if (ce->parent->constructor && ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL) {
+ zend_error(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
+ ce->parent->name->val, ce->parent->constructor->common.function_name->val,
+ ce->name->val, ce->constructor->common.function_name->val
+ );
+ }
+ return;
+ }
+
+ if ((function = zend_hash_str_find_ptr(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1)) != NULL) {
+ /* inherit parent's constructor */
+ if (function->type == ZEND_INTERNAL_FUNCTION) {
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ new_function = pemalloc(sizeof(zend_internal_function), 1);
+ memcpy(new_function, function, sizeof(zend_internal_function));
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
+ memcpy(new_function, function, sizeof(zend_internal_function));
+ new_function->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
+ }
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_function, function, sizeof(zend_op_array));
+ }
+ zend_hash_str_update_ptr(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1, new_function);
+ function_add_ref(new_function);
+ } else {
+ /* Don't inherit the old style constructor if we already have the new style constructor */
+ zend_string *lc_class_name;
+ zend_string *lc_parent_class_name;
+
+ lc_class_name = zend_string_alloc(ce->name->len, 0);
+ zend_str_tolower_copy(lc_class_name->val, ce->name->val, ce->name->len);
+ if (!zend_hash_exists(&ce->function_table, lc_class_name)) {
+ lc_parent_class_name = zend_string_alloc(ce->parent->name->len, 0);
+ zend_str_tolower_copy(lc_parent_class_name->val, ce->parent->name->val, ce->parent->name->len);
+ if (!zend_hash_exists(&ce->function_table, lc_parent_class_name) &&
+ (function = zend_hash_find_ptr(&ce->parent->function_table, lc_parent_class_name)) != NULL) {
+ if (function->common.fn_flags & ZEND_ACC_CTOR) {
+ /* inherit parent's constructor */
+ if (function->type == ZEND_INTERNAL_FUNCTION) {
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ new_function = pemalloc(sizeof(zend_internal_function), 1);
+ memcpy(new_function, function, sizeof(zend_internal_function));
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
+ memcpy(new_function, function, sizeof(zend_internal_function));
+ new_function->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
+ }
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_function, function, sizeof(zend_op_array));
+ }
+ zend_hash_update_ptr(&ce->function_table, lc_parent_class_name, new_function);
+ function_add_ref(new_function);
+ }
+ }
+ zend_string_release(lc_parent_class_name);
+ }
+ zend_string_free(lc_class_name);
+ }
+ ce->constructor = ce->parent->constructor;
+}
+/* }}} */
+
+char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
+{
+ if (fn_flags & ZEND_ACC_PRIVATE) {
+ return "private";
+ }
+ if (fn_flags & ZEND_ACC_PROTECTED) {
+ return "protected";
+ }
+ if (fn_flags & ZEND_ACC_PUBLIC) {
+ return "public";
+ }
+ return "";
+}
+/* }}} */
+
+static zend_function *do_inherit_method(zend_function *old_function, zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ zend_function *new_function;
+
+ if (old_function->type == ZEND_INTERNAL_FUNCTION) {
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ new_function = pemalloc(sizeof(zend_internal_function), 1);
+ memcpy(new_function, old_function, sizeof(zend_internal_function));
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
+ memcpy(new_function, old_function, sizeof(zend_internal_function));
+ new_function->common.fn_flags |= ZEND_ACC_ARENA_ALLOCATED;
+ }
+ } else {
+ new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_function, old_function, sizeof(zend_op_array));
+ }
+ /* The class entry of the derived function intentionally remains the same
+ * as that of the parent class. That allows us to know in which context
+ * we're running, and handle private method calls properly.
+ */
+ function_add_ref(new_function);
+ return new_function;
+}
+/* }}} */
+
+static zend_bool zend_do_perform_implementation_check(const zend_function *fe, const zend_function *proto TSRMLS_DC) /* {{{ */
+{
+ uint32_t i, num_args;
+
+ /* If it's a user function then arg_info == NULL means we don't have any parameters but
+ * we still need to do the arg number checks. We are only willing to ignore this for internal
+ * functions because extensions don't always define arg_info.
+ */
+ if (!proto || (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION)) {
+ return 1;
+ }
+
+ /* Checks for constructors only if they are declared in an interface,
+ * or explicitly marked as abstract
+ */
+ if ((fe->common.fn_flags & ZEND_ACC_CTOR)
+ && ((proto->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0
+ && (proto->common.fn_flags & ZEND_ACC_ABSTRACT) == 0)) {
+ return 1;
+ }
+
+ /* If both methods are private do not enforce a signature */
+ if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ return 1;
+ }
+
+ /* check number of arguments */
+ if (proto->common.required_num_args < fe->common.required_num_args
+ || proto->common.num_args > fe->common.num_args) {
+ return 0;
+ }
+
+ /* by-ref constraints on return values are covariant */
+ if ((proto->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
+ && !(fe->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ return 0;
+ }
+
+ if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
+ && !(fe->common.fn_flags & ZEND_ACC_VARIADIC)) {
+ return 0;
+ }
+
+ /* For variadic functions any additional (optional) arguments that were added must be
+ * checked against the signature of the variadic argument, so in this case we have to
+ * go through all the parameters of the function and not just those present in the
+ * prototype. */
+ num_args = proto->common.num_args;
+ if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
+ && fe->common.num_args > proto->common.num_args) {
+ num_args = fe->common.num_args;
+ }
+
+ for (i = 0; i < num_args; i++) {
+ zend_arg_info *fe_arg_info = &fe->common.arg_info[i];
+
+ zend_arg_info *proto_arg_info;
+ if (i < proto->common.num_args) {
+ proto_arg_info = &proto->common.arg_info[i];
+ } else {
+ proto_arg_info = &proto->common.arg_info[proto->common.num_args-1];
+ }
+
+ if (ZEND_LOG_XOR(fe_arg_info->class_name, proto_arg_info->class_name)) {
+ /* Only one has a type hint and the other one doesn't */
+ return 0;
+ }
+
+ if (fe_arg_info->class_name) {
+ zend_string *fe_class_name, *proto_class_name;
+
+ if (!strcasecmp(fe_arg_info->class_name, "parent") && proto->common.scope) {
+ fe_class_name = zend_string_copy(proto->common.scope->name);
+ } else if (!strcasecmp(fe_arg_info->class_name, "self") && fe->common.scope) {
+ fe_class_name = zend_string_copy(fe->common.scope->name);
+ } else {
+ fe_class_name = zend_string_init(
+ fe_arg_info->class_name,
+ fe_arg_info->class_name_len, 0);
+ }
+
+ if (!strcasecmp(proto_arg_info->class_name, "parent") && proto->common.scope && proto->common.scope->parent) {
+ proto_class_name = zend_string_copy(proto->common.scope->parent->name);
+ } else if (!strcasecmp(proto_arg_info->class_name, "self") && proto->common.scope) {
+ proto_class_name = zend_string_copy(proto->common.scope->name);
+ } else {
+ proto_class_name = zend_string_init(
+ proto_arg_info->class_name,
+ proto_arg_info->class_name_len, 0);
+ }
+
+ if (strcasecmp(fe_class_name->val, proto_class_name->val)!=0) {
+ const char *colon;
+
+ if (fe->common.type != ZEND_USER_FUNCTION) {
+ zend_string_release(proto_class_name);
+ zend_string_release(fe_class_name);
+ return 0;
+ } else if (strchr(proto_class_name->val, '\\') != NULL ||
+ (colon = zend_memrchr(fe_class_name->val, '\\', fe_class_name->len)) == NULL ||
+ strcasecmp(colon+1, proto_class_name->val) != 0) {
+ zend_class_entry *fe_ce, *proto_ce;
+
+ fe_ce = zend_lookup_class(fe_class_name TSRMLS_CC);
+ proto_ce = zend_lookup_class(proto_class_name TSRMLS_CC);
+
+ /* Check for class alias */
+ if (!fe_ce || !proto_ce ||
+ fe_ce->type == ZEND_INTERNAL_CLASS ||
+ proto_ce->type == ZEND_INTERNAL_CLASS ||
+ fe_ce != proto_ce) {
+ zend_string_release(proto_class_name);
+ zend_string_release(fe_class_name);
+ return 0;
+ }
+ }
+ }
+ zend_string_release(proto_class_name);
+ zend_string_release(fe_class_name);
+ }
+ if (fe_arg_info->type_hint != proto_arg_info->type_hint) {
+ /* Incompatible type hint */
+ return 0;
+ }
+
+ /* by-ref constraints on arguments are invariant */
+ if (fe_arg_info->pass_by_reference != proto_arg_info->pass_by_reference) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+/* }}} */
+
+static zend_string *zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{{ */
+{
+ smart_str str = {0};
+
+ if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ smart_str_appends(&str, "& ");
+ }
+
+ if (fptr->common.scope) {
+ smart_str_append(&str, fptr->common.scope->name);
+ smart_str_appends(&str, "::");
+ }
+
+ smart_str_append(&str, fptr->common.function_name);
+ smart_str_appendc(&str, '(');
+
+ if (fptr->common.arg_info) {
+ uint32_t i, required;
+ zend_arg_info *arg_info = fptr->common.arg_info;
+
+ required = fptr->common.required_num_args;
+ for (i = 0; i < fptr->common.num_args;) {
+ if (arg_info->class_name) {
+ const char *class_name;
+ uint32_t class_name_len;
+ if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope) {
+ class_name = fptr->common.scope->name->val;
+ class_name_len = fptr->common.scope->name->len;
+ } else if (!strcasecmp(arg_info->class_name, "parent") && fptr->common.scope->parent) {
+ class_name = fptr->common.scope->parent->name->val;
+ class_name_len = fptr->common.scope->parent->name->len;
+ } else {
+ class_name = arg_info->class_name;
+ class_name_len = arg_info->class_name_len;
+ }
+
+ smart_str_appendl(&str, class_name, class_name_len);
+ smart_str_appendc(&str, ' ');
+ } else if (arg_info->type_hint) {
+ const char *type_name = zend_get_type_by_const(arg_info->type_hint);
+ smart_str_appends(&str, type_name);
+ smart_str_appendc(&str, ' ');
+ }
+
+ if (arg_info->pass_by_reference) {
+ smart_str_appendc(&str, '&');
+ }
+
+ if (arg_info->is_variadic) {
+ smart_str_appends(&str, "...");
+ }
+
+ smart_str_appendc(&str, '$');
+
+ if (arg_info->name) {
+ smart_str_appendl(&str, arg_info->name, arg_info->name_len);
+ } else {
+ smart_str_appends(&str, "param");
+ smart_str_append_unsigned(&str, i);
+ }
+
+ if (i >= required && !arg_info->is_variadic) {
+ smart_str_appends(&str, " = ");
+ if (fptr->type == ZEND_USER_FUNCTION) {
+ zend_op *precv = NULL;
+ {
+ uint32_t idx = i;
+ zend_op *op = fptr->op_array.opcodes;
+ zend_op *end = op + fptr->op_array.last;
+
+ ++idx;
+ while (op < end) {
+ if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT)
+ && op->op1.num == (zend_ulong)idx)
+ {
+ precv = op;
+ }
+ ++op;
+ }
+ }
+ if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
+ zval *zv = precv->op2.zv;
+
+ if (Z_TYPE_P(zv) == IS_CONSTANT) {
+ smart_str_append(&str, Z_STR_P(zv));
+ } else if (Z_TYPE_P(zv) == IS_FALSE) {
+ smart_str_appends(&str, "false");
+ } else if (Z_TYPE_P(zv) == IS_TRUE) {
+ smart_str_appends(&str, "true");
+ } else if (Z_TYPE_P(zv) == IS_NULL) {
+ smart_str_appends(&str, "NULL");
+ } else if (Z_TYPE_P(zv) == IS_STRING) {
+ smart_str_appendc(&str, '\'');
+ smart_str_appendl(&str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10));
+ if (Z_STRLEN_P(zv) > 10) {
+ smart_str_appends(&str, "...");
+ }
+ smart_str_appendc(&str, '\'');
+ } else if (Z_TYPE_P(zv) == IS_ARRAY) {
+ smart_str_appends(&str, "Array");
+ } else if (Z_TYPE_P(zv) == IS_CONSTANT_AST) {
+ smart_str_appends(&str, "<expression>");
+ } else {
+ zend_string *zv_str = zval_get_string(zv);
+ smart_str_append(&str, zv_str);
+ zend_string_release(zv_str);
+ }
+ }
+ } else {
+ smart_str_appends(&str, "NULL");
+ }
+ }
+
+ if (++i < fptr->common.num_args) {
+ smart_str_appends(&str, ", ");
+ }
+ arg_info++;
+ }
+ }
+
+ smart_str_appendc(&str, ')');
+ smart_str_0(&str);
+
+ return str.s;
+}
+/* }}} */
+
+static void do_inheritance_check_on_method(zend_function *child, zend_function *parent TSRMLS_DC) /* {{{ */
+{
+ uint32_t child_flags;
+ uint32_t parent_flags = parent->common.fn_flags;
+
+ if ((parent->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0
+ && parent->common.fn_flags & ZEND_ACC_ABSTRACT
+ && parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
+ && child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",
+ parent->common.scope->name->val,
+ child->common.function_name->val,
+ child->common.prototype ? child->common.prototype->common.scope->name->val : child->common.scope->name->val);
+ }
+
+ if (parent_flags & ZEND_ACC_FINAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val);
+ }
+
+ child_flags = child->common.fn_flags;
+ /* You cannot change from static to non static and vice versa.
+ */
+ if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) {
+ if (child->common.fn_flags & ZEND_ACC_STATIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
+ } else {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
+ }
+ }
+
+ /* Disallow making an inherited method abstract. */
+ if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
+ }
+
+ if (parent_flags & ZEND_ACC_CHANGED) {
+ child->common.fn_flags |= ZEND_ACC_CHANGED;
+ } else {
+ /* Prevent derived classes from restricting access that was available in parent classes
+ */
+ if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
+ } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK))
+ && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) {
+ child->common.fn_flags |= ZEND_ACC_CHANGED;
+ }
+ }
+
+ if (parent_flags & ZEND_ACC_PRIVATE) {
+ child->common.prototype = NULL;
+ } else if (parent_flags & ZEND_ACC_ABSTRACT) {
+ child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
+ child->common.prototype = parent;
+ } else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
+ /* ctors only have a prototype if it comes from an interface */
+ child->common.prototype = parent->common.prototype ? parent->common.prototype : parent;
+ }
+
+ if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype TSRMLS_CC)->val);
+ }
+ } else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
+ if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
+ zend_string *method_prototype = zend_get_function_declaration(parent TSRMLS_CC);
+ zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, method_prototype->val);
+ zend_string_free(method_prototype);
+ }
+ }
+}
+/* }}} */
+
+static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_function *parent, zend_string *key, zend_class_entry *child_ce) /* {{{ */
+{
+ uint32_t parent_flags = parent->common.fn_flags;
+ zend_function *child;
+ TSRMLS_FETCH();
+
+ if ((child = zend_hash_find_ptr(child_function_table, key)) == NULL) {
+ if (parent_flags & (ZEND_ACC_ABSTRACT)) {
+ child_ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ }
+ return 1; /* method doesn't exist in child, copy from parent */
+ }
+
+ do_inheritance_check_on_method(child, parent TSRMLS_CC);
+
+ return 0;
+}
+/* }}} */
+
+static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ zend_property_info *child_info;
+ zend_class_entry *parent_ce = ce->parent;
+
+ if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
+ if ((child_info = zend_hash_find_ptr(&ce->properties_info, key)) != NULL) {
+ child_info->flags |= ZEND_ACC_CHANGED;
+ } else {
+ if(ce->type & ZEND_INTERNAL_CLASS) {
+ child_info = zend_duplicate_property_info_internal(parent_info);
+ } else {
+ child_info = zend_duplicate_property_info(parent_info TSRMLS_CC);
+ }
+ zend_hash_update_ptr(&ce->properties_info, key, child_info);
+ child_info->flags &= ~ZEND_ACC_PRIVATE; /* it's not private anymore */
+ child_info->flags |= ZEND_ACC_SHADOW; /* but it's a shadow of private */
+ }
+ return 0; /* don't copy access information to child */
+ }
+
+ if ((child_info = zend_hash_find_ptr(&ce->properties_info, key)) != NULL) {
+ if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s",
+ (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name->val, key->val,
+ (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name->val, key->val);
+
+ }
+
+ if(parent_info->flags & ZEND_ACC_CHANGED) {
+ child_info->flags |= ZEND_ACC_CHANGED;
+ }
+
+ if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
+ } else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
+ zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
+ ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
+ ZVAL_UNDEF(&ce->default_properties_table[child_info->offset]);
+ child_info->offset = parent_info->offset;
+ }
+ return 0; /* Don't copy from parent */
+ } else {
+ return 1; /* Copy from parent */
+ }
+}
+/* }}} */
+
+static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
+{
+ if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
+ zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name->val, iface->name->val);
+ }
+ if (ce == iface) {
+ zend_error(E_ERROR, "Interface %s cannot implement itself", ce->name->val);
+ }
+}
+/* }}} */
+
+ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC) /* {{{ */
+{
+ /* expects interface to be contained in ce's interface list already */
+ uint32_t i, ce_num, if_num = iface->num_interfaces;
+ zend_class_entry *entry;
+
+ if (if_num==0) {
+ return;
+ }
+ ce_num = ce->num_interfaces;
+
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
+ } else {
+ ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
+ }
+
+ /* Inherit the interfaces, only if they're not already inherited by the class */
+ while (if_num--) {
+ entry = iface->interfaces[if_num];
+ for (i = 0; i < ce_num; i++) {
+ if (ce->interfaces[i] == entry) {
+ break;
+ }
+ }
+ if (i == ce_num) {
+ ce->interfaces[ce->num_interfaces++] = entry;
+ }
+ }
+
+ /* and now call the implementing handlers */
+ while (ce_num < ce->num_interfaces) {
+ do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
+ }
+}
+/* }}} */
+
+#ifdef ZTS
+# define zval_property_ctor(parent_ce, ce) \
+ (((parent_ce)->type != (ce)->type) ? ZVAL_COPY_CTOR : zval_add_ref)
+#else
+# define zval_property_ctor(parent_ce, ce) \
+ zval_add_ref
+#endif
+
+static void do_inherit_class_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
+{
+ if (!Z_ISREF_P(zv)) {
+ if (parent_ce->type == ZEND_INTERNAL_CLASS) {
+ ZVAL_NEW_PERSISTENT_REF(zv, zv);
+ } else {
+ ZVAL_NEW_REF(zv, zv);
+ }
+ }
+ if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ if (zend_hash_add(&ce->constants_table, name, zv)) {
+ Z_ADDREF_P(zv);
+ }
+}
+/* }}} */
+
+ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
+{
+ zend_property_info *property_info;
+ zend_function *func;
+ zend_string *key;
+ zval *zv;
+
+ if ((ce->ce_flags & ZEND_ACC_INTERFACE)
+ && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val);
+ }
+ if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val);
+ }
+
+ ce->parent = parent_ce;
+ /* Copy serialize/unserialize callbacks */
+ if (!ce->serialize) {
+ ce->serialize = parent_ce->serialize;
+ }
+ if (!ce->unserialize) {
+ ce->unserialize = parent_ce->unserialize;
+ }
+
+ /* Inherit interfaces */
+ zend_do_inherit_interfaces(ce, parent_ce TSRMLS_CC);
+
+ /* Inherit properties */
+ if (parent_ce->default_properties_count) {
+ int i = ce->default_properties_count + parent_ce->default_properties_count;
+
+ ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * i, ce->type == ZEND_INTERNAL_CLASS);
+ if (ce->default_properties_count) {
+ while (i-- > parent_ce->default_properties_count) {
+ ce->default_properties_table[i] = ce->default_properties_table[i - parent_ce->default_properties_count];
+ }
+ }
+ for (i = 0; i < parent_ce->default_properties_count; i++) {
+#ifdef ZTS
+ if (parent_ce->type != ce->type) {
+ ZVAL_DUP(&ce->default_properties_table[i], &parent_ce->default_properties_table[i]);
+ if (Z_OPT_CONSTANT(ce->default_properties_table[i])) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ continue;
+ }
+#endif
+
+ ZVAL_COPY(&ce->default_properties_table[i], &parent_ce->default_properties_table[i]);
+ if (Z_OPT_CONSTANT(ce->default_properties_table[i])) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ }
+ ce->default_properties_count += parent_ce->default_properties_count;
+ }
+
+ if (parent_ce->type != ce->type) {
+ /* User class extends internal class */
+ zend_update_class_constants(parent_ce TSRMLS_CC);
+ if (parent_ce->default_static_members_count) {
+ int i = ce->default_static_members_count + parent_ce->default_static_members_count;
+
+ ce->default_static_members_table = erealloc(ce->default_static_members_table, sizeof(zval) * i);
+ if (ce->default_static_members_count) {
+ while (i-- > parent_ce->default_static_members_count) {
+ ce->default_static_members_table[i] = ce->default_static_members_table[i - parent_ce->default_static_members_count];
+ }
+ }
+ for (i = 0; i < parent_ce->default_static_members_count; i++) {
+ ZVAL_MAKE_REF(&CE_STATIC_MEMBERS(parent_ce)[i]);
+ ce->default_static_members_table[i] = CE_STATIC_MEMBERS(parent_ce)[i];
+ Z_ADDREF(ce->default_static_members_table[i]);
+ if (Z_CONSTANT_P(Z_REFVAL(ce->default_static_members_table[i]))) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ }
+ ce->default_static_members_count += parent_ce->default_static_members_count;
+ ce->static_members_table = ce->default_static_members_table;
+ }
+ } else {
+ if (parent_ce->default_static_members_count) {
+ int i = ce->default_static_members_count + parent_ce->default_static_members_count;
+
+ ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval) * i, ce->type == ZEND_INTERNAL_CLASS);
+ if (ce->default_static_members_count) {
+ while (i-- > parent_ce->default_static_members_count) {
+ ce->default_static_members_table[i] = ce->default_static_members_table[i - parent_ce->default_static_members_count];
+ }
+ }
+ for (i = 0; i < parent_ce->default_static_members_count; i++) {
+ ZVAL_MAKE_REF(&parent_ce->default_static_members_table[i]);
+ ce->default_static_members_table[i] = parent_ce->default_static_members_table[i];
+ Z_ADDREF(ce->default_static_members_table[i]);
+ if (Z_CONSTANT_P(Z_REFVAL(ce->default_static_members_table[i]))) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ }
+ ce->default_static_members_count += parent_ce->default_static_members_count;
+ if (ce->type == ZEND_USER_CLASS) {
+ ce->static_members_table = ce->default_static_members_table;
+ }
+ }
+ }
+
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, property_info) {
+ if (property_info->ce == ce) {
+ if (property_info->flags & ZEND_ACC_STATIC) {
+ property_info->offset += parent_ce->default_static_members_count;
+ } else {
+ property_info->offset += parent_ce->default_properties_count;
+ }
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->properties_info, key, property_info) {
+ if (do_inherit_property_access_check(&ce->properties_info, property_info, key, ce TSRMLS_CC)) {
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ property_info = zend_duplicate_property_info_internal(property_info);
+ } else {
+ property_info = zend_duplicate_property_info(property_info TSRMLS_CC);
+ }
+ zend_hash_add_new_ptr(&ce->properties_info, key, property_info);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL(&parent_ce->constants_table, key, zv) {
+ do_inherit_class_constant(key, zv, ce, parent_ce TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->function_table, key, func) {
+ if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
+ zend_function *new_func = do_inherit_method(func, ce TSRMLS_CC);
+ zend_hash_add_new_ptr(&ce->function_table, key, new_func);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ do_inherit_parent_constructor(ce TSRMLS_CC);
+
+ if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
+ ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
+ } else if (!(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
+ /* The verification will be done in runtime by ZEND_VERIFY_ABSTRACT_CLASS */
+ zend_verify_abstract_class(ce TSRMLS_CC);
+ }
+ ce->ce_flags |= parent_ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS;
+}
+/* }}} */
+
+static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval *parent_constant, zend_string *name, const zend_class_entry *iface) /* {{{ */
+{
+ zval *old_constant;
+
+ if ((old_constant = zend_hash_find(child_constants_table, name)) != NULL) {
+ if (!Z_ISREF_P(old_constant) ||
+ !Z_ISREF_P(parent_constant) ||
+ Z_REFVAL_P(old_constant) != Z_REFVAL_P(parent_constant)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", name->val, iface->name->val);
+ }
+ return 0;
+ }
+ return 1;
+}
+/* }}} */
+
+static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
+{
+ if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
+ ZVAL_MAKE_REF(zv);
+ Z_ADDREF_P(zv);
+ if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
+ ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;
+ }
+ zend_hash_update(&ce->constants_table, name, zv);
+ }
+}
+/* }}} */
+
+ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
+{
+ uint32_t i, ignore = 0;
+ uint32_t current_iface_num = ce->num_interfaces;
+ uint32_t parent_iface_num = ce->parent ? ce->parent->num_interfaces : 0;
+ zend_function *func;
+ zend_string *key;
+ zval *zv;
+
+ for (i = 0; i < ce->num_interfaces; i++) {
+ if (ce->interfaces[i] == NULL) {
+ memmove(ce->interfaces + i, ce->interfaces + i + 1, sizeof(zend_class_entry*) * (--ce->num_interfaces - i));
+ i--;
+ } else if (ce->interfaces[i] == iface) {
+ if (i < parent_iface_num) {
+ ignore = 1;
+ } else {
+ zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name->val, iface->name->val);
+ }
+ }
+ }
+ if (ignore) {
+ /* Check for attempt to redeclare interface constants */
+ ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, zv) {
+ do_inherit_constant_check(&iface->constants_table, zv, key, iface);
+ } ZEND_HASH_FOREACH_END();
+ } else {
+ if (ce->num_interfaces >= current_iface_num) {
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
+ } else {
+ ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
+ }
+ }
+ ce->interfaces[ce->num_interfaces++] = iface;
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL(&iface->constants_table, key, zv) {
+ do_inherit_iface_constant(key, zv, ce, iface TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&iface->function_table, key, func) {
+ if (do_inherit_method_check(&ce->function_table, func, key, ce)) {
+ zend_function *new_func = do_inherit_method(func, ce TSRMLS_CC);
+ zend_hash_add_new_ptr(&ce->function_table, key, new_func);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ do_implement_interface(ce, iface TSRMLS_CC);
+ zend_do_inherit_interfaces(ce, iface TSRMLS_CC);
+ }
+}
+/* }}} */
+
+ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
+{
+ uint32_t i, ignore = 0;
+ uint32_t current_trait_num = ce->num_traits;
+ uint32_t parent_trait_num = ce->parent ? ce->parent->num_traits : 0;
+
+ for (i = 0; i < ce->num_traits; i++) {
+ if (ce->traits[i] == NULL) {
+ memmove(ce->traits + i, ce->traits + i + 1, sizeof(zend_class_entry*) * (--ce->num_traits - i));
+ i--;
+ } else if (ce->traits[i] == trait) {
+ if (i < parent_trait_num) {
+ ignore = 1;
+ }
+ }
+ }
+ if (!ignore) {
+ if (ce->num_traits >= current_trait_num) {
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ ce->traits = (zend_class_entry **) realloc(ce->traits, sizeof(zend_class_entry *) * (++current_trait_num));
+ } else {
+ ce->traits = (zend_class_entry **) erealloc(ce->traits, sizeof(zend_class_entry *) * (++current_trait_num));
+ }
+ }
+ ce->traits[ce->num_traits++] = trait;
+ }
+}
+/* }}} */
+
+static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_function *other_fn TSRMLS_DC) /* {{{ */
+{
+ uint32_t fn_flags = fn->common.scope->ce_flags;
+ uint32_t other_flags = other_fn->common.scope->ce_flags;
+
+ return zend_do_perform_implementation_check(fn, other_fn TSRMLS_CC)
+ && ((other_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) || zend_do_perform_implementation_check(other_fn, fn TSRMLS_CC))
+ && ((fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC)) ==
+ (other_flags & (ZEND_ACC_FINAL|ZEND_ACC_STATIC))); /* equal final and static qualifier */
+}
+/* }}} */
+
+static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe TSRMLS_DC) /* {{{ */
+{
+ if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) {
+ ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
+ } else if (!strncmp(mname->val, ZEND_CONSTRUCTOR_FUNC_NAME, mname->len)) {
+ if (ce->constructor) {
+ zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val);
+ }
+ ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
+ } else if (!strncmp(mname->val, ZEND_DESTRUCTOR_FUNC_NAME, mname->len)) {
+ ce->destructor = fe; fe->common.fn_flags |= ZEND_ACC_DTOR;
+ } else if (!strncmp(mname->val, ZEND_GET_FUNC_NAME, mname->len)) {
+ ce->__get = fe;
+ } else if (!strncmp(mname->val, ZEND_SET_FUNC_NAME, mname->len)) {
+ ce->__set = fe;
+ } else if (!strncmp(mname->val, ZEND_CALL_FUNC_NAME, mname->len)) {
+ ce->__call = fe;
+ } else if (!strncmp(mname->val, ZEND_UNSET_FUNC_NAME, mname->len)) {
+ ce->__unset = fe;
+ } else if (!strncmp(mname->val, ZEND_ISSET_FUNC_NAME, mname->len)) {
+ ce->__isset = fe;
+ } else if (!strncmp(mname->val, ZEND_CALLSTATIC_FUNC_NAME, mname->len)) {
+ ce->__callstatic = fe;
+ } else if (!strncmp(mname->val, ZEND_TOSTRING_FUNC_NAME, mname->len)) {
+ ce->__tostring = fe;
+ } else if (!strncmp(mname->val, ZEND_DEBUGINFO_FUNC_NAME, mname->len)) {
+ ce->__debugInfo = fe;
+ } else if (ce->name->len == mname->len) {
+ zend_string *lowercase_name = zend_string_alloc(ce->name->len, 0);
+ zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
+ if (!memcmp(mname->val, lowercase_name->val, mname->len)) {
+ if (ce->constructor) {
+ zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val);
+ }
+ ce->constructor = fe;
+ fe->common.fn_flags |= ZEND_ACC_CTOR;
+ }
+ zend_string_release(lowercase_name);
+ }
+}
+/* }}} */
+
+static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
+{
+ zend_function *existing_fn = NULL;
+ zend_function *new_fn;
+
+ if ((existing_fn = zend_hash_find_ptr(&ce->function_table, key)) != NULL) {
+ if (existing_fn->common.scope == ce) {
+ /* members from the current class override trait methods */
+ /* use temporary *overriden HashTable to detect hidden conflict */
+ if (*overriden) {
+ if ((existing_fn = zend_hash_find_ptr(*overriden, key)) != NULL) {
+ if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ /* Make sure the trait method is compatible with previosly declared abstract method */
+ if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
+ zend_get_function_declaration(fn TSRMLS_CC)->val,
+ zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
+ }
+ } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ /* Make sure the abstract declaration is compatible with previous declaration */
+ if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
+ zend_get_function_declaration(fn TSRMLS_CC)->val,
+ zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
+ }
+ return;
+ }
+ }
+ } else {
+ ALLOC_HASHTABLE(*overriden);
+ zend_hash_init_ex(*overriden, 8, NULL, ptr_dtor, 0, 0);
+ }
+ zend_hash_update_mem(*overriden, key, fn, sizeof(zend_function));
+ return;
+ } else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ /* Make sure the trait method is compatible with previosly declared abstract method */
+ if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
+ zend_get_function_declaration(fn TSRMLS_CC)->val,
+ zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
+ }
+ } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ /* Make sure the abstract declaration is compatible with previous declaration */
+ if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
+ zend_get_function_declaration(fn TSRMLS_CC)->val,
+ zend_get_function_declaration(existing_fn TSRMLS_CC)->val);
+ }
+ return;
+ } else if ((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ /* two traits can't define the same non-abstract method */
+#if 1
+ zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s",
+ name, ce->name->val);
+#else /* TODO: better error message */
+ zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s",
+ fn->common.scope->name->val, fn->common.function_name->val,
+ ce->name->val, name,
+ existing_fn->common.scope->name->val, existing_fn->common.function_name->val);
+#endif
+ } else {
+ /* inherited members are overridden by members inserted by traits */
+ /* check whether the trait method fulfills the inheritance requirements */
+ do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
+ }
+ }
+
+ function_add_ref(fn);
+ new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_fn, fn, sizeof(zend_op_array));
+ fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
+ zend_add_magic_methods(ce, key, fn TSRMLS_CC);
+}
+/* }}} */
+
+static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /* {{{ */
+{
+ if ((fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+
+ fn->common.scope = ce;
+
+ if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ }
+ if (fn->op_array.static_variables) {
+ ce->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
+ }
+ }
+}
+/* }}} */
+
+static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, zend_class_entry *ce, HashTable **overriden, HashTable *exclude_table TSRMLS_DC) /* {{{ */
+{
+ zend_trait_alias *alias, **alias_ptr;
+ zend_string *lcname;
+ zend_function fn_copy;
+
+ /* apply aliases which are qualified with a class name, there should not be any ambiguity */
+ if (ce->trait_aliases) {
+ alias_ptr = ce->trait_aliases;
+ alias = *alias_ptr;
+ while (alias) {
+ /* Scope unset or equal to the function we compare to, and the alias applies to fn */
+ if (alias->alias != NULL
+ && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
+ && alias->trait_method->method_name->len == fnname->len
+ && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) {
+ fn_copy = *fn;
+
+ /* if it is 0, no modifieres has been changed */
+ if (alias->modifiers) {
+ fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
+ }
+
+ lcname = zend_string_alloc(alias->alias->len, 0);
+ zend_str_tolower_copy(lcname->val, alias->alias->val, alias->alias->len);
+ zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden TSRMLS_CC);
+ zend_string_release(lcname);
+
+ /* Record the trait from which this alias was resolved. */
+ if (!alias->trait_method->ce) {
+ alias->trait_method->ce = fn->common.scope;
+ }
+ }
+ alias_ptr++;
+ alias = *alias_ptr;
+ }
+ }
+
+ if (exclude_table == NULL || zend_hash_find(exclude_table, fnname) == NULL) {
+ /* is not in hashtable, thus, function is not to be excluded */
+ fn_copy = *fn;
+
+ /* apply aliases which have not alias name, just setting visibility */
+ if (ce->trait_aliases) {
+ alias_ptr = ce->trait_aliases;
+ alias = *alias_ptr;
+ while (alias) {
+ /* Scope unset or equal to the function we compare to, and the alias applies to fn */
+ if (alias->alias == NULL && alias->modifiers != 0
+ && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
+ && (alias->trait_method->method_name->len == fnname->len)
+ && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) {
+
+ fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
+
+ /** Record the trait from which this alias was resolved. */
+ if (!alias->trait_method->ce) {
+ alias->trait_method->ce = fn->common.scope;
+ }
+ }
+ alias_ptr++;
+ alias = *alias_ptr;
+ }
+ }
+
+ zend_add_trait_method(ce, fn->common.function_name->val, fnname, &fn_copy, overriden TSRMLS_CC);
+ }
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+/* }}} */
+
+static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC) /* {{{ */
+{
+ uint32_t i;
+
+ if ((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name->val);
+ }
+
+ for (i = 0; i < ce->num_traits; i++) {
+ if (ce->traits[i] == trait) {
+ return;
+ }
+ }
+ zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name->val, ce->name->val);
+}
+/* }}} */
+
+static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ size_t i, j = 0;
+ zend_trait_precedence *cur_precedence;
+ zend_trait_method_reference *cur_method_ref;
+ zend_string *lcname;
+ zend_bool method_exists;
+
+ /* resolve class references */
+ if (ce->trait_precedences) {
+ i = 0;
+ while ((cur_precedence = ce->trait_precedences[i])) {
+ /** Resolve classes for all precedence operations. */
+ if (cur_precedence->exclude_from_classes) {
+ cur_method_ref = cur_precedence->trait_method;
+ if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name,
+ ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
+ }
+ zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
+
+ /** Ensure that the prefered method is actually available. */
+ lcname = zend_string_alloc(cur_method_ref->method_name->len, 0);
+ zend_str_tolower_copy(lcname->val,
+ cur_method_ref->method_name->val,
+ cur_method_ref->method_name->len);
+ method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
+ lcname);
+ zend_string_free(lcname);
+ if (!method_exists) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "A precedence rule was defined for %s::%s but this method does not exist",
+ cur_method_ref->ce->name->val,
+ cur_method_ref->method_name->val);
+ }
+
+ /** With the other traits, we are more permissive.
+ We do not give errors for those. This allows to be more
+ defensive in such definitions.
+ However, we want to make sure that the insteadof declaration
+ is consistent in itself.
+ */
+ j = 0;
+ while (cur_precedence->exclude_from_classes[j].class_name) {
+ zend_string* class_name = cur_precedence->exclude_from_classes[j].class_name;
+
+ if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name->val);
+ }
+ zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce TSRMLS_CC);
+
+ /* make sure that the trait method is not from a class mentioned in
+ exclude_from_classes, for consistency */
+ if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i].ce) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Inconsistent insteadof definition. "
+ "The method %s is to be used from %s, but %s is also on the exclude list",
+ cur_method_ref->method_name->val,
+ cur_precedence->trait_method->ce->name->val,
+ cur_precedence->trait_method->ce->name->val);
+ }
+
+ zend_string_release(class_name);
+ j++;
+ }
+ }
+ i++;
+ }
+ }
+
+ if (ce->trait_aliases) {
+ i = 0;
+ while (ce->trait_aliases[i]) {
+ /** For all aliases with an explicit class name, resolve the class now. */
+ if (ce->trait_aliases[i]->trait_method->class_name) {
+ cur_method_ref = ce->trait_aliases[i]->trait_method;
+ if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
+ }
+ zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC);
+
+ /** And, ensure that the referenced method is resolvable, too. */
+ lcname = zend_string_alloc(cur_method_ref->method_name->len, 0);
+ zend_str_tolower_copy(lcname->val,
+ cur_method_ref->method_name->val,
+ cur_method_ref->method_name->len);
+ method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
+ lcname);
+ zend_string_free(lcname);
+
+ if (!method_exists) {
+ zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name->val, cur_method_ref->method_name->val);
+ }
+ }
+ i++;
+ }
+ }
+}
+/* }}} */
+
+static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_trait_precedence **precedences, zend_class_entry *trait) /* {{{ */
+{
+ size_t i = 0, j;
+
+ if (!precedences) {
+ return;
+ }
+ while (precedences[i]) {
+ if (precedences[i]->exclude_from_classes) {
+ j = 0;
+ while (precedences[i]->exclude_from_classes[j].ce) {
+ if (precedences[i]->exclude_from_classes[j].ce == trait) {
+ zend_string *lcname = zend_string_alloc(precedences[i]->trait_method->method_name->len, 0);
+
+ zend_str_tolower_copy(lcname->val,
+ precedences[i]->trait_method->method_name->val,
+ precedences[i]->trait_method->method_name->len);
+ if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) {
+ zend_string_release(lcname);
+ zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name->val, trait->name->val);
+ }
+ zend_string_release(lcname);
+ }
+ ++j;
+ }
+ }
+ ++i;
+ }
+}
+/* }}} */
+
+static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ uint32_t i;
+ HashTable *overriden = NULL;
+ zend_string *key;
+ zend_function *fn;
+
+ for (i = 0; i < ce->num_traits; i++) {
+ if (ce->trait_precedences) {
+ HashTable exclude_table;
+
+ /* TODO: revisit this start size, may be its not optimal */
+ zend_hash_init_ex(&exclude_table, 8, NULL, NULL, 0, 0);
+
+ zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
+
+ /* copies functions, applies defined aliasing, and excludes unused trait methods */
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
+ zend_traits_copy_functions(key, fn, ce, &overriden, &exclude_table TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+
+ zend_hash_destroy(&exclude_table);
+ } else {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->traits[i]->function_table, key, fn) {
+ zend_traits_copy_functions(key, fn, ce, &overriden, NULL TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+ }
+ }
+
+ ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) {
+ zend_fixup_trait_method(fn, ce);
+ } ZEND_HASH_FOREACH_END();
+
+ if (overriden) {
+ zend_hash_destroy(overriden);
+ FREE_HASHTABLE(overriden);
+ }
+}
+/* }}} */
+
+static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, zend_string *prop_name, zend_class_entry *coliding_ce) /* {{{ */
+{
+ size_t i;
+
+ if (coliding_ce == ce) {
+ for (i = 0; i < current_trait; i++) {
+ if (zend_hash_exists(&ce->traits[i]->properties_info, prop_name)) {
+ return ce->traits[i];
+ }
+ }
+ }
+
+ return coliding_ce;
+}
+/* }}} */
+
+static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ size_t i;
+ zend_property_info *property_info;
+ zend_property_info *coliding_prop;
+ zval compare_result;
+ zend_string* prop_name;
+ const char* class_name_unused;
+ zend_bool not_compatible;
+ zval* prop_value;
+ uint32_t flags;
+ zend_string *doc_comment;
+
+ /* In the following steps the properties are inserted into the property table
+ * for that, a very strict approach is applied:
+ * - check for compatibility, if not compatible with any property in class -> fatal
+ * - if compatible, then strict notice
+ */
+ for (i = 0; i < ce->num_traits; i++) {
+ ZEND_HASH_FOREACH_PTR(&ce->traits[i]->properties_info, property_info) {
+ /* first get the unmangeld name if necessary,
+ * then check whether the property is already there
+ */
+ flags = property_info->flags;
+ if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
+ prop_name = zend_string_copy(property_info->name);
+ } else {
+ const char *pname;
+ size_t pname_len;
+
+ /* for private and protected we need to unmangle the names */
+ zend_unmangle_property_name_ex(property_info->name,
+ &class_name_unused, &pname, &pname_len);
+ prop_name = zend_string_init(pname, pname_len, 0);
+ }
+
+ /* next: check for conflicts with current class */
+ if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
+ if (coliding_prop->flags & ZEND_ACC_SHADOW) {
+ zend_hash_del(&ce->properties_info, prop_name);
+ flags |= ZEND_ACC_CHANGED;
+ } else {
+ if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
+ == (flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) {
+ /* flags are identical, now the value needs to be checked */
+ if (flags & ZEND_ACC_STATIC) {
+ not_compatible = (FAILURE == compare_function(&compare_result,
+ &ce->default_static_members_table[coliding_prop->offset],
+ &ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
+ || (Z_LVAL(compare_result) != 0);
+ } else {
+ not_compatible = (FAILURE == compare_function(&compare_result,
+ &ce->default_properties_table[coliding_prop->offset],
+ &ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
+ || (Z_LVAL(compare_result) != 0);
+ }
+ } else {
+ /* the flags are not identical, thus, we assume properties are not compatible */
+ not_compatible = 1;
+ }
+
+ if (not_compatible) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
+ find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
+ property_info->ce->name->val,
+ prop_name->val,
+ ce->name->val);
+ } else {
+ zend_error(E_STRICT,
+ "%s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed",
+ find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
+ property_info->ce->name->val,
+ prop_name->val,
+ ce->name->val);
+ zend_string_release(prop_name);
+ continue;
+ }
+ }
+ }
+
+ /* property not found, so lets add it */
+ if (flags & ZEND_ACC_STATIC) {
+ prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
+ } else {
+ prop_value = &ce->traits[i]->default_properties_table[property_info->offset];
+ }
+ if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value);
+
+ doc_comment = property_info->doc_comment ? zend_string_copy(property_info->doc_comment) : NULL;
+ zend_declare_property_ex(ce, prop_name,
+ prop_value, flags,
+ doc_comment TSRMLS_CC);
+ zend_string_release(prop_name);
+ } ZEND_HASH_FOREACH_END();
+ }
+}
+/* }}} */
+
+static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+ int i = 0;
+ zend_trait_alias* cur_alias;
+ zend_string* lc_method_name;
+
+ if (ce->trait_aliases) {
+ while (ce->trait_aliases[i]) {
+ cur_alias = ce->trait_aliases[i];
+ /** The trait for this alias has not been resolved, this means, this
+ alias was not applied. Abort with an error. */
+ if (!cur_alias->trait_method->ce) {
+ if (cur_alias->alias) {
+ /** Plain old inconsistency/typo/bug */
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "An alias (%s) was defined for method %s(), but this method does not exist",
+ cur_alias->alias->val,
+ cur_alias->trait_method->method_name->val);
+ } else {
+ /** Here are two possible cases:
+ 1) this is an attempt to modifiy the visibility
+ of a method introduce as part of another alias.
+ Since that seems to violate the DRY principle,
+ we check against it and abort.
+ 2) it is just a plain old inconsitency/typo/bug
+ as in the case where alias is set. */
+
+ lc_method_name = zend_string_alloc(cur_alias->trait_method->method_name->len, 0);
+ zend_str_tolower_copy(
+ lc_method_name->val,
+ cur_alias->trait_method->method_name->val,
+ cur_alias->trait_method->method_name->len);
+ if (zend_hash_exists(&ce->function_table,
+ lc_method_name)) {
+ zend_string_free(lc_method_name);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error",
+ cur_alias->trait_method->method_name->val);
+ } else {
+ zend_string_free(lc_method_name);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "The modifiers of the trait method %s() are changed, but this method does not exist. Error",
+ cur_alias->trait_method->method_name->val);
+
+ }
+ }
+ }
+ i++;
+ }
+ }
+}
+/* }}} */
+
+ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC) /* {{{ */
+{
+
+ if (ce->num_traits <= 0) {
+ return;
+ }
+
+ /* complete initialization of trait strutures in ce */
+ zend_traits_init_trait_structures(ce TSRMLS_CC);
+
+ /* first care about all methods to be flattened into the class */
+ zend_do_traits_method_binding(ce TSRMLS_CC);
+
+ /* Aliases which have not been applied indicate typos/bugs. */
+ zend_do_check_for_inconsistent_traits_aliasing(ce TSRMLS_CC);
+
+ /* then flatten the properties into it, to, mostly to notfiy developer about problems */
+ zend_do_traits_property_binding(ce TSRMLS_CC);
+
+ /* verify that all abstract methods from traits have been implemented */
+ zend_verify_abstract_class(ce TSRMLS_CC);
+
+ /* now everything should be fine and an added ZEND_ACC_IMPLICIT_ABSTRACT_CLASS should be removed */
+ if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) {
+ ce->ce_flags -= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ }
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_dynamic_array.h b/Zend/zend_inheritance.h
index e69eb18768..647b492371 100644
--- a/Zend/zend_dynamic_array.h
+++ b/Zend/zend_inheritance.h
@@ -5,7 +5,7 @@
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
+ | that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
@@ -17,26 +17,25 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+#ifndef ZEND_INHERITANCE_H
+#define ZEND_INHERITANCE_H
-#ifndef ZEND_DYNAMIC_ARRAY_H
-#define ZEND_DYNAMIC_ARRAY_H
-
-typedef struct _dynamic_array {
- char *array;
- unsigned int element_size;
- unsigned int last_used;
- unsigned int allocated;
-} dynamic_array;
+#include "zend.h"
BEGIN_EXTERN_C()
-ZEND_API int zend_dynamic_array_init(dynamic_array *da, unsigned int element_size, unsigned int size);
-ZEND_API void *zend_dynamic_array_push(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_pop(dynamic_array *da);
-ZEND_API void *zend_dynamic_array_get_element(dynamic_array *da, unsigned int index);
+
+ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface TSRMLS_DC);
+ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC);
+
+ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *trait TSRMLS_DC);
+ZEND_API void zend_do_bind_traits(zend_class_entry *ce TSRMLS_DC);
+
+ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC);
+void zend_do_early_binding(TSRMLS_D);
+
END_EXTERN_C()
-#endif /* ZEND_DYNAMIC_ARRAY_H */
+#endif
/*
* Local variables:
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index 52585005b9..e60e58d2aa 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -56,7 +56,7 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
/* even if on_modify bails out, we have to continue on with restoring,
since there can be allocated variables that would be freed on MM shutdown
and would lead to memory corruption later ini entry is modified again */
- result = ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
+ result = ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
} zend_end_try();
}
if (stage == ZEND_INI_STAGE_RUNTIME && result == FAILURE) {
@@ -64,14 +64,12 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
return 1;
}
if (ini_entry->value != ini_entry->orig_value) {
- efree(ini_entry->value);
+ zend_string_release(ini_entry->value);
}
ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
ini_entry->modifiable = ini_entry->orig_modifiable;
ini_entry->modified = 0;
ini_entry->orig_value = NULL;
- ini_entry->orig_value_length = 0;
ini_entry->orig_modifiable = 0;
}
return 0;
@@ -86,9 +84,18 @@ static int zend_restore_ini_entry_wrapper(zval *el TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void _free_ptr(zval *zv) /* {{{ */
+static void free_ini_entry(zval *zv) /* {{{ */
{
- free(Z_PTR_P(zv));
+ zend_ini_entry *entry = (zend_ini_entry*)Z_PTR_P(zv);
+
+ zend_string_release(entry->name);
+ if (entry->value) {
+ zend_string_release(entry->value);
+ }
+ if (entry->orig_value) {
+ zend_string_release(entry->orig_value);
+ }
+ free(entry);
}
/* }}} */
@@ -102,7 +109,7 @@ ZEND_API int zend_ini_startup(TSRMLS_D) /* {{{ */
EG(ini_directives) = registered_zend_ini_directives;
EG(modified_ini_directives) = NULL;
EG(error_reporting_ini_entry) = NULL;
- zend_hash_init_ex(registered_zend_ini_directives, 128, NULL, _free_ptr, 1, 0);
+ zend_hash_init_ex(registered_zend_ini_directives, 128, NULL, free_ini_entry, 1, 0);
return SUCCESS;
}
/* }}} */
@@ -136,13 +143,32 @@ ZEND_API int zend_ini_deactivate(TSRMLS_D) /* {{{ */
/* }}} */
#ifdef ZTS
+static void copy_ini_entry(zval *zv) /* {{{ */
+{
+ zend_ini_entry *old_entry = (zend_ini_entry*)Z_PTR_P(zv);
+ zend_ini_entry *new_entry = pemalloc(sizeof(zend_ini_entry), 1);
+
+ Z_PTR_P(zv) = new_entry;
+ memcpy(new_entry, old_entry, sizeof(zend_ini_entry));
+ if (old_entry->name) {
+ new_entry->name = zend_string_init(old_entry->name->val, old_entry->name->len, 1);
+ }
+ if (old_entry->value) {
+ new_entry->value = zend_string_init(old_entry->value->val, old_entry->value->len, 1);
+ }
+ if (old_entry->orig_value) {
+ new_entry->orig_value = zend_string_init(old_entry->orig_value->val, old_entry->orig_value->len, 1);
+ }
+}
+/* }}} */
+
ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */
{
EG(modified_ini_directives) = NULL;
EG(error_reporting_ini_entry) = NULL;
EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0);
- zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL);
+ zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, free_ini_entry, 1, 0);
+ zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, copy_ini_entry);
return SUCCESS;
}
/* }}} */
@@ -177,13 +203,11 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D) /* {{{ */
/*
* Registration / unregistration
*/
-ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC) /* {{{ */
+ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC) /* {{{ */
{
- const zend_ini_entry *p = ini_entry;
- zend_ini_entry *hashed_ini_entry;
- zval default_value;
+ zend_ini_entry *p;
+ zval *default_value;
HashTable *directives = registered_zend_ini_directives;
- zend_bool config_directive_success = 0;
#ifdef ZTS
/* if we are called during the request, eg: from dl(),
@@ -199,26 +223,42 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu
}
#endif
- while (p->name) {
- config_directive_success = 0;
- if ((hashed_ini_entry = zend_hash_str_add_mem(directives, p->name, p->name_length, (void*)p, sizeof(zend_ini_entry))) == NULL) {
+ while (ini_entry->name) {
+ p = pemalloc(sizeof(zend_ini_entry), 1);
+ p->name = zend_string_init(ini_entry->name, ini_entry->name_length, 1);
+ p->on_modify = ini_entry->on_modify;
+ p->mh_arg1 = ini_entry->mh_arg1;
+ p->mh_arg2 = ini_entry->mh_arg2;
+ p->mh_arg3 = ini_entry->mh_arg3;
+ p->value = NULL;
+ p->orig_value = NULL;
+ p->displayer = ini_entry->displayer;
+ p->modifiable = ini_entry->modifiable;
+
+ p->orig_modifiable = 0;
+ p->modified = 0;
+ p->module_number = module_number;
+
+ if (zend_hash_add_ptr(directives, p->name, (void*)p) == NULL) {
+ if (p->name) {
+ zend_string_release(p->name);
+ }
zend_unregister_ini_entries(module_number TSRMLS_CC);
return FAILURE;
}
- hashed_ini_entry->module_number = module_number;
- if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) {
- if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRSIZE(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) {
- hashed_ini_entry->value = Z_STRVAL(default_value);
- hashed_ini_entry->value_length = Z_STRSIZE(default_value);
- config_directive_success = 1;
- }
- }
+ if (((default_value = zend_get_configuration_directive(p->name)) != NULL) &&
+ (!p->on_modify || p->on_modify(p, Z_STR_P(default_value), p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS)) {
+
+ p->value = zend_string_copy(Z_STR_P(default_value));
+ } else {
+ p->value = ini_entry->value ?
+ zend_string_init(ini_entry->value, ini_entry->value_length, 1) : NULL;
- if (!config_directive_success && hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
+ if (p->on_modify) {
+ p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
+ }
}
- p++;
+ ini_entry++;
}
return SUCCESS;
}
@@ -237,7 +277,7 @@ static int zend_ini_refresh_cache(zval *el, void *arg TSRMLS_DC) /* {{{ */
int stage = (int)(zend_intptr_t)arg;
if (p->on_modify) {
- p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
+ p->on_modify(p, p->value, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC);
}
return 0;
}
@@ -250,18 +290,43 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
/* }}} */
#endif
-ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */
+ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */
{
TSRMLS_FETCH();
- return zend_alter_ini_entry_ex(name, new_value, new_value_length, modify_type, stage, 0 TSRMLS_CC);
+ return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
+}
+/* }}} */
+
+ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage) /* {{{ */
+{
+ int ret;
+ zend_string *new_value;
+ TSRMLS_FETCH();
+
+ new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
+ ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
+ zend_string_release(new_value);
+ return ret;
+}
+/* }}} */
+
+ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
+{
+ int ret;
+ zend_string *new_value;
+
+ new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
+ ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, force_change TSRMLS_CC);
+ zend_string_release(new_value);
+ return ret;
}
/* }}} */
-ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
+ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
{
zend_ini_entry *ini_entry;
- char *duplicate;
+ zend_string *duplicate;
zend_bool modifiable;
zend_bool modified;
@@ -288,23 +353,21 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint ne
}
if (!modified) {
ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
ini_entry->orig_modifiable = modifiable;
ini_entry->modified = 1;
zend_hash_add_ptr(EG(modified_ini_directives), name, ini_entry);
}
- duplicate = estrndup(new_value, new_value_length);
+ duplicate = zend_string_copy(new_value);
if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
+ || ini_entry->on_modify(ini_entry, duplicate, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
if (modified && ini_entry->orig_value != ini_entry->value) { /* we already changed the value, free the changed value */
- efree(ini_entry->value);
+ zend_string_release(ini_entry->value);
}
ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
} else {
- efree(duplicate);
+ zend_string_release(duplicate);
return FAILURE;
}
@@ -352,7 +415,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
* Data retrieval
*/
-ZEND_API zend_int_t zend_ini_int(char *name, uint name_length, int orig) /* {{{ */
+ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
@@ -360,9 +423,9 @@ ZEND_API zend_int_t zend_ini_int(char *name, uint name_length, int orig) /* {{{
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
if (orig && ini_entry->modified) {
- return (ini_entry->orig_value ? ZEND_STRTOI(ini_entry->orig_value, NULL, 0) : 0);
+ return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value->val, NULL, 0) : 0);
} else {
- return (ini_entry->value ? ZEND_STRTOI(ini_entry->value, NULL, 0) : 0);
+ return (ini_entry->value ? ZEND_STRTOL(ini_entry->value->val, NULL, 0) : 0);
}
}
@@ -378,9 +441,9 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
if (orig && ini_entry->modified) {
- return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0);
+ return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value->val, NULL) : 0.0);
} else {
- return (double) (ini_entry->value ? zend_strtod(ini_entry->value, NULL) : 0.0);
+ return (double) (ini_entry->value ? zend_strtod(ini_entry->value->val, NULL) : 0.0);
}
}
@@ -400,9 +463,9 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b
}
if (orig && ini_entry->modified) {
- return ini_entry->orig_value;
+ return ini_entry->orig_value ? ini_entry->orig_value->val : NULL;
} else {
- return ini_entry->value;
+ return ini_entry->value ? ini_entry->value->val : NULL;
}
} else {
if (exists) {
@@ -470,29 +533,26 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */
{
- int value, tmp_value_len;
- char *tmp_value;
+ int value;
+ zend_string *tmp_value;
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );
- tmp_value_len = ini_entry->orig_value_length;
} else if (ini_entry->value) {
tmp_value = ini_entry->value;
- tmp_value_len = ini_entry->value_length;
} else {
tmp_value = NULL;
- tmp_value_len = 0;
}
if (tmp_value) {
- if (tmp_value_len == 4 && strcasecmp(tmp_value, "true") == 0) {
+ if (tmp_value->len == 4 && strcasecmp(tmp_value->val, "true") == 0) {
value = 1;
- } else if (tmp_value_len == 3 && strcasecmp(tmp_value, "yes") == 0) {
+ } else if (tmp_value->len == 3 && strcasecmp(tmp_value->val, "yes") == 0) {
value = 1;
- } else if (tmp_value_len == 2 && strcasecmp(tmp_value, "on") == 0) {
+ } else if (tmp_value->len == 2 && strcasecmp(tmp_value->val, "on") == 0) {
value = 1;
} else {
- value = atoi(tmp_value);
+ value = atoi(tmp_value->val);
}
} else {
value = 0;
@@ -511,9 +571,9 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */
char *value;
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -538,9 +598,9 @@ ZEND_INI_DISP(display_link_numbers) /* {{{ */
char *value;
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -569,17 +629,17 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
p = (zend_bool *) (base+(size_t) mh_arg1);
- if (new_value_length == 2 && strcasecmp("on", new_value) == 0) {
+ if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
*p = (zend_bool) 1;
}
- else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) {
+ else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
*p = (zend_bool) 1;
}
- else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) {
+ else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
*p = (zend_bool) 1;
}
else {
- *p = (zend_bool) atoi(new_value);
+ *p = (zend_bool) atoi(new_value->val);
}
return SUCCESS;
}
@@ -587,7 +647,7 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
{
- zend_int_t *p;
+ zend_long *p;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
@@ -596,16 +656,16 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
base = (char *) ts_resource(*((int *) mh_arg2));
#endif
- p = (zend_int_t *) (base+(size_t) mh_arg1);
+ p = (zend_long *) (base+(size_t) mh_arg1);
- *p = zend_atol(new_value, new_value_length);
+ *p = zend_atol(new_value->val, new_value->len);
return SUCCESS;
}
/* }}} */
ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
{
- zend_int_t *p, tmp;
+ zend_long *p, tmp;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
@@ -614,12 +674,12 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
base = (char *) ts_resource(*((int *) mh_arg2));
#endif
- tmp = zend_atol(new_value, new_value_length);
+ tmp = zend_atol(new_value->val, new_value->len);
if (tmp < 0) {
return FAILURE;
}
- p = (zend_int_t *) (base+(size_t) mh_arg1);
+ p = (zend_long *) (base+(size_t) mh_arg1);
*p = tmp;
return SUCCESS;
@@ -639,7 +699,7 @@ ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */
p = (double *) (base+(size_t) mh_arg1);
- *p = zend_strtod(new_value, NULL);
+ *p = zend_strtod(new_value->val, NULL);
return SUCCESS;
}
/* }}} */
@@ -657,7 +717,7 @@ ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */
p = (char **) (base+(size_t) mh_arg1);
- *p = new_value;
+ *p = new_value ? new_value->val : NULL;
return SUCCESS;
}
/* }}} */
@@ -673,13 +733,13 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */
base = (char *) ts_resource(*((int *) mh_arg2));
#endif
- if (new_value && !new_value[0]) {
+ if (new_value && !new_value->val[0]) {
return FAILURE;
}
p = (char **) (base+(size_t) mh_arg1);
- *p = new_value;
+ *p = new_value ? new_value->val : NULL;
return SUCCESS;
}
/* }}} */
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index 4ed2b99387..f0a72c5142 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -27,28 +27,37 @@
#define ZEND_INI_ALL (ZEND_INI_USER|ZEND_INI_PERDIR|ZEND_INI_SYSTEM)
-#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
+#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, zend_string *new_value, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC)
#define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type)
-struct _zend_ini_entry {
- int module_number;
- int modifiable;
- char *name; // TODO: convert into zend_string ???
- uint name_length;
+typedef struct _zend_ini_entry_def {
+ const char *name;
ZEND_INI_MH((*on_modify));
void *mh_arg1;
void *mh_arg2;
void *mh_arg3;
+ const char *value;
+ void (*displayer)(zend_ini_entry *ini_entry, int type);
+ int modifiable;
- char *value; // TODO: convert into zend_string ???
+ uint name_length;
uint value_length;
+} zend_ini_entry_def;
+
+struct _zend_ini_entry {
+ zend_string *name;
+ ZEND_INI_MH((*on_modify));
+ void *mh_arg1;
+ void *mh_arg2;
+ void *mh_arg3;
+ zend_string *value;
+ zend_string *orig_value;
+ void (*displayer)(zend_ini_entry *ini_entry, int type);
+ int modifiable;
- char *orig_value; // TODO: convert into zend_string ???
- uint orig_value_length;
int orig_modifiable;
int modified;
-
- void (*displayer)(zend_ini_entry *ini_entry, int type);
+ int module_number;
};
BEGIN_EXTERN_C()
@@ -61,15 +70,17 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D);
ZEND_API void zend_ini_sort_entries(TSRMLS_D);
-ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
+ZEND_API int zend_register_ini_entries(const zend_ini_entry_def *ini_entry, int module_number TSRMLS_DC);
ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC);
ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC);
-ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage);
-ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
+ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage);
+ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, int force_change TSRMLS_DC);
+ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage);
+ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value, size_t value_length, int modify_type, int stage, int force_change TSRMLS_DC);
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module);
-ZEND_API zend_int_t zend_ini_int(char *name, uint name_length, int orig);
+ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig);
ZEND_API double zend_ini_double(char *name, uint name_length, int orig);
ZEND_API char *zend_ini_string(char *name, uint name_length, int orig);
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists);
@@ -81,11 +92,11 @@ ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
ZEND_API ZEND_INI_DISP(display_link_numbers);
END_EXTERN_C()
-#define ZEND_INI_BEGIN() static const zend_ini_entry ini_entries[] = {
-#define ZEND_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, NULL } };
+#define ZEND_INI_BEGIN() static const zend_ini_entry_def ini_entries[] = {
+#define ZEND_INI_END() { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0} };
#define ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, displayer) \
- { 0, modifiable, name, sizeof(name)-1, on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
+ { name, on_modify, arg1, arg2, arg3, default_value, displayer, modifiable, sizeof(name)-1, sizeof(default_value)-1 },
#define ZEND_INI_ENTRY3(name, default_value, modifiable, on_modify, arg1, arg2, arg3) \
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, arg3, NULL)
@@ -124,12 +135,12 @@ END_EXTERN_C()
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
#endif
-#define INI_INT(name) zend_ini_int((name), sizeof(name)-1, 0)
+#define INI_INT(name) zend_ini_long((name), sizeof(name)-1, 0)
#define INI_FLT(name) zend_ini_double((name), sizeof(name)-1, 0)
#define INI_STR(name) zend_ini_string_ex((name), sizeof(name)-1, 0, NULL)
#define INI_BOOL(name) ((zend_bool) INI_INT(name))
-#define INI_ORIG_INT(name) zend_ini_int((name), sizeof(name)-1, 1)
+#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name)-1, 1)
#define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name)-1, 1)
#define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name)-1, 1)
#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 7981cff3d4..e343fcd92a 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -50,13 +50,13 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
int i_result;
int i_op1, i_op2;
int str_len;
- char str_result[MAX_LENGTH_OF_ZEND_INT];
+ char str_result[MAX_LENGTH_OF_LONG];
i_op1 = atoi(Z_STRVAL_P(op1));
- STR_FREE(Z_STR_P(op1));
+ zend_string_free(Z_STR_P(op1));
if (op2) {
i_op2 = atoi(Z_STRVAL_P(op2));
- STR_FREE(Z_STR_P(op2));
+ zend_string_free(Z_STR_P(op2));
} else {
i_op2 = 0;
}
@@ -99,11 +99,11 @@ static void zend_ini_init_string(zval *result)
*/
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
{
- int op1_len = Z_STRSIZE_P(op1);
- int length = op1_len + Z_STRSIZE_P(op2);
+ int op1_len = Z_STRLEN_P(op1);
+ int length = op1_len + Z_STRLEN_P(op2);
- ZVAL_NEW_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1));
- memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRSIZE_P(op2));
+ ZVAL_NEW_STR(result, zend_string_realloc(Z_STR_P(op1), length, 1));
+ memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[length] = 0;
}
/* }}} */
@@ -115,7 +115,7 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
zval *c, tmp;
/* If name contains ':' it is not a constant. Bug #26893. */
- if (!memchr(Z_STRVAL_P(name), ':', Z_STRSIZE_P(name))
+ if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
&& (c = zend_get_constant(Z_STR_P(name) TSRMLS_CC)) != 0) {
if (Z_TYPE_P(c) != IS_STRING) {
ZVAL_COPY_VALUE(&tmp, c);
@@ -126,11 +126,11 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
convert_to_string(&tmp);
c = &tmp;
}
- ZVAL_PSTRINGL(result, Z_STRVAL_P(c), Z_STRSIZE_P(c));
+ ZVAL_PSTRINGL(result, Z_STRVAL_P(c), Z_STRLEN_P(c));
if (c == &tmp) {
zval_dtor(&tmp);
}
- STR_FREE(Z_STR_P(name));
+ zend_string_free(Z_STR_P(name));
} else {
*result = *name;
}
@@ -141,14 +141,14 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
*/
static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
{
- zval curval;
+ zval *curval;
char *envvar;
/* Fetch configuration option value */
- if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name), &curval) == SUCCESS) {
- ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRSIZE(curval));
+ if ((curval = zend_get_configuration_directive(Z_STR_P(name))) != NULL) {
+ ZVAL_PSTRINGL(result, Z_STRVAL_P(curval), Z_STRLEN_P(curval));
/* ..or if not found, try ENV */
- } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRSIZE_P(name) TSRMLS_CC)) != NULL ||
+ } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
ZVAL_PSTRING(result, envvar);
} else {
@@ -264,6 +264,7 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int s
%token TC_QUOTED_STRING
%token BOOL_TRUE
%token BOOL_FALSE
+%token NULL_NULL
%token END_OF_LINE
%token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}'
%left '|' '&' '^'
@@ -282,26 +283,26 @@ statement:
printf("SECTION: [%s]\n", Z_STRVAL($2));
#endif
ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC);
- STR_RELEASE(Z_STR($2));
+ zend_string_release(Z_STR($2));
}
| TC_LABEL '=' string_or_value {
#if DEBUG_CFG_PARSER
printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3));
#endif
ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
- STR_RELEASE(Z_STR($1));
- STR_RELEASE(Z_STR($3));
+ zend_string_release(Z_STR($1));
+ zval_ptr_dtor(&$3);
}
| TC_OFFSET option_offset ']' '=' string_or_value {
#if DEBUG_CFG_PARSER
printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5));
#endif
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
- STR_RELEASE(Z_STR($1));
- STR_RELEASE(Z_STR($2));
- STR_RELEASE(Z_STR($5));
+ zend_string_release(Z_STR($1));
+ zend_string_release(Z_STR($2));
+ zval_ptr_dtor(&$5);
}
- | TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); STR_RELEASE(Z_STR($1)); }
+ | TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); zend_string_release(Z_STR($1)); }
| END_OF_LINE
;
@@ -314,6 +315,7 @@ string_or_value:
expr { $$ = $1; }
| BOOL_TRUE { $$ = $1; }
| BOOL_FALSE { $$ = $1; }
+ | NULL_NULL { $$ = $1; }
| END_OF_LINE { zend_ini_init_string(&$$); }
;
@@ -323,8 +325,8 @@ option_offset:
;
encapsed_list:
- encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
- | encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
+ encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
+ | encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
| /* empty */ { zend_ini_init_string(&$$); }
;
@@ -332,18 +334,18 @@ var_string_list_section:
cfg_var_ref { $$ = $1; }
| constant_literal { $$ = $1; }
| '"' encapsed_list '"' { $$ = $2; }
- | var_string_list_section cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
- | var_string_list_section constant_literal { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
- | var_string_list_section '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); STR_FREE(Z_STR($3)); }
+ | var_string_list_section cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
+ | var_string_list_section constant_literal { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
+ | var_string_list_section '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); }
;
var_string_list:
cfg_var_ref { $$ = $1; }
| constant_string { $$ = $1; }
| '"' encapsed_list '"' { $$ = $2; }
- | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
- | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); }
- | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); STR_FREE(Z_STR($3)); }
+ | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
+ | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
+ | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); }
;
expr:
@@ -357,7 +359,7 @@ expr:
;
cfg_var_ref:
- TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); STR_FREE(Z_STR($2)); }
+ TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); zend_string_free(Z_STR($2)); }
;
constant_literal:
diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c
index 981ab50100..2abf1140fc 100644
--- a/Zend/zend_ini_scanner.c
+++ b/Zend/zend_ini_scanner.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include "zend.h"
+#include "zend_API.h"
#include "zend_globals.h"
#include <zend_ini_parser.h>
#include "zend_ini_scanner.h"
@@ -134,12 +135,58 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
#define zend_ini_copy_value(retval, str, len) \
- ZVAL_NEW_STR(retval, STR_INIT(str, len, 1))
+ ZVAL_NEW_STR(retval, zend_string_init(str, len, 1))
-#define RETURN_TOKEN(type, str, len) { \
- zend_ini_copy_value(ini_lval, str, len); \
- return type; \
+#define RETURN_TOKEN(type, str, len) { \
+ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
+ zend_ini_copy_typed_value(ini_lval, type, str, len); \
+ } else { \
+ zend_ini_copy_value(ini_lval, str, len); \
+ } \
+ return type; \
+}
+
+static inline int convert_to_number(zval *retval, const char *str, const int str_len)
+{
+ zend_uchar type;
+ int overflow;
+ zend_long lval;
+ double dval;
+
+ if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow)) != 0) {
+ if (type == IS_LONG) {
+ ZVAL_LONG(retval, lval);
+ return SUCCESS;
+ } else if (type == IS_DOUBLE && !overflow) {
+ ZVAL_DOUBLE(retval, dval);
+ return SUCCESS;
+ }
+ }
+
+ return FAILURE;
+}
+
+static void zend_ini_copy_typed_value(zval *retval, const int type, const char *str, int len)
+{
+ switch (type) {
+ case BOOL_FALSE:
+ case BOOL_TRUE:
+ ZVAL_BOOL(retval, type == BOOL_TRUE);
+ break;
+
+ case NULL_NULL:
+ ZVAL_NULL(retval);
+ break;
+
+ case TC_NUMBER:
+ if (convert_to_number(retval, str, len) == SUCCESS) {
+ break;
+ }
+ /* intentional fall-through */
+ default:
+ zend_ini_copy_value(retval, str, len);
+ }
}
static void _yy_push_state(int new_state TSRMLS_DC)
@@ -171,7 +218,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
{
/* Sanity check */
- if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
+ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) {
zend_error(E_WARNING, "Invalid scanner mode");
return FAILURE;
}
@@ -269,7 +316,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
/* convert escape sequences */
s = t = Z_STRVAL_P(lval);
- end = s + Z_STRSIZE_P(lval);
+ end = s + Z_STRLEN_P(lval);
while (s < end) {
if (*s == '\\') {
@@ -288,7 +335,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
case '\\':
case '$':
*t++ = *s;
- Z_STRSIZE_P(lval)--;
+ Z_STRLEN_P(lval)--;
break;
default:
*t++ = '\\';
@@ -330,7 +377,7 @@ restart:
}
}
-#line 334 "Zend/zend_ini_scanner.c"
+#line 381 "Zend/zend_ini_scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -459,7 +506,7 @@ yy2:
yy3:
YYDEBUG(3, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 426 "Zend/zend_ini_scanner.l"
+#line 477 "Zend/zend_ini_scanner.l"
{ /* Get option name */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -469,37 +516,37 @@ yy3:
RETURN_TOKEN(TC_LABEL, yytext, yyleng);
}
-#line 473 "Zend/zend_ini_scanner.c"
+#line 520 "Zend/zend_ini_scanner.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy68;
+ goto yy73;
yy5:
YYDEBUG(5, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 572 "Zend/zend_ini_scanner.l"
+#line 623 "Zend/zend_ini_scanner.l"
{
/* eat whitespace */
goto restart;
}
-#line 487 "Zend/zend_ini_scanner.c"
+#line 534 "Zend/zend_ini_scanner.c"
yy6:
YYDEBUG(6, *YYCURSOR);
++YYCURSOR;
yy7:
YYDEBUG(7, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 577 "Zend/zend_ini_scanner.l"
+#line 628 "Zend/zend_ini_scanner.l"
{
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 499 "Zend/zend_ini_scanner.c"
+#line 546 "Zend/zend_ini_scanner.c"
yy8:
YYDEBUG(8, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy71;
+ if (yych == '\n') goto yy76;
goto yy7;
yy9:
YYDEBUG(9, *YYCURSOR);
@@ -508,20 +555,20 @@ yy9:
if (yych <= ' ') {
if (yych <= '\n') {
if (yych <= 0x08) goto yy26;
- if (yych <= '\t') goto yy67;
- goto yy71;
+ if (yych <= '\t') goto yy72;
+ goto yy76;
} else {
- if (yych == '\r') goto yy72;
+ if (yych == '\r') goto yy77;
if (yych <= 0x1F) goto yy26;
- goto yy69;
+ goto yy74;
}
} else {
if (yych <= ':') {
- if (yych == '#') goto yy58;
+ if (yych == '#') goto yy63;
goto yy26;
} else {
- if (yych <= ';') goto yy53;
- if (yych == '=') goto yy51;
+ if (yych <= ';') goto yy58;
+ if (yych == '=') goto yy56;
goto yy26;
}
}
@@ -530,16 +577,16 @@ yy10:
++YYCURSOR;
YYDEBUG(11, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 500 "Zend/zend_ini_scanner.l"
+#line 551 "Zend/zend_ini_scanner.l"
{ /* Disallow these chars outside option values */
return yytext[0];
}
-#line 538 "Zend/zend_ini_scanner.c"
+#line 585 "Zend/zend_ini_scanner.c"
yy12:
YYDEBUG(12, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy59;
+ goto yy64;
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -548,23 +595,23 @@ yy14:
YYDEBUG(14, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy54;
+ goto yy59;
YYDEBUG(15, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 600 "Zend/zend_ini_scanner.l"
+#line 651 "Zend/zend_ini_scanner.l"
{
return 0;
}
-#line 559 "Zend/zend_ini_scanner.c"
+#line 606 "Zend/zend_ini_scanner.c"
yy16:
YYDEBUG(16, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy52;
+ goto yy57;
yy17:
YYDEBUG(17, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 436 "Zend/zend_ini_scanner.l"
+#line 487 "Zend/zend_ini_scanner.l"
{ /* Start option value */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
yy_push_state(ST_RAW TSRMLS_CC);
@@ -573,12 +620,12 @@ yy17:
}
return '=';
}
-#line 577 "Zend/zend_ini_scanner.c"
+#line 624 "Zend/zend_ini_scanner.c"
yy18:
YYDEBUG(18, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy48;
- if (yych == 'a') goto yy48;
+ if (yych == 'A') goto yy53;
+ if (yych == 'a') goto yy53;
goto yy26;
yy19:
YYDEBUG(19, *YYCURSOR);
@@ -629,7 +676,7 @@ yy23:
++YYCURSOR;
YYDEBUG(24, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 355 "Zend/zend_ini_scanner.l"
+#line 402 "Zend/zend_ini_scanner.l"
{ /* Section start */
/* Enter section data lookup state */
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
@@ -639,7 +686,7 @@ yy23:
}
return TC_SECTION;
}
-#line 643 "Zend/zend_ini_scanner.c"
+#line 690 "Zend/zend_ini_scanner.c"
yy25:
YYDEBUG(25, *YYCURSOR);
++YYCURSOR;
@@ -669,7 +716,7 @@ yy28:
}
YYDEBUG(30, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 380 "Zend/zend_ini_scanner.l"
+#line 427 "Zend/zend_ini_scanner.l"
{ /* Start of option with offset */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -682,7 +729,7 @@ yy28:
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
}
-#line 686 "Zend/zend_ini_scanner.c"
+#line 733 "Zend/zend_ini_scanner.c"
yy31:
YYDEBUG(31, *YYCURSOR);
++YYCURSOR;
@@ -728,11 +775,11 @@ yy31:
yy33:
YYDEBUG(33, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 418 "Zend/zend_ini_scanner.l"
+#line 465 "Zend/zend_ini_scanner.l"
{ /* TRUE value (when used outside option value/offset this causes parse error!) */
RETURN_TOKEN(BOOL_TRUE, "1", 1);
}
-#line 736 "Zend/zend_ini_scanner.c"
+#line 783 "Zend/zend_ini_scanner.c"
yy34:
YYDEBUG(34, *YYCURSOR);
++YYCURSOR;
@@ -802,11 +849,11 @@ yy39:
yy41:
YYDEBUG(41, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 422 "Zend/zend_ini_scanner.l"
+#line 469 "Zend/zend_ini_scanner.l"
{ /* FALSE value (when used outside option value/offset this causes parse error!)*/
RETURN_TOKEN(BOOL_FALSE, "", 0);
}
-#line 810 "Zend/zend_ini_scanner.c"
+#line 857 "Zend/zend_ini_scanner.c"
yy42:
YYDEBUG(42, *YYCURSOR);
++YYCURSOR;
@@ -849,14 +896,14 @@ yy44:
} else {
if (yych == '=') goto yy41;
if (yych <= 'M') goto yy26;
- goto yy47;
+ goto yy52;
}
} else {
if (yych <= 'm') {
if (yych == '^') goto yy41;
goto yy26;
} else {
- if (yych <= 'n') goto yy47;
+ if (yych <= 'n') goto yy52;
if (yych <= 'z') goto yy26;
if (yych <= '~') goto yy41;
goto yy26;
@@ -871,205 +918,262 @@ yy45:
yy46:
YYDEBUG(46, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy39;
- if (yych == 'l') goto yy39;
- goto yy26;
+ if (yych == 'L') goto yy47;
+ if (yych != 'l') goto yy26;
yy47:
YYDEBUG(47, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(48, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy25;
+ if (yych <= '\t') goto yy50;
+ } else {
+ if (yych != '\r') goto yy25;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= ' ') goto yy47;
+ if (yych >= '#') goto yy25;
+ } else {
+ if (yych == '%') goto yy25;
+ }
+ }
+ } else {
+ if (yych <= '=') {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy25;
+ if (yych >= '*') goto yy25;
+ } else {
+ if (yych == '<') goto yy25;
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych == '[') goto yy28;
+ goto yy25;
+ } else {
+ if (yych <= '^') goto yy49;
+ if (yych <= 'z') goto yy25;
+ if (yych >= 0x7F) goto yy25;
+ }
+ }
+ }
+yy49:
+ YYDEBUG(49, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 473 "Zend/zend_ini_scanner.l"
+ {
+ RETURN_TOKEN(NULL_NULL, "", 0);
+}
+#line 972 "Zend/zend_ini_scanner.c"
+yy50:
+ YYDEBUG(50, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(51, *YYCURSOR);
+ if (yych == '\t') goto yy50;
+ if (yych == ' ') goto yy50;
+ goto yy49;
+yy52:
+ YYDEBUG(52, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'E') goto yy39;
if (yych == 'e') goto yy39;
goto yy26;
-yy48:
- YYDEBUG(48, *YYCURSOR);
+yy53:
+ YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy49;
+ if (yych == 'L') goto yy54;
if (yych != 'l') goto yy26;
-yy49:
- YYDEBUG(49, *YYCURSOR);
+yy54:
+ YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy50;
+ if (yych == 'S') goto yy55;
if (yych != 's') goto yy26;
-yy50:
- YYDEBUG(50, *YYCURSOR);
+yy55:
+ YYDEBUG(55, *YYCURSOR);
yych = *++YYCURSOR;
if (yych == 'E') goto yy39;
if (yych == 'e') goto yy39;
goto yy26;
-yy51:
- YYDEBUG(51, *YYCURSOR);
+yy56:
+ YYDEBUG(56, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy52:
- YYDEBUG(52, *YYCURSOR);
- if (yych == '\t') goto yy51;
- if (yych == ' ') goto yy51;
+yy57:
+ YYDEBUG(57, *YYCURSOR);
+ if (yych == '\t') goto yy56;
+ if (yych == ' ') goto yy56;
goto yy17;
-yy53:
- YYDEBUG(53, *YYCURSOR);
+yy58:
+ YYDEBUG(58, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy54:
- YYDEBUG(54, *YYCURSOR);
+yy59:
+ YYDEBUG(59, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy53;
+ goto yy58;
}
- if (yych >= '\r') goto yy57;
-yy55:
- YYDEBUG(55, *YYCURSOR);
+ if (yych >= '\r') goto yy62;
+yy60:
+ YYDEBUG(60, *YYCURSOR);
++YYCURSOR;
-yy56:
- YYDEBUG(56, *YYCURSOR);
+yy61:
+ YYDEBUG(61, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 582 "Zend/zend_ini_scanner.l"
+#line 633 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 933 "Zend/zend_ini_scanner.c"
-yy57:
- YYDEBUG(57, *YYCURSOR);
+#line 1037 "Zend/zend_ini_scanner.c"
+yy62:
+ YYDEBUG(62, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy55;
- goto yy56;
-yy58:
- YYDEBUG(58, *YYCURSOR);
+ if (yych == '\n') goto yy60;
+ goto yy61;
+yy63:
+ YYDEBUG(63, *YYCURSOR);
yyaccept = 1;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy59:
- YYDEBUG(59, *YYCURSOR);
+yy64:
+ YYDEBUG(64, *YYCURSOR);
if (yych <= '\'') {
if (yych <= ' ') {
if (yych <= '\n') {
- if (yych <= 0x08) goto yy58;
- if (yych >= '\n') goto yy64;
+ if (yych <= 0x08) goto yy63;
+ if (yych >= '\n') goto yy69;
} else {
- if (yych == '\r') goto yy66;
- goto yy58;
+ if (yych == '\r') goto yy71;
+ goto yy63;
}
} else {
if (yych <= '$') {
- if (yych == '#') goto yy58;
+ if (yych == '#') goto yy63;
} else {
- if (yych != '&') goto yy58;
+ if (yych != '&') goto yy63;
}
}
} else {
if (yych <= 'Z') {
if (yych <= ';') {
- if (yych <= ')') goto yy60;
- if (yych <= ':') goto yy58;
+ if (yych <= ')') goto yy65;
+ if (yych <= ':') goto yy63;
} else {
- if (yych != '=') goto yy58;
+ if (yych != '=') goto yy63;
}
} else {
if (yych <= '^') {
- if (yych <= '[') goto yy62;
- if (yych <= ']') goto yy58;
+ if (yych <= '[') goto yy67;
+ if (yych <= ']') goto yy63;
} else {
- if (yych <= 'z') goto yy58;
- if (yych >= 0x7F) goto yy58;
+ if (yych <= 'z') goto yy63;
+ if (yych >= 0x7F) goto yy63;
}
}
}
-yy60:
- YYDEBUG(60, *YYCURSOR);
+yy65:
+ YYDEBUG(65, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(61, *YYCURSOR);
- if (yych == '\n') goto yy64;
- if (yych == '\r') goto yy66;
- goto yy60;
-yy62:
- YYDEBUG(62, *YYCURSOR);
+ YYDEBUG(66, *YYCURSOR);
+ if (yych == '\n') goto yy69;
+ if (yych == '\r') goto yy71;
+ goto yy65;
+yy67:
+ YYDEBUG(67, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(63, *YYCURSOR);
+ YYDEBUG(68, *YYCURSOR);
if (yych <= '\f') {
- if (yych <= 0x08) goto yy60;
- if (yych <= '\t') goto yy62;
- if (yych >= '\v') goto yy60;
+ if (yych <= 0x08) goto yy65;
+ if (yych <= '\t') goto yy67;
+ if (yych >= '\v') goto yy65;
} else {
- if (yych <= '\r') goto yy66;
- if (yych == ' ') goto yy62;
- goto yy60;
+ if (yych <= '\r') goto yy71;
+ if (yych == ' ') goto yy67;
+ goto yy65;
}
-yy64:
- YYDEBUG(64, *YYCURSOR);
+yy69:
+ YYDEBUG(69, *YYCURSOR);
++YYCURSOR;
-yy65:
- YYDEBUG(65, *YYCURSOR);
+yy70:
+ YYDEBUG(70, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 588 "Zend/zend_ini_scanner.l"
+#line 639 "Zend/zend_ini_scanner.l"
{ /* #Comment */
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 1019 "Zend/zend_ini_scanner.c"
-yy66:
- YYDEBUG(66, *YYCURSOR);
+#line 1123 "Zend/zend_ini_scanner.c"
+yy71:
+ YYDEBUG(71, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy64;
- goto yy65;
-yy67:
- YYDEBUG(67, *YYCURSOR);
+ if (yych == '\n') goto yy69;
+ goto yy70;
+yy72:
+ YYDEBUG(72, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy68:
- YYDEBUG(68, *YYCURSOR);
+yy73:
+ YYDEBUG(73, *YYCURSOR);
if (yych <= ' ') {
if (yych <= '\n') {
if (yych <= 0x08) goto yy5;
- if (yych <= '\t') goto yy67;
- goto yy71;
+ if (yych <= '\t') goto yy72;
+ goto yy76;
} else {
- if (yych == '\r') goto yy72;
+ if (yych == '\r') goto yy77;
if (yych <= 0x1F) goto yy5;
- goto yy67;
+ goto yy72;
}
} else {
if (yych <= ':') {
- if (yych == '#') goto yy60;
+ if (yych == '#') goto yy65;
goto yy5;
} else {
- if (yych <= ';') goto yy53;
- if (yych == '=') goto yy51;
+ if (yych <= ';') goto yy58;
+ if (yych == '=') goto yy56;
goto yy5;
}
}
-yy69:
- YYDEBUG(69, *YYCURSOR);
+yy74:
+ YYDEBUG(74, *YYCURSOR);
yyaccept = 1;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(70, *YYCURSOR);
+ YYDEBUG(75, *YYCURSOR);
if (yych <= '&') {
if (yych <= 0x1F) {
if (yych <= '\n') {
if (yych <= 0x08) goto yy25;
- if (yych <= '\t') goto yy67;
+ if (yych <= '\t') goto yy72;
} else {
- if (yych == '\r') goto yy72;
+ if (yych == '\r') goto yy77;
goto yy25;
}
} else {
if (yych <= '#') {
- if (yych <= ' ') goto yy69;
+ if (yych <= ' ') goto yy74;
if (yych <= '"') goto yy3;
- goto yy58;
+ goto yy63;
} else {
if (yych == '%') goto yy25;
goto yy3;
@@ -1082,9 +1186,9 @@ yy69:
if (yych <= ')') goto yy3;
goto yy25;
} else {
- if (yych <= ';') goto yy53;
+ if (yych <= ';') goto yy58;
if (yych <= '<') goto yy25;
- goto yy51;
+ goto yy56;
}
} else {
if (yych <= ']') {
@@ -1098,14 +1202,14 @@ yy69:
}
}
}
-yy71:
- YYDEBUG(71, *YYCURSOR);
+yy76:
+ YYDEBUG(76, *YYCURSOR);
yych = *++YYCURSOR;
goto yy7;
-yy72:
- YYDEBUG(72, *YYCURSOR);
+yy77:
+ YYDEBUG(77, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy71;
+ if ((yych = *YYCURSOR) == '\n') goto yy76;
goto yy7;
}
/* *********************************** */
@@ -1145,17 +1249,17 @@ yyc_ST_DOUBLE_QUOTES:
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
- YYDEBUG(73, *YYCURSOR);
+ YYDEBUG(78, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
- if (yych == '"') goto yy77;
- if (yych == '$') goto yy79;
- YYDEBUG(75, *YYCURSOR);
+ if (yych == '"') goto yy82;
+ if (yych == '$') goto yy84;
+ YYDEBUG(80, *YYCURSOR);
++YYCURSOR;
-yy76:
- YYDEBUG(76, *YYCURSOR);
+yy81:
+ YYDEBUG(81, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 532 "Zend/zend_ini_scanner.l"
+#line 583 "Zend/zend_ini_scanner.l"
{ /* Escape double quoted string contents */
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1191,46 +1295,46 @@ yy76:
zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
return TC_QUOTED_STRING;
}
-#line 1195 "Zend/zend_ini_scanner.c"
-yy77:
- YYDEBUG(77, *YYCURSOR);
+#line 1299 "Zend/zend_ini_scanner.c"
+yy82:
+ YYDEBUG(82, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy83;
-yy78:
- YYDEBUG(78, *YYCURSOR);
+ goto yy88;
+yy83:
+ YYDEBUG(83, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 527 "Zend/zend_ini_scanner.l"
+#line 578 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string ends */
yy_pop_state(TSRMLS_C);
return '"';
}
-#line 1209 "Zend/zend_ini_scanner.c"
-yy79:
- YYDEBUG(79, *YYCURSOR);
+#line 1313 "Zend/zend_ini_scanner.c"
+yy84:
+ YYDEBUG(84, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '{') goto yy76;
- YYDEBUG(80, *YYCURSOR);
+ if (yych != '{') goto yy81;
+ YYDEBUG(85, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(81, *YYCURSOR);
+ YYDEBUG(86, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 398 "Zend/zend_ini_scanner.l"
+#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
return TC_DOLLAR_CURLY;
}
-#line 1223 "Zend/zend_ini_scanner.c"
-yy82:
- YYDEBUG(82, *YYCURSOR);
+#line 1327 "Zend/zend_ini_scanner.c"
+yy87:
+ YYDEBUG(87, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy83:
- YYDEBUG(83, *YYCURSOR);
+yy88:
+ YYDEBUG(88, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy82;
+ goto yy87;
}
- goto yy78;
+ goto yy83;
}
/* *********************************** */
yyc_ST_OFFSET:
@@ -1269,496 +1373,496 @@ yyc_ST_OFFSET:
66, 66, 66, 66, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66,
};
- YYDEBUG(84, *YYCURSOR);
+ YYDEBUG(89, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '-') {
if (yych <= ' ') {
if (yych <= '\n') {
- if (yych <= 0x08) goto yy86;
- if (yych <= '\t') goto yy88;
- goto yy89;
+ if (yych <= 0x08) goto yy91;
+ if (yych <= '\t') goto yy93;
+ goto yy94;
} else {
- if (yych == '\r') goto yy89;
- if (yych >= ' ') goto yy88;
+ if (yych == '\r') goto yy94;
+ if (yych >= ' ') goto yy93;
}
} else {
if (yych <= '$') {
- if (yych == '"') goto yy91;
- if (yych >= '$') goto yy93;
+ if (yych == '"') goto yy96;
+ if (yych >= '$') goto yy98;
} else {
- if (yych == '\'') goto yy94;
- if (yych >= '-') goto yy95;
+ if (yych == '\'') goto yy99;
+ if (yych >= '-') goto yy100;
}
}
} else {
if (yych <= 'Z') {
if (yych <= '9') {
- if (yych <= '.') goto yy96;
- if (yych >= '0') goto yy97;
+ if (yych <= '.') goto yy101;
+ if (yych >= '0') goto yy102;
} else {
- if (yych == ';') goto yy89;
- if (yych >= 'A') goto yy99;
+ if (yych == ';') goto yy94;
+ if (yych >= 'A') goto yy104;
}
} else {
if (yych <= '^') {
- if (yych <= '[') goto yy86;
- if (yych <= '\\') goto yy101;
- if (yych <= ']') goto yy102;
+ if (yych <= '[') goto yy91;
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy107;
} else {
- if (yych == '`') goto yy86;
- if (yych <= 'z') goto yy99;
+ if (yych == '`') goto yy91;
+ if (yych <= 'z') goto yy104;
}
}
}
-yy86:
- YYDEBUG(86, *YYCURSOR);
+yy91:
+ YYDEBUG(91, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy105;
-yy87:
- YYDEBUG(87, *YYCURSOR);
+ goto yy110;
+yy92:
+ YYDEBUG(92, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 518 "Zend/zend_ini_scanner.l"
+#line 569 "Zend/zend_ini_scanner.l"
{ /* Get rest as section/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
-#line 1327 "Zend/zend_ini_scanner.c"
-yy88:
- YYDEBUG(88, *YYCURSOR);
+#line 1431 "Zend/zend_ini_scanner.c"
+yy93:
+ YYDEBUG(93, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy131;
+ goto yy136;
}
- if (yych == '"') goto yy133;
- if (yych == ']') goto yy134;
- goto yy105;
-yy89:
- YYDEBUG(89, *YYCURSOR);
+ if (yych == '"') goto yy138;
+ if (yych == ']') goto yy139;
+ goto yy110;
+yy94:
+ YYDEBUG(94, *YYCURSOR);
++YYCURSOR;
-yy90:
- YYDEBUG(90, *YYCURSOR);
+yy95:
+ YYDEBUG(95, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 600 "Zend/zend_ini_scanner.l"
+#line 651 "Zend/zend_ini_scanner.l"
{
return 0;
}
-#line 1348 "Zend/zend_ini_scanner.c"
-yy91:
- YYDEBUG(91, *YYCURSOR);
+#line 1452 "Zend/zend_ini_scanner.c"
+yy96:
+ YYDEBUG(96, *YYCURSOR);
++YYCURSOR;
-yy92:
- YYDEBUG(92, *YYCURSOR);
+yy97:
+ YYDEBUG(97, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 522 "Zend/zend_ini_scanner.l"
+#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
return '"';
}
-#line 1360 "Zend/zend_ini_scanner.c"
-yy93:
- YYDEBUG(93, *YYCURSOR);
+#line 1464 "Zend/zend_ini_scanner.c"
+yy98:
+ YYDEBUG(98, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy90;
- if (yych <= '[') goto yy104;
- goto yy109;
+ if (yych <= 0x00) goto yy95;
+ if (yych <= '[') goto yy109;
+ goto yy114;
} else {
- if (yych == '{') goto yy129;
- goto yy104;
+ if (yych == '{') goto yy134;
+ goto yy109;
}
-yy94:
- YYDEBUG(94, *YYCURSOR);
+yy99:
+ YYDEBUG(99, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy125;
+ goto yy130;
}
- goto yy90;
-yy95:
- YYDEBUG(95, *YYCURSOR);
+ goto yy95;
+yy100:
+ YYDEBUG(100, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy123;
- goto yy105;
-yy96:
- YYDEBUG(96, *YYCURSOR);
+ if (yych <= '/') goto yy110;
+ if (yych <= '9') goto yy128;
+ goto yy110;
+yy101:
+ YYDEBUG(101, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy121;
- goto yy105;
-yy97:
- YYDEBUG(97, *YYCURSOR);
+ if (yych <= '/') goto yy110;
+ if (yych <= '9') goto yy126;
+ goto yy110;
+yy102:
+ YYDEBUG(102, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '\'') {
if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy105;
+ if (yych == '\n') goto yy103;
+ if (yych <= '\f') goto yy110;
} else {
- if (yych == '"') goto yy98;
- if (yych <= '&') goto yy105;
+ if (yych == '"') goto yy103;
+ if (yych <= '&') goto yy110;
}
} else {
if (yych <= '9') {
- if (yych == '.') goto yy117;
- if (yych <= '/') goto yy105;
- goto yy119;
+ if (yych == '.') goto yy122;
+ if (yych <= '/') goto yy110;
+ goto yy124;
} else {
if (yych <= ';') {
- if (yych <= ':') goto yy105;
+ if (yych <= ':') goto yy110;
} else {
- if (yych != ']') goto yy105;
+ if (yych != ']') goto yy110;
}
}
}
-yy98:
- YYDEBUG(98, *YYCURSOR);
+yy103:
+ YYDEBUG(103, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 496 "Zend/zend_ini_scanner.l"
+#line 547 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
-#line 1426 "Zend/zend_ini_scanner.c"
-yy99:
- YYDEBUG(99, *YYCURSOR);
+#line 1530 "Zend/zend_ini_scanner.c"
+yy104:
+ YYDEBUG(104, *YYCURSOR);
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy115;
+ goto yy120;
}
if (yych <= '"') {
if (yych <= '\f') {
- if (yych != '\n') goto yy105;
+ if (yych != '\n') goto yy110;
} else {
- if (yych <= '\r') goto yy100;
- if (yych <= '!') goto yy105;
+ if (yych <= '\r') goto yy105;
+ if (yych <= '!') goto yy110;
}
} else {
if (yych <= ':') {
- if (yych != '\'') goto yy105;
+ if (yych != '\'') goto yy110;
} else {
- if (yych <= ';') goto yy100;
- if (yych != ']') goto yy105;
+ if (yych <= ';') goto yy105;
+ if (yych != ']') goto yy110;
}
}
-yy100:
- YYDEBUG(100, *YYCURSOR);
+yy105:
+ YYDEBUG(105, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 492 "Zend/zend_ini_scanner.l"
+#line 543 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
-#line 1456 "Zend/zend_ini_scanner.c"
-yy101:
- YYDEBUG(101, *YYCURSOR);
+#line 1560 "Zend/zend_ini_scanner.c"
+yy106:
+ YYDEBUG(106, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy104;
-yy102:
- YYDEBUG(102, *YYCURSOR);
+ goto yy109;
+yy107:
+ YYDEBUG(107, *YYCURSOR);
++YYCURSOR;
-yy103:
- YYDEBUG(103, *YYCURSOR);
+yy108:
+ YYDEBUG(108, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 393 "Zend/zend_ini_scanner.l"
+#line 440 "Zend/zend_ini_scanner.l"
{ /* End of section or an option offset */
BEGIN(INITIAL);
return ']';
}
-#line 1472 "Zend/zend_ini_scanner.c"
-yy104:
- YYDEBUG(104, *YYCURSOR);
+#line 1576 "Zend/zend_ini_scanner.c"
+yy109:
+ YYDEBUG(109, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy105:
- YYDEBUG(105, *YYCURSOR);
+yy110:
+ YYDEBUG(110, *YYCURSOR);
if (yybm[0+yych] & 2) {
- goto yy104;
+ goto yy109;
}
- if (yych == '$') goto yy107;
- if (yych != '\\') goto yy87;
-yy106:
- YYDEBUG(106, *YYCURSOR);
+ if (yych == '$') goto yy112;
+ if (yych != '\\') goto yy92;
+yy111:
+ YYDEBUG(111, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- goto yy104;
-yy107:
- YYDEBUG(107, *YYCURSOR);
+ goto yy109;
+yy112:
+ YYDEBUG(112, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy108;
- if (yych <= '[') goto yy104;
- goto yy109;
+ if (yych <= 0x00) goto yy113;
+ if (yych <= '[') goto yy109;
+ goto yy114;
} else {
- if (yych != '{') goto yy104;
+ if (yych != '{') goto yy109;
}
-yy108:
- YYDEBUG(108, *YYCURSOR);
+yy113:
+ YYDEBUG(113, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 1) {
if (yyaccept <= 0) {
- goto yy87;
+ goto yy92;
} else {
- goto yy90;
+ goto yy95;
}
} else {
if (yyaccept <= 2) {
- goto yy98;
+ goto yy103;
} else {
- goto yy100;
+ goto yy105;
}
}
-yy109:
- YYDEBUG(109, *YYCURSOR);
+yy114:
+ YYDEBUG(114, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yybm[0+yych] & 4) {
- goto yy110;
+ goto yy115;
}
- if (yych == '\\') goto yy112;
- goto yy104;
-yy110:
- YYDEBUG(110, *YYCURSOR);
+ if (yych == '\\') goto yy117;
+ goto yy109;
+yy115:
+ YYDEBUG(115, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(111, *YYCURSOR);
+ YYDEBUG(116, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy110;
+ goto yy115;
}
- if (yych == '\\') goto yy114;
- goto yy104;
-yy112:
- YYDEBUG(112, *YYCURSOR);
+ if (yych == '\\') goto yy119;
+ goto yy109;
+yy117:
+ YYDEBUG(117, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(113, *YYCURSOR);
+ YYDEBUG(118, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy110;
+ goto yy115;
}
- if (yych == '\\') goto yy112;
- goto yy104;
-yy114:
- YYDEBUG(114, *YYCURSOR);
+ if (yych == '\\') goto yy117;
+ goto yy109;
+yy119:
+ YYDEBUG(119, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yybm[0+yych] & 4) {
- goto yy110;
+ goto yy115;
}
- if (yych == '\\') goto yy112;
- goto yy104;
-yy115:
- YYDEBUG(115, *YYCURSOR);
+ if (yych == '\\') goto yy117;
+ goto yy109;
+yy120:
+ YYDEBUG(120, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(116, *YYCURSOR);
+ YYDEBUG(121, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy115;
+ goto yy120;
}
if (yych <= '$') {
if (yych <= '\r') {
- if (yych == '\n') goto yy100;
- if (yych <= '\f') goto yy104;
- goto yy100;
+ if (yych == '\n') goto yy105;
+ if (yych <= '\f') goto yy109;
+ goto yy105;
} else {
- if (yych == '"') goto yy100;
- if (yych <= '#') goto yy104;
- goto yy107;
+ if (yych == '"') goto yy105;
+ if (yych <= '#') goto yy109;
+ goto yy112;
}
} else {
if (yych <= ';') {
- if (yych == '\'') goto yy100;
- if (yych <= ':') goto yy104;
- goto yy100;
+ if (yych == '\'') goto yy105;
+ if (yych <= ':') goto yy109;
+ goto yy105;
} else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy100;
- goto yy104;
+ if (yych <= '[') goto yy109;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy105;
+ goto yy109;
}
}
-yy117:
- YYDEBUG(117, *YYCURSOR);
+yy122:
+ YYDEBUG(122, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(118, *YYCURSOR);
+ YYDEBUG(123, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy117;
+ goto yy122;
}
if (yych <= '$') {
if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
+ if (yych == '\n') goto yy103;
+ if (yych <= '\f') goto yy109;
+ goto yy103;
} else {
- if (yych == '"') goto yy98;
- if (yych <= '#') goto yy104;
- goto yy107;
+ if (yych == '"') goto yy103;
+ if (yych <= '#') goto yy109;
+ goto yy112;
}
} else {
if (yych <= ';') {
- if (yych == '\'') goto yy98;
- if (yych <= ':') goto yy104;
- goto yy98;
+ if (yych == '\'') goto yy103;
+ if (yych <= ':') goto yy109;
+ goto yy103;
} else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
+ if (yych <= '[') goto yy109;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy103;
+ goto yy109;
}
}
-yy119:
- YYDEBUG(119, *YYCURSOR);
+yy124:
+ YYDEBUG(124, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(120, *YYCURSOR);
+ YYDEBUG(125, *YYCURSOR);
if (yych <= '\'') {
if (yych <= '!') {
if (yych <= '\n') {
- if (yych <= '\t') goto yy104;
- goto yy98;
+ if (yych <= '\t') goto yy109;
+ goto yy103;
} else {
- if (yych == '\r') goto yy98;
- goto yy104;
+ if (yych == '\r') goto yy103;
+ goto yy109;
}
} else {
if (yych <= '#') {
- if (yych <= '"') goto yy98;
- goto yy104;
+ if (yych <= '"') goto yy103;
+ goto yy109;
} else {
- if (yych <= '$') goto yy107;
- if (yych <= '&') goto yy104;
- goto yy98;
+ if (yych <= '$') goto yy112;
+ if (yych <= '&') goto yy109;
+ goto yy103;
}
}
} else {
if (yych <= ':') {
if (yych <= '.') {
- if (yych <= '-') goto yy104;
- goto yy117;
+ if (yych <= '-') goto yy109;
+ goto yy122;
} else {
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy119;
- goto yy104;
+ if (yych <= '/') goto yy109;
+ if (yych <= '9') goto yy124;
+ goto yy109;
}
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
+ if (yych <= ';') goto yy103;
+ goto yy109;
} else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy103;
+ goto yy109;
}
}
}
-yy121:
- YYDEBUG(121, *YYCURSOR);
+yy126:
+ YYDEBUG(126, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(122, *YYCURSOR);
+ YYDEBUG(127, *YYCURSOR);
if (yych <= '&') {
if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
+ if (yych == '\n') goto yy103;
+ if (yych <= '\f') goto yy109;
+ goto yy103;
} else {
if (yych <= '"') {
- if (yych <= '!') goto yy104;
- goto yy98;
+ if (yych <= '!') goto yy109;
+ goto yy103;
} else {
- if (yych == '$') goto yy107;
- goto yy104;
+ if (yych == '$') goto yy112;
+ goto yy109;
}
}
} else {
if (yych <= ':') {
- if (yych <= '\'') goto yy98;
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy121;
- goto yy104;
+ if (yych <= '\'') goto yy103;
+ if (yych <= '/') goto yy109;
+ if (yych <= '9') goto yy126;
+ goto yy109;
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
+ if (yych <= ';') goto yy103;
+ goto yy109;
} else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy103;
+ goto yy109;
}
}
}
-yy123:
- YYDEBUG(123, *YYCURSOR);
+yy128:
+ YYDEBUG(128, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(124, *YYCURSOR);
+ YYDEBUG(129, *YYCURSOR);
if (yych <= '&') {
if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
+ if (yych == '\n') goto yy103;
+ if (yych <= '\f') goto yy109;
+ goto yy103;
} else {
if (yych <= '"') {
- if (yych <= '!') goto yy104;
- goto yy98;
+ if (yych <= '!') goto yy109;
+ goto yy103;
} else {
- if (yych == '$') goto yy107;
- goto yy104;
+ if (yych == '$') goto yy112;
+ goto yy109;
}
}
} else {
if (yych <= ':') {
- if (yych <= '\'') goto yy98;
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy123;
- goto yy104;
+ if (yych <= '\'') goto yy103;
+ if (yych <= '/') goto yy109;
+ if (yych <= '9') goto yy128;
+ goto yy109;
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
+ if (yych <= ';') goto yy103;
+ goto yy109;
} else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy103;
+ goto yy109;
}
}
}
-yy125:
- YYDEBUG(125, *YYCURSOR);
+yy130:
+ YYDEBUG(130, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(126, *YYCURSOR);
+ YYDEBUG(131, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy125;
+ goto yy130;
}
- YYDEBUG(127, *YYCURSOR);
+ YYDEBUG(132, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(128, *YYCURSOR);
+ YYDEBUG(133, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 365 "Zend/zend_ini_scanner.l"
+#line 412 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -1767,59 +1871,59 @@ yy125:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
-#line 1771 "Zend/zend_ini_scanner.c"
-yy129:
- YYDEBUG(129, *YYCURSOR);
+#line 1875 "Zend/zend_ini_scanner.c"
+yy134:
+ YYDEBUG(134, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(130, *YYCURSOR);
+ YYDEBUG(135, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 398 "Zend/zend_ini_scanner.l"
+#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
return TC_DOLLAR_CURLY;
}
-#line 1782 "Zend/zend_ini_scanner.c"
-yy131:
- YYDEBUG(131, *YYCURSOR);
+#line 1886 "Zend/zend_ini_scanner.c"
+yy136:
+ YYDEBUG(136, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(132, *YYCURSOR);
+ YYDEBUG(137, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy131;
+ goto yy136;
}
if (yych <= '$') {
if (yych <= '\r') {
- if (yych == '\n') goto yy87;
- if (yych <= '\f') goto yy104;
- goto yy87;
+ if (yych == '\n') goto yy92;
+ if (yych <= '\f') goto yy109;
+ goto yy92;
} else {
- if (yych == '"') goto yy133;
- if (yych <= '#') goto yy104;
- goto yy107;
+ if (yych == '"') goto yy138;
+ if (yych <= '#') goto yy109;
+ goto yy112;
}
} else {
if (yych <= ';') {
- if (yych == '\'') goto yy87;
- if (yych <= ':') goto yy104;
- goto yy87;
+ if (yych == '\'') goto yy92;
+ if (yych <= ':') goto yy109;
+ goto yy92;
} else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy134;
- goto yy104;
+ if (yych <= '[') goto yy109;
+ if (yych <= '\\') goto yy111;
+ if (yych <= ']') goto yy139;
+ goto yy109;
}
}
-yy133:
- YYDEBUG(133, *YYCURSOR);
+yy138:
+ YYDEBUG(138, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy92;
-yy134:
- YYDEBUG(134, *YYCURSOR);
+ goto yy97;
+yy139:
+ YYDEBUG(139, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy103;
+ goto yy108;
}
/* *********************************** */
yyc_ST_RAW:
@@ -1858,46 +1962,46 @@ yyc_ST_RAW:
64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64,
};
- YYDEBUG(135, *YYCURSOR);
+ YYDEBUG(140, *YYCURSOR);
YYFILL(3);
yych = *YYCURSOR;
if (yych <= '\f') {
if (yych <= 0x08) {
- if (yych >= 0x01) goto yy139;
+ if (yych >= 0x01) goto yy144;
} else {
- if (yych <= '\t') goto yy141;
- if (yych <= '\n') goto yy142;
- goto yy139;
+ if (yych <= '\t') goto yy146;
+ if (yych <= '\n') goto yy147;
+ goto yy144;
}
} else {
if (yych <= ' ') {
- if (yych <= '\r') goto yy144;
- if (yych <= 0x1F) goto yy139;
- goto yy141;
+ if (yych <= '\r') goto yy149;
+ if (yych <= 0x1F) goto yy144;
+ goto yy146;
} else {
- if (yych == ';') goto yy145;
- goto yy139;
+ if (yych == ';') goto yy150;
+ goto yy144;
}
}
- YYDEBUG(137, *YYCURSOR);
+ YYDEBUG(142, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(138, *YYCURSOR);
+ YYDEBUG(143, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 595 "Zend/zend_ini_scanner.l"
+#line 646 "Zend/zend_ini_scanner.l"
{ /* End of option value (if EOF is reached before EOL */
BEGIN(INITIAL);
return END_OF_LINE;
}
-#line 1892 "Zend/zend_ini_scanner.c"
-yy139:
- YYDEBUG(139, *YYCURSOR);
+#line 1996 "Zend/zend_ini_scanner.c"
+yy144:
+ YYDEBUG(144, *YYCURSOR);
++YYCURSOR;
-yy140:
- YYDEBUG(140, *YYCURSOR);
+yy145:
+ YYDEBUG(145, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 445 "Zend/zend_ini_scanner.l"
+#line 496 "Zend/zend_ini_scanner.l"
{ /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
- char *sc = NULL;
+ unsigned char *sc = NULL;
while (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR) {
case '\n':
@@ -1932,111 +2036,111 @@ end_raw_value_chars:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
-#line 1936 "Zend/zend_ini_scanner.c"
-yy141:
- YYDEBUG(141, *YYCURSOR);
+#line 2040 "Zend/zend_ini_scanner.c"
+yy146:
+ YYDEBUG(146, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '\r') {
- if (yych <= 0x08) goto yy140;
- if (yych <= '\n') goto yy153;
- if (yych <= '\f') goto yy140;
- goto yy153;
+ if (yych <= 0x08) goto yy145;
+ if (yych <= '\n') goto yy158;
+ if (yych <= '\f') goto yy145;
+ goto yy158;
} else {
if (yych <= ' ') {
- if (yych <= 0x1F) goto yy140;
- goto yy153;
+ if (yych <= 0x1F) goto yy145;
+ goto yy158;
} else {
- if (yych == ';') goto yy153;
- goto yy140;
+ if (yych == ';') goto yy158;
+ goto yy145;
}
}
-yy142:
- YYDEBUG(142, *YYCURSOR);
+yy147:
+ YYDEBUG(147, *YYCURSOR);
++YYCURSOR;
-yy143:
- YYDEBUG(143, *YYCURSOR);
+yy148:
+ YYDEBUG(148, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 486 "Zend/zend_ini_scanner.l"
+#line 537 "Zend/zend_ini_scanner.l"
{ /* End of option value */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 1967 "Zend/zend_ini_scanner.c"
-yy144:
- YYDEBUG(144, *YYCURSOR);
+#line 2071 "Zend/zend_ini_scanner.c"
+yy149:
+ YYDEBUG(149, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy151;
- goto yy143;
-yy145:
- YYDEBUG(145, *YYCURSOR);
+ if (yych == '\n') goto yy156;
+ goto yy148;
+yy150:
+ YYDEBUG(150, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy147;
-yy146:
- YYDEBUG(146, *YYCURSOR);
+ goto yy152;
+yy151:
+ YYDEBUG(151, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy147:
- YYDEBUG(147, *YYCURSOR);
+yy152:
+ YYDEBUG(152, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy146;
+ goto yy151;
}
- if (yych >= '\r') goto yy150;
-yy148:
- YYDEBUG(148, *YYCURSOR);
+ if (yych >= '\r') goto yy155;
+yy153:
+ YYDEBUG(153, *YYCURSOR);
++YYCURSOR;
-yy149:
- YYDEBUG(149, *YYCURSOR);
+yy154:
+ YYDEBUG(154, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 582 "Zend/zend_ini_scanner.l"
+#line 633 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 2001 "Zend/zend_ini_scanner.c"
-yy150:
- YYDEBUG(150, *YYCURSOR);
+#line 2105 "Zend/zend_ini_scanner.c"
+yy155:
+ YYDEBUG(155, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy148;
- goto yy149;
-yy151:
- YYDEBUG(151, *YYCURSOR);
+ if (yych == '\n') goto yy153;
+ goto yy154;
+yy156:
+ YYDEBUG(156, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy143;
-yy152:
- YYDEBUG(152, *YYCURSOR);
+ goto yy148;
+yy157:
+ YYDEBUG(157, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy153:
- YYDEBUG(153, *YYCURSOR);
+yy158:
+ YYDEBUG(158, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy152;
+ goto yy157;
}
if (yych <= '\f') {
- if (yych == '\n') goto yy151;
+ if (yych == '\n') goto yy156;
} else {
- if (yych <= '\r') goto yy155;
- if (yych == ';') goto yy146;
+ if (yych <= '\r') goto yy160;
+ if (yych == ';') goto yy151;
}
- YYDEBUG(154, *YYCURSOR);
+ YYDEBUG(159, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 572 "Zend/zend_ini_scanner.l"
+#line 623 "Zend/zend_ini_scanner.l"
{
/* eat whitespace */
goto restart;
}
-#line 2035 "Zend/zend_ini_scanner.c"
-yy155:
- YYDEBUG(155, *YYCURSOR);
+#line 2139 "Zend/zend_ini_scanner.c"
+yy160:
+ YYDEBUG(160, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy151;
- goto yy143;
+ if ((yych = *YYCURSOR) == '\n') goto yy156;
+ goto yy148;
}
/* *********************************** */
yyc_ST_SECTION_RAW:
@@ -2075,85 +2179,85 @@ yyc_ST_SECTION_RAW:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(156, *YYCURSOR);
+ YYDEBUG(161, *YYCURSOR);
YYFILL(3);
yych = *YYCURSOR;
if (yych <= '\f') {
- if (yych == '\n') goto yy160;
+ if (yych == '\n') goto yy165;
} else {
- if (yych <= '\r') goto yy160;
- if (yych == ']') goto yy162;
+ if (yych <= '\r') goto yy165;
+ if (yych == ']') goto yy167;
}
- YYDEBUG(158, *YYCURSOR);
+ YYDEBUG(163, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy169;
-yy159:
- YYDEBUG(159, *YYCURSOR);
+ goto yy174;
+yy164:
+ YYDEBUG(164, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 482 "Zend/zend_ini_scanner.l"
+#line 533 "Zend/zend_ini_scanner.l"
{ /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
-#line 2099 "Zend/zend_ini_scanner.c"
-yy160:
- YYDEBUG(160, *YYCURSOR);
+#line 2203 "Zend/zend_ini_scanner.c"
+yy165:
+ YYDEBUG(165, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(161, *YYCURSOR);
+ YYDEBUG(166, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 600 "Zend/zend_ini_scanner.l"
+#line 651 "Zend/zend_ini_scanner.l"
{
return 0;
}
-#line 2109 "Zend/zend_ini_scanner.c"
-yy162:
- YYDEBUG(162, *YYCURSOR);
+#line 2213 "Zend/zend_ini_scanner.c"
+yy167:
+ YYDEBUG(167, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy165;
-yy163:
- YYDEBUG(163, *YYCURSOR);
+ goto yy170;
+yy168:
+ YYDEBUG(168, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 374 "Zend/zend_ini_scanner.l"
+#line 421 "Zend/zend_ini_scanner.l"
{ /* End of section */
BEGIN(INITIAL);
SCNG(lineno)++;
return ']';
}
-#line 2124 "Zend/zend_ini_scanner.c"
-yy164:
- YYDEBUG(164, *YYCURSOR);
+#line 2228 "Zend/zend_ini_scanner.c"
+yy169:
+ YYDEBUG(169, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy165:
- YYDEBUG(165, *YYCURSOR);
+yy170:
+ YYDEBUG(170, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy164;
+ goto yy169;
}
- if (yych == '\n') goto yy166;
- if (yych == '\r') goto yy167;
- goto yy163;
-yy166:
- YYDEBUG(166, *YYCURSOR);
+ if (yych == '\n') goto yy171;
+ if (yych == '\r') goto yy172;
+ goto yy168;
+yy171:
+ YYDEBUG(171, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy163;
-yy167:
- YYDEBUG(167, *YYCURSOR);
+ goto yy168;
+yy172:
+ YYDEBUG(172, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy166;
- goto yy163;
-yy168:
- YYDEBUG(168, *YYCURSOR);
+ if (yych == '\n') goto yy171;
+ goto yy168;
+yy173:
+ YYDEBUG(173, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy169:
- YYDEBUG(169, *YYCURSOR);
+yy174:
+ YYDEBUG(174, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy168;
+ goto yy173;
}
- goto yy159;
+ goto yy164;
}
/* *********************************** */
yyc_ST_SECTION_VALUE:
@@ -2192,523 +2296,523 @@ yyc_ST_SECTION_VALUE:
132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132,
};
- YYDEBUG(170, *YYCURSOR);
+ YYDEBUG(175, *YYCURSOR);
YYFILL(3);
yych = *YYCURSOR;
if (yych <= '-') {
if (yych <= ' ') {
if (yych <= '\n') {
- if (yych <= 0x08) goto yy172;
- if (yych <= '\t') goto yy174;
- goto yy175;
+ if (yych <= 0x08) goto yy177;
+ if (yych <= '\t') goto yy179;
+ goto yy180;
} else {
- if (yych == '\r') goto yy175;
- if (yych >= ' ') goto yy174;
+ if (yych == '\r') goto yy180;
+ if (yych >= ' ') goto yy179;
}
} else {
if (yych <= '$') {
- if (yych == '"') goto yy177;
- if (yych >= '$') goto yy179;
+ if (yych == '"') goto yy182;
+ if (yych >= '$') goto yy184;
} else {
- if (yych == '\'') goto yy180;
- if (yych >= '-') goto yy181;
+ if (yych == '\'') goto yy185;
+ if (yych >= '-') goto yy186;
}
}
} else {
if (yych <= 'Z') {
if (yych <= '9') {
- if (yych <= '.') goto yy182;
- if (yych >= '0') goto yy183;
+ if (yych <= '.') goto yy187;
+ if (yych >= '0') goto yy188;
} else {
- if (yych == ';') goto yy175;
- if (yych >= 'A') goto yy185;
+ if (yych == ';') goto yy180;
+ if (yych >= 'A') goto yy190;
}
} else {
if (yych <= '^') {
- if (yych <= '[') goto yy172;
- if (yych <= '\\') goto yy187;
- if (yych <= ']') goto yy188;
+ if (yych <= '[') goto yy177;
+ if (yych <= '\\') goto yy192;
+ if (yych <= ']') goto yy193;
} else {
- if (yych == '`') goto yy172;
- if (yych <= 'z') goto yy185;
+ if (yych == '`') goto yy177;
+ if (yych <= 'z') goto yy190;
}
}
}
-yy172:
- YYDEBUG(172, *YYCURSOR);
+yy177:
+ YYDEBUG(177, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy195;
-yy173:
- YYDEBUG(173, *YYCURSOR);
+ goto yy200;
+yy178:
+ YYDEBUG(178, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 518 "Zend/zend_ini_scanner.l"
+#line 569 "Zend/zend_ini_scanner.l"
{ /* Get rest as section/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
-#line 2250 "Zend/zend_ini_scanner.c"
-yy174:
- YYDEBUG(174, *YYCURSOR);
+#line 2354 "Zend/zend_ini_scanner.c"
+yy179:
+ YYDEBUG(179, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy221;
- goto yy195;
+ if (yych == '\t') goto yy226;
+ goto yy200;
} else {
- if (yych <= ' ') goto yy221;
- if (yych == '"') goto yy223;
- goto yy195;
+ if (yych <= ' ') goto yy226;
+ if (yych == '"') goto yy228;
+ goto yy200;
}
-yy175:
- YYDEBUG(175, *YYCURSOR);
+yy180:
+ YYDEBUG(180, *YYCURSOR);
++YYCURSOR;
-yy176:
- YYDEBUG(176, *YYCURSOR);
+yy181:
+ YYDEBUG(181, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 600 "Zend/zend_ini_scanner.l"
+#line 651 "Zend/zend_ini_scanner.l"
{
return 0;
}
-#line 2273 "Zend/zend_ini_scanner.c"
-yy177:
- YYDEBUG(177, *YYCURSOR);
+#line 2377 "Zend/zend_ini_scanner.c"
+yy182:
+ YYDEBUG(182, *YYCURSOR);
++YYCURSOR;
-yy178:
- YYDEBUG(178, *YYCURSOR);
+yy183:
+ YYDEBUG(183, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 522 "Zend/zend_ini_scanner.l"
+#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
return '"';
}
-#line 2285 "Zend/zend_ini_scanner.c"
-yy179:
- YYDEBUG(179, *YYCURSOR);
+#line 2389 "Zend/zend_ini_scanner.c"
+yy184:
+ YYDEBUG(184, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy176;
- if (yych <= '[') goto yy194;
- goto yy199;
+ if (yych <= 0x00) goto yy181;
+ if (yych <= '[') goto yy199;
+ goto yy204;
} else {
- if (yych == '{') goto yy219;
- goto yy194;
+ if (yych == '{') goto yy224;
+ goto yy199;
}
-yy180:
- YYDEBUG(180, *YYCURSOR);
+yy185:
+ YYDEBUG(185, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy215;
+ goto yy220;
}
- goto yy176;
-yy181:
- YYDEBUG(181, *YYCURSOR);
+ goto yy181;
+yy186:
+ YYDEBUG(186, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy195;
- if (yych <= '9') goto yy213;
- goto yy195;
-yy182:
- YYDEBUG(182, *YYCURSOR);
+ if (yych <= '/') goto yy200;
+ if (yych <= '9') goto yy218;
+ goto yy200;
+yy187:
+ YYDEBUG(187, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy195;
- if (yych <= '9') goto yy211;
- goto yy195;
-yy183:
- YYDEBUG(183, *YYCURSOR);
+ if (yych <= '/') goto yy200;
+ if (yych <= '9') goto yy216;
+ goto yy200;
+yy188:
+ YYDEBUG(188, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '\'') {
if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy195;
+ if (yych == '\n') goto yy189;
+ if (yych <= '\f') goto yy200;
} else {
- if (yych == '"') goto yy184;
- if (yych <= '&') goto yy195;
+ if (yych == '"') goto yy189;
+ if (yych <= '&') goto yy200;
}
} else {
if (yych <= '9') {
- if (yych == '.') goto yy207;
- if (yych <= '/') goto yy195;
- goto yy209;
+ if (yych == '.') goto yy212;
+ if (yych <= '/') goto yy200;
+ goto yy214;
} else {
if (yych <= ';') {
- if (yych <= ':') goto yy195;
+ if (yych <= ':') goto yy200;
} else {
- if (yych != ']') goto yy195;
+ if (yych != ']') goto yy200;
}
}
}
-yy184:
- YYDEBUG(184, *YYCURSOR);
+yy189:
+ YYDEBUG(189, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 496 "Zend/zend_ini_scanner.l"
+#line 547 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
-#line 2351 "Zend/zend_ini_scanner.c"
-yy185:
- YYDEBUG(185, *YYCURSOR);
+#line 2455 "Zend/zend_ini_scanner.c"
+yy190:
+ YYDEBUG(190, *YYCURSOR);
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy205;
+ goto yy210;
}
if (yych <= '"') {
if (yych <= '\f') {
- if (yych != '\n') goto yy195;
+ if (yych != '\n') goto yy200;
} else {
- if (yych <= '\r') goto yy186;
- if (yych <= '!') goto yy195;
+ if (yych <= '\r') goto yy191;
+ if (yych <= '!') goto yy200;
}
} else {
if (yych <= ':') {
- if (yych != '\'') goto yy195;
+ if (yych != '\'') goto yy200;
} else {
- if (yych <= ';') goto yy186;
- if (yych != ']') goto yy195;
+ if (yych <= ';') goto yy191;
+ if (yych != ']') goto yy200;
}
}
-yy186:
- YYDEBUG(186, *YYCURSOR);
+yy191:
+ YYDEBUG(191, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 492 "Zend/zend_ini_scanner.l"
+#line 543 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
-#line 2381 "Zend/zend_ini_scanner.c"
-yy187:
- YYDEBUG(187, *YYCURSOR);
+#line 2485 "Zend/zend_ini_scanner.c"
+yy192:
+ YYDEBUG(192, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy194;
-yy188:
- YYDEBUG(188, *YYCURSOR);
+ goto yy199;
+yy193:
+ YYDEBUG(193, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy191;
-yy189:
- YYDEBUG(189, *YYCURSOR);
+ goto yy196;
+yy194:
+ YYDEBUG(194, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 374 "Zend/zend_ini_scanner.l"
+#line 421 "Zend/zend_ini_scanner.l"
{ /* End of section */
BEGIN(INITIAL);
SCNG(lineno)++;
return ']';
}
-#line 2400 "Zend/zend_ini_scanner.c"
-yy190:
- YYDEBUG(190, *YYCURSOR);
+#line 2504 "Zend/zend_ini_scanner.c"
+yy195:
+ YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy191:
- YYDEBUG(191, *YYCURSOR);
+yy196:
+ YYDEBUG(196, *YYCURSOR);
if (yybm[0+yych] & 2) {
- goto yy190;
+ goto yy195;
}
- if (yych == '\n') goto yy192;
- if (yych == '\r') goto yy193;
- goto yy189;
-yy192:
- YYDEBUG(192, *YYCURSOR);
+ if (yych == '\n') goto yy197;
+ if (yych == '\r') goto yy198;
+ goto yy194;
+yy197:
+ YYDEBUG(197, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy189;
-yy193:
- YYDEBUG(193, *YYCURSOR);
+ goto yy194;
+yy198:
+ YYDEBUG(198, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy192;
- goto yy189;
-yy194:
- YYDEBUG(194, *YYCURSOR);
+ if (yych == '\n') goto yy197;
+ goto yy194;
+yy199:
+ YYDEBUG(199, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy195:
- YYDEBUG(195, *YYCURSOR);
+yy200:
+ YYDEBUG(200, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy194;
+ goto yy199;
}
- if (yych == '$') goto yy197;
- if (yych != '\\') goto yy173;
-yy196:
- YYDEBUG(196, *YYCURSOR);
+ if (yych == '$') goto yy202;
+ if (yych != '\\') goto yy178;
+yy201:
+ YYDEBUG(201, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- goto yy194;
-yy197:
- YYDEBUG(197, *YYCURSOR);
+ goto yy199;
+yy202:
+ YYDEBUG(202, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy198;
- if (yych <= '[') goto yy194;
- goto yy199;
+ if (yych <= 0x00) goto yy203;
+ if (yych <= '[') goto yy199;
+ goto yy204;
} else {
- if (yych != '{') goto yy194;
+ if (yych != '{') goto yy199;
}
-yy198:
- YYDEBUG(198, *YYCURSOR);
+yy203:
+ YYDEBUG(203, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 1) {
if (yyaccept <= 0) {
- goto yy173;
+ goto yy178;
} else {
- goto yy176;
+ goto yy181;
}
} else {
if (yyaccept <= 2) {
- goto yy184;
+ goto yy189;
} else {
- goto yy186;
+ goto yy191;
}
}
-yy199:
- YYDEBUG(199, *YYCURSOR);
+yy204:
+ YYDEBUG(204, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yybm[0+yych] & 8) {
- goto yy200;
+ goto yy205;
}
- if (yych == '\\') goto yy202;
- goto yy194;
-yy200:
- YYDEBUG(200, *YYCURSOR);
+ if (yych == '\\') goto yy207;
+ goto yy199;
+yy205:
+ YYDEBUG(205, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(201, *YYCURSOR);
+ YYDEBUG(206, *YYCURSOR);
if (yybm[0+yych] & 8) {
- goto yy200;
+ goto yy205;
}
- if (yych == '\\') goto yy204;
- goto yy194;
-yy202:
- YYDEBUG(202, *YYCURSOR);
+ if (yych == '\\') goto yy209;
+ goto yy199;
+yy207:
+ YYDEBUG(207, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(203, *YYCURSOR);
+ YYDEBUG(208, *YYCURSOR);
if (yybm[0+yych] & 8) {
- goto yy200;
+ goto yy205;
}
- if (yych == '\\') goto yy202;
- goto yy194;
-yy204:
- YYDEBUG(204, *YYCURSOR);
+ if (yych == '\\') goto yy207;
+ goto yy199;
+yy209:
+ YYDEBUG(209, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yybm[0+yych] & 8) {
- goto yy200;
+ goto yy205;
}
- if (yych == '\\') goto yy202;
- goto yy194;
-yy205:
- YYDEBUG(205, *YYCURSOR);
+ if (yych == '\\') goto yy207;
+ goto yy199;
+yy210:
+ YYDEBUG(210, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(206, *YYCURSOR);
+ YYDEBUG(211, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy205;
+ goto yy210;
}
if (yych <= '$') {
if (yych <= '\r') {
- if (yych == '\n') goto yy186;
- if (yych <= '\f') goto yy194;
- goto yy186;
+ if (yych == '\n') goto yy191;
+ if (yych <= '\f') goto yy199;
+ goto yy191;
} else {
- if (yych == '"') goto yy186;
- if (yych <= '#') goto yy194;
- goto yy197;
+ if (yych == '"') goto yy191;
+ if (yych <= '#') goto yy199;
+ goto yy202;
}
} else {
if (yych <= ';') {
- if (yych == '\'') goto yy186;
- if (yych <= ':') goto yy194;
- goto yy186;
+ if (yych == '\'') goto yy191;
+ if (yych <= ':') goto yy199;
+ goto yy191;
} else {
- if (yych <= '[') goto yy194;
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy186;
- goto yy194;
+ if (yych <= '[') goto yy199;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy191;
+ goto yy199;
}
}
-yy207:
- YYDEBUG(207, *YYCURSOR);
+yy212:
+ YYDEBUG(212, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(208, *YYCURSOR);
+ YYDEBUG(213, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy207;
+ goto yy212;
}
if (yych <= '$') {
if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
+ if (yych == '\n') goto yy189;
+ if (yych <= '\f') goto yy199;
+ goto yy189;
} else {
- if (yych == '"') goto yy184;
- if (yych <= '#') goto yy194;
- goto yy197;
+ if (yych == '"') goto yy189;
+ if (yych <= '#') goto yy199;
+ goto yy202;
}
} else {
if (yych <= ';') {
- if (yych == '\'') goto yy184;
- if (yych <= ':') goto yy194;
- goto yy184;
+ if (yych == '\'') goto yy189;
+ if (yych <= ':') goto yy199;
+ goto yy189;
} else {
- if (yych <= '[') goto yy194;
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
+ if (yych <= '[') goto yy199;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy189;
+ goto yy199;
}
}
-yy209:
- YYDEBUG(209, *YYCURSOR);
+yy214:
+ YYDEBUG(214, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(210, *YYCURSOR);
+ YYDEBUG(215, *YYCURSOR);
if (yych <= '\'') {
if (yych <= '!') {
if (yych <= '\n') {
- if (yych <= '\t') goto yy194;
- goto yy184;
+ if (yych <= '\t') goto yy199;
+ goto yy189;
} else {
- if (yych == '\r') goto yy184;
- goto yy194;
+ if (yych == '\r') goto yy189;
+ goto yy199;
}
} else {
if (yych <= '#') {
- if (yych <= '"') goto yy184;
- goto yy194;
+ if (yych <= '"') goto yy189;
+ goto yy199;
} else {
- if (yych <= '$') goto yy197;
- if (yych <= '&') goto yy194;
- goto yy184;
+ if (yych <= '$') goto yy202;
+ if (yych <= '&') goto yy199;
+ goto yy189;
}
}
} else {
if (yych <= ':') {
if (yych <= '.') {
- if (yych <= '-') goto yy194;
- goto yy207;
+ if (yych <= '-') goto yy199;
+ goto yy212;
} else {
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy209;
- goto yy194;
+ if (yych <= '/') goto yy199;
+ if (yych <= '9') goto yy214;
+ goto yy199;
}
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
+ if (yych <= ';') goto yy189;
+ goto yy199;
} else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy189;
+ goto yy199;
}
}
}
-yy211:
- YYDEBUG(211, *YYCURSOR);
+yy216:
+ YYDEBUG(216, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(212, *YYCURSOR);
+ YYDEBUG(217, *YYCURSOR);
if (yych <= '&') {
if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
+ if (yych == '\n') goto yy189;
+ if (yych <= '\f') goto yy199;
+ goto yy189;
} else {
if (yych <= '"') {
- if (yych <= '!') goto yy194;
- goto yy184;
+ if (yych <= '!') goto yy199;
+ goto yy189;
} else {
- if (yych == '$') goto yy197;
- goto yy194;
+ if (yych == '$') goto yy202;
+ goto yy199;
}
}
} else {
if (yych <= ':') {
- if (yych <= '\'') goto yy184;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy211;
- goto yy194;
+ if (yych <= '\'') goto yy189;
+ if (yych <= '/') goto yy199;
+ if (yych <= '9') goto yy216;
+ goto yy199;
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
+ if (yych <= ';') goto yy189;
+ goto yy199;
} else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy189;
+ goto yy199;
}
}
}
-yy213:
- YYDEBUG(213, *YYCURSOR);
+yy218:
+ YYDEBUG(218, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(214, *YYCURSOR);
+ YYDEBUG(219, *YYCURSOR);
if (yych <= '&') {
if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
+ if (yych == '\n') goto yy189;
+ if (yych <= '\f') goto yy199;
+ goto yy189;
} else {
if (yych <= '"') {
- if (yych <= '!') goto yy194;
- goto yy184;
+ if (yych <= '!') goto yy199;
+ goto yy189;
} else {
- if (yych == '$') goto yy197;
- goto yy194;
+ if (yych == '$') goto yy202;
+ goto yy199;
}
}
} else {
if (yych <= ':') {
- if (yych <= '\'') goto yy184;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy213;
- goto yy194;
+ if (yych <= '\'') goto yy189;
+ if (yych <= '/') goto yy199;
+ if (yych <= '9') goto yy218;
+ goto yy199;
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
+ if (yych <= ';') goto yy189;
+ goto yy199;
} else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy189;
+ goto yy199;
}
}
}
-yy215:
- YYDEBUG(215, *YYCURSOR);
+yy220:
+ YYDEBUG(220, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(216, *YYCURSOR);
+ YYDEBUG(221, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy215;
+ goto yy220;
}
- YYDEBUG(217, *YYCURSOR);
+ YYDEBUG(222, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(218, *YYCURSOR);
+ YYDEBUG(223, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 365 "Zend/zend_ini_scanner.l"
+#line 412 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -2717,65 +2821,65 @@ yy215:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
-#line 2721 "Zend/zend_ini_scanner.c"
-yy219:
- YYDEBUG(219, *YYCURSOR);
+#line 2825 "Zend/zend_ini_scanner.c"
+yy224:
+ YYDEBUG(224, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(220, *YYCURSOR);
+ YYDEBUG(225, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 398 "Zend/zend_ini_scanner.l"
+#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
return TC_DOLLAR_CURLY;
}
-#line 2732 "Zend/zend_ini_scanner.c"
-yy221:
- YYDEBUG(221, *YYCURSOR);
+#line 2836 "Zend/zend_ini_scanner.c"
+yy226:
+ YYDEBUG(226, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(222, *YYCURSOR);
+ YYDEBUG(227, *YYCURSOR);
if (yych <= '"') {
if (yych <= '\f') {
- if (yych <= 0x08) goto yy194;
- if (yych <= '\t') goto yy221;
- if (yych <= '\n') goto yy173;
- goto yy194;
+ if (yych <= 0x08) goto yy199;
+ if (yych <= '\t') goto yy226;
+ if (yych <= '\n') goto yy178;
+ goto yy199;
} else {
if (yych <= 0x1F) {
- if (yych <= '\r') goto yy173;
- goto yy194;
+ if (yych <= '\r') goto yy178;
+ goto yy199;
} else {
- if (yych <= ' ') goto yy221;
- if (yych <= '!') goto yy194;
+ if (yych <= ' ') goto yy226;
+ if (yych <= '!') goto yy199;
}
}
} else {
if (yych <= ':') {
if (yych <= '$') {
- if (yych <= '#') goto yy194;
- goto yy197;
+ if (yych <= '#') goto yy199;
+ goto yy202;
} else {
- if (yych == '\'') goto yy173;
- goto yy194;
+ if (yych == '\'') goto yy178;
+ goto yy199;
}
} else {
if (yych <= '[') {
- if (yych <= ';') goto yy173;
- goto yy194;
+ if (yych <= ';') goto yy178;
+ goto yy199;
} else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy173;
- goto yy194;
+ if (yych <= '\\') goto yy201;
+ if (yych <= ']') goto yy178;
+ goto yy199;
}
}
}
-yy223:
- YYDEBUG(223, *YYCURSOR);
+yy228:
+ YYDEBUG(228, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy178;
+ goto yy183;
}
/* *********************************** */
yyc_ST_VALUE:
@@ -2814,28 +2918,28 @@ yyc_ST_VALUE:
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
};
- YYDEBUG(224, *YYCURSOR);
+ YYDEBUG(229, *YYCURSOR);
YYFILL(6);
yych = *YYCURSOR;
YYDEBUG(-1, yych);
switch (yych) {
- case 0x00: goto yy226;
+ case 0x00: goto yy231;
case '\t':
- case ' ': goto yy230;
- case '\n': goto yy232;
- case '\r': goto yy234;
+ case ' ': goto yy235;
+ case '\n': goto yy237;
+ case '\r': goto yy239;
case '!':
case '&':
case '(':
case ')':
case '^':
case '|':
- case '~': goto yy235;
- case '"': goto yy237;
- case '$': goto yy239;
- case '\'': goto yy240;
- case '-': goto yy241;
- case '.': goto yy242;
+ case '~': goto yy240;
+ case '"': goto yy242;
+ case '$': goto yy244;
+ case '\'': goto yy245;
+ case '-': goto yy246;
+ case '.': goto yy247;
case '0':
case '1':
case '2':
@@ -2845,9 +2949,9 @@ yyc_ST_VALUE:
case '6':
case '7':
case '8':
- case '9': goto yy243;
- case ';': goto yy245;
- case '=': goto yy246;
+ case '9': goto yy248;
+ case ';': goto yy250;
+ case '=': goto yy251;
case 'A':
case 'B':
case 'C':
@@ -2890,1576 +2994,1637 @@ yyc_ST_VALUE:
case 'v':
case 'w':
case 'x':
- case 'z': goto yy248;
+ case 'z': goto yy253;
case 'F':
- case 'f': goto yy250;
+ case 'f': goto yy255;
case 'N':
- case 'n': goto yy251;
+ case 'n': goto yy256;
case 'O':
- case 'o': goto yy252;
+ case 'o': goto yy257;
case 'T':
- case 't': goto yy253;
+ case 't': goto yy258;
case 'Y':
- case 'y': goto yy254;
- default: goto yy228;
+ case 'y': goto yy259;
+ default: goto yy233;
}
-yy226:
- YYDEBUG(226, *YYCURSOR);
+yy231:
+ YYDEBUG(231, *YYCURSOR);
++YYCURSOR;
-yy227:
- YYDEBUG(227, *YYCURSOR);
+yy232:
+ YYDEBUG(232, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 595 "Zend/zend_ini_scanner.l"
+#line 646 "Zend/zend_ini_scanner.l"
{ /* End of option value (if EOF is reached before EOL */
BEGIN(INITIAL);
return END_OF_LINE;
}
-#line 2918 "Zend/zend_ini_scanner.c"
-yy228:
- YYDEBUG(228, *YYCURSOR);
+#line 3022 "Zend/zend_ini_scanner.c"
+yy233:
+ YYDEBUG(233, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy256;
-yy229:
- YYDEBUG(229, *YYCURSOR);
+ goto yy261;
+yy234:
+ YYDEBUG(234, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 514 "Zend/zend_ini_scanner.l"
+#line 565 "Zend/zend_ini_scanner.l"
{ /* Get everything else as option/offset value */
RETURN_TOKEN(TC_STRING, yytext, yyleng);
}
-#line 2931 "Zend/zend_ini_scanner.c"
-yy230:
- YYDEBUG(230, *YYCURSOR);
+#line 3035 "Zend/zend_ini_scanner.c"
+yy235:
+ YYDEBUG(235, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy306;
-yy231:
- YYDEBUG(231, *YYCURSOR);
+ goto yy315;
+yy236:
+ YYDEBUG(236, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 568 "Zend/zend_ini_scanner.l"
+#line 619 "Zend/zend_ini_scanner.l"
{
RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng);
}
-#line 2944 "Zend/zend_ini_scanner.c"
-yy232:
- YYDEBUG(232, *YYCURSOR);
+#line 3048 "Zend/zend_ini_scanner.c"
+yy237:
+ YYDEBUG(237, *YYCURSOR);
++YYCURSOR;
-yy233:
- YYDEBUG(233, *YYCURSOR);
+yy238:
+ YYDEBUG(238, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 486 "Zend/zend_ini_scanner.l"
+#line 537 "Zend/zend_ini_scanner.l"
{ /* End of option value */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 2957 "Zend/zend_ini_scanner.c"
-yy234:
- YYDEBUG(234, *YYCURSOR);
+#line 3061 "Zend/zend_ini_scanner.c"
+yy239:
+ YYDEBUG(239, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy304;
- goto yy233;
-yy235:
- YYDEBUG(235, *YYCURSOR);
+ if (yych == '\n') goto yy313;
+ goto yy238;
+yy240:
+ YYDEBUG(240, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy303;
-yy236:
- YYDEBUG(236, *YYCURSOR);
+ goto yy312;
+yy241:
+ YYDEBUG(241, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 504 "Zend/zend_ini_scanner.l"
+#line 555 "Zend/zend_ini_scanner.l"
{ /* Boolean operators */
return yytext[0];
}
-#line 2975 "Zend/zend_ini_scanner.c"
-yy237:
- YYDEBUG(237, *YYCURSOR);
+#line 3079 "Zend/zend_ini_scanner.c"
+yy242:
+ YYDEBUG(242, *YYCURSOR);
++YYCURSOR;
-yy238:
- YYDEBUG(238, *YYCURSOR);
+yy243:
+ YYDEBUG(243, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 522 "Zend/zend_ini_scanner.l"
+#line 573 "Zend/zend_ini_scanner.l"
{ /* Double quoted '"' string start */
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
return '"';
}
-#line 2987 "Zend/zend_ini_scanner.c"
-yy239:
- YYDEBUG(239, *YYCURSOR);
+#line 3091 "Zend/zend_ini_scanner.c"
+yy244:
+ YYDEBUG(244, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy227;
- if (yych <= '[') goto yy255;
- goto yy262;
+ if (yych <= 0x00) goto yy232;
+ if (yych <= '[') goto yy260;
+ goto yy267;
} else {
- if (yych == '{') goto yy300;
- goto yy255;
+ if (yych == '{') goto yy309;
+ goto yy260;
}
-yy240:
- YYDEBUG(240, *YYCURSOR);
+yy245:
+ YYDEBUG(245, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy296;
+ goto yy305;
}
- goto yy227;
-yy241:
- YYDEBUG(241, *YYCURSOR);
+ goto yy232;
+yy246:
+ YYDEBUG(246, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy294;
- goto yy256;
-yy242:
- YYDEBUG(242, *YYCURSOR);
+ if (yych <= '/') goto yy261;
+ if (yych <= '9') goto yy303;
+ goto yy261;
+yy247:
+ YYDEBUG(247, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy292;
- goto yy256;
-yy243:
- YYDEBUG(243, *YYCURSOR);
+ if (yych <= '/') goto yy261;
+ if (yych <= '9') goto yy301;
+ goto yy261;
+yy248:
+ YYDEBUG(248, *YYCURSOR);
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') {
if (yych <= 0x1F) {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy256;
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy261;
} else {
- if (yych != '\r') goto yy256;
+ if (yych != '\r') goto yy261;
}
} else {
if (yych <= ')') {
- if (yych <= '"') goto yy244;
- if (yych <= '%') goto yy256;
+ if (yych <= '"') goto yy249;
+ if (yych <= '%') goto yy261;
} else {
- if (yych == '.') goto yy288;
- goto yy256;
+ if (yych == '.') goto yy297;
+ goto yy261;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= '9') goto yy290;
- if (yych <= ':') goto yy256;
+ if (yych <= '9') goto yy299;
+ if (yych <= ':') goto yy261;
} else {
- if (yych != '=') goto yy256;
+ if (yych != '=') goto yy261;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '{') goto yy261;
} else {
- if (yych != '~') goto yy256;
+ if (yych != '~') goto yy261;
}
}
}
-yy244:
- YYDEBUG(244, *YYCURSOR);
+yy249:
+ YYDEBUG(249, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 496 "Zend/zend_ini_scanner.l"
+#line 547 "Zend/zend_ini_scanner.l"
{ /* Get number option value as string */
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
}
-#line 3066 "Zend/zend_ini_scanner.c"
-yy245:
- YYDEBUG(245, *YYCURSOR);
+#line 3170 "Zend/zend_ini_scanner.c"
+yy250:
+ YYDEBUG(250, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy284;
-yy246:
- YYDEBUG(246, *YYCURSOR);
+ goto yy293;
+yy251:
+ YYDEBUG(251, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(247, *YYCURSOR);
+ YYDEBUG(252, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 508 "Zend/zend_ini_scanner.l"
+#line 559 "Zend/zend_ini_scanner.l"
{ /* Make = used in option value to trigger error */
yyless(0);
BEGIN(INITIAL);
return END_OF_LINE;
}
-#line 3083 "Zend/zend_ini_scanner.c"
-yy248:
- YYDEBUG(248, *YYCURSOR);
+#line 3187 "Zend/zend_ini_scanner.c"
+yy253:
+ YYDEBUG(253, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy257;
+ goto yy262;
}
if (yych <= ':') {
if (yych <= '\r') {
if (yych <= 0x08) {
- if (yych >= 0x01) goto yy256;
+ if (yych >= 0x01) goto yy261;
} else {
- if (yych <= '\n') goto yy249;
- if (yych <= '\f') goto yy256;
+ if (yych <= '\n') goto yy254;
+ if (yych <= '\f') goto yy261;
}
} else {
if (yych <= '"') {
- if (yych <= 0x1F) goto yy256;
+ if (yych <= 0x1F) goto yy261;
} else {
- if (yych <= '%') goto yy256;
- if (yych >= '*') goto yy256;
+ if (yych <= '%') goto yy261;
+ if (yych >= '*') goto yy261;
}
}
} else {
if (yych <= '^') {
if (yych <= '<') {
- if (yych >= '<') goto yy256;
+ if (yych >= '<') goto yy261;
} else {
- if (yych <= '=') goto yy249;
- if (yych <= ']') goto yy256;
+ if (yych <= '=') goto yy254;
+ if (yych <= ']') goto yy261;
}
} else {
if (yych <= '|') {
- if (yych <= '{') goto yy256;
+ if (yych <= '{') goto yy261;
} else {
- if (yych != '~') goto yy256;
+ if (yych != '~') goto yy261;
}
}
}
-yy249:
- YYDEBUG(249, *YYCURSOR);
+yy254:
+ YYDEBUG(254, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 492 "Zend/zend_ini_scanner.l"
+#line 543 "Zend/zend_ini_scanner.l"
{ /* Get constant option value */
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
}
-#line 3130 "Zend/zend_ini_scanner.c"
-yy250:
- YYDEBUG(250, *YYCURSOR);
+#line 3234 "Zend/zend_ini_scanner.c"
+yy255:
+ YYDEBUG(255, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '<') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '/') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- goto yy256;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ goto yy261;
} else {
- if (yych <= '9') goto yy257;
- if (yych == ';') goto yy249;
- goto yy256;
+ if (yych <= '9') goto yy262;
+ if (yych == ';') goto yy254;
+ goto yy261;
}
}
} else {
if (yych <= '_') {
if (yych <= 'A') {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy280;
+ if (yych <= '=') goto yy254;
+ if (yych <= '@') goto yy261;
+ goto yy289;
} else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- goto yy257;
+ if (yych <= 'Z') goto yy262;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ goto yy262;
}
} else {
if (yych <= '{') {
- if (yych <= '`') goto yy256;
- if (yych <= 'a') goto yy280;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych <= '`') goto yy261;
+ if (yych <= 'a') goto yy289;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy251:
- YYDEBUG(251, *YYCURSOR);
+yy256:
+ YYDEBUG(256, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'N') {
if (yych <= '%') {
if (yych <= '\f') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\n') goto yy249;
- goto yy256;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ if (yych <= '\n') goto yy254;
+ goto yy261;
} else {
- if (yych <= '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- if (yych <= '"') goto yy249;
- goto yy256;
+ if (yych <= '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ if (yych <= '"') goto yy254;
+ goto yy261;
}
} else {
if (yych <= ':') {
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- goto yy256;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ if (yych <= '9') goto yy262;
+ goto yy261;
} else {
if (yych <= '<') {
- if (yych <= ';') goto yy249;
- goto yy256;
+ if (yych <= ';') goto yy254;
+ goto yy261;
} else {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy257;
+ if (yych <= '=') goto yy254;
+ if (yych <= '@') goto yy261;
+ goto yy262;
}
}
}
} else {
if (yych <= 'n') {
if (yych <= 'Z') {
- if (yych <= 'O') goto yy276;
- if (yych == 'U') goto yy277;
- goto yy257;
+ if (yych <= 'O') goto yy281;
+ if (yych == 'U') goto yy282;
+ goto yy262;
} else {
if (yych <= '^') {
- if (yych <= ']') goto yy256;
- goto yy249;
+ if (yych <= ']') goto yy261;
+ goto yy254;
} else {
- if (yych == '`') goto yy256;
- goto yy257;
+ if (yych == '`') goto yy261;
+ goto yy262;
}
}
} else {
if (yych <= 'z') {
- if (yych <= 'o') goto yy276;
- if (yych == 'u') goto yy277;
- goto yy257;
+ if (yych <= 'o') goto yy281;
+ if (yych == 'u') goto yy282;
+ goto yy262;
} else {
if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy249;
+ if (yych <= '{') goto yy261;
+ goto yy254;
} else {
- if (yych == '~') goto yy249;
- goto yy256;
+ if (yych == '~') goto yy254;
+ goto yy261;
}
}
}
}
-yy252:
- YYDEBUG(252, *YYCURSOR);
+yy257:
+ YYDEBUG(257, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'E') {
if (yych <= '%') {
if (yych <= '\f') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\n') goto yy249;
- goto yy256;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ if (yych <= '\n') goto yy254;
+ goto yy261;
} else {
- if (yych <= '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- if (yych <= '"') goto yy249;
- goto yy256;
+ if (yych <= '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ if (yych <= '"') goto yy254;
+ goto yy261;
}
} else {
if (yych <= ':') {
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- goto yy256;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ if (yych <= '9') goto yy262;
+ goto yy261;
} else {
if (yych <= '<') {
- if (yych <= ';') goto yy249;
- goto yy256;
+ if (yych <= ';') goto yy254;
+ goto yy261;
} else {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy257;
+ if (yych <= '=') goto yy254;
+ if (yych <= '@') goto yy261;
+ goto yy262;
}
}
}
} else {
if (yych <= 'e') {
if (yych <= 'Z') {
- if (yych <= 'F') goto yy271;
- if (yych == 'N') goto yy265;
- goto yy257;
+ if (yych <= 'F') goto yy276;
+ if (yych == 'N') goto yy270;
+ goto yy262;
} else {
if (yych <= '^') {
- if (yych <= ']') goto yy256;
- goto yy249;
+ if (yych <= ']') goto yy261;
+ goto yy254;
} else {
- if (yych == '`') goto yy256;
- goto yy257;
+ if (yych == '`') goto yy261;
+ goto yy262;
}
}
} else {
if (yych <= 'z') {
- if (yych <= 'f') goto yy271;
- if (yych == 'n') goto yy265;
- goto yy257;
+ if (yych <= 'f') goto yy276;
+ if (yych == 'n') goto yy270;
+ goto yy262;
} else {
if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy249;
+ if (yych <= '{') goto yy261;
+ goto yy254;
} else {
- if (yych == '~') goto yy249;
- goto yy256;
+ if (yych == '~') goto yy254;
+ goto yy261;
}
}
}
}
-yy253:
- YYDEBUG(253, *YYCURSOR);
+yy258:
+ YYDEBUG(258, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'R') goto yy269;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'R') goto yy274;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'r') goto yy269;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'r') goto yy274;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy254:
- YYDEBUG(254, *YYCURSOR);
+yy259:
+ YYDEBUG(259, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy259;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'E') goto yy264;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'e') goto yy259;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'e') goto yy264;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy255:
- YYDEBUG(255, *YYCURSOR);
+yy260:
+ YYDEBUG(260, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy256:
- YYDEBUG(256, *YYCURSOR);
+yy261:
+ YYDEBUG(261, *YYCURSOR);
if (yybm[0+yych] & 2) {
- goto yy255;
+ goto yy260;
}
- if (yych == '$') goto yy260;
- goto yy229;
-yy257:
- YYDEBUG(257, *YYCURSOR);
+ if (yych == '$') goto yy265;
+ goto yy234;
+yy262:
+ YYDEBUG(262, *YYCURSOR);
yyaccept = 4;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(258, *YYCURSOR);
+ YYDEBUG(263, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy257;
+ goto yy262;
}
if (yych <= ')') {
if (yych <= '\r') {
if (yych <= 0x08) {
- if (yych <= 0x00) goto yy249;
- goto yy255;
+ if (yych <= 0x00) goto yy254;
+ goto yy260;
} else {
- if (yych <= '\n') goto yy249;
- if (yych <= '\f') goto yy255;
- goto yy249;
+ if (yych <= '\n') goto yy254;
+ if (yych <= '\f') goto yy260;
+ goto yy254;
}
} else {
if (yych <= '#') {
- if (yych <= 0x1F) goto yy255;
- if (yych <= '"') goto yy249;
- goto yy255;
+ if (yych <= 0x1F) goto yy260;
+ if (yych <= '"') goto yy254;
+ goto yy260;
} else {
- if (yych <= '$') goto yy260;
- if (yych <= '%') goto yy255;
- goto yy249;
+ if (yych <= '$') goto yy265;
+ if (yych <= '%') goto yy260;
+ goto yy254;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= ':') goto yy255;
- goto yy249;
+ if (yych <= ':') goto yy260;
+ goto yy254;
} else {
- if (yych == '=') goto yy249;
- goto yy255;
+ if (yych == '=') goto yy254;
+ goto yy260;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy249;
- if (yych <= '{') goto yy255;
- goto yy249;
+ if (yych <= '^') goto yy254;
+ if (yych <= '{') goto yy260;
+ goto yy254;
} else {
- if (yych == '~') goto yy249;
- goto yy255;
+ if (yych == '~') goto yy254;
+ goto yy260;
}
}
}
-yy259:
- YYDEBUG(259, *YYCURSOR);
+yy264:
+ YYDEBUG(264, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'S') goto yy265;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'S') goto yy270;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 's') goto yy265;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 's') goto yy270;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy260:
- YYDEBUG(260, *YYCURSOR);
+yy265:
+ YYDEBUG(265, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yych <= '\\') {
- if (yych <= 0x00) goto yy261;
- if (yych <= '[') goto yy255;
- goto yy262;
+ if (yych <= 0x00) goto yy266;
+ if (yych <= '[') goto yy260;
+ goto yy267;
} else {
- if (yych != '{') goto yy255;
+ if (yych != '{') goto yy260;
}
-yy261:
- YYDEBUG(261, *YYCURSOR);
+yy266:
+ YYDEBUG(266, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 3) {
if (yyaccept <= 1) {
if (yyaccept <= 0) {
- goto yy229;
+ goto yy234;
} else {
- goto yy231;
+ goto yy236;
}
} else {
if (yyaccept <= 2) {
- goto yy227;
+ goto yy232;
} else {
- goto yy244;
+ goto yy249;
}
}
} else {
if (yyaccept <= 5) {
if (yyaccept <= 4) {
- goto yy249;
+ goto yy254;
} else {
- goto yy266;
+ goto yy271;
}
} else {
- goto yy273;
+ if (yyaccept <= 6) {
+ goto yy278;
+ } else {
+ goto yy285;
+ }
}
}
-yy262:
- YYDEBUG(262, *YYCURSOR);
+yy267:
+ YYDEBUG(267, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
if (yybm[0+yych] & 8) {
- goto yy263;
+ goto yy268;
}
- goto yy255;
-yy263:
- YYDEBUG(263, *YYCURSOR);
+ goto yy260;
+yy268:
+ YYDEBUG(268, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(264, *YYCURSOR);
+ YYDEBUG(269, *YYCURSOR);
if (yybm[0+yych] & 8) {
- goto yy263;
+ goto yy268;
}
- if (yych <= 0x00) goto yy229;
- if (yych == '\\') goto yy262;
- goto yy255;
-yy265:
- YYDEBUG(265, *YYCURSOR);
+ if (yych <= 0x00) goto yy234;
+ if (yych == '\\') goto yy267;
+ goto yy260;
+yy270:
+ YYDEBUG(270, *YYCURSOR);
yyaccept = 5;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy267;
+ goto yy272;
}
if (yych <= ';') {
if (yych <= ' ') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy266;
- if (yych <= '\t') goto yy256;
+ if (yych <= 0x00) goto yy271;
+ if (yych <= '\t') goto yy261;
} else {
- if (yych != '\r') goto yy256;
+ if (yych != '\r') goto yy261;
}
} else {
if (yych <= ')') {
- if (yych <= '"') goto yy266;
- if (yych <= '%') goto yy256;
+ if (yych <= '"') goto yy271;
+ if (yych <= '%') goto yy261;
} else {
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- if (yych <= ':') goto yy256;
+ if (yych <= '/') goto yy261;
+ if (yych <= '9') goto yy262;
+ if (yych <= ':') goto yy261;
}
}
} else {
if (yych <= '_') {
if (yych <= '@') {
- if (yych != '=') goto yy256;
+ if (yych != '=') goto yy261;
} else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych >= '_') goto yy257;
+ if (yych <= 'Z') goto yy262;
+ if (yych <= ']') goto yy261;
+ if (yych >= '_') goto yy262;
}
} else {
if (yych <= '{') {
- if (yych <= '`') goto yy256;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych <= '`') goto yy261;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych >= 0x7F) goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych >= 0x7F) goto yy261;
}
}
}
-yy266:
- YYDEBUG(266, *YYCURSOR);
+yy271:
+ YYDEBUG(271, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 418 "Zend/zend_ini_scanner.l"
+#line 465 "Zend/zend_ini_scanner.l"
{ /* TRUE value (when used outside option value/offset this causes parse error!) */
RETURN_TOKEN(BOOL_TRUE, "1", 1);
}
-#line 3642 "Zend/zend_ini_scanner.c"
-yy267:
- YYDEBUG(267, *YYCURSOR);
+#line 3750 "Zend/zend_ini_scanner.c"
+yy272:
+ YYDEBUG(272, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(268, *YYCURSOR);
+ YYDEBUG(273, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy267;
+ goto yy272;
}
- goto yy266;
-yy269:
- YYDEBUG(269, *YYCURSOR);
+ goto yy271;
+yy274:
+ YYDEBUG(274, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'U') goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'U') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'u') goto yy270;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'u') goto yy275;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy270:
- YYDEBUG(270, *YYCURSOR);
+yy275:
+ YYDEBUG(275, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy265;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'E') goto yy270;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'e') goto yy265;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'e') goto yy270;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy271:
- YYDEBUG(271, *YYCURSOR);
+yy276:
+ YYDEBUG(276, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'F') goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'F') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'f') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'f') goto yy277;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy272:
- YYDEBUG(272, *YYCURSOR);
+yy277:
+ YYDEBUG(277, *YYCURSOR);
yyaccept = 6;
yych = *(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy257;
+ goto yy262;
}
if (yych <= ')') {
if (yych <= '\f') {
if (yych <= 0x08) {
- if (yych >= 0x01) goto yy256;
+ if (yych >= 0x01) goto yy261;
} else {
- if (yych <= '\t') goto yy274;
- if (yych >= '\v') goto yy256;
+ if (yych <= '\t') goto yy279;
+ if (yych >= '\v') goto yy261;
}
} else {
if (yych <= ' ') {
- if (yych <= '\r') goto yy273;
- if (yych <= 0x1F) goto yy256;
- goto yy274;
+ if (yych <= '\r') goto yy278;
+ if (yych <= 0x1F) goto yy261;
+ goto yy279;
} else {
- if (yych <= '"') goto yy273;
- if (yych <= '%') goto yy256;
+ if (yych <= '"') goto yy278;
+ if (yych <= '%') goto yy261;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= ':') goto yy256;
+ if (yych <= ':') goto yy261;
} else {
- if (yych != '=') goto yy256;
+ if (yych != '=') goto yy261;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy273;
- if (yych <= '{') goto yy256;
+ if (yych <= '^') goto yy278;
+ if (yych <= '{') goto yy261;
} else {
- if (yych != '~') goto yy256;
+ if (yych != '~') goto yy261;
}
}
}
-yy273:
- YYDEBUG(273, *YYCURSOR);
+yy278:
+ YYDEBUG(278, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 422 "Zend/zend_ini_scanner.l"
+#line 469 "Zend/zend_ini_scanner.l"
{ /* FALSE value (when used outside option value/offset this causes parse error!)*/
RETURN_TOKEN(BOOL_FALSE, "", 0);
}
-#line 3852 "Zend/zend_ini_scanner.c"
-yy274:
- YYDEBUG(274, *YYCURSOR);
+#line 3960 "Zend/zend_ini_scanner.c"
+yy279:
+ YYDEBUG(279, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(275, *YYCURSOR);
- if (yych == '\t') goto yy274;
- if (yych == ' ') goto yy274;
- goto yy273;
-yy276:
- YYDEBUG(276, *YYCURSOR);
+ YYDEBUG(280, *YYCURSOR);
+ if (yych == '\t') goto yy279;
+ if (yych == ' ') goto yy279;
+ goto yy278;
+yy281:
+ YYDEBUG(281, *YYCURSOR);
yyaccept = 6;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '<') {
if (yych <= ' ') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy273;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\t') goto yy274;
- goto yy273;
+ if (yych <= 0x00) goto yy278;
+ if (yych <= 0x08) goto yy261;
+ if (yych <= '\t') goto yy279;
+ goto yy278;
} else {
- if (yych == '\r') goto yy273;
- if (yych <= 0x1F) goto yy256;
- goto yy274;
+ if (yych == '\r') goto yy278;
+ if (yych <= 0x1F) goto yy261;
+ goto yy279;
}
} else {
if (yych <= '/') {
- if (yych <= '"') goto yy273;
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy273;
- goto yy256;
+ if (yych <= '"') goto yy278;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy278;
+ goto yy261;
} else {
- if (yych <= '9') goto yy257;
- if (yych == ';') goto yy273;
- goto yy256;
+ if (yych <= '9') goto yy262;
+ if (yych == ';') goto yy278;
+ goto yy261;
}
}
} else {
if (yych <= '_') {
if (yych <= 'N') {
- if (yych <= '=') goto yy273;
- if (yych <= '@') goto yy256;
- if (yych <= 'M') goto yy257;
- goto yy279;
+ if (yych <= '=') goto yy278;
+ if (yych <= '@') goto yy261;
+ if (yych <= 'M') goto yy262;
+ goto yy288;
} else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy273;
- goto yy257;
+ if (yych <= 'Z') goto yy262;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy278;
+ goto yy262;
}
} else {
if (yych <= 'z') {
- if (yych <= '`') goto yy256;
- if (yych == 'n') goto yy279;
- goto yy257;
+ if (yych <= '`') goto yy261;
+ if (yych == 'n') goto yy288;
+ goto yy262;
} else {
if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy273;
+ if (yych <= '{') goto yy261;
+ goto yy278;
} else {
- if (yych == '~') goto yy273;
- goto yy256;
+ if (yych == '~') goto yy278;
+ goto yy261;
}
}
}
}
-yy277:
- YYDEBUG(277, *YYCURSOR);
+yy282:
+ YYDEBUG(282, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'L') goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'L') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'l') goto yy278;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'l') goto yy283;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy278:
- YYDEBUG(278, *YYCURSOR);
+yy283:
+ YYDEBUG(283, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'L') goto yy272;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'L') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'l') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'l') goto yy284;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy279:
- YYDEBUG(279, *YYCURSOR);
+yy284:
+ YYDEBUG(284, *YYCURSOR);
+ yyaccept = 7;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy262;
+ }
+ if (yych <= ')') {
+ if (yych <= '\f') {
+ if (yych <= 0x08) {
+ if (yych >= 0x01) goto yy261;
+ } else {
+ if (yych <= '\t') goto yy286;
+ if (yych >= '\v') goto yy261;
+ }
+ } else {
+ if (yych <= ' ') {
+ if (yych <= '\r') goto yy285;
+ if (yych <= 0x1F) goto yy261;
+ goto yy286;
+ } else {
+ if (yych <= '"') goto yy285;
+ if (yych <= '%') goto yy261;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy261;
+ } else {
+ if (yych != '=') goto yy261;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy285;
+ if (yych <= '{') goto yy261;
+ } else {
+ if (yych != '~') goto yy261;
+ }
+ }
+ }
+yy285:
+ YYDEBUG(285, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 473 "Zend/zend_ini_scanner.l"
+ {
+ RETURN_TOKEN(NULL_NULL, "", 0);
+}
+#line 4175 "Zend/zend_ini_scanner.c"
+yy286:
+ YYDEBUG(286, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(287, *YYCURSOR);
+ if (yych == '\t') goto yy286;
+ if (yych == ' ') goto yy286;
+ goto yy285;
+yy288:
+ YYDEBUG(288, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy272;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'E') goto yy277;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'e') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'e') goto yy277;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy280:
- YYDEBUG(280, *YYCURSOR);
+yy289:
+ YYDEBUG(289, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'L') goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'L') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'l') goto yy281;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'l') goto yy290;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy281:
- YYDEBUG(281, *YYCURSOR);
+yy290:
+ YYDEBUG(290, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'S') goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych != 'S') goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 's') goto yy282;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 's') goto yy291;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy282:
- YYDEBUG(282, *YYCURSOR);
+yy291:
+ YYDEBUG(291, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '=') {
if (yych <= '"') {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
+ if (yych <= 0x00) goto yy254;
+ if (yych <= 0x08) goto yy261;
+ goto yy254;
} else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
+ if (yych == '\r') goto yy254;
+ if (yych <= 0x1F) goto yy261;
+ goto yy254;
}
} else {
if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
+ if (yych <= '%') goto yy261;
+ if (yych <= ')') goto yy254;
+ if (yych <= '/') goto yy261;
+ goto yy262;
} else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
+ if (yych == ';') goto yy254;
+ if (yych <= '<') goto yy261;
+ goto yy254;
}
}
} else {
if (yych <= '`') {
if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy272;
- goto yy257;
+ if (yych <= '@') goto yy261;
+ if (yych == 'E') goto yy277;
+ goto yy262;
} else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
+ if (yych <= ']') goto yy261;
+ if (yych <= '^') goto yy254;
+ if (yych <= '_') goto yy262;
+ goto yy261;
}
} else {
if (yych <= '{') {
- if (yych == 'e') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
+ if (yych == 'e') goto yy277;
+ if (yych <= 'z') goto yy262;
+ goto yy261;
} else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
+ if (yych == '}') goto yy261;
+ if (yych <= '~') goto yy254;
+ goto yy261;
}
}
}
-yy283:
- YYDEBUG(283, *YYCURSOR);
+yy292:
+ YYDEBUG(292, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy284:
- YYDEBUG(284, *YYCURSOR);
+yy293:
+ YYDEBUG(293, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy283;
+ goto yy292;
}
- if (yych >= '\r') goto yy287;
-yy285:
- YYDEBUG(285, *YYCURSOR);
+ if (yych >= '\r') goto yy296;
+yy294:
+ YYDEBUG(294, *YYCURSOR);
++YYCURSOR;
-yy286:
- YYDEBUG(286, *YYCURSOR);
+yy295:
+ YYDEBUG(295, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 582 "Zend/zend_ini_scanner.l"
+#line 633 "Zend/zend_ini_scanner.l"
{ /* Comment */
BEGIN(INITIAL);
SCNG(lineno)++;
return END_OF_LINE;
}
-#line 4245 "Zend/zend_ini_scanner.c"
-yy287:
- YYDEBUG(287, *YYCURSOR);
+#line 4410 "Zend/zend_ini_scanner.c"
+yy296:
+ YYDEBUG(296, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy285;
- goto yy286;
-yy288:
- YYDEBUG(288, *YYCURSOR);
+ if (yych == '\n') goto yy294;
+ goto yy295;
+yy297:
+ YYDEBUG(297, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(289, *YYCURSOR);
+ YYDEBUG(298, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy288;
+ goto yy297;
}
if (yych <= ')') {
if (yych <= '\r') {
if (yych <= 0x08) {
- if (yych <= 0x00) goto yy244;
- goto yy255;
+ if (yych <= 0x00) goto yy249;
+ goto yy260;
} else {
- if (yych <= '\n') goto yy244;
- if (yych <= '\f') goto yy255;
- goto yy244;
+ if (yych <= '\n') goto yy249;
+ if (yych <= '\f') goto yy260;
+ goto yy249;
}
} else {
if (yych <= '#') {
- if (yych <= 0x1F) goto yy255;
- if (yych <= '"') goto yy244;
- goto yy255;
+ if (yych <= 0x1F) goto yy260;
+ if (yych <= '"') goto yy249;
+ goto yy260;
} else {
- if (yych <= '$') goto yy260;
- if (yych <= '%') goto yy255;
- goto yy244;
+ if (yych <= '$') goto yy265;
+ if (yych <= '%') goto yy260;
+ goto yy249;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= ':') goto yy255;
- goto yy244;
+ if (yych <= ':') goto yy260;
+ goto yy249;
} else {
- if (yych == '=') goto yy244;
- goto yy255;
+ if (yych == '=') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
+ if (yych <= '^') goto yy249;
+ if (yych <= '{') goto yy260;
+ goto yy249;
} else {
- if (yych == '~') goto yy244;
- goto yy255;
+ if (yych == '~') goto yy249;
+ goto yy260;
}
}
}
-yy290:
- YYDEBUG(290, *YYCURSOR);
+yy299:
+ YYDEBUG(299, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(291, *YYCURSOR);
+ YYDEBUG(300, *YYCURSOR);
if (yych <= '.') {
if (yych <= 0x1F) {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy260;
+ goto yy249;
} else {
- if (yych == '\r') goto yy244;
- goto yy255;
+ if (yych == '\r') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
+ if (yych <= '"') goto yy249;
+ if (yych <= '#') goto yy260;
+ goto yy265;
} else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- if (yych <= '-') goto yy255;
- goto yy288;
+ if (yych <= '%') goto yy260;
+ if (yych <= ')') goto yy249;
+ if (yych <= '-') goto yy260;
+ goto yy297;
}
}
} else {
if (yych <= '=') {
if (yych <= ':') {
- if (yych <= '/') goto yy255;
- if (yych <= '9') goto yy290;
- goto yy255;
+ if (yych <= '/') goto yy260;
+ if (yych <= '9') goto yy299;
+ goto yy260;
} else {
- if (yych == '<') goto yy255;
- goto yy244;
+ if (yych == '<') goto yy260;
+ goto yy249;
}
} else {
if (yych <= '{') {
- if (yych == '^') goto yy244;
- goto yy255;
+ if (yych == '^') goto yy249;
+ goto yy260;
} else {
- if (yych == '}') goto yy255;
- if (yych <= '~') goto yy244;
- goto yy255;
+ if (yych == '}') goto yy260;
+ if (yych <= '~') goto yy249;
+ goto yy260;
}
}
}
-yy292:
- YYDEBUG(292, *YYCURSOR);
+yy301:
+ YYDEBUG(301, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(293, *YYCURSOR);
+ YYDEBUG(302, *YYCURSOR);
if (yych <= '/') {
if (yych <= 0x1F) {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy260;
+ goto yy249;
} else {
- if (yych == '\r') goto yy244;
- goto yy255;
+ if (yych == '\r') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
+ if (yych <= '"') goto yy249;
+ if (yych <= '#') goto yy260;
+ goto yy265;
} else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- goto yy255;
+ if (yych <= '%') goto yy260;
+ if (yych <= ')') goto yy249;
+ goto yy260;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= '9') goto yy292;
- if (yych <= ':') goto yy255;
- goto yy244;
+ if (yych <= '9') goto yy301;
+ if (yych <= ':') goto yy260;
+ goto yy249;
} else {
- if (yych == '=') goto yy244;
- goto yy255;
+ if (yych == '=') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
+ if (yych <= '^') goto yy249;
+ if (yych <= '{') goto yy260;
+ goto yy249;
} else {
- if (yych == '~') goto yy244;
- goto yy255;
+ if (yych == '~') goto yy249;
+ goto yy260;
}
}
}
-yy294:
- YYDEBUG(294, *YYCURSOR);
+yy303:
+ YYDEBUG(303, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(295, *YYCURSOR);
+ YYDEBUG(304, *YYCURSOR);
if (yych <= '/') {
if (yych <= 0x1F) {
if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy260;
+ goto yy249;
} else {
- if (yych == '\r') goto yy244;
- goto yy255;
+ if (yych == '\r') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
+ if (yych <= '"') goto yy249;
+ if (yych <= '#') goto yy260;
+ goto yy265;
} else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- goto yy255;
+ if (yych <= '%') goto yy260;
+ if (yych <= ')') goto yy249;
+ goto yy260;
}
}
} else {
if (yych <= ']') {
if (yych <= ';') {
- if (yych <= '9') goto yy294;
- if (yych <= ':') goto yy255;
- goto yy244;
+ if (yych <= '9') goto yy303;
+ if (yych <= ':') goto yy260;
+ goto yy249;
} else {
- if (yych == '=') goto yy244;
- goto yy255;
+ if (yych == '=') goto yy249;
+ goto yy260;
}
} else {
if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
+ if (yych <= '^') goto yy249;
+ if (yych <= '{') goto yy260;
+ goto yy249;
} else {
- if (yych == '~') goto yy244;
- goto yy255;
+ if (yych == '~') goto yy249;
+ goto yy260;
}
}
}
-yy296:
- YYDEBUG(296, *YYCURSOR);
+yy305:
+ YYDEBUG(305, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(297, *YYCURSOR);
+ YYDEBUG(306, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy296;
+ goto yy305;
}
- YYDEBUG(298, *YYCURSOR);
+ YYDEBUG(307, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(299, *YYCURSOR);
+ YYDEBUG(308, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 365 "Zend/zend_ini_scanner.l"
+#line 412 "Zend/zend_ini_scanner.l"
{ /* Raw string */
/* Eat leading and trailing single quotes */
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
@@ -4468,66 +4633,66 @@ yy296:
}
RETURN_TOKEN(TC_RAW, yytext, yyleng);
}
-#line 4472 "Zend/zend_ini_scanner.c"
-yy300:
- YYDEBUG(300, *YYCURSOR);
+#line 4637 "Zend/zend_ini_scanner.c"
+yy309:
+ YYDEBUG(309, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(301, *YYCURSOR);
+ YYDEBUG(310, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 398 "Zend/zend_ini_scanner.l"
+#line 445 "Zend/zend_ini_scanner.l"
{ /* Variable start */
yy_push_state(ST_VARNAME TSRMLS_CC);
return TC_DOLLAR_CURLY;
}
-#line 4483 "Zend/zend_ini_scanner.c"
-yy302:
- YYDEBUG(302, *YYCURSOR);
+#line 4648 "Zend/zend_ini_scanner.c"
+yy311:
+ YYDEBUG(311, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy303:
- YYDEBUG(303, *YYCURSOR);
- if (yych == '\t') goto yy302;
- if (yych == ' ') goto yy302;
- goto yy236;
-yy304:
- YYDEBUG(304, *YYCURSOR);
+yy312:
+ YYDEBUG(312, *YYCURSOR);
+ if (yych == '\t') goto yy311;
+ if (yych == ' ') goto yy311;
+ goto yy241;
+yy313:
+ YYDEBUG(313, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy233;
-yy305:
- YYDEBUG(305, *YYCURSOR);
+ goto yy238;
+yy314:
+ YYDEBUG(314, *YYCURSOR);
yyaccept = 1;
YYMARKER = ++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
-yy306:
- YYDEBUG(306, *YYCURSOR);
+yy315:
+ YYDEBUG(315, *YYCURSOR);
if (yych <= 0x1F) {
if (yych <= '\n') {
- if (yych <= 0x08) goto yy231;
- if (yych <= '\t') goto yy305;
- goto yy304;
+ if (yych <= 0x08) goto yy236;
+ if (yych <= '\t') goto yy314;
+ goto yy313;
} else {
- if (yych == '\r') goto yy308;
- goto yy231;
+ if (yych == '\r') goto yy317;
+ goto yy236;
}
} else {
if (yych <= '"') {
- if (yych <= ' ') goto yy305;
- if (yych <= '!') goto yy231;
+ if (yych <= ' ') goto yy314;
+ if (yych <= '!') goto yy236;
} else {
- if (yych == ';') goto yy283;
- goto yy231;
+ if (yych == ';') goto yy292;
+ goto yy236;
}
}
- YYDEBUG(307, *YYCURSOR);
+ YYDEBUG(316, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy238;
-yy308:
- YYDEBUG(308, *YYCURSOR);
+ goto yy243;
+yy317:
+ YYDEBUG(317, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy304;
- goto yy233;
+ if ((yych = *YYCURSOR) == '\n') goto yy313;
+ goto yy238;
}
/* *********************************** */
yyc_ST_VARNAME:
@@ -4566,51 +4731,51 @@ yyc_ST_VARNAME:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(309, *YYCURSOR);
+ YYDEBUG(318, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= ')') {
if (yych <= '"') {
if (yych <= '\f') {
- if (yych <= 0x08) goto yy311;
- if (yych <= '\n') goto yy313;
+ if (yych <= 0x08) goto yy320;
+ if (yych <= '\n') goto yy322;
} else {
- if (yych <= '\r') goto yy313;
- if (yych >= '!') goto yy313;
+ if (yych <= '\r') goto yy322;
+ if (yych >= '!') goto yy322;
}
} else {
if (yych <= '%') {
- if (yych == '$') goto yy313;
+ if (yych == '$') goto yy322;
} else {
- if (yych != '\'') goto yy313;
+ if (yych != '\'') goto yy322;
}
}
} else {
if (yych <= '[') {
if (yych <= '<') {
- if (yych == ';') goto yy313;
+ if (yych == ';') goto yy322;
} else {
- if (yych <= '=') goto yy313;
- if (yych >= '[') goto yy313;
+ if (yych <= '=') goto yy322;
+ if (yych >= '[') goto yy322;
}
} else {
if (yych <= 'z') {
- if (yych == '^') goto yy313;
+ if (yych == '^') goto yy322;
} else {
- if (yych == '}') goto yy315;
- if (yych <= '~') goto yy313;
+ if (yych == '}') goto yy324;
+ if (yych <= '~') goto yy322;
}
}
}
-yy311:
- YYDEBUG(311, *YYCURSOR);
+yy320:
+ YYDEBUG(320, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy318;
-yy312:
- YYDEBUG(312, *YYCURSOR);
+ goto yy327;
+yy321:
+ YYDEBUG(321, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 403 "Zend/zend_ini_scanner.l"
+#line 450 "Zend/zend_ini_scanner.l"
{ /* Variable name */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -4620,41 +4785,41 @@ yy312:
RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
}
-#line 4624 "Zend/zend_ini_scanner.c"
-yy313:
- YYDEBUG(313, *YYCURSOR);
+#line 4789 "Zend/zend_ini_scanner.c"
+yy322:
+ YYDEBUG(322, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(314, *YYCURSOR);
+ YYDEBUG(323, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 600 "Zend/zend_ini_scanner.l"
+#line 651 "Zend/zend_ini_scanner.l"
{
return 0;
}
-#line 4634 "Zend/zend_ini_scanner.c"
-yy315:
- YYDEBUG(315, *YYCURSOR);
+#line 4799 "Zend/zend_ini_scanner.c"
+yy324:
+ YYDEBUG(324, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(316, *YYCURSOR);
+ YYDEBUG(325, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 413 "Zend/zend_ini_scanner.l"
+#line 460 "Zend/zend_ini_scanner.l"
{ /* Variable end */
yy_pop_state(TSRMLS_C);
return '}';
}
-#line 4645 "Zend/zend_ini_scanner.c"
-yy317:
- YYDEBUG(317, *YYCURSOR);
+#line 4810 "Zend/zend_ini_scanner.c"
+yy326:
+ YYDEBUG(326, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy318:
- YYDEBUG(318, *YYCURSOR);
+yy327:
+ YYDEBUG(327, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy317;
+ goto yy326;
}
- goto yy312;
+ goto yy321;
}
}
-#line 604 "Zend/zend_ini_scanner.l"
+#line 655 "Zend/zend_ini_scanner.l"
}
diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h
index aafe7efdde..c81e3605d8 100644
--- a/Zend/zend_ini_scanner.h
+++ b/Zend/zend_ini_scanner.h
@@ -25,6 +25,7 @@
/* Scanner modes */
#define ZEND_INI_SCANNER_NORMAL 0 /* Normal mode. [DEFAULT] */
#define ZEND_INI_SCANNER_RAW 1 /* Raw mode. Option values are not parsed */
+#define ZEND_INI_SCANNER_TYPED 2 /* Typed mode. */
BEGIN_EXTERN_C()
int zend_ini_scanner_get_lineno(TSRMLS_D);
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 0bd303f54a..3bfb1557b1 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -24,6 +24,7 @@
#include <errno.h>
#include "zend.h"
+#include "zend_API.h"
#include "zend_globals.h"
#include <zend_ini_parser.h>
#include "zend_ini_scanner.h"
@@ -132,12 +133,58 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
#define zend_ini_copy_value(retval, str, len) \
- ZVAL_NEW_STR(retval, STR_INIT(str, len, 1))
+ ZVAL_NEW_STR(retval, zend_string_init(str, len, 1))
-#define RETURN_TOKEN(type, str, len) { \
- zend_ini_copy_value(ini_lval, str, len); \
- return type; \
+#define RETURN_TOKEN(type, str, len) { \
+ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
+ zend_ini_copy_typed_value(ini_lval, type, str, len); \
+ } else { \
+ zend_ini_copy_value(ini_lval, str, len); \
+ } \
+ return type; \
+}
+
+static inline int convert_to_number(zval *retval, const char *str, const int str_len)
+{
+ zend_uchar type;
+ int overflow;
+ zend_long lval;
+ double dval;
+
+ if ((type = is_numeric_string_ex(str, str_len, &lval, &dval, 0, &overflow)) != 0) {
+ if (type == IS_LONG) {
+ ZVAL_LONG(retval, lval);
+ return SUCCESS;
+ } else if (type == IS_DOUBLE && !overflow) {
+ ZVAL_DOUBLE(retval, dval);
+ return SUCCESS;
+ }
+ }
+
+ return FAILURE;
+}
+
+static void zend_ini_copy_typed_value(zval *retval, const int type, const char *str, int len)
+{
+ switch (type) {
+ case BOOL_FALSE:
+ case BOOL_TRUE:
+ ZVAL_BOOL(retval, type == BOOL_TRUE);
+ break;
+
+ case NULL_NULL:
+ ZVAL_NULL(retval);
+ break;
+
+ case TC_NUMBER:
+ if (convert_to_number(retval, str, len) == SUCCESS) {
+ break;
+ }
+ /* intentional fall-through */
+ default:
+ zend_ini_copy_value(retval, str, len);
+ }
}
static void _yy_push_state(int new_state TSRMLS_DC)
@@ -169,7 +216,7 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
{
/* Sanity check */
- if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
+ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW && scanner_mode != ZEND_INI_SCANNER_TYPED) {
zend_error(E_WARNING, "Invalid scanner mode");
return FAILURE;
}
@@ -267,7 +314,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
/* convert escape sequences */
s = t = Z_STRVAL_P(lval);
- end = s + Z_STRSIZE_P(lval);
+ end = s + Z_STRLEN_P(lval);
while (s < end) {
if (*s == '\\') {
@@ -286,7 +333,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
case '\\':
case '$':
*t++ = *s;
- Z_STRSIZE_P(lval)--;
+ Z_STRLEN_P(lval)--;
break;
default:
*t++ = '\\';
@@ -419,10 +466,14 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
RETURN_TOKEN(BOOL_TRUE, "1", 1);
}
-<INITIAL,ST_VALUE>("false"|"off"|"no"|"none"|"null"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/
+<INITIAL,ST_VALUE>("false"|"off"|"no"|"none"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/
RETURN_TOKEN(BOOL_FALSE, "", 0);
}
+<INITIAL,ST_VALUE>("null"){TABS_AND_SPACES}* {
+ RETURN_TOKEN(NULL_NULL, "", 0);
+}
+
<INITIAL>{LABEL} { /* Get option name */
/* Eat leading whitespace */
EAT_LEADING_WHITESPACE();
@@ -443,7 +494,7 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
}
<ST_RAW>{RAW_VALUE_CHARS} { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
- char *sc = NULL;
+ unsigned char *sc = NULL;
while (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR) {
case '\n':
diff --git a/Zend/zend_int.h b/Zend/zend_int.h
deleted file mode 100644
index de48718365..0000000000
--- a/Zend/zend_int.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Anatol Belski <ab@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifndef ZEND_INT_H
-#define ZEND_INT_H
-
-#ifndef ZEND_WIN32
-/* this probably needs more on non windows, like for C++ and C99*/
-# include <stdint.h>
-# include <inttypes.h>
-#endif
-
-/* This is the heart of the whole int64 enablement in zval. Based on this
- macros the zend_size_t datatype is handled, see zend_types.h */
-#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
-# define ZEND_ENABLE_INT64 1
-#endif
-
-/* Integer types or the old bad long. */
-#ifdef ZEND_ENABLE_INT64
-# ifdef ZEND_WIN32
-# ifdef _WIN64
-typedef __int64 zend_int_t;
-typedef unsigned __int64 zend_uint_t;
-typedef __int64 zend_off_t;
-# define ZEND_INT_MAX _I64_MAX
-# define ZEND_INT_MIN _I64_MIN
-# define ZEND_UINT_MAX _UI64_MAX
-# define Z_I(i) i##i64
-# define Z_UI(i) i##Ui64
-# else
-# error Cant enable 64 bit integers on non 64 bit platform
-# endif
-# else
-# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64)
-typedef int64_t zend_int_t;
-typedef uint64_t zend_uint_t;
-typedef off_t zend_off_t;
-# define ZEND_INT_MAX INT64_MAX
-# define ZEND_INT_MIN INT64_MIN
-# define ZEND_UINT_MAX UINT64_MAX
-# define Z_I(i) i##LL
-# define Z_UI(i) i##ULL
-# else
-# error Cant enable 64 bit integers on non 64 bit platform
-# endif
-# endif
-# define SIZEOF_ZEND_INT 8
-#else
-typedef long zend_int_t;
-typedef unsigned long zend_uint_t;
-typedef long zend_off_t;
-# define ZEND_INT_MAX LONG_MAX
-# define ZEND_INT_MIN LONG_MIN
-# define ZEND_UINT_MAX ULONG_MAX
-# define Z_I(i) i##L
-# define Z_UI(i) i##UL
-# define SIZEOF_ZEND_INT SIZEOF_LONG
-#endif
-
-
-/* conversion macros */
-#define ZEND_ITOA_BUF_LEN 65
-
-#ifdef ZEND_ENABLE_INT64
-# ifdef PHP_WIN32
-# define ZEND_ITOA(i, s, len) _i64toa_s((i), (s), (len), 10)
-# define ZEND_ATOI(i, s) i = _atoi64((s))
-# define ZEND_STRTOI(s0, s1, base) _strtoi64((s0), (s1), (base))
-# define ZEND_STRTOUI(s0, s1, base) _strtoui64((s0), (s1), (base))
-# define ZEND_INT_FMT "%I64d"
-# define ZEND_UINT_FMT "%I64u"
-# define ZEND_INT_FMT_SPEC "I64d"
-# define ZEND_UINT_FMT_SPEC "I64u"
-# define ZEND_STRTOI_PTR _strtoi64
-# define ZEND_STRTOUI_PTR _strtoui64
-# define ZEND_ABS _abs64
-# else
-# define ZEND_ITOA(i, s, len) \
- do { \
- int st = snprintf((s), (len), "%lld", (i)); \
- (s)[st] = '\0'; \
- } while (0)
-# define ZEND_ATOI(i, s) (i) = atoll((s))
-# define ZEND_STRTOI(s0, s1, base) strtoll((s0), (s1), (base))
-# define ZEND_STRTOUI(s0, s1, base) strtoull((s0), (s1), (base))
-# define ZEND_INT_FMT "%" PRId64
-# define ZEND_UINT_FMT "%" PRIu64
-# define ZEND_INT_FMT_SPEC PRId64
-# define ZEND_UINT_FMT_SPEC PRIu64
-# define ZEND_STRTOI_PTR strtoll
-# define ZEND_STRTOUI_PTR strtoull
-# define ZEND_ABS llabs
-# endif
-#else
-# define ZEND_STRTOI(s0, s1, base) strtol((s0), (s1), (base))
-# define ZEND_STRTOUI(s0, s1, base) strtoul((s0), (s1), (base))
-# ifdef PHP_WIN32
-# define ZEND_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10)
-# define ZEND_ATOI(i, s) i = atol((s))
-# else
-# define ZEND_ITOA(i, s, len) \
- do { \
- int st = snprintf((s), (len), "%ld", (i)); \
- (s)[st] = '\0'; \
- } while (0)
-# define ZEND_ATOI(i, s) (i) = atol((s))
-# endif
-# define ZEND_INT_FMT "%ld"
-# define ZEND_UINT_FMT "%lu"
-# define ZEND_INT_FMT_SPEC "ld"
-# define ZEND_UINT_FMT_SPEC "lu"
-# define ZEND_STRTOI_PTR strtol
-# define ZEND_STRTOUI_PTR strtoul
-# define ZEND_ABS abs
-#endif
-
-
-#endif /* ZEND_INT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index 8d1b2e3652..e299741000 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -195,7 +195,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_
static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
{
*int_key = _iter->index;
- return HASH_KEY_IS_INT;
+ return HASH_KEY_IS_LONG;
}
#endif
/* }}} */
@@ -216,7 +216,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name->val);
}
- ZVAL_INT(key, 0);
+ ZVAL_LONG(key, 0);
}
}
/* }}} */
@@ -282,8 +282,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
zend_class_entry *ce_it;
zend_user_it_new_iterator(ce, object, &iterator TSRMLS_CC);
- ce_it = (Z_TYPE(iterator) == IS_OBJECT &&
- Z_OBJ_HT(iterator)->get_class_entry) ? Z_OBJCE(iterator) : NULL;
+ ce_it = (Z_TYPE(iterator) == IS_OBJECT) ? Z_OBJCE(iterator) : NULL;
if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) {
if (!EG(exception)) {
@@ -303,7 +302,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
{
/* check that class_type is traversable at c-level or implements at least one of 'aggregate' and 'Iterator' */
- zend_uint i;
+ uint32_t i;
if (class_type->get_iterator || (class_type->parent && class_type->parent->get_iterator)) {
return SUCCESS;
@@ -325,7 +324,8 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en
/* {{{ zend_implement_aggregate */
static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
{
- int i, t = -1;
+ uint32_t i;
+ int t = -1;
if (class_type->get_iterator) {
if (class_type->type == ZEND_INTERNAL_CLASS) {
@@ -406,7 +406,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en
/* }}}*/
/* {{{ zend_user_serialize */
-ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC)
+ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC)
{
zend_class_entry * ce = Z_OBJCE_P(object);
zval retval;
@@ -424,8 +424,8 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
zval_ptr_dtor(&retval);
return FAILURE;
case IS_STRING:
- *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRSIZE(retval));
- *buf_len = Z_STRSIZE(retval);
+ *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ *buf_len = Z_STRLEN(retval);
result = SUCCESS;
break;
default: /* failure */
@@ -443,7 +443,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
/* }}} */
/* {{{ zend_user_unserialize */
-ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
+ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC)
{
zval zdata;
@@ -463,7 +463,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
}
/* }}} */
-ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
+ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name->val);
@@ -471,7 +471,7 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zen
}
/* }}} */
-ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
+ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
{
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name->val);
return FAILURE;
diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h
index 7fe0e4e2f0..9bfef0990d 100644
--- a/Zend/zend_interfaces.h
+++ b/Zend/zend_interfaces.h
@@ -61,11 +61,11 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
ZEND_API void zend_register_interfaces(TSRMLS_D);
-ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
-ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
+ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
-ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
-ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
+ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC);
END_EXTERN_C()
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index 7c08ac59b5..8edd5dbdc4 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -47,7 +47,6 @@ static zend_object_handlers iterator_object_handlers = {
NULL, /* method get */
NULL, /* call */
NULL, /* get ctor */
- NULL, /* get_ce */
NULL, /* get class name */
NULL, /* compare */
NULL, /* cast */
@@ -84,29 +83,13 @@ ZEND_API void zend_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
zend_objects_store_del(&iter->std TSRMLS_CC);
}
-ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(
- zval *array_ptr, zend_object_iterator **iter TSRMLS_DC)
+ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr TSRMLS_DC)
{
- switch (Z_TYPE_P(array_ptr)) {
- case IS_OBJECT:
- if (Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
- *iter = (zend_object_iterator *)Z_OBJ_P(array_ptr);
- return ZEND_ITER_OBJECT;
- }
- if (Z_OBJPROP_P(array_ptr)) {
- return ZEND_ITER_PLAIN_OBJECT;
- }
- return ZEND_ITER_INVALID;
-
- case IS_ARRAY:
- if (Z_ARRVAL_P(array_ptr)) {
- return ZEND_ITER_PLAIN_ARRAY;
- }
- return ZEND_ITER_INVALID;
-
- default:
- return ZEND_ITER_INVALID;
+ if (Z_TYPE_P(array_ptr) &&
+ Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
+ return (zend_object_iterator *)Z_OBJ_P(array_ptr);
}
+ return NULL;
}
/*
diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h
index 468223d47c..a1148db214 100644
--- a/Zend/zend_iterators.h
+++ b/Zend/zend_iterators.h
@@ -58,7 +58,7 @@ struct _zend_object_iterator {
zend_object std;
zval data;
zend_object_iterator_funcs *funcs;
- zend_uint_t index; /* private to fe_reset/fe_fetch opcodes */
+ zend_ulong index; /* private to fe_reset/fe_fetch opcodes */
};
typedef struct _zend_class_iterator_funcs {
@@ -71,16 +71,9 @@ typedef struct _zend_class_iterator_funcs {
union _zend_function *zf_rewind;
} zend_class_iterator_funcs;
-enum zend_object_iterator_kind {
- ZEND_ITER_INVALID,
- ZEND_ITER_PLAIN_ARRAY,
- ZEND_ITER_PLAIN_OBJECT,
- ZEND_ITER_OBJECT
-};
-
BEGIN_EXTERN_C()
/* given a zval, returns stuff that can be used to iterate it. */
-ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(zval *array_ptr, zend_object_iterator **iter TSRMLS_DC);
+ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr TSRMLS_DC);
/* given an iterator, wrap it up as a zval for use by the engine opcodes */
ZEND_API void zend_iterator_init(zend_object_iterator *iter TSRMLS_DC);
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 0d40b73e4d..97fc4de546 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -15,6 +15,7 @@
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+ | Nikita Popov <nikic@php.net> |
+----------------------------------------------------------------------+
*/
@@ -40,12 +41,12 @@
static YYSIZE_T zend_yytnamerr(char*, const char*);
#define YYERROR_VERBOSE
-#define YYSTYPE znode
+#define YYSTYPE zend_parser_stack_elem
%}
%pure_parser
-%expect 3
+%expect 2
%code requires {
#ifdef ZTS
@@ -54,25 +55,62 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
#endif
}
-%token END 0 "end of file"
+%destructor { zend_ast_destroy($$); } <ast>
+%destructor { if ($$) zend_string_release($$); } <str>
+
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
+%left ','
+%left T_LOGICAL_OR
+%left T_LOGICAL_XOR
+%left T_LOGICAL_AND
+%right T_PRINT
+%right T_YIELD
+%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
+%left '?' ':'
+%right T_COALESCE
+%left T_BOOLEAN_OR
+%left T_BOOLEAN_AND
+%left '|'
+%left '^'
+%left '&'
+%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
+%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
+%left T_SL T_SR
+%left '+' '-' '.'
+%left '*' '/' '%'
+%right '!'
+%nonassoc T_INSTANCEOF
+%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
+%right T_POW
+%right '['
+%nonassoc T_NEW T_CLONE
+%left T_ELSEIF
+%left T_ELSE
+%left T_ENDIF
+%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
+%right T_DOUBLE_ARROW
+
+%token <ast> T_LNUMBER "integer number (T_LNUMBER)"
+%token <ast> T_DNUMBER "floating-point number (T_DNUMBER)"
+%token <ast> T_STRING "identifier (T_STRING)"
+%token <ast> T_VARIABLE "variable (T_VARIABLE)"
+%token <ast> T_INLINE_HTML
+%token <ast> T_ENCAPSED_AND_WHITESPACE "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
+%token <ast> T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
+%token <ast> T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
+%token <ast> T_NUM_STRING "number (T_NUM_STRING)"
+
+%token END 0 "end of file"
%token T_INCLUDE "include (T_INCLUDE)"
%token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)"
%token T_EVAL "eval (T_EVAL)"
%token T_REQUIRE "require (T_REQUIRE)"
%token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)"
-%left ','
-%left T_LOGICAL_OR
%token T_LOGICAL_OR "or (T_LOGICAL_OR)"
-%left T_LOGICAL_XOR
%token T_LOGICAL_XOR "xor (T_LOGICAL_XOR)"
-%left T_LOGICAL_AND
%token T_LOGICAL_AND "and (T_LOGICAL_AND)"
-%right T_PRINT
%token T_PRINT "print (T_PRINT)"
-%right T_YIELD
%token T_YIELD "yield (T_YIELD)"
-%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
%token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)"
%token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)"
%token T_MUL_EQUAL "*= (T_MUL_EQUAL)"
@@ -84,32 +122,17 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_XOR_EQUAL "^= (T_XOR_EQUAL)"
%token T_SL_EQUAL "<<= (T_SL_EQUAL)"
%token T_SR_EQUAL ">>= (T_SR_EQUAL)"
-%left '?' ':'
-%left T_BOOLEAN_OR
%token T_BOOLEAN_OR "|| (T_BOOLEAN_OR)"
-%left T_BOOLEAN_AND
%token T_BOOLEAN_AND "&& (T_BOOLEAN_AND)"
-%left '|'
-%left '^'
-%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
%token T_IS_EQUAL "== (T_IS_EQUAL)"
%token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)"
%token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)"
%token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
-%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
%token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
%token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
-%left T_SL T_SR
%token T_SL "<< (T_SL)"
%token T_SR ">> (T_SR)"
-%left '+' '-' '.'
-%left '*' '/' '%'
-%right '!'
-%nonassoc T_INSTANCEOF
%token T_INSTANCEOF "instanceof (T_INSTANCEOF)"
-%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
-%right T_POW
%token T_INC "++ (T_INC)"
%token T_DEC "-- (T_DEC)"
%token T_INT_CAST "(int) (T_INT_CAST)"
@@ -119,29 +142,15 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_OBJECT_CAST "(object) (T_OBJECT_CAST)"
%token T_BOOL_CAST "(bool) (T_BOOL_CAST)"
%token T_UNSET_CAST "(unset) (T_UNSET_CAST)"
-%right '['
-%nonassoc T_NEW T_CLONE
%token T_NEW "new (T_NEW)"
%token T_CLONE "clone (T_CLONE)"
%token T_EXIT "exit (T_EXIT)"
%token T_IF "if (T_IF)"
-%left T_ELSEIF
%token T_ELSEIF "elseif (T_ELSEIF)"
-%left T_ELSE
%token T_ELSE "else (T_ELSE)"
-%left T_ENDIF
%token T_ENDIF "endif (T_ENDIF)"
-%token T_LNUMBER "integer number (T_LNUMBER)"
-%token T_DNUMBER "floating-point number (T_DNUMBER)"
-%token T_STRING "identifier (T_STRING)"
-%token T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
-%token T_VARIABLE "variable (T_VARIABLE)"
-%token T_NUM_STRING "number (T_NUM_STRING)"
-%token T_INLINE_HTML
%token T_CHARACTER
%token T_BAD_CHARACTER
-%token T_ENCAPSED_AND_WHITESPACE "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
-%token T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
%token T_ECHO "echo (T_ECHO)"
%token T_DO "do (T_DO)"
%token T_WHILE "while (T_WHILE)"
@@ -170,7 +179,6 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_USE "use (T_USE)"
%token T_INSTEADOF "insteadof (T_INSTEADOF)"
%token T_GLOBAL "global (T_GLOBAL)"
-%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
%token T_STATIC "static (T_STATIC)"
%token T_ABSTRACT "abstract (T_ABSTRACT)"
%token T_FINAL "final (T_FINAL)"
@@ -192,12 +200,13 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_LIST "list (T_LIST)"
%token T_ARRAY "array (T_ARRAY)"
%token T_CALLABLE "callable (T_CALLABLE)"
+%token T_LINE "__LINE__ (T_LINE)"
+%token T_FILE "__FILE__ (T_FILE)"
+%token T_DIR "__DIR__ (T_DIR)"
%token T_CLASS_C "__CLASS__ (T_CLASS_C)"
%token T_TRAIT_C "__TRAIT__ (T_TRAIT_C)"
%token T_METHOD_C "__METHOD__ (T_METHOD_C)"
%token T_FUNC_C "__FUNCTION__ (T_FUNC_C)"
-%token T_LINE "__LINE__ (T_LINE)"
-%token T_FILE "__FILE__ (T_FILE)"
%token T_COMMENT "comment (T_COMMENT)"
%token T_DOC_COMMENT "doc comment (T_DOC_COMMENT)"
%token T_OPEN_TAG "open tag (T_OPEN_TAG)"
@@ -211,293 +220,256 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)"
%token T_NAMESPACE "namespace (T_NAMESPACE)"
%token T_NS_C "__NAMESPACE__ (T_NS_C)"
-%token T_DIR "__DIR__ (T_DIR)"
%token T_NS_SEPARATOR "\\ (T_NS_SEPARATOR)"
%token T_ELLIPSIS "... (T_ELLIPSIS)"
+%token T_COALESCE "?? (T_COALESCE)"
%token T_POW "** (T_POW)"
%token T_POW_EQUAL "**= (T_POW_EQUAL)"
+%type <ast> top_statement namespace_name name statement function_declaration_statement
+%type <ast> class_declaration_statement use_declaration const_decl inner_statement
+%type <ast> expr optional_expr while_statement for_statement foreach_variable
+%type <ast> foreach_statement declare_statement finally_statement unset_variable variable
+%type <ast> extends_from parameter optional_type argument expr_without_variable global_var
+%type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
+%type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
+%type <ast> new_expr class_name class_name_reference simple_variable internal_functions_in_yacc
+%type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name
+%type <ast> variable_class_name dereferencable_scalar class_name_scalar constant dereferencable
+%type <ast> callable_expr callable_variable static_member new_variable
+%type <ast> assignment_list_element array_pair encaps_var encaps_var_offset isset_variables
+%type <ast> isset_variable
+%type <ast> top_statement_list use_declarations const_list inner_statement_list if_stmt
+%type <ast> alt_if_stmt for_exprs switch_case_list global_var_list static_var_list
+%type <ast> echo_expr_list unset_variables catch_list parameter_list class_statement_list
+%type <ast> implements_list interface_extends_list case_list if_stmt_without_else
+%type <ast> non_empty_parameter_list argument_list non_empty_argument_list property_list
+%type <ast> class_const_list name_list trait_adaptations method_body non_empty_for_exprs
+%type <ast> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
+%type <ast> lexical_var_list encaps_list array_pair_list non_empty_array_pair_list
+%type <ast> assignment_list
+
+%type <num> returns_ref function is_reference is_variadic class_type variable_modifiers
+%type <num> method_modifiers trait_modifiers non_empty_member_modifiers member_modifier
+
+%type <str> backup_doc_comment
+
%% /* Rules */
start:
- top_statement_list { zend_do_end_compilation(TSRMLS_C); }
+ top_statement_list { CG(ast) = $1; }
;
top_statement_list:
- top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
- | /* empty */
+ top_statement_list top_statement { $$ = zend_ast_list_add($1, $2); }
+ | /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
namespace_name:
- T_STRING { $$ = $1; }
- | namespace_name T_NS_SEPARATOR T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
+ T_STRING { $$ = $1; }
+ | namespace_name T_NS_SEPARATOR T_STRING { $$ = zend_ast_append_str($1, $3); }
+;
+
+name:
+ namespace_name { $$ = $1; $$->attr = ZEND_NAME_NOT_FQ; }
+ | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$ = $3; $$->attr = ZEND_NAME_RELATIVE; }
+ | T_NS_SEPARATOR namespace_name { $$ = $2; $$->attr = ZEND_NAME_FQ; }
;
top_statement:
- statement { zend_verify_namespace(TSRMLS_C); }
- | function_declaration_statement { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
- | class_declaration_statement { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
- | T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; }
- | T_NAMESPACE namespace_name ';' { zend_do_begin_namespace(&$2, 0 TSRMLS_CC); }
- | T_NAMESPACE namespace_name '{' { zend_do_begin_namespace(&$2, 1 TSRMLS_CC); }
- top_statement_list '}' { zend_do_end_namespace(TSRMLS_C); }
- | T_NAMESPACE '{' { zend_do_begin_namespace(NULL, 1 TSRMLS_CC); }
- top_statement_list '}' { zend_do_end_namespace(TSRMLS_C); }
- | T_USE use_declarations ';' { zend_verify_namespace(TSRMLS_C); }
- | T_USE T_FUNCTION use_function_declarations ';' { zend_verify_namespace(TSRMLS_C); }
- | T_USE T_CONST use_const_declarations ';' { zend_verify_namespace(TSRMLS_C); }
- | constant_declaration ';' { zend_verify_namespace(TSRMLS_C); }
+ statement { $$ = $1; }
+ | function_declaration_statement { $$ = $1; }
+ | class_declaration_statement { $$ = $1; }
+ | T_HALT_COMPILER '(' ')' ';'
+ { $$ = zend_ast_create(ZEND_AST_HALT_COMPILER,
+ zend_ast_create_zval_from_long(zend_get_scanned_file_offset(TSRMLS_C)));
+ zend_stop_lexing(TSRMLS_C); }
+ | T_NAMESPACE namespace_name ';'
+ { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, NULL);
+ RESET_DOC_COMMENT(); }
+ | T_NAMESPACE namespace_name { RESET_DOC_COMMENT(); }
+ '{' top_statement_list '}'
+ { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, $5); }
+ | T_NAMESPACE { RESET_DOC_COMMENT(); }
+ '{' top_statement_list '}'
+ { $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
+ | T_USE use_declarations ';' { $$ = $2; $$->attr = T_CLASS; }
+ | T_USE T_FUNCTION use_declarations ';' { $$ = $3; $$->attr = T_FUNCTION; }
+ | T_USE T_CONST use_declarations ';' { $$ = $3; $$->attr = T_CONST; }
+ | T_CONST const_list ';' { $$ = $2; }
;
use_declarations:
use_declarations ',' use_declaration
+ { $$ = zend_ast_list_add($1, $3); }
| use_declaration
+ { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
;
use_declaration:
- namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); }
- | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); }
+ namespace_name
+ { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, NULL); }
+ | namespace_name T_AS T_STRING
+ { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, $3); }
+ | T_NS_SEPARATOR namespace_name
+ { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $2, NULL); }
+ | T_NS_SEPARATOR namespace_name T_AS T_STRING
+ { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $2, $4); }
;
-use_function_declarations:
- use_function_declarations ',' use_function_declaration
- | use_function_declaration
-;
-
-use_function_declaration:
- namespace_name { zend_do_use_function(&$1, NULL, 0 TSRMLS_CC); }
- | namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3, 0 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL, 1 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4, 1 TSRMLS_CC); }
-;
-
-use_const_declarations:
- use_const_declarations ',' use_const_declaration
- | use_const_declaration
-;
-
-use_const_declaration:
- namespace_name { zend_do_use_const(&$1, NULL, 0 TSRMLS_CC); }
- | namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3, 0 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL, 1 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4, 1 TSRMLS_CC); }
-;
-
-constant_declaration:
- constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_constant(&$3, &$5 TSRMLS_CC); }
- | T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); }
+const_list:
+ const_list ',' const_decl { $$ = zend_ast_list_add($1, $3); }
+ | const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CONST_DECL, $1); }
;
inner_statement_list:
- inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
+ inner_statement_list inner_statement
+ { $$ = zend_ast_list_add($1, $2); }
| /* empty */
+ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
inner_statement:
- statement
- | function_declaration_statement
- | class_declaration_statement
- | T_HALT_COMPILER '(' ')' ';' { zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); }
+ statement { $$ = $1; }
+ | function_declaration_statement { $$ = $1; }
+ | class_declaration_statement { $$ = $1; }
+ | T_HALT_COMPILER '(' ')' ';'
+ { $$ = NULL; zend_error_noreturn(E_COMPILE_ERROR,
+ "__HALT_COMPILER() can only be used from the outermost scope"); }
;
statement:
- unticked_statement { DO_TICKS(); }
- | T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
+ '{' inner_statement_list '}' { $$ = $2; }
+ | if_stmt { $$ = $1; }
+ | alt_if_stmt { $$ = $1; }
+ | T_WHILE '(' expr ')' while_statement
+ { $$ = zend_ast_create(ZEND_AST_WHILE, $3, $5); }
+ | T_DO statement T_WHILE '(' expr ')' ';'
+ { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2, $5); }
+ | T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement
+ { $$ = zend_ast_create(ZEND_AST_FOR, $3, $5, $7, $9); }
+ | T_SWITCH '(' expr ')' switch_case_list
+ { $$ = zend_ast_create(ZEND_AST_SWITCH, $3, $5); }
+ | T_BREAK optional_expr ';' { $$ = zend_ast_create(ZEND_AST_BREAK, $2); }
+ | T_CONTINUE optional_expr ';' { $$ = zend_ast_create(ZEND_AST_CONTINUE, $2); }
+ | T_RETURN optional_expr ';' { $$ = zend_ast_create(ZEND_AST_RETURN, $2); }
+ | T_GLOBAL global_var_list ';' { $$ = $2; }
+ | T_STATIC static_var_list ';' { $$ = $2; }
+ | T_ECHO echo_expr_list ';' { $$ = $2; }
+ | T_INLINE_HTML { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
+ | expr ';' { $$ = $1; }
+ | T_UNSET '(' unset_variables ')' ';' { $$ = $3; }
+ | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
+ { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $5, NULL, $7); }
+ | T_FOREACH '(' expr T_AS foreach_variable T_DOUBLE_ARROW foreach_variable ')'
+ foreach_statement
+ { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $7, $5, $9); }
+ | T_DECLARE '(' const_list ')'
+ { zend_handle_encoding_declaration($3 TSRMLS_CC); }
+ declare_statement
+ { $$ = zend_ast_create(ZEND_AST_DECLARE, $3, $6); }
+ | ';' /* empty statement */ { $$ = NULL; }
+ | T_TRY '{' inner_statement_list '}' catch_list finally_statement
+ { $$ = zend_ast_create(ZEND_AST_TRY, $3, $5, $6); }
+ | T_THROW expr ';' { $$ = zend_ast_create(ZEND_AST_THROW, $2); }
+ | T_GOTO T_STRING ';' { $$ = zend_ast_create(ZEND_AST_GOTO, $2); }
+ | T_STRING ':' { $$ = zend_ast_create(ZEND_AST_LABEL, $1); }
+;
+
+catch_list:
+ /* empty */
+ { $$ = zend_ast_create_list(0, ZEND_AST_CATCH_LIST); }
+ | catch_list T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'
+ { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_CATCH, $4, $5, $8)); }
;
-unticked_statement:
- '{' inner_statement_list '}'
- | T_IF parenthesis_expr { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } statement { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
- | T_IF parenthesis_expr ':' { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
- | T_WHILE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr { zend_do_while_cond(&$3, &$$ TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$4 TSRMLS_CC); }
- | T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE { $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr ';' { zend_do_do_while_end(&$1, &$4, &$6 TSRMLS_CC); }
- | T_FOR
- '('
- for_expr
- ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); }
- for_expr
- ';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
- for_expr
- ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
- for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
- | T_SWITCH parenthesis_expr { zend_do_switch_cond(&$2 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$4 TSRMLS_CC); }
- | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
- | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
- | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
- | T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
- | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
- | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
- | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
- | yield_expr ';' { zend_do_free(&$1 TSRMLS_CC); }
- | T_GLOBAL global_var_list ';'
- | T_STATIC static_var_list ';'
- | T_ECHO echo_expr_list ';'
- | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); }
- | expr ';' { zend_do_free(&$1 TSRMLS_CC); }
- | T_UNSET '(' unset_variables ')' ';'
- | T_FOREACH '(' variable T_AS
- { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 1 TSRMLS_CC); }
- foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
- foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
- | T_FOREACH '(' expr_without_variable T_AS
- { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); }
- foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
- foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
- | T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
- | ';' /* empty statement */
- | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
- catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
- finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
- | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
- | T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); }
-;
-
-catch_statement:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
- fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
- T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
- '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
- additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;}
-
finally_statement:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
-;
-
-additional_catches:
- non_empty_additional_catches { $$ = $1; }
- | /* empty */ { $$.u.op.opline_num = -1; }
-;
-
-non_empty_additional_catches:
- additional_catch { $$ = $1; }
- | non_empty_additional_catches additional_catch { $$ = $2; }
-;
-
-additional_catch:
- T_CATCH '(' fully_qualified_class_name { $$.u.op.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
+ /* empty */ { $$ = NULL; }
+ | T_FINALLY '{' inner_statement_list '}' { $$ = $3; }
;
unset_variables:
- unset_variable
- | unset_variables ',' unset_variable
+ unset_variable { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
+ | unset_variables ',' unset_variable { $$ = zend_ast_list_add($1, $3); }
;
unset_variable:
- variable { zend_do_end_variable_parse(&$1, BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
+ variable { $$ = zend_ast_create(ZEND_AST_UNSET, $1); }
;
function_declaration_statement:
- unticked_function_declaration_statement { DO_TICKS(); }
-;
-
-class_declaration_statement:
- unticked_class_declaration_statement { DO_TICKS(); }
+ function returns_ref T_STRING '(' parameter_list ')' backup_doc_comment
+ '{' inner_statement_list '}'
+ { $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2, $1, $7,
+ zend_ast_get_str($3), $5, NULL, $9); }
;
is_reference:
- /* empty */ { $$.op_type = 0; }
- | '&' { $$.op_type = 1; }
+ /* empty */ { $$ = 0; }
+ | '&' { $$ = ZEND_PARAM_REF; }
;
is_variadic:
- /* empty */ { $$.op_type = 0; }
- | T_ELLIPSIS { $$.op_type = 1; }
-;
-
-unticked_function_declaration_statement:
- function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); }
- '(' parameter_list ')'
- '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
+ /* empty */ { $$ = 0; }
+ | T_ELLIPSIS { $$ = ZEND_PARAM_VARIADIC; }
;
-unticked_class_declaration_statement:
- class_entry_type T_STRING extends_from
- { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); }
- implements_list
- '{'
- class_statement_list
- '}' { zend_do_end_class_declaration(&$1, &$3 TSRMLS_CC); }
- | interface_entry T_STRING
- { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); }
- interface_extends_list
- '{'
- class_statement_list
- '}' { zend_do_end_class_declaration(&$1, NULL TSRMLS_CC); }
+class_declaration_statement:
+ class_type { $<num>$ = CG(zend_lineno); }
+ T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
+ { $$ = zend_ast_create_decl(ZEND_AST_CLASS, $1, $<num>2, $6,
+ zend_ast_get_str($3), $4, $5, $8); }
+ | T_INTERFACE { $<num>$ = CG(zend_lineno); }
+ T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}'
+ { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_INTERFACE, $<num>2, $5,
+ zend_ast_get_str($3), NULL, $4, $7); }
;
-
-class_entry_type:
- T_CLASS { $$.u.op.opline_num = CG(zend_lineno); $$.EA = 0; }
- | T_ABSTRACT T_CLASS { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
- | T_TRAIT { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_TRAIT; }
- | T_FINAL T_CLASS { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_FINAL_CLASS; }
+class_type:
+ T_CLASS { $$ = 0; }
+ | T_ABSTRACT T_CLASS { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
+ | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL_CLASS; }
+ | T_TRAIT { $$ = ZEND_ACC_TRAIT; }
;
extends_from:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_EXTENDS fully_qualified_class_name { zend_do_fetch_class(&$$, &$2 TSRMLS_CC); }
-;
-
-interface_entry:
- T_INTERFACE { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_INTERFACE; }
+ /* empty */ { $$ = NULL; }
+ | T_EXTENDS name { $$ = $2; }
;
interface_extends_list:
- /* empty */
- | T_EXTENDS interface_list
+ /* empty */ { $$ = NULL; }
+ | T_EXTENDS name_list { $$ = $2; }
;
implements_list:
- /* empty */
- | T_IMPLEMENTS interface_list
-;
-
-interface_list:
- fully_qualified_class_name { zend_do_implements_interface(&$1 TSRMLS_CC); }
- | interface_list ',' fully_qualified_class_name { zend_do_implements_interface(&$3 TSRMLS_CC); }
-;
-
-foreach_optional_arg:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_DOUBLE_ARROW foreach_variable { $$ = $2; }
+ /* empty */ { $$ = NULL; }
+ | T_IMPLEMENTS name_list { $$ = $2; }
;
foreach_variable:
- variable { zend_check_writable_variable(&$1); $$ = $1; }
- | '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.EA |= ZEND_PARSED_REFERENCE_VARIABLE; }
- | T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' { $$ = $1; $$.EA = ZEND_PARSED_LIST_EXPR; }
+ variable { $$ = $1; }
+ | '&' variable { $$ = zend_ast_create(ZEND_AST_REF, $2); }
+ | T_LIST '(' assignment_list ')' { $$ = $3; }
;
for_statement:
- statement
- | ':' inner_statement_list T_ENDFOR ';'
+ statement { $$ = $1; }
+ | ':' inner_statement_list T_ENDFOR ';' { $$ = $2; }
;
-
foreach_statement:
- statement
- | ':' inner_statement_list T_ENDFOREACH ';'
+ statement { $$ = $1; }
+ | ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; }
;
-
declare_statement:
- statement
- | ':' inner_statement_list T_ENDDECLARE ';'
+ statement { $$ = $1; }
+ | ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; }
;
-
-declare_list:
- T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
- | declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
-;
-
-
switch_case_list:
'{' case_list '}' { $$ = $2; }
| '{' ';' case_list '}' { $$ = $3; }
@@ -505,14 +477,14 @@ switch_case_list:
| ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
;
-
case_list:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C); zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
- | case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C); zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
+ /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_SWITCH_LIST); }
+ | case_list T_CASE expr case_separator inner_statement_list
+ { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, $3, $5)); }
+ | case_list T_DEFAULT case_separator inner_statement_list
+ { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, NULL, $4)); }
;
-
case_separator:
':'
| ';'
@@ -520,547 +492,476 @@ case_separator:
while_statement:
- statement
- | ':' inner_statement_list T_ENDWHILE ';'
+ statement { $$ = $1; }
+ | ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; }
;
-
-elseif_list:
- /* empty */
- | elseif_list T_ELSEIF parenthesis_expr { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } statement { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
+if_stmt_without_else:
+ T_IF '(' expr ')' statement
+ { $$ = zend_ast_create_list(1, ZEND_AST_IF,
+ zend_ast_create(ZEND_AST_IF_ELEM, $3, $5)); }
+ | if_stmt_without_else T_ELSEIF '(' expr ')' statement
+ { $$ = zend_ast_list_add($1,
+ zend_ast_create(ZEND_AST_IF_ELEM, $4, $6)); }
;
-
-new_elseif_list:
- /* empty */
- | new_elseif_list T_ELSEIF parenthesis_expr ':' { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
+if_stmt:
+ if_stmt_without_else { $$ = $1; }
+ | if_stmt_without_else T_ELSE statement
+ { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_IF_ELEM, NULL, $3)); }
;
-
-else_single:
- /* empty */
- | T_ELSE statement
+alt_if_stmt_without_else:
+ T_IF '(' expr ')' ':' inner_statement_list
+ { $$ = zend_ast_create_list(1, ZEND_AST_IF,
+ zend_ast_create(ZEND_AST_IF_ELEM, $3, $6)); }
+ | alt_if_stmt_without_else T_ELSEIF '(' expr ')' ':' inner_statement_list
+ { $$ = zend_ast_list_add($1,
+ zend_ast_create(ZEND_AST_IF_ELEM, $4, $7)); }
;
-
-new_else_single:
- /* empty */
- | T_ELSE ':' inner_statement_list
+alt_if_stmt:
+ alt_if_stmt_without_else T_ENDIF ';' { $$ = $1; }
+ | alt_if_stmt_without_else T_ELSE ':' inner_statement_list T_ENDIF ';'
+ { $$ = zend_ast_list_add($1,
+ zend_ast_create(ZEND_AST_IF_ELEM, NULL, $4)); }
;
-
parameter_list:
- non_empty_parameter_list
- | /* empty */
+ non_empty_parameter_list { $$ = $1; }
+ | /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
;
non_empty_parameter_list:
parameter
+ { $$ = zend_ast_create_list(1, ZEND_AST_PARAM_LIST, $1); }
| non_empty_parameter_list ',' parameter
+ { $$ = zend_ast_list_add($1, $3); }
;
parameter:
- optional_class_type is_reference is_variadic T_VARIABLE
- { zend_do_receive_param(ZEND_RECV, &$4, NULL, &$1, $2.op_type, $3.op_type TSRMLS_CC); }
- | optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar
- { zend_do_receive_param(ZEND_RECV_INIT, &$4, &$6, &$1, $2.op_type, $3.op_type TSRMLS_CC); }
+ optional_type is_reference is_variadic T_VARIABLE
+ { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, NULL); }
+ | optional_type is_reference is_variadic T_VARIABLE '=' expr
+ { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, $6); }
;
-optional_class_type:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_ARRAY; }
- | T_CALLABLE { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_CALLABLE; }
- | fully_qualified_class_name { $$ = $1; }
+optional_type:
+ /* empty */ { $$ = NULL; }
+ | T_ARRAY { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
+ | T_CALLABLE { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
+ | name { $$ = $1; }
;
-
-function_call_parameter_list:
- '(' ')' { Z_IVAL($$.u.constant) = 0; }
- | '(' non_empty_function_call_parameter_list ')' { $$ = $2; }
- | '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); }
+argument_list:
+ '(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
+ | '(' non_empty_argument_list ')' { $$ = $2; }
;
-
-non_empty_function_call_parameter_list:
- function_call_parameter
- | non_empty_function_call_parameter_list ',' function_call_parameter
+non_empty_argument_list:
+ argument
+ { $$ = zend_ast_create_list(1, ZEND_AST_ARG_LIST, $1); }
+ | non_empty_argument_list ',' argument
+ { $$ = zend_ast_list_add($1, $3); }
;
-function_call_parameter:
- expr_without_variable { zend_do_pass_param(&$1, ZEND_SEND_VAL TSRMLS_CC); }
- | variable { zend_do_pass_param(&$1, ZEND_SEND_VAR TSRMLS_CC); }
- | '&' w_variable { zend_do_pass_param(&$2, ZEND_SEND_REF TSRMLS_CC); }
- | T_ELLIPSIS expr { zend_do_unpack_params(&$2 TSRMLS_CC); }
+argument:
+ expr { $$ = $1; }
+ | T_ELLIPSIS expr { $$ = zend_ast_create(ZEND_AST_UNPACK, $2); }
;
global_var_list:
- global_var_list ',' global_var { zend_do_fetch_global_variable(&$3, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
- | global_var { zend_do_fetch_global_variable(&$1, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
+ global_var_list ',' global_var { $$ = zend_ast_list_add($1, $3); }
+ | global_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
;
-
global_var:
- T_VARIABLE { $$ = $1; }
- | '$' r_variable { $$ = $2; }
- | '$' '{' expr '}' { $$ = $3; }
+ simple_variable
+ { $$ = zend_ast_create(ZEND_AST_GLOBAL, zend_ast_create(ZEND_AST_VAR, $1)); }
;
static_var_list:
- static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | static_var_list ',' T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($5.u.constant) = 0; zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($3.u.constant) = 0; zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
+ static_var_list ',' static_var { $$ = zend_ast_list_add($1, $3); }
+ | static_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
+;
+static_var:
+ T_VARIABLE { $$ = zend_ast_create(ZEND_AST_STATIC, $1, NULL); }
+ | T_VARIABLE '=' expr { $$ = zend_ast_create(ZEND_AST_STATIC, $1, $3); }
;
class_statement_list:
class_statement_list class_statement
+ { $$ = zend_ast_list_add($1, $2); }
| /* empty */
+ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
class_statement:
- variable_modifiers { CG(access_type) = Z_IVAL($1.u.constant); } class_variable_declaration ';'
- | class_constant_declaration ';'
- | trait_use_statement
- | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); }
- '(' parameter_list ')'
- method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
-;
-
-trait_use_statement:
- T_USE trait_list trait_adaptations
+ variable_modifiers property_list ';'
+ { $$ = zend_ast_append_doc_comment($2 TSRMLS_CC); $$->attr = $1; }
+ | T_CONST class_const_list ';'
+ { $$ = $2; RESET_DOC_COMMENT(); }
+ | T_USE name_list trait_adaptations
+ { $$ = zend_ast_create(ZEND_AST_USE_TRAIT, $2, $3); }
+ | method_modifiers function returns_ref T_STRING '(' parameter_list ')' backup_doc_comment
+ method_body
+ { $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1, $2, $8,
+ zend_ast_get_str($4), $6, NULL, $9); }
;
-trait_list:
- fully_qualified_class_name { zend_do_use_trait(&$1 TSRMLS_CC); }
- | trait_list ',' fully_qualified_class_name { zend_do_use_trait(&$3 TSRMLS_CC); }
+name_list:
+ name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
+ | name_list ',' name { $$ = zend_ast_list_add($1, $3); }
;
trait_adaptations:
- ';'
- | '{' trait_adaptation_list '}'
+ ';' { $$ = NULL; }
+ | '{' '}' { $$ = NULL; }
+ | '{' trait_adaptation_list '}' { $$ = $2; }
;
trait_adaptation_list:
- /* empty */
- | non_empty_trait_adaptation_list
+ trait_adaptation
+ { $$ = zend_ast_create_list(1, ZEND_AST_TRAIT_ADAPTATIONS, $1); }
+ | trait_adaptation_list trait_adaptation
+ { $$ = zend_ast_list_add($1, $2); }
;
-non_empty_trait_adaptation_list:
- trait_adaptation_statement
- | non_empty_trait_adaptation_list trait_adaptation_statement
-;
-
-trait_adaptation_statement:
- trait_precedence ';'
- | trait_alias ';'
+trait_adaptation:
+ trait_precedence ';' { $$ = $1; }
+ | trait_alias ';' { $$ = $1; }
;
trait_precedence:
- trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list { zend_add_trait_precedence(&$1, &$3 TSRMLS_CC); }
+ absolute_trait_method_reference T_INSTEADOF name_list
+ { $$ = zend_ast_create(ZEND_AST_TRAIT_PRECEDENCE, $1, $3); }
;
-trait_reference_list:
- fully_qualified_class_name { zend_resolve_class_name(&$1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STR($1.u.constant) TSRMLS_CC); }
- | trait_reference_list ',' fully_qualified_class_name { zend_resolve_class_name(&$3 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STR($3.u.constant) TSRMLS_CC); $$ = $1; }
+trait_alias:
+ trait_method_reference T_AS trait_modifiers T_STRING
+ { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, $4); }
+ | trait_method_reference T_AS member_modifier
+ { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, NULL); }
;
trait_method_reference:
- T_STRING { zend_prepare_reference(&$$, NULL, &$1 TSRMLS_CC); }
- | trait_method_reference_fully_qualified { $$ = $1; }
+ T_STRING
+ { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, NULL, $1); }
+ | absolute_trait_method_reference { $$ = $1; }
;
-trait_method_reference_fully_qualified:
- fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_prepare_reference(&$$, &$1, &$3 TSRMLS_CC); }
-;
-
-trait_alias:
- trait_method_reference T_AS trait_modifiers T_STRING { zend_add_trait_alias(&$1, &$3, &$4 TSRMLS_CC); }
- | trait_method_reference T_AS member_modifier { zend_add_trait_alias(&$1, &$3, NULL TSRMLS_CC); }
+absolute_trait_method_reference:
+ name T_PAAMAYIM_NEKUDOTAYIM T_STRING
+ { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, $1, $3); }
;
trait_modifiers:
- /* empty */ { Z_IVAL($$.u.constant) = 0x0; } /* No change of methods visibility */
- | member_modifier { $$ = $1; } /* REM: Keep in mind, there are not only visibility modifiers */
+ /* empty */ { $$ = 0; }
+ | member_modifier { $$ = $1; }
;
method_body:
- ';' /* abstract method */ { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
- | '{' inner_statement_list '}' { Z_IVAL($$.u.constant) = 0; }
+ ';' /* abstract method */ { $$ = NULL; }
+ | '{' inner_statement_list '}' { $$ = $2; }
;
variable_modifiers:
non_empty_member_modifiers { $$ = $1; }
- | T_VAR { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
+ | T_VAR { $$ = ZEND_ACC_PUBLIC; }
;
method_modifiers:
- /* empty */ { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
- | non_empty_member_modifiers { $$ = $1; if (!(Z_IVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_IVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } }
+ /* empty */ { $$ = ZEND_ACC_PUBLIC; }
+ | non_empty_member_modifiers
+ { $$ = $1; if (!($$ & ZEND_ACC_PPP_MASK)) { $$ |= ZEND_ACC_PUBLIC; } }
;
non_empty_member_modifiers:
- member_modifier { $$ = $1; }
- | non_empty_member_modifiers member_modifier { Z_IVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
+ member_modifier { $$ = $1; }
+ | non_empty_member_modifiers member_modifier
+ { $$ = zend_add_member_modifier($1, $2); }
;
member_modifier:
- T_PUBLIC { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
- | T_PROTECTED { Z_IVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
- | T_PRIVATE { Z_IVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
- | T_STATIC { Z_IVAL($$.u.constant) = ZEND_ACC_STATIC; }
- | T_ABSTRACT { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
- | T_FINAL { Z_IVAL($$.u.constant) = ZEND_ACC_FINAL; }
+ T_PUBLIC { $$ = ZEND_ACC_PUBLIC; }
+ | T_PROTECTED { $$ = ZEND_ACC_PROTECTED; }
+ | T_PRIVATE { $$ = ZEND_ACC_PRIVATE; }
+ | T_STATIC { $$ = ZEND_ACC_STATIC; }
+ | T_ABSTRACT { $$ = ZEND_ACC_ABSTRACT; }
+ | T_FINAL { $$ = ZEND_ACC_FINAL; }
;
-class_variable_declaration:
- class_variable_declaration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, CG(access_type) TSRMLS_CC); }
- | class_variable_declaration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, CG(access_type) TSRMLS_CC); }
- | T_VARIABLE { zend_do_declare_property(&$1, NULL, CG(access_type) TSRMLS_CC); }
- | T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3, CG(access_type) TSRMLS_CC); }
+property_list:
+ property_list ',' property { $$ = zend_ast_list_add($1, $3); }
+ | property { $$ = zend_ast_create_list(1, ZEND_AST_PROP_DECL, $1); }
;
-class_constant_declaration:
- class_constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_class_constant(&$3, &$5 TSRMLS_CC); }
- | T_CONST T_STRING '=' static_scalar { zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); }
+property:
+ T_VARIABLE { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, NULL); }
+ | T_VARIABLE '=' expr
+ { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, $3); }
;
-echo_expr_list:
- echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
- | expr { zend_do_echo(&$1 TSRMLS_CC); }
-;
-
-
-for_expr:
- /* empty */ { $$.op_type = IS_CONST; ZVAL_BOOL(&$$.u.constant, 1); }
- | non_empty_for_expr { $$ = $1; }
+class_const_list:
+ class_const_list ',' const_decl { $$ = zend_ast_list_add($1, $3); }
+ | const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CLASS_CONST_DECL, $1); }
;
-non_empty_for_expr:
- non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
- | expr { $$ = $1; }
+const_decl:
+ T_STRING '=' expr { $$ = zend_ast_create(ZEND_AST_CONST_ELEM, $1, $3); }
;
-chaining_method_or_property:
- chaining_method_or_property variable_property { $$.EA = $2.EA; }
- | variable_property { $$.EA = $1.EA; }
+echo_expr_list:
+ echo_expr_list ',' echo_expr { $$ = zend_ast_list_add($1, $3); }
+ | echo_expr { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
;
-
-chaining_dereference:
- chaining_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | '[' dim_offset ']' { zend_do_pop_object(&$1 TSRMLS_CC); fetch_array_dim(&$$, &$1, &$2 TSRMLS_CC); }
+echo_expr:
+ expr { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
;
-chaining_instance_call:
- chaining_dereference { zend_do_push_object(&$1 TSRMLS_CC); } chaining_method_or_property { $$ = $3; }
- | chaining_dereference { zend_do_push_object(&$1 TSRMLS_CC); $$ = $1; }
- | chaining_method_or_property { $$ = $1; }
+for_exprs:
+ /* empty */ { $$ = NULL; }
+ | non_empty_for_exprs { $$ = $1; }
;
-instance_call:
- /* empty */ { $$ = $0; }
- | { zend_do_push_object(&$0 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); }
- chaining_instance_call { zend_do_pop_object(&$$ TSRMLS_CC); zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); }
+non_empty_for_exprs:
+ non_empty_for_exprs ',' expr { $$ = zend_ast_list_add($1, $3); }
+ | expr { $$ = zend_ast_create_list(1, ZEND_AST_EXPR_LIST, $1); }
;
new_expr:
- T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+ T_NEW class_name_reference ctor_arguments
+ { $$ = zend_ast_create(ZEND_AST_NEW, $2, $3); }
;
expr_without_variable:
- T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
- | variable '=' expr { zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
- | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$4, BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
- | variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated"); zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $3.EA = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
- | T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); }
- | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_POW_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_POW, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
- | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
- | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
- | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
- | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
- | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_POW expr { zend_do_binary_op(ZEND_POW, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | '+' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
- | '-' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
- | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
- | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
- | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
- | expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
- | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
- | expr T_INSTANCEOF class_name_reference { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); }
- | parenthesis_expr { $$ = $1; }
- | new_expr { $$ = $1; }
- | '(' new_expr ')' { $$ = $2; } instance_call { $$ = $5; }
- | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
- expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
- expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
- | expr '?' ':' { zend_do_jmp_set(&$1, &$2, &$3 TSRMLS_CC); }
- expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); }
+ T_LIST '(' assignment_list ')' '=' expr
+ { $$ = zend_ast_create(ZEND_AST_ASSIGN, $3, $6); }
+ | variable '=' expr
+ { $$ = zend_ast_create(ZEND_AST_ASSIGN, $1, $3); }
+ | variable '=' '&' variable
+ { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
+ | variable '=' '&' new_expr
+ { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
+ | T_CLONE expr { $$ = zend_ast_create(ZEND_AST_CLONE, $2); }
+ | variable T_PLUS_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_ADD, $1, $3); }
+ | variable T_MINUS_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SUB, $1, $3); }
+ | variable T_MUL_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MUL, $1, $3); }
+ | variable T_POW_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_POW, $1, $3); }
+ | variable T_DIV_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_DIV, $1, $3); }
+ | variable T_CONCAT_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_CONCAT, $1, $3); }
+ | variable T_MOD_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MOD, $1, $3); }
+ | variable T_AND_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_AND, $1, $3); }
+ | variable T_OR_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_OR, $1, $3); }
+ | variable T_XOR_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_XOR, $1, $3); }
+ | variable T_SL_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SL, $1, $3); }
+ | variable T_SR_EQUAL expr
+ { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SR, $1, $3); }
+ | variable T_INC { $$ = zend_ast_create(ZEND_AST_POST_INC, $1); }
+ | T_INC variable { $$ = zend_ast_create(ZEND_AST_PRE_INC, $2); }
+ | variable T_DEC { $$ = zend_ast_create(ZEND_AST_POST_DEC, $1); }
+ | T_DEC variable { $$ = zend_ast_create(ZEND_AST_PRE_DEC, $2); }
+ | expr T_BOOLEAN_OR expr
+ { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
+ | expr T_BOOLEAN_AND expr
+ { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
+ | expr T_LOGICAL_OR expr
+ { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
+ | expr T_LOGICAL_AND expr
+ { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
+ | expr T_LOGICAL_XOR expr
+ { $$ = zend_ast_create_binary_op(ZEND_BOOL_XOR, $1, $3); }
+ | expr '|' expr { $$ = zend_ast_create_binary_op(ZEND_BW_OR, $1, $3); }
+ | expr '&' expr { $$ = zend_ast_create_binary_op(ZEND_BW_AND, $1, $3); }
+ | expr '^' expr { $$ = zend_ast_create_binary_op(ZEND_BW_XOR, $1, $3); }
+ | expr '.' expr { $$ = zend_ast_create_binary_op(ZEND_CONCAT, $1, $3); }
+ | expr '+' expr { $$ = zend_ast_create_binary_op(ZEND_ADD, $1, $3); }
+ | expr '-' expr { $$ = zend_ast_create_binary_op(ZEND_SUB, $1, $3); }
+ | expr '*' expr { $$ = zend_ast_create_binary_op(ZEND_MUL, $1, $3); }
+ | expr T_POW expr { $$ = zend_ast_create_binary_op(ZEND_POW, $1, $3); }
+ | expr '/' expr { $$ = zend_ast_create_binary_op(ZEND_DIV, $1, $3); }
+ | expr '%' expr { $$ = zend_ast_create_binary_op(ZEND_MOD, $1, $3); }
+ | expr T_SL expr { $$ = zend_ast_create_binary_op(ZEND_SL, $1, $3); }
+ | expr T_SR expr { $$ = zend_ast_create_binary_op(ZEND_SR, $1, $3); }
+ | '+' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_PLUS, $2); }
+ | '-' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_MINUS, $2); }
+ | '!' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BOOL_NOT, $2); }
+ | '~' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BW_NOT, $2); }
+ | expr T_IS_IDENTICAL expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_IDENTICAL, $1, $3); }
+ | expr T_IS_NOT_IDENTICAL expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_IDENTICAL, $1, $3); }
+ | expr T_IS_EQUAL expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_EQUAL, $1, $3); }
+ | expr T_IS_NOT_EQUAL expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_EQUAL, $1, $3); }
+ | expr '<' expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER, $1, $3); }
+ | expr T_IS_SMALLER_OR_EQUAL expr
+ { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER_OR_EQUAL, $1, $3); }
+ | expr '>' expr
+ { $$ = zend_ast_create(ZEND_AST_GREATER, $1, $3); }
+ | expr T_IS_GREATER_OR_EQUAL expr
+ { $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1, $3); }
+ | expr T_INSTANCEOF class_name_reference
+ { $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1, $3); }
+ | '(' expr ')' { $$ = $2; }
+ | new_expr { $$ = $1; }
+ | expr '?' expr ':' expr
+ { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, $3, $5); }
+ | expr '?' ':' expr
+ { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, NULL, $4); }
+ | expr T_COALESCE expr
+ { $$ = zend_ast_create(ZEND_AST_COALESCE, $1, $3); }
| internal_functions_in_yacc { $$ = $1; }
- | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_INT TSRMLS_CC); }
- | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
- | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
- | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
- | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
- | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, _IS_BOOL TSRMLS_CC); }
- | T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
- | T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
- | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
- | scalar { $$ = $1; }
- | combined_scalar_offset { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); }
- | combined_scalar { $$ = $1; }
- | '`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
- | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
- | T_YIELD { zend_do_yield(&$$, NULL, NULL, 0 TSRMLS_CC); }
- | function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); }
- '(' parameter_list ')' lexical_vars
- '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $3; }
- | T_STATIC function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); }
- '(' parameter_list ')' lexical_vars
- '{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $4; }
-;
-
-yield_expr:
- T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); }
- | T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); }
- | T_YIELD expr T_DOUBLE_ARROW expr_without_variable { zend_do_yield(&$$, &$4, &$2, 0 TSRMLS_CC); }
- | T_YIELD expr T_DOUBLE_ARROW variable { zend_do_yield(&$$, &$4, &$2, 1 TSRMLS_CC); }
-;
-
-combined_scalar_offset:
- combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { $1.EA = 0; zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | general_constant '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
-;
-
-combined_scalar:
- T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '[' array_pair_list ']' { $$ = $2; }
+ | T_INT_CAST expr { $$ = zend_ast_create_cast(IS_LONG, $2); }
+ | T_DOUBLE_CAST expr { $$ = zend_ast_create_cast(IS_DOUBLE, $2); }
+ | T_STRING_CAST expr { $$ = zend_ast_create_cast(IS_STRING, $2); }
+ | T_ARRAY_CAST expr { $$ = zend_ast_create_cast(IS_ARRAY, $2); }
+ | T_OBJECT_CAST expr { $$ = zend_ast_create_cast(IS_OBJECT, $2); }
+ | T_BOOL_CAST expr { $$ = zend_ast_create_cast(_IS_BOOL, $2); }
+ | T_UNSET_CAST expr { $$ = zend_ast_create_cast(IS_NULL, $2); }
+ | T_EXIT exit_expr { $$ = zend_ast_create(ZEND_AST_EXIT, $2); }
+ | '@' expr { $$ = zend_ast_create(ZEND_AST_SILENCE, $2); }
+ | scalar { $$ = $1; }
+ | '`' backticks_expr '`' { $$ = zend_ast_create(ZEND_AST_SHELL_EXEC, $2); }
+ | T_PRINT expr { $$ = zend_ast_create(ZEND_AST_PRINT, $2); }
+ | T_YIELD { $$ = zend_ast_create(ZEND_AST_YIELD, NULL, NULL); }
+ | T_YIELD expr { $$ = zend_ast_create(ZEND_AST_YIELD, $2, NULL); }
+ | T_YIELD expr T_DOUBLE_ARROW expr { $$ = zend_ast_create(ZEND_AST_YIELD, $4, $2); }
+ | function returns_ref '(' parameter_list ')' lexical_vars backup_doc_comment
+ '{' inner_statement_list '}'
+ { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2, $1, $7,
+ zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
+ $4, $6, $9); }
+ | T_STATIC function returns_ref '(' parameter_list ')' lexical_vars backup_doc_comment
+ '{' inner_statement_list '}'
+ { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $3 | ZEND_ACC_STATIC, $2, $8,
+ zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
+ $5, $7, $10); }
;
function:
- T_FUNCTION { $$.u.op.opline_num = CG(zend_lineno); }
+ T_FUNCTION { $$ = CG(zend_lineno); }
;
-lexical_vars:
- /* empty */
- | T_USE '(' lexical_var_list ')'
+backup_doc_comment:
+ /* empty */ { $$ = CG(doc_comment); CG(doc_comment) = NULL; }
;
-lexical_var_list:
- lexical_var_list ',' T_VARIABLE { zend_do_fetch_lexical_variable(&$3, 0 TSRMLS_CC); }
- | lexical_var_list ',' '&' T_VARIABLE { zend_do_fetch_lexical_variable(&$4, 1 TSRMLS_CC); }
- | T_VARIABLE { zend_do_fetch_lexical_variable(&$1, 0 TSRMLS_CC); }
- | '&' T_VARIABLE { zend_do_fetch_lexical_variable(&$2, 1 TSRMLS_CC); }
+returns_ref:
+ /* empty */ { $$ = 0; }
+ | '&' { $$ = ZEND_ACC_RETURN_REFERENCE; }
;
-function_call:
- namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant); zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $$.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | T_NS_SEPARATOR namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(&$2, &$$, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
- | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { $$.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
+lexical_vars:
+ /* empty */ { $$ = NULL; }
+ | T_USE '(' lexical_var_list ')' { $$ = $3; }
;
-class_name:
- T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1);}
- | namespace_name { $$ = $1; }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
+lexical_var_list:
+ lexical_var_list ',' lexical_var { $$ = zend_ast_list_add($1, $3); }
+ | lexical_var { $$ = zend_ast_create_list(1, ZEND_AST_CLOSURE_USES, $1); }
;
-fully_qualified_class_name:
- namespace_name { $$ = $1; }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
+lexical_var:
+ T_VARIABLE { $$ = $1; }
+ | '&' T_VARIABLE { $$ = $2; $$->attr = 1; }
;
-
-
-class_name_reference:
- class_name { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
- | dynamic_class_name_reference { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
-;
-
-
-dynamic_class_name_reference:
- base_variable T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
- object_property { zend_do_push_object(&$4 TSRMLS_CC); } dynamic_class_name_variable_properties
- { zend_do_pop_object(&$$ TSRMLS_CC); $$.EA = ZEND_PARSED_MEMBER; }
- | base_variable { $$ = $1; }
+function_call:
+ name argument_list
+ { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
+ { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
+ | variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
+ { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
+ | callable_expr argument_list
+ { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
;
-
-dynamic_class_name_variable_properties:
- dynamic_class_name_variable_properties dynamic_class_name_variable_property
- | /* empty */
+class_name:
+ T_STATIC
+ { zval zv; ZVAL_STRINGL(&zv, "static", sizeof("static")-1);
+ $$ = zend_ast_create_zval_ex(&zv, ZEND_NAME_NOT_FQ); }
+ | name { $$ = $1; }
;
-
-dynamic_class_name_variable_property:
- T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); }
+class_name_reference:
+ class_name { $$ = $1; }
+ | new_variable { $$ = $1; }
;
exit_expr:
- /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
- | parenthesis_expr { $$ = $1; }
+ /* empty */ { $$ = NULL; }
+ | '(' optional_expr ')' { $$ = $2; }
;
backticks_expr:
- /* empty */ { ZVAL_EMPTY_STRING(&$$.u.constant); $$.op_type = IS_CONST; }
- | T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
- | encaps_list { $$ = $1; }
+ /* empty */
+ { $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
+ | T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
+ | encaps_list { $$ = $1; }
;
ctor_arguments:
- /* empty */ { Z_IVAL($$.u.constant) = 0; }
- | function_call_parameter_list { $$ = $1; }
-;
-
-
-common_scalar:
- T_LNUMBER { $$ = $1; }
- | T_DNUMBER { $$ = $1; }
- | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | T_LINE { $$ = $1; }
- | T_FILE { $$ = $1; }
- | T_DIR { $$ = $1; }
- | T_TRAIT_C { $$ = $1; }
- | T_METHOD_C { $$ = $1; }
- | T_FUNC_C { $$ = $1; }
- | T_NS_C { $$ = $1; }
- | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
- | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); $$.op_type = IS_CONST; }
-;
-
-static_class_constant:
- class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); }
-;
-
-static_scalar: /* compile-time evaluated scalars */
- static_scalar_value { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); }
-;
-
-static_scalar_value:
- common_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
- | static_class_name_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
- | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
- | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
- | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
- | '[' static_array_pair_list ']' { $$ = $2; }
- | static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
- | T_CLASS_C { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
- | static_operation { $$ = $1; }
-;
-
-static_operation:
- static_scalar_value '[' static_scalar_value ']' { $$.u.ast = zend_ast_create_binary(ZEND_FETCH_DIM_R, $1.u.ast, $3.u.ast); }
- | static_scalar_value '+' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_ADD, $1.u.ast, $3.u.ast); }
- | static_scalar_value '-' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SUB, $1.u.ast, $3.u.ast); }
- | static_scalar_value '*' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MUL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_POW static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_POW, $1.u.ast, $3.u.ast); }
- | static_scalar_value '/' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_DIV, $1.u.ast, $3.u.ast); }
- | static_scalar_value '%' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MOD, $1.u.ast, $3.u.ast); }
- | '!' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_BOOL_NOT, $2.u.ast); }
- | '~' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_BW_NOT, $2.u.ast); }
- | static_scalar_value '|' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_OR, $1.u.ast, $3.u.ast); }
- | static_scalar_value '&' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_AND, $1.u.ast, $3.u.ast); }
- | static_scalar_value '^' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_XOR, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_SL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_SR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SR, $1.u.ast, $3.u.ast); }
- | static_scalar_value '.' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_CONCAT, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_LOGICAL_XOR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_XOR, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_LOGICAL_AND static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_AND, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_LOGICAL_OR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_OR, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_BOOLEAN_AND static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_AND, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_BOOLEAN_OR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_OR, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_IS_IDENTICAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_IDENTICAL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_NOT_IDENTICAL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_IS_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_EQUAL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_IS_NOT_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_NOT_EQUAL, $1.u.ast, $3.u.ast); }
- | static_scalar_value '<' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER, $1.u.ast, $3.u.ast); }
- | static_scalar_value '>' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER, $3.u.ast, $1.u.ast); }
- | static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER_OR_EQUAL, $1.u.ast, $3.u.ast); }
- | static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER_OR_EQUAL, $3.u.ast, $1.u.ast); }
- | static_scalar_value '?' ':' static_scalar_value { $$.u.ast = zend_ast_create_ternary(ZEND_SELECT, $1.u.ast, NULL, $4.u.ast); }
- | static_scalar_value '?' static_scalar_value ':' static_scalar_value { $$.u.ast = zend_ast_create_ternary(ZEND_SELECT, $1.u.ast, $3.u.ast, $5.u.ast); }
- | '+' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_UNARY_PLUS, $2.u.ast); }
- | '-' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_UNARY_MINUS, $2.u.ast); }
- | '(' static_scalar_value ')' { $$ = $2; }
-;
-
-general_constant:
- class_constant { $$ = $1; }
- | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); }
- | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
+ /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
+ | argument_list { $$ = $1; }
+;
+
+
+dereferencable_scalar:
+ T_ARRAY '(' array_pair_list ')' { $$ = $3; }
+ | '[' array_pair_list ']' { $$ = $2; }
+ | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
;
scalar:
- T_STRING_VARNAME { $$ = $1; }
- | general_constant { $$ = $1; }
- | class_name_scalar { $$ = $1; }
- | common_scalar { $$ = $1; }
- | '"' encaps_list '"' { $$ = $2; }
+ T_LNUMBER { $$ = $1; }
+ | T_DNUMBER { $$ = $1; }
+ | T_LINE { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_LINE); }
+ | T_FILE { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FILE); }
+ | T_DIR { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_DIR); }
+ | T_TRAIT_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_TRAIT_C); }
+ | T_METHOD_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_METHOD_C); }
+ | T_FUNC_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FUNC_C); }
+ | T_NS_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_NS_C); }
+ | T_CLASS_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C); }
+ | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
+ | T_START_HEREDOC T_END_HEREDOC
+ { $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
+ | '"' encaps_list '"' { $$ = $2; }
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
- | T_CLASS_C { if (Z_TYPE($1.u.constant) == IS_CONSTANT) {zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC);} else {$$ = $1;} }
+ | dereferencable_scalar { $$ = $1; }
+ | class_name_scalar { $$ = $1; }
+ | constant { $$ = $1; }
;
-static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; array_init(&$$.u.constant); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
- | non_empty_static_array_pair_list possible_comma { zend_ast_dynamic_shrink(&$1.u.ast); $$ = $1; }
+constant:
+ name { $$ = zend_ast_create(ZEND_AST_CONST, $1); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
+ { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
+ | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
+ { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
;
possible_comma:
@@ -1068,232 +969,190 @@ possible_comma:
| ','
;
-non_empty_static_array_pair_list:
- non_empty_static_array_pair_list ',' static_scalar_value T_DOUBLE_ARROW static_scalar_value { zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); zend_ast_dynamic_add(&$$.u.ast, $5.u.ast); }
- | non_empty_static_array_pair_list ',' static_scalar_value { zend_ast_dynamic_add(&$$.u.ast, NULL); zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); }
- | static_scalar_value T_DOUBLE_ARROW static_scalar_value { $$.u.ast = zend_ast_create_dynamic(ZEND_INIT_ARRAY); zend_ast_dynamic_add(&$$.u.ast, $1.u.ast); zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); }
- | static_scalar_value { $$.u.ast = zend_ast_create_dynamic(ZEND_INIT_ARRAY); zend_ast_dynamic_add(&$$.u.ast, NULL); zend_ast_dynamic_add(&$$.u.ast, $1.u.ast); }
-;
-
expr:
- r_variable { $$ = $1; }
+ variable { $$ = $1; }
| expr_without_variable { $$ = $1; }
;
-parenthesis_expr:
- '(' expr ')' { $$ = $2; }
- | '(' yield_expr ')' { $$ = $2; }
-;
-
-
-r_variable:
- variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
-;
-
-
-w_variable:
- variable { zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $$ = $1;
- zend_check_writable_variable(&$1); }
-;
-
-rw_variable:
- variable { zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); $$ = $1;
- zend_check_writable_variable(&$1); }
-;
-
-variable:
- base_variable_with_function_calls T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
- object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties
- { zend_do_pop_object(&$$ TSRMLS_CC); $$.EA = $1.EA | ($7.EA ? $7.EA : $6.EA); }
- | base_variable_with_function_calls { $$ = $1; }
-;
-
-variable_properties:
- variable_properties variable_property { $$.EA = $2.EA; }
- | /* empty */ { $$.EA = 0; }
-;
-
-
-variable_property:
- T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.EA = $4.EA; }
-;
-
-array_method_dereference:
- array_method_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | method '[' dim_offset ']' { $1.EA = ZEND_PARSED_METHOD_CALL; fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
-;
-
-method:
- { zend_do_pop_object(&$$ TSRMLS_CC); zend_do_begin_method_call(&$$ TSRMLS_CC); }
- function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
-;
-
-method_or_not:
- method { $$ = $1; $$.EA = ZEND_PARSED_METHOD_CALL; zend_do_push_object(&$$ TSRMLS_CC); }
- | array_method_dereference { $$ = $1; zend_do_push_object(&$$ TSRMLS_CC); }
- | /* empty */ { $$.EA = ZEND_PARSED_MEMBER; }
-;
-
-variable_without_objects:
- reference_variable { $$ = $1; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
-;
-
-static_member:
- class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
-
+optional_expr:
+ /* empty */ { $$ = NULL; }
+ | expr { $$ = $1; }
;
variable_class_name:
- reference_variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$=$1;; }
+ dereferencable { $$ = $1; }
;
-array_function_dereference:
- array_function_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | function_call { zend_do_begin_variable_parse(TSRMLS_C); $1.EA = ZEND_PARSED_FUNCTION_CALL; }
- '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$4 TSRMLS_CC); }
+dereferencable:
+ variable { $$ = $1; }
+ | '(' expr ')' { $$ = $2; }
+ | dereferencable_scalar { $$ = $1; }
;
-base_variable_with_function_calls:
- base_variable { $$ = $1; }
- | array_function_dereference { $$ = $1; }
- | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.EA = ZEND_PARSED_FUNCTION_CALL; }
+callable_expr:
+ callable_variable { $$ = $1; }
+ | '(' expr ')' { $$ = $2; }
+ | dereferencable_scalar { $$ = $1; }
;
-
-base_variable:
- reference_variable { $$ = $1; $$.EA = ZEND_PARSED_VARIABLE; }
- | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.EA = ZEND_PARSED_VARIABLE; }
- | static_member { $$ = $1; $$.EA = ZEND_PARSED_STATIC_MEMBER; }
+callable_variable:
+ simple_variable
+ { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
+ | dereferencable '[' optional_expr ']'
+ { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
+ | constant '[' optional_expr ']'
+ { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
+ | dereferencable '{' expr '}'
+ { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
+ | dereferencable T_OBJECT_OPERATOR member_name argument_list
+ { $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
+ | function_call { $$ = $1; }
;
-reference_variable:
- reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
+variable:
+ callable_variable
+ { $$ = $1; }
+ | static_member
+ { $$ = $1; }
+ | dereferencable T_OBJECT_OPERATOR member_name
+ { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
;
-
-compound_variable:
+simple_variable:
T_VARIABLE { $$ = $1; }
| '$' '{' expr '}' { $$ = $3; }
+ | '$' simple_variable { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
;
-dim_offset:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | expr { $$ = $1; }
-;
-
-
-object_property:
- object_dim_list { $$ = $1; }
- | variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-object_dim_list:
- object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
- | object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
- | variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
-;
-
-variable_name:
+static_member:
+ class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
+ { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
+ | variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
+ { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
+;
+
+new_variable:
+ simple_variable
+ { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
+ | new_variable '[' optional_expr ']'
+ { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
+ | new_variable '{' expr '}'
+ { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
+ | new_variable T_OBJECT_OPERATOR member_name
+ { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
+ { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
+ | new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable
+ { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
+;
+
+member_name:
T_STRING { $$ = $1; }
| '{' expr '}' { $$ = $2; }
-;
-
-simple_indirect_reference:
- '$' { Z_IVAL($$.u.constant) = 1; }
- | simple_indirect_reference '$' { Z_IVAL($$.u.constant)++; }
+ | simple_variable { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
;
assignment_list:
assignment_list ',' assignment_list_element
+ { $$ = zend_ast_list_add($1, $3); }
| assignment_list_element
+ { $$ = zend_ast_create_list(1, ZEND_AST_LIST, $1); }
;
-
assignment_list_element:
- variable { zend_do_add_list_element(&$1 TSRMLS_CC); }
- | T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); }
- | /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); }
+ variable { $$ = $1; }
+ | T_LIST '(' assignment_list ')' { $$ = $3; }
+ | /* empty */ { $$ = NULL; }
;
array_pair_list:
- /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); zend_do_end_array(&$$, &$$ TSRMLS_CC); }
- | non_empty_array_pair_list possible_comma { zend_do_end_array(&$$, &$1 TSRMLS_CC); }
+ /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_ARRAY); }
+ | non_empty_array_pair_list possible_comma { $$ = $1; }
;
non_empty_array_pair_list:
- non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
- | expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
- | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
- | non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
- | expr T_DOUBLE_ARROW '&' w_variable { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
- | '&' w_variable { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
+ non_empty_array_pair_list ',' array_pair
+ { $$ = zend_ast_list_add($1, $3); }
+ | array_pair
+ { $$ = zend_ast_create_list(1, ZEND_AST_ARRAY, $1); }
;
-encaps_list:
- encaps_list encaps_var { zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
- | encaps_var { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, NULL, &$1 TSRMLS_CC); }
- | T_ENCAPSED_AND_WHITESPACE encaps_var { zend_do_add_string(&$$, NULL, &$1 TSRMLS_CC); zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$$, &$2 TSRMLS_CC); }
+array_pair:
+ expr T_DOUBLE_ARROW expr
+ { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $3, $1); }
+ | expr { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $1, NULL); }
+ | expr T_DOUBLE_ARROW '&' variable
+ { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $4, $1); }
+ | '&' variable
+ { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $2, NULL); }
;
-
+encaps_list:
+ encaps_list encaps_var
+ { $$ = zend_ast_list_add($1, $2); }
+ | encaps_list T_ENCAPSED_AND_WHITESPACE
+ { $$ = zend_ast_list_add($1, $2); }
+ | encaps_var
+ { $$ = zend_ast_create_list(1, ZEND_AST_ENCAPS_LIST, $1); }
+ | T_ENCAPSED_AND_WHITESPACE encaps_var
+ { $$ = zend_ast_create_list(2, ZEND_AST_ENCAPS_LIST, $1, $2); }
+;
encaps_var:
- T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
- | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
- | T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
+ T_VARIABLE
+ { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
+ | T_VARIABLE '[' encaps_var_offset ']'
+ { $$ = zend_ast_create(ZEND_AST_DIM,
+ zend_ast_create(ZEND_AST_VAR, $1), $3); }
+ | T_VARIABLE T_OBJECT_OPERATOR T_STRING
+ { $$ = zend_ast_create(ZEND_AST_PROP,
+ zend_ast_create(ZEND_AST_VAR, $1), $3); }
+ | T_DOLLAR_OPEN_CURLY_BRACES expr '}'
+ { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
+ | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'
+ { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
+ | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
+ { $$ = zend_ast_create(ZEND_AST_DIM,
+ zend_ast_create(ZEND_AST_VAR, $2), $4); }
| T_CURLY_OPEN variable '}' { $$ = $2; }
;
-
encaps_var_offset:
T_STRING { $$ = $1; }
| T_NUM_STRING { $$ = $1; }
- | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
+ | T_VARIABLE { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
;
internal_functions_in_yacc:
T_ISSET '(' isset_variables ')' { $$ = $3; }
- | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
- | T_EMPTY '(' expr_without_variable ')' { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$3 TSRMLS_CC); }
- | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
- | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
- | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
- | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
- | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
+ | T_EMPTY '(' expr ')' { $$ = zend_ast_create(ZEND_AST_EMPTY, $3); }
+ | T_INCLUDE expr
+ { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE, $2); }
+ | T_INCLUDE_ONCE expr
+ { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE_ONCE, $2); }
+ | T_EVAL '(' expr ')'
+ { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_EVAL, $3); }
+ | T_REQUIRE expr
+ { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE, $2); }
+ | T_REQUIRE_ONCE expr
+ { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE_ONCE, $2); }
;
isset_variables:
- isset_variable { $$ = $1; }
- | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } isset_variable { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
+ isset_variable { $$ = $1; }
+ | isset_variables ',' isset_variable
+ { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
;
isset_variable:
- variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
- | expr_without_variable { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); }
-;
-
-class_constant:
- class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
- | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
-;
-
-static_class_name_scalar:
- class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { zend_do_resolve_class_name(&$$, &$1, 1 TSRMLS_CC); }
+ expr { $$ = zend_ast_create(ZEND_AST_ISSET, $1); }
;
class_name_scalar:
- class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { zend_do_resolve_class_name(&$$, &$1, 0 TSRMLS_CC); }
+ class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
+ { $$ = zend_ast_create(ZEND_AST_RESOLVE_CLASS_NAME, $1); }
;
%%
diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c
index ffde058e0b..034369a4c2 100644
--- a/Zend/zend_language_scanner.c
+++ b/Zend/zend_language_scanner.c
@@ -128,7 +128,7 @@ BEGIN_EXTERN_C()
static size_t encoding_filter_script_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
- assert(internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding));
+ ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length, internal_encoding, LANG_SCNG(script_encoding) TSRMLS_CC);
}
@@ -146,7 +146,7 @@ LANG_SCNG(script_encoding), zend_multibyte_encoding_utf8 TSRMLS_CC);
static size_t encoding_filter_intermediate_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
- assert(internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding));
+ ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length,
internal_encoding, zend_multibyte_encoding_utf8 TSRMLS_CC);
}
@@ -535,9 +535,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename;
}
- compiled_filename = STR_INIT(file_path, strlen(file_path), 0);
+ compiled_filename = zend_string_init(file_path, strlen(file_path), 0);
zend_set_compiled_filename(compiled_filename TSRMLS_CC);
- STR_RELEASE(compiled_filename);
+ zend_string_release(compiled_filename);
if (CG(start_lineno)) {
CG(zend_lineno) = CG(start_lineno);
@@ -558,19 +558,15 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
zend_lex_state original_lex_state;
zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval=NULL;
int compiler_result;
zend_bool compilation_successful=0;
- znode retval_znode;
+ zval retval_zv;
zend_bool original_in_compilation = CG(in_compilation);
- retval_znode.op_type = IS_CONST;
- ZVAL_INT(&retval_znode.u.constant, 1);
+ ZVAL_LONG(&retval_zv, 1);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- retval = op_array; /* success oriented */
-
if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
@@ -585,27 +581,31 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
CG(active_op_array) = op_array;
zend_stack_push(&CG(context_stack), (void *) &CG(context));
zend_init_compiler_context(TSRMLS_C);
+ CG(ast_arena) = zend_arena_create(1024 * 32);
compiler_result = zendparse(TSRMLS_C);
- zend_do_return(&retval_znode, 0 TSRMLS_CC);
- CG(in_compilation) = original_in_compilation;
if (compiler_result != 0) { /* parser error */
zend_bailout();
}
+ zend_compile_top_stmt(CG(ast) TSRMLS_CC);
+ zend_ast_destroy(CG(ast));
+ zend_arena_destroy(CG(ast_arena));
+ zend_do_end_compilation(TSRMLS_C);
+ zend_emit_final_return(&retval_zv TSRMLS_CC);
+ CG(in_compilation) = original_in_compilation;
compilation_successful=1;
}
- if (retval) {
- CG(active_op_array) = original_active_op_array;
- if (compilation_successful) {
- pass_two(op_array TSRMLS_CC);
- zend_release_labels(0 TSRMLS_CC);
- } else {
- efree(op_array);
- retval = NULL;
- }
+ CG(active_op_array) = original_active_op_array;
+ if (compilation_successful) {
+ pass_two(op_array TSRMLS_CC);
+ zend_release_labels(0 TSRMLS_CC);
+ } else {
+ efree_size(op_array, sizeof(zend_op_array));
+ op_array = NULL;
}
+
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- return retval;
+ return op_array;
}
@@ -631,7 +631,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) {
if (!file_handle.opened_path) {
- file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRSIZE_P(filename));
+ file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
}
zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path));
@@ -655,8 +655,8 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
zend_string *new_compiled_filename;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
- old_len = Z_STRSIZE_P(str);
- Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0);
+ old_len = Z_STRLEN_P(str);
+ Z_STR_P(str) = zend_string_realloc(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1);
@@ -685,9 +685,9 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
yy_scan_buffer(buf, size TSRMLS_CC);
- new_compiled_filename = STR_INIT(filename, strlen(filename), 0);
+ new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
- STR_RELEASE(new_compiled_filename);
+ zend_string_release(new_compiled_filename);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
RESET_DOC_COMMENT();
@@ -720,63 +720,50 @@ ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D)
zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
{
zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval;
+ zend_op_array *op_array = NULL;
zval tmp;
- int compiler_result;
zend_bool original_in_compilation = CG(in_compilation);
- if (Z_STRSIZE_P(source_string)==0) {
- efree(op_array);
+ if (Z_STRLEN_P(source_string)==0) {
return NULL;
}
- CG(in_compilation) = 1;
-
ZVAL_DUP(&tmp, source_string);
convert_to_string(&tmp);
source_string = &tmp;
-
+
+ CG(in_compilation) = 1;
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) {
- efree(op_array);
- retval = NULL;
- } else {
- zend_bool orig_interactive = CG(interactive);
-
- CG(interactive) = 0;
- init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(interactive) = orig_interactive;
- CG(active_op_array) = op_array;
- zend_stack_push(&CG(context_stack), (void *) &CG(context));
- zend_init_compiler_context(TSRMLS_C);
+ if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC) == SUCCESS) {
+ CG(ast) = NULL;
+ CG(ast_arena) = zend_arena_create(1024 * 32);
BEGIN(ST_IN_SCRIPTING);
- compiler_result = zendparse(TSRMLS_C);
-
- if (SCNG(script_filtered)) {
- efree(SCNG(script_filtered));
- SCNG(script_filtered) = NULL;
- }
- if (compiler_result != 0) {
- CG(active_op_array) = original_active_op_array;
- CG(unclean_shutdown)=1;
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- retval = NULL;
- } else {
- zend_do_return(NULL, 0 TSRMLS_CC);
- CG(active_op_array) = original_active_op_array;
+ if (!zendparse(TSRMLS_C)) {
+ zend_op_array *original_active_op_array = CG(active_op_array);
+ op_array = emalloc(sizeof(zend_op_array));
+ init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
+ CG(active_op_array) = op_array;
+
+ zend_stack_push(&CG(context_stack), (void *) &CG(context));
+ zend_init_compiler_context(TSRMLS_C);
+ zend_compile_top_stmt(CG(ast) TSRMLS_CC);
+ zend_do_end_compilation(TSRMLS_C);
+ zend_emit_final_return(NULL TSRMLS_CC);
pass_two(op_array TSRMLS_CC);
zend_release_labels(0 TSRMLS_CC);
- retval = op_array;
+
+ CG(active_op_array) = original_active_op_array;
}
+
+ zend_ast_destroy(CG(ast));
+ zend_arena_destroy(CG(ast_arena));
}
+
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zval_dtor(&tmp);
CG(in_compilation) = original_in_compilation;
- return retval;
+ return op_array;
}
@@ -858,7 +845,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start));
SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start));
SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start));
- SCNG(yy_limit) = new_yy_start + (SCNG(yy_limit) - SCNG(yy_start));
+ SCNG(yy_limit) = new_yy_start + length;
SCNG(yy_start) = new_yy_start;
}
@@ -876,15 +863,6 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
ZVAL_STRINGL(zendlval, yytext, yyleng); \
}
-// TODO: some extensions might need content, but we don't copy it intentional ???
-#if 0
-# define DUMMY_STRINGL(zendlval, yytext, yyleng) \
- ZVAL_STRINGL(zendlval, yytext, yyleng)
-#else
-# define DUMMY_STRINGL(zendlval, yytext, yyleng) \
- ZVAL_EMPTY_STRING(zendlval)
-#endif
-
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
{
register char *s, *t;
@@ -894,7 +872,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
- end = s+Z_STRSIZE_P(zendlval);
+ end = s+Z_STRLEN_P(zendlval);
while (s<end) {
if (*s=='\\') {
s++;
@@ -906,23 +884,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
switch(*s) {
case 'n':
*t++ = '\n';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'r':
*t++ = '\r';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 't':
*t++ = '\t';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'f':
*t++ = '\f';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'v':
*t++ = '\v';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'e':
#ifdef PHP_WIN32
@@ -930,7 +908,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
#else
*t++ = '\e';
#endif
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case '"':
case '`':
@@ -942,22 +920,22 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
case '\\':
case '$':
*t++ = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'x':
case 'X':
if (ZEND_IS_HEX(*(s+1))) {
char hex_buf[3] = { 0, 0, 0 };
- Z_STRSIZE_P(zendlval)--; /* for the 'x' */
+ Z_STRLEN_P(zendlval)--; /* for the 'x' */
hex_buf[0] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_HEX(*(s+1))) {
hex_buf[1] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
}
- *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16);
+ *t++ = (char) ZEND_STRTOL(hex_buf, NULL, 16);
} else {
*t++ = '\\';
*t++ = *s;
@@ -969,16 +947,16 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
char octal_buf[4] = { 0, 0, 0, 0 };
octal_buf[0] = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) {
octal_buf[1] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) {
octal_buf[2] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
}
}
- *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8);
+ *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8);
} else {
*t++ = '\\';
*t++ = *s;
@@ -1000,9 +978,9 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
unsigned char *str;
// TODO: avoid realocation ???
s = Z_STRVAL_P(zendlval);
- SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
+ SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
zval_ptr_dtor(zendlval);
- ZVAL_STRINGL(zendlval, str, sz);
+ ZVAL_STRINGL(zendlval, (char *) str, sz);
efree(str);
}
}
@@ -1013,10 +991,8 @@ int lex_scan(zval *zendlval TSRMLS_DC)
restart:
SCNG(yy_text) = YYCURSOR;
-yymore_restart:
-
-#line 1020 "Zend/zend_language_scanner.c"
+#line 996 "Zend/zend_language_scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1059,64 +1035,19 @@ yymore_restart:
}
/* *********************************** */
yyc_INITIAL:
- {
- static const unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 0, 0, 128, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- YYDEBUG(0, *YYCURSOR);
- YYFILL(8);
- yych = *YYCURSOR;
- if (yych != '<') goto yy4;
- YYDEBUG(2, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '?') {
- if (yych == '%') goto yy7;
- if (yych >= '?') goto yy5;
- } else {
- if (yych <= 'S') {
- if (yych >= 'S') goto yy9;
- } else {
- if (yych == 's') goto yy9;
- }
- }
+ YYDEBUG(0, *YYCURSOR);
+ YYFILL(7);
+ yych = *YYCURSOR;
+ if (yych != '<') goto yy4;
+ YYDEBUG(2, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '?') goto yy5;
yy3:
- YYDEBUG(3, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1779 "Zend/zend_language_scanner.l"
- {
+ YYDEBUG(3, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1631 "Zend/zend_language_scanner.l"
+ {
if (YYCURSOR > YYLIMIT) {
return 0;
}
@@ -1128,35 +1059,19 @@ inline_char_handler:
YYCURSOR = ptr ? ptr + 1 : YYLIMIT;
- if (YYCURSOR < YYLIMIT) {
- switch (*YYCURSOR) {
- case '?':
- if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
- break;
- }
- continue;
- case '%':
- if (CG(asp_tags)) {
- break;
- }
- continue;
- case 's':
- case 'S':
- /* Probably NOT an opening PHP <script> tag, so don't end the HTML chunk yet
- * If it is, the PHP <script> tag rule checks for any HTML scanned before it */
- YYCURSOR--;
- yymore();
- default:
- continue;
- }
-
- YYCURSOR--;
+ if (YYCURSOR >= YYLIMIT) {
+ break;
}
- break;
+ if (*YYCURSOR == '?') {
+ if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
+
+ YYCURSOR--;
+ break;
+ }
+ }
}
-inline_html:
yyleng = YYCURSOR - SCNG(yy_text);
if (SCNG(output_filter)) {
@@ -1176,342 +1091,87 @@ inline_html:
HANDLE_NEWLINES(yytext, yyleng);
return T_INLINE_HTML;
}
-#line 1180 "Zend/zend_language_scanner.c"
+#line 1095 "Zend/zend_language_scanner.c"
yy4:
- YYDEBUG(4, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy3;
+ YYDEBUG(4, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy3;
yy5:
- YYDEBUG(5, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 'O') {
- if (yych == '=') goto yy45;
- } else {
- if (yych <= 'P') goto yy47;
- if (yych == 'p') goto yy47;
- }
+ YYDEBUG(5, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 'O') {
+ if (yych == '=') goto yy7;
+ } else {
+ if (yych <= 'P') goto yy9;
+ if (yych == 'p') goto yy9;
+ }
yy6:
- YYDEBUG(6, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1769 "Zend/zend_language_scanner.l"
- {
+ YYDEBUG(6, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1622 "Zend/zend_language_scanner.l"
+ {
if (CG(short_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
goto inline_char_handler;
}
}
-#line 1208 "Zend/zend_language_scanner.c"
+#line 1122 "Zend/zend_language_scanner.c"
yy7:
- YYDEBUG(7, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy43;
- YYDEBUG(8, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1750 "Zend/zend_language_scanner.l"
- {
- if (CG(asp_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- goto inline_char_handler;
- }
+ YYDEBUG(7, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(8, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1609 "Zend/zend_language_scanner.l"
+ {
+ BEGIN(ST_IN_SCRIPTING);
+ return T_OPEN_TAG_WITH_ECHO;
}
-#line 1225 "Zend/zend_language_scanner.c"
+#line 1133 "Zend/zend_language_scanner.c"
yy9:
- YYDEBUG(9, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'C') goto yy11;
- if (yych == 'c') goto yy11;
+ YYDEBUG(9, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'H') goto yy11;
+ if (yych == 'h') goto yy11;
yy10:
- YYDEBUG(10, *YYCURSOR);
- YYCURSOR = YYMARKER;
- if (yyaccept <= 0) {
- goto yy3;
- } else {
- goto yy6;
- }
+ YYDEBUG(10, *YYCURSOR);
+ YYCURSOR = YYMARKER;
+ goto yy6;
yy11:
- YYDEBUG(11, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy12;
- if (yych != 'r') goto yy10;
+ YYDEBUG(11, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'P') goto yy12;
+ if (yych != 'p') goto yy10;
yy12:
- YYDEBUG(12, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy13;
- if (yych != 'i') goto yy10;
-yy13:
- YYDEBUG(13, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy14;
- if (yych != 'p') goto yy10;
-yy14:
- YYDEBUG(14, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy15;
- if (yych != 't') goto yy10;
-yy15:
- YYDEBUG(15, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy10;
- if (yych == 'l') goto yy10;
- goto yy17;
-yy16:
- YYDEBUG(16, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(8);
- yych = *YYCURSOR;
-yy17:
- YYDEBUG(17, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy16;
- }
- if (yych == 'L') goto yy18;
- if (yych != 'l') goto yy10;
-yy18:
- YYDEBUG(18, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy19;
- if (yych != 'a') goto yy10;
-yy19:
- YYDEBUG(19, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'N') goto yy20;
- if (yych != 'n') goto yy10;
-yy20:
- YYDEBUG(20, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'G') goto yy21;
- if (yych != 'g') goto yy10;
-yy21:
- YYDEBUG(21, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'U') goto yy22;
- if (yych != 'u') goto yy10;
-yy22:
- YYDEBUG(22, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy23;
- if (yych != 'a') goto yy10;
-yy23:
- YYDEBUG(23, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'G') goto yy24;
- if (yych != 'g') goto yy10;
-yy24:
- YYDEBUG(24, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy25;
- if (yych != 'e') goto yy10;
-yy25:
- YYDEBUG(25, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(26, *YYCURSOR);
- if (yych <= '\r') {
- if (yych <= 0x08) goto yy10;
- if (yych <= '\n') goto yy25;
- if (yych <= '\f') goto yy10;
- goto yy25;
- } else {
- if (yych <= ' ') {
- if (yych <= 0x1F) goto yy10;
- goto yy25;
- } else {
- if (yych != '=') goto yy10;
- }
- }
-yy27:
- YYDEBUG(27, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(5);
- yych = *YYCURSOR;
- YYDEBUG(28, *YYCURSOR);
- if (yych <= '!') {
- if (yych <= '\f') {
- if (yych <= 0x08) goto yy10;
- if (yych <= '\n') goto yy27;
- goto yy10;
- } else {
- if (yych <= '\r') goto yy27;
- if (yych == ' ') goto yy27;
- goto yy10;
- }
- } else {
- if (yych <= 'O') {
- if (yych <= '"') goto yy30;
- if (yych == '\'') goto yy31;
- goto yy10;
- } else {
- if (yych <= 'P') goto yy29;
- if (yych != 'p') goto yy10;
- }
- }
-yy29:
- YYDEBUG(29, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy42;
- if (yych == 'h') goto yy42;
- goto yy10;
-yy30:
- YYDEBUG(30, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy39;
- if (yych == 'p') goto yy39;
- goto yy10;
-yy31:
- YYDEBUG(31, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy32;
- if (yych != 'p') goto yy10;
-yy32:
- YYDEBUG(32, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy33;
- if (yych != 'h') goto yy10;
-yy33:
- YYDEBUG(33, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy34;
- if (yych != 'p') goto yy10;
-yy34:
- YYDEBUG(34, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych != '\'') goto yy10;
-yy35:
- YYDEBUG(35, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(36, *YYCURSOR);
- if (yych <= '\r') {
- if (yych <= 0x08) goto yy10;
- if (yych <= '\n') goto yy35;
- if (yych <= '\f') goto yy10;
- goto yy35;
- } else {
- if (yych <= ' ') {
- if (yych <= 0x1F) goto yy10;
- goto yy35;
- } else {
- if (yych != '>') goto yy10;
- }
- }
- YYDEBUG(37, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(38, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1716 "Zend/zend_language_scanner.l"
- {
- YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
-
- if (bracket != SCNG(yy_text)) {
- /* Handle previously scanned HTML, as possible <script> tags found are assumed to not be PHP's */
- YYCURSOR = bracket;
- goto inline_html;
- }
-
- HANDLE_NEWLINES(yytext, yyleng);
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
-}
-#line 1426 "Zend/zend_language_scanner.c"
-yy39:
- YYDEBUG(39, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy40;
- if (yych != 'h') goto yy10;
-yy40:
- YYDEBUG(40, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy41;
- if (yych != 'p') goto yy10;
-yy41:
- YYDEBUG(41, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '"') goto yy35;
- goto yy10;
-yy42:
- YYDEBUG(42, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy35;
- if (yych == 'p') goto yy35;
- goto yy10;
-yy43:
- YYDEBUG(43, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(44, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1732 "Zend/zend_language_scanner.l"
- {
- if (CG(asp_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
+ YYDEBUG(12, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '\f') {
+ if (yych <= 0x08) goto yy10;
+ if (yych >= '\v') goto yy10;
} else {
- goto inline_char_handler;
+ if (yych <= '\r') goto yy15;
+ if (yych != ' ') goto yy10;
}
-}
-#line 1463 "Zend/zend_language_scanner.c"
-yy45:
- YYDEBUG(45, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(46, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1743 "Zend/zend_language_scanner.l"
- {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
-}
-#line 1475 "Zend/zend_language_scanner.c"
-yy47:
- YYDEBUG(47, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'H') goto yy48;
- if (yych != 'h') goto yy10;
-yy48:
- YYDEBUG(48, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy49;
- if (yych != 'p') goto yy10;
-yy49:
- YYDEBUG(49, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '\f') {
- if (yych <= 0x08) goto yy10;
- if (yych >= '\v') goto yy10;
- } else {
- if (yych <= '\r') goto yy52;
- if (yych != ' ') goto yy10;
- }
-yy50:
- YYDEBUG(50, *YYCURSOR);
- ++YYCURSOR;
-yy51:
- YYDEBUG(51, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1761 "Zend/zend_language_scanner.l"
- {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
+yy13:
+ YYDEBUG(13, *YYCURSOR);
+ ++YYCURSOR;
+yy14:
+ YYDEBUG(14, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1615 "Zend/zend_language_scanner.l"
+ {
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
-#line 1509 "Zend/zend_language_scanner.c"
-yy52:
- YYDEBUG(52, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy50;
- goto yy51;
- }
+#line 1170 "Zend/zend_language_scanner.c"
+yy15:
+ YYDEBUG(15, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy13;
+ goto yy14;
/* *********************************** */
yyc_ST_BACKQUOTE:
{
@@ -1549,34 +1209,34 @@ yyc_ST_BACKQUOTE:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(53, *YYCURSOR);
+ YYDEBUG(16, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '_') {
- if (yych != '$') goto yy60;
+ if (yych != '$') goto yy23;
} else {
- if (yych <= '`') goto yy58;
- if (yych == '{') goto yy57;
- goto yy60;
+ if (yych <= '`') goto yy21;
+ if (yych == '{') goto yy20;
+ goto yy23;
}
- YYDEBUG(55, *YYCURSOR);
+ YYDEBUG(18, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '_') {
- if (yych <= '@') goto yy56;
- if (yych <= 'Z') goto yy63;
- if (yych >= '_') goto yy63;
+ if (yych <= '@') goto yy19;
+ if (yych <= 'Z') goto yy26;
+ if (yych >= '_') goto yy26;
} else {
if (yych <= 'z') {
- if (yych >= 'a') goto yy63;
+ if (yych >= 'a') goto yy26;
} else {
- if (yych <= '{') goto yy66;
- if (yych >= 0x7F) goto yy63;
+ if (yych <= '{') goto yy29;
+ if (yych >= 0x7F) goto yy26;
}
}
-yy56:
- YYDEBUG(56, *YYCURSOR);
+yy19:
+ YYDEBUG(19, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2222 "Zend/zend_language_scanner.l"
+#line 2042 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1617,118 +1277,118 @@ yy56:
zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1621 "Zend/zend_language_scanner.c"
-yy57:
- YYDEBUG(57, *YYCURSOR);
+#line 1281 "Zend/zend_language_scanner.c"
+yy20:
+ YYDEBUG(20, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '$') goto yy61;
- goto yy56;
-yy58:
- YYDEBUG(58, *YYCURSOR);
+ if (yych == '$') goto yy24;
+ goto yy19;
+yy21:
+ YYDEBUG(21, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(59, *YYCURSOR);
+ YYDEBUG(22, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2166 "Zend/zend_language_scanner.l"
+#line 1986 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '`';
}
-#line 1637 "Zend/zend_language_scanner.c"
-yy60:
- YYDEBUG(60, *YYCURSOR);
+#line 1297 "Zend/zend_language_scanner.c"
+yy23:
+ YYDEBUG(23, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy56;
-yy61:
- YYDEBUG(61, *YYCURSOR);
+ goto yy19;
+yy24:
+ YYDEBUG(24, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(62, *YYCURSOR);
+ YYDEBUG(25, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2153 "Zend/zend_language_scanner.l"
+#line 1973 "Zend/zend_language_scanner.l"
{
- Z_IVAL_P(zendlval) = (zend_int_t) '{';
+ Z_LVAL_P(zendlval) = (zend_long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1654 "Zend/zend_language_scanner.c"
-yy63:
- YYDEBUG(63, *YYCURSOR);
+#line 1314 "Zend/zend_language_scanner.c"
+yy26:
+ YYDEBUG(26, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(64, *YYCURSOR);
+ YYDEBUG(27, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy63;
+ goto yy26;
}
- if (yych == '-') goto yy68;
- if (yych == '[') goto yy70;
-yy65:
- YYDEBUG(65, *YYCURSOR);
+ if (yych == '-') goto yy31;
+ if (yych == '[') goto yy33;
+yy28:
+ YYDEBUG(28, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1860 "Zend/zend_language_scanner.l"
+#line 1696 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1675 "Zend/zend_language_scanner.c"
-yy66:
- YYDEBUG(66, *YYCURSOR);
+#line 1335 "Zend/zend_language_scanner.c"
+yy29:
+ YYDEBUG(29, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(67, *YYCURSOR);
+ YYDEBUG(30, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1483 "Zend/zend_language_scanner.l"
+#line 1462 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1686 "Zend/zend_language_scanner.c"
-yy68:
- YYDEBUG(68, *YYCURSOR);
+#line 1346 "Zend/zend_language_scanner.c"
+yy31:
+ YYDEBUG(31, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '>') goto yy72;
-yy69:
- YYDEBUG(69, *YYCURSOR);
+ if (yych == '>') goto yy35;
+yy32:
+ YYDEBUG(32, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy65;
-yy70:
- YYDEBUG(70, *YYCURSOR);
+ goto yy28;
+yy33:
+ YYDEBUG(33, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(71, *YYCURSOR);
+ YYDEBUG(34, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1853 "Zend/zend_language_scanner.l"
+#line 1689 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1707 "Zend/zend_language_scanner.c"
-yy72:
- YYDEBUG(72, *YYCURSOR);
+#line 1367 "Zend/zend_language_scanner.c"
+yy35:
+ YYDEBUG(35, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy69;
- if (yych <= 'Z') goto yy73;
- if (yych <= '^') goto yy69;
+ if (yych <= '@') goto yy32;
+ if (yych <= 'Z') goto yy36;
+ if (yych <= '^') goto yy32;
} else {
- if (yych <= '`') goto yy69;
- if (yych <= 'z') goto yy73;
- if (yych <= '~') goto yy69;
+ if (yych <= '`') goto yy32;
+ if (yych <= 'z') goto yy36;
+ if (yych <= '~') goto yy32;
}
-yy73:
- YYDEBUG(73, *YYCURSOR);
+yy36:
+ YYDEBUG(36, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(74, *YYCURSOR);
+ YYDEBUG(37, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1844 "Zend/zend_language_scanner.l"
+#line 1680 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1732 "Zend/zend_language_scanner.c"
+#line 1392 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_DOUBLE_QUOTES:
@@ -1767,36 +1427,36 @@ yyc_ST_DOUBLE_QUOTES:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(75, *YYCURSOR);
+ YYDEBUG(38, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '#') {
- if (yych == '"') goto yy80;
- goto yy82;
+ if (yych == '"') goto yy43;
+ goto yy45;
} else {
- if (yych <= '$') goto yy77;
- if (yych == '{') goto yy79;
- goto yy82;
+ if (yych <= '$') goto yy40;
+ if (yych == '{') goto yy42;
+ goto yy45;
}
-yy77:
- YYDEBUG(77, *YYCURSOR);
+yy40:
+ YYDEBUG(40, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '_') {
- if (yych <= '@') goto yy78;
- if (yych <= 'Z') goto yy85;
- if (yych >= '_') goto yy85;
+ if (yych <= '@') goto yy41;
+ if (yych <= 'Z') goto yy48;
+ if (yych >= '_') goto yy48;
} else {
if (yych <= 'z') {
- if (yych >= 'a') goto yy85;
+ if (yych >= 'a') goto yy48;
} else {
- if (yych <= '{') goto yy88;
- if (yych >= 0x7F) goto yy85;
+ if (yych <= '{') goto yy51;
+ if (yych >= 0x7F) goto yy48;
}
}
-yy78:
- YYDEBUG(78, *YYCURSOR);
+yy41:
+ YYDEBUG(41, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2172 "Zend/zend_language_scanner.l"
+#line 1992 "Zend/zend_language_scanner.l"
{
if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) {
YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1;
@@ -1845,129 +1505,129 @@ double_quotes_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1849 "Zend/zend_language_scanner.c"
-yy79:
- YYDEBUG(79, *YYCURSOR);
+#line 1509 "Zend/zend_language_scanner.c"
+yy42:
+ YYDEBUG(42, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '$') goto yy83;
- goto yy78;
-yy80:
- YYDEBUG(80, *YYCURSOR);
+ if (yych == '$') goto yy46;
+ goto yy41;
+yy43:
+ YYDEBUG(43, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(81, *YYCURSOR);
+ YYDEBUG(44, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2161 "Zend/zend_language_scanner.l"
+#line 1981 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '"';
}
-#line 1865 "Zend/zend_language_scanner.c"
-yy82:
- YYDEBUG(82, *YYCURSOR);
+#line 1525 "Zend/zend_language_scanner.c"
+yy45:
+ YYDEBUG(45, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy78;
-yy83:
- YYDEBUG(83, *YYCURSOR);
+ goto yy41;
+yy46:
+ YYDEBUG(46, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(84, *YYCURSOR);
+ YYDEBUG(47, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2153 "Zend/zend_language_scanner.l"
+#line 1973 "Zend/zend_language_scanner.l"
{
- Z_IVAL_P(zendlval) = (zend_int_t) '{';
+ Z_LVAL_P(zendlval) = (zend_long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1882 "Zend/zend_language_scanner.c"
-yy85:
- YYDEBUG(85, *YYCURSOR);
+#line 1542 "Zend/zend_language_scanner.c"
+yy48:
+ YYDEBUG(48, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(86, *YYCURSOR);
+ YYDEBUG(49, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy85;
+ goto yy48;
}
- if (yych == '-') goto yy90;
- if (yych == '[') goto yy92;
-yy87:
- YYDEBUG(87, *YYCURSOR);
+ if (yych == '-') goto yy53;
+ if (yych == '[') goto yy55;
+yy50:
+ YYDEBUG(50, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1860 "Zend/zend_language_scanner.l"
+#line 1696 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1903 "Zend/zend_language_scanner.c"
-yy88:
- YYDEBUG(88, *YYCURSOR);
+#line 1563 "Zend/zend_language_scanner.c"
+yy51:
+ YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(89, *YYCURSOR);
+ YYDEBUG(52, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1483 "Zend/zend_language_scanner.l"
+#line 1462 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1914 "Zend/zend_language_scanner.c"
-yy90:
- YYDEBUG(90, *YYCURSOR);
+#line 1574 "Zend/zend_language_scanner.c"
+yy53:
+ YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '>') goto yy94;
-yy91:
- YYDEBUG(91, *YYCURSOR);
+ if (yych == '>') goto yy57;
+yy54:
+ YYDEBUG(54, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy87;
-yy92:
- YYDEBUG(92, *YYCURSOR);
+ goto yy50;
+yy55:
+ YYDEBUG(55, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(93, *YYCURSOR);
+ YYDEBUG(56, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1853 "Zend/zend_language_scanner.l"
+#line 1689 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1935 "Zend/zend_language_scanner.c"
-yy94:
- YYDEBUG(94, *YYCURSOR);
+#line 1595 "Zend/zend_language_scanner.c"
+yy57:
+ YYDEBUG(57, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy91;
- if (yych <= 'Z') goto yy95;
- if (yych <= '^') goto yy91;
+ if (yych <= '@') goto yy54;
+ if (yych <= 'Z') goto yy58;
+ if (yych <= '^') goto yy54;
} else {
- if (yych <= '`') goto yy91;
- if (yych <= 'z') goto yy95;
- if (yych <= '~') goto yy91;
+ if (yych <= '`') goto yy54;
+ if (yych <= 'z') goto yy58;
+ if (yych <= '~') goto yy54;
}
-yy95:
- YYDEBUG(95, *YYCURSOR);
+yy58:
+ YYDEBUG(58, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(96, *YYCURSOR);
+ YYDEBUG(59, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1844 "Zend/zend_language_scanner.l"
+#line 1680 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 1960 "Zend/zend_language_scanner.c"
+#line 1620 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_END_HEREDOC:
- YYDEBUG(97, *YYCURSOR);
+ YYDEBUG(60, *YYCURSOR);
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(99, *YYCURSOR);
+ YYDEBUG(62, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(100, *YYCURSOR);
+ YYDEBUG(63, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2139 "Zend/zend_language_scanner.l"
+#line 1959 "Zend/zend_language_scanner.l"
{
zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
@@ -1980,7 +1640,7 @@ yyc_ST_END_HEREDOC:
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
}
-#line 1984 "Zend/zend_language_scanner.c"
+#line 1644 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_HEREDOC:
{
@@ -2018,31 +1678,31 @@ yyc_ST_HEREDOC:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(101, *YYCURSOR);
+ YYDEBUG(64, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
- if (yych == '$') goto yy103;
- if (yych == '{') goto yy105;
- goto yy106;
-yy103:
- YYDEBUG(103, *YYCURSOR);
+ if (yych == '$') goto yy66;
+ if (yych == '{') goto yy68;
+ goto yy69;
+yy66:
+ YYDEBUG(66, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '_') {
- if (yych <= '@') goto yy104;
- if (yych <= 'Z') goto yy109;
- if (yych >= '_') goto yy109;
+ if (yych <= '@') goto yy67;
+ if (yych <= 'Z') goto yy72;
+ if (yych >= '_') goto yy72;
} else {
if (yych <= 'z') {
- if (yych >= 'a') goto yy109;
+ if (yych >= 'a') goto yy72;
} else {
- if (yych <= '{') goto yy112;
- if (yych >= 0x7F) goto yy109;
+ if (yych <= '{') goto yy75;
+ if (yych >= 0x7F) goto yy72;
}
}
-yy104:
- YYDEBUG(104, *YYCURSOR);
+yy67:
+ YYDEBUG(67, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2264 "Zend/zend_language_scanner.l"
+#line 2084 "Zend/zend_language_scanner.l"
{
int newline = 0;
@@ -2115,107 +1775,107 @@ heredoc_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 2119 "Zend/zend_language_scanner.c"
-yy105:
- YYDEBUG(105, *YYCURSOR);
+#line 1779 "Zend/zend_language_scanner.c"
+yy68:
+ YYDEBUG(68, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '$') goto yy107;
- goto yy104;
-yy106:
- YYDEBUG(106, *YYCURSOR);
+ if (yych == '$') goto yy70;
+ goto yy67;
+yy69:
+ YYDEBUG(69, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy104;
-yy107:
- YYDEBUG(107, *YYCURSOR);
+ goto yy67;
+yy70:
+ YYDEBUG(70, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(108, *YYCURSOR);
+ YYDEBUG(71, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2153 "Zend/zend_language_scanner.l"
+#line 1973 "Zend/zend_language_scanner.l"
{
- Z_IVAL_P(zendlval) = (zend_int_t) '{';
+ Z_LVAL_P(zendlval) = (zend_long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 2141 "Zend/zend_language_scanner.c"
-yy109:
- YYDEBUG(109, *YYCURSOR);
+#line 1801 "Zend/zend_language_scanner.c"
+yy72:
+ YYDEBUG(72, *YYCURSOR);
yyaccept = 0;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(110, *YYCURSOR);
+ YYDEBUG(73, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy109;
+ goto yy72;
}
- if (yych == '-') goto yy114;
- if (yych == '[') goto yy116;
-yy111:
- YYDEBUG(111, *YYCURSOR);
+ if (yych == '-') goto yy77;
+ if (yych == '[') goto yy79;
+yy74:
+ YYDEBUG(74, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1860 "Zend/zend_language_scanner.l"
+#line 1696 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 2162 "Zend/zend_language_scanner.c"
-yy112:
- YYDEBUG(112, *YYCURSOR);
+#line 1822 "Zend/zend_language_scanner.c"
+yy75:
+ YYDEBUG(75, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(113, *YYCURSOR);
+ YYDEBUG(76, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1483 "Zend/zend_language_scanner.l"
+#line 1462 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 2173 "Zend/zend_language_scanner.c"
-yy114:
- YYDEBUG(114, *YYCURSOR);
+#line 1833 "Zend/zend_language_scanner.c"
+yy77:
+ YYDEBUG(77, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '>') goto yy118;
-yy115:
- YYDEBUG(115, *YYCURSOR);
+ if (yych == '>') goto yy81;
+yy78:
+ YYDEBUG(78, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy111;
-yy116:
- YYDEBUG(116, *YYCURSOR);
+ goto yy74;
+yy79:
+ YYDEBUG(79, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(117, *YYCURSOR);
+ YYDEBUG(80, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1853 "Zend/zend_language_scanner.l"
+#line 1689 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 2194 "Zend/zend_language_scanner.c"
-yy118:
- YYDEBUG(118, *YYCURSOR);
+#line 1854 "Zend/zend_language_scanner.c"
+yy81:
+ YYDEBUG(81, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy115;
- if (yych <= 'Z') goto yy119;
- if (yych <= '^') goto yy115;
+ if (yych <= '@') goto yy78;
+ if (yych <= 'Z') goto yy82;
+ if (yych <= '^') goto yy78;
} else {
- if (yych <= '`') goto yy115;
- if (yych <= 'z') goto yy119;
- if (yych <= '~') goto yy115;
+ if (yych <= '`') goto yy78;
+ if (yych <= 'z') goto yy82;
+ if (yych <= '~') goto yy78;
}
-yy119:
- YYDEBUG(119, *YYCURSOR);
+yy82:
+ YYDEBUG(82, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(120, *YYCURSOR);
+ YYDEBUG(83, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1844 "Zend/zend_language_scanner.l"
+#line 1680 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 2219 "Zend/zend_language_scanner.c"
+#line 1879 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_IN_SCRIPTING:
@@ -2254,7 +1914,7 @@ yyc_ST_IN_SCRIPTING:
4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,
};
- YYDEBUG(121, *YYCURSOR);
+ YYDEBUG(84, *YYCURSOR);
YYFILL(16);
yych = *YYCURSOR;
YYDEBUG(-1, yych);
@@ -2287,32 +1947,32 @@ yyc_ST_IN_SCRIPTING:
case 0x1C:
case 0x1D:
case 0x1E:
- case 0x1F: goto yy184;
+ case 0x1F: goto yy147;
case '\t':
case '\n':
case '\r':
- case ' ': goto yy140;
- case '!': goto yy154;
- case '"': goto yy180;
- case '#': goto yy176;
- case '$': goto yy165;
- case '%': goto yy159;
- case '&': goto yy160;
- case '\'': goto yy178;
- case '(': goto yy148;
+ case ' ': goto yy103;
+ case '!': goto yy118;
+ case '"': goto yy143;
+ case '#': goto yy139;
+ case '$': goto yy129;
+ case '%': goto yy123;
+ case '&': goto yy124;
+ case '\'': goto yy141;
+ case '(': goto yy112;
case ')':
case ',':
case ';':
case '@':
case '[':
case ']':
- case '~': goto yy166;
- case '*': goto yy157;
- case '+': goto yy153;
- case '-': goto yy138;
- case '.': goto yy145;
- case '/': goto yy158;
- case '0': goto yy172;
+ case '~': goto yy130;
+ case '*': goto yy121;
+ case '+': goto yy117;
+ case '-': goto yy101;
+ case '.': goto yy108;
+ case '/': goto yy122;
+ case '0': goto yy135;
case '1':
case '2':
case '3':
@@ -2321,600 +1981,594 @@ yyc_ST_IN_SCRIPTING:
case '6':
case '7':
case '8':
- case '9': goto yy174;
- case ':': goto yy142;
- case '<': goto yy155;
- case '=': goto yy151;
- case '>': goto yy156;
- case '?': goto yy167;
+ case '9': goto yy137;
+ case ':': goto yy105;
+ case '<': goto yy119;
+ case '=': goto yy115;
+ case '>': goto yy120;
+ case '?': goto yy109;
case 'A':
- case 'a': goto yy133;
+ case 'a': goto yy96;
case 'B':
- case 'b': goto yy135;
+ case 'b': goto yy98;
case 'C':
- case 'c': goto yy127;
+ case 'c': goto yy90;
case 'D':
- case 'd': goto yy125;
+ case 'd': goto yy88;
case 'E':
- case 'e': goto yy123;
+ case 'e': goto yy86;
case 'F':
- case 'f': goto yy126;
+ case 'f': goto yy89;
case 'G':
- case 'g': goto yy136;
+ case 'g': goto yy99;
case 'I':
- case 'i': goto yy131;
+ case 'i': goto yy94;
case 'L':
- case 'l': goto yy152;
+ case 'l': goto yy116;
case 'N':
- case 'n': goto yy146;
+ case 'n': goto yy110;
case 'O':
- case 'o': goto yy163;
+ case 'o': goto yy127;
case 'P':
- case 'p': goto yy137;
+ case 'p': goto yy100;
case 'R':
- case 'r': goto yy128;
+ case 'r': goto yy91;
case 'S':
- case 's': goto yy134;
+ case 's': goto yy97;
case 'T':
- case 't': goto yy130;
+ case 't': goto yy93;
case 'U':
- case 'u': goto yy149;
+ case 'u': goto yy113;
case 'V':
- case 'v': goto yy147;
+ case 'v': goto yy111;
case 'W':
- case 'w': goto yy132;
+ case 'w': goto yy95;
case 'X':
- case 'x': goto yy164;
+ case 'x': goto yy128;
case 'Y':
- case 'y': goto yy129;
- case '\\': goto yy143;
- case '^': goto yy162;
- case '_': goto yy150;
- case '`': goto yy182;
- case '{': goto yy168;
- case '|': goto yy161;
- case '}': goto yy170;
- default: goto yy175;
- }
-yy123:
- YYDEBUG(123, *YYCURSOR);
+ case 'y': goto yy92;
+ case '\\': goto yy106;
+ case '^': goto yy126;
+ case '_': goto yy114;
+ case '`': goto yy145;
+ case '{': goto yy131;
+ case '|': goto yy125;
+ case '}': goto yy133;
+ default: goto yy138;
+ }
+yy86:
+ YYDEBUG(86, *YYCURSOR);
++YYCURSOR;
YYDEBUG(-1, yych);
switch ((yych = *YYCURSOR)) {
case 'C':
- case 'c': goto yy742;
+ case 'c': goto yy695;
case 'L':
- case 'l': goto yy743;
+ case 'l': goto yy696;
case 'M':
- case 'm': goto yy744;
+ case 'm': goto yy697;
case 'N':
- case 'n': goto yy745;
+ case 'n': goto yy698;
case 'V':
- case 'v': goto yy746;
+ case 'v': goto yy699;
case 'X':
- case 'x': goto yy747;
- default: goto yy187;
+ case 'x': goto yy700;
+ default: goto yy150;
}
-yy124:
- YYDEBUG(124, *YYCURSOR);
+yy87:
+ YYDEBUG(87, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1882 "Zend/zend_language_scanner.l"
+#line 1719 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
return T_STRING;
}
-#line 2407 "Zend/zend_language_scanner.c"
-yy125:
- YYDEBUG(125, *YYCURSOR);
+#line 2067 "Zend/zend_language_scanner.c"
+yy88:
+ YYDEBUG(88, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
if (yych <= 'H') {
- if (yych == 'E') goto yy724;
- goto yy187;
+ if (yych == 'E') goto yy677;
+ goto yy150;
} else {
- if (yych <= 'I') goto yy725;
- if (yych <= 'N') goto yy187;
- goto yy726;
+ if (yych <= 'I') goto yy678;
+ if (yych <= 'N') goto yy150;
+ goto yy679;
}
} else {
if (yych <= 'h') {
- if (yych == 'e') goto yy724;
- goto yy187;
+ if (yych == 'e') goto yy677;
+ goto yy150;
} else {
- if (yych <= 'i') goto yy725;
- if (yych == 'o') goto yy726;
- goto yy187;
+ if (yych <= 'i') goto yy678;
+ if (yych == 'o') goto yy679;
+ goto yy150;
}
}
-yy126:
- YYDEBUG(126, *YYCURSOR);
+yy89:
+ YYDEBUG(89, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'U') {
if (yych <= 'N') {
- if (yych == 'I') goto yy700;
- goto yy187;
+ if (yych == 'I') goto yy653;
+ goto yy150;
} else {
- if (yych <= 'O') goto yy701;
- if (yych <= 'T') goto yy187;
- goto yy702;
+ if (yych <= 'O') goto yy654;
+ if (yych <= 'T') goto yy150;
+ goto yy655;
}
} else {
if (yych <= 'n') {
- if (yych == 'i') goto yy700;
- goto yy187;
+ if (yych == 'i') goto yy653;
+ goto yy150;
} else {
- if (yych <= 'o') goto yy701;
- if (yych == 'u') goto yy702;
- goto yy187;
+ if (yych <= 'o') goto yy654;
+ if (yych == 'u') goto yy655;
+ goto yy150;
}
}
-yy127:
- YYDEBUG(127, *YYCURSOR);
+yy90:
+ YYDEBUG(90, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
if (yych <= 'K') {
- if (yych == 'A') goto yy665;
- goto yy187;
+ if (yych == 'A') goto yy618;
+ goto yy150;
} else {
- if (yych <= 'L') goto yy666;
- if (yych <= 'N') goto yy187;
- goto yy667;
+ if (yych <= 'L') goto yy619;
+ if (yych <= 'N') goto yy150;
+ goto yy620;
}
} else {
if (yych <= 'k') {
- if (yych == 'a') goto yy665;
- goto yy187;
+ if (yych == 'a') goto yy618;
+ goto yy150;
} else {
- if (yych <= 'l') goto yy666;
- if (yych == 'o') goto yy667;
- goto yy187;
+ if (yych <= 'l') goto yy619;
+ if (yych == 'o') goto yy620;
+ goto yy150;
}
}
-yy128:
- YYDEBUG(128, *YYCURSOR);
+yy91:
+ YYDEBUG(91, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy647;
- if (yych == 'e') goto yy647;
- goto yy187;
-yy129:
- YYDEBUG(129, *YYCURSOR);
+ if (yych == 'E') goto yy600;
+ if (yych == 'e') goto yy600;
+ goto yy150;
+yy92:
+ YYDEBUG(92, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy642;
- if (yych == 'i') goto yy642;
- goto yy187;
-yy130:
- YYDEBUG(130, *YYCURSOR);
+ if (yych == 'I') goto yy595;
+ if (yych == 'i') goto yy595;
+ goto yy150;
+yy93:
+ YYDEBUG(93, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'R') {
- if (yych == 'H') goto yy630;
- if (yych <= 'Q') goto yy187;
- goto yy631;
+ if (yych == 'H') goto yy583;
+ if (yych <= 'Q') goto yy150;
+ goto yy584;
} else {
if (yych <= 'h') {
- if (yych <= 'g') goto yy187;
- goto yy630;
+ if (yych <= 'g') goto yy150;
+ goto yy583;
} else {
- if (yych == 'r') goto yy631;
- goto yy187;
+ if (yych == 'r') goto yy584;
+ goto yy150;
}
}
-yy131:
- YYDEBUG(131, *YYCURSOR);
+yy94:
+ YYDEBUG(94, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'S') {
if (yych <= 'L') {
- if (yych == 'F') goto yy577;
- goto yy187;
+ if (yych == 'F') goto yy530;
+ goto yy150;
} else {
- if (yych <= 'M') goto yy579;
- if (yych <= 'N') goto yy580;
- if (yych <= 'R') goto yy187;
- goto yy581;
+ if (yych <= 'M') goto yy532;
+ if (yych <= 'N') goto yy533;
+ if (yych <= 'R') goto yy150;
+ goto yy534;
}
} else {
if (yych <= 'm') {
- if (yych == 'f') goto yy577;
- if (yych <= 'l') goto yy187;
- goto yy579;
+ if (yych == 'f') goto yy530;
+ if (yych <= 'l') goto yy150;
+ goto yy532;
} else {
- if (yych <= 'n') goto yy580;
- if (yych == 's') goto yy581;
- goto yy187;
+ if (yych <= 'n') goto yy533;
+ if (yych == 's') goto yy534;
+ goto yy150;
}
}
-yy132:
- YYDEBUG(132, *YYCURSOR);
+yy95:
+ YYDEBUG(95, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy572;
- if (yych == 'h') goto yy572;
- goto yy187;
-yy133:
- YYDEBUG(133, *YYCURSOR);
+ if (yych == 'H') goto yy525;
+ if (yych == 'h') goto yy525;
+ goto yy150;
+yy96:
+ YYDEBUG(96, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'S') {
if (yych <= 'M') {
- if (yych == 'B') goto yy554;
- goto yy187;
+ if (yych == 'B') goto yy507;
+ goto yy150;
} else {
- if (yych <= 'N') goto yy555;
- if (yych <= 'Q') goto yy187;
- if (yych <= 'R') goto yy556;
- goto yy557;
+ if (yych <= 'N') goto yy508;
+ if (yych <= 'Q') goto yy150;
+ if (yych <= 'R') goto yy509;
+ goto yy510;
}
} else {
if (yych <= 'n') {
- if (yych == 'b') goto yy554;
- if (yych <= 'm') goto yy187;
- goto yy555;
+ if (yych == 'b') goto yy507;
+ if (yych <= 'm') goto yy150;
+ goto yy508;
} else {
- if (yych <= 'q') goto yy187;
- if (yych <= 'r') goto yy556;
- if (yych <= 's') goto yy557;
- goto yy187;
+ if (yych <= 'q') goto yy150;
+ if (yych <= 'r') goto yy509;
+ if (yych <= 's') goto yy510;
+ goto yy150;
}
}
-yy134:
- YYDEBUG(134, *YYCURSOR);
+yy97:
+ YYDEBUG(97, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'W') {
- if (yych == 'T') goto yy542;
- if (yych <= 'V') goto yy187;
- goto yy543;
+ if (yych == 'T') goto yy495;
+ if (yych <= 'V') goto yy150;
+ goto yy496;
} else {
if (yych <= 't') {
- if (yych <= 's') goto yy187;
- goto yy542;
+ if (yych <= 's') goto yy150;
+ goto yy495;
} else {
- if (yych == 'w') goto yy543;
- goto yy187;
+ if (yych == 'w') goto yy496;
+ goto yy150;
}
}
-yy135:
- YYDEBUG(135, *YYCURSOR);
+yy98:
+ YYDEBUG(98, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= ';') {
if (yych <= '"') {
- if (yych <= '!') goto yy187;
- goto yy534;
+ if (yych <= '!') goto yy150;
+ goto yy487;
} else {
- if (yych == '\'') goto yy535;
- goto yy187;
+ if (yych == '\'') goto yy488;
+ goto yy150;
}
} else {
if (yych <= 'R') {
- if (yych <= '<') goto yy533;
- if (yych <= 'Q') goto yy187;
- goto yy536;
+ if (yych <= '<') goto yy486;
+ if (yych <= 'Q') goto yy150;
+ goto yy489;
} else {
- if (yych == 'r') goto yy536;
- goto yy187;
+ if (yych == 'r') goto yy489;
+ goto yy150;
}
}
-yy136:
- YYDEBUG(136, *YYCURSOR);
+yy99:
+ YYDEBUG(99, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'L') goto yy523;
- if (yych <= 'N') goto yy187;
- goto yy524;
+ if (yych == 'L') goto yy476;
+ if (yych <= 'N') goto yy150;
+ goto yy477;
} else {
if (yych <= 'l') {
- if (yych <= 'k') goto yy187;
- goto yy523;
+ if (yych <= 'k') goto yy150;
+ goto yy476;
} else {
- if (yych == 'o') goto yy524;
- goto yy187;
+ if (yych == 'o') goto yy477;
+ goto yy150;
}
}
-yy137:
- YYDEBUG(137, *YYCURSOR);
+yy100:
+ YYDEBUG(100, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'U') {
- if (yych == 'R') goto yy499;
- if (yych <= 'T') goto yy187;
- goto yy500;
+ if (yych == 'R') goto yy452;
+ if (yych <= 'T') goto yy150;
+ goto yy453;
} else {
if (yych <= 'r') {
- if (yych <= 'q') goto yy187;
- goto yy499;
+ if (yych <= 'q') goto yy150;
+ goto yy452;
} else {
- if (yych == 'u') goto yy500;
- goto yy187;
+ if (yych == 'u') goto yy453;
+ goto yy150;
}
}
-yy138:
- YYDEBUG(138, *YYCURSOR);
+yy101:
+ YYDEBUG(101, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '<') {
- if (yych == '-') goto yy495;
+ if (yych == '-') goto yy448;
} else {
- if (yych <= '=') goto yy493;
- if (yych <= '>') goto yy497;
+ if (yych <= '=') goto yy446;
+ if (yych <= '>') goto yy450;
}
-yy139:
- YYDEBUG(139, *YYCURSOR);
+yy102:
+ YYDEBUG(102, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1472 "Zend/zend_language_scanner.l"
+#line 1451 "Zend/zend_language_scanner.l"
{
return yytext[0];
}
-#line 2643 "Zend/zend_language_scanner.c"
-yy140:
- YYDEBUG(140, *YYCURSOR);
+#line 2303 "Zend/zend_language_scanner.c"
+yy103:
+ YYDEBUG(103, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy492;
-yy141:
- YYDEBUG(141, *YYCURSOR);
+ goto yy445;
+yy104:
+ YYDEBUG(104, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1194 "Zend/zend_language_scanner.l"
+#line 1170 "Zend/zend_language_scanner.l"
{
- DUMMY_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 2658 "Zend/zend_language_scanner.c"
-yy142:
- YYDEBUG(142, *YYCURSOR);
+#line 2317 "Zend/zend_language_scanner.c"
+yy105:
+ YYDEBUG(105, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == ':') goto yy489;
- goto yy139;
-yy143:
- YYDEBUG(143, *YYCURSOR);
+ if (yych == ':') goto yy442;
+ goto yy102;
+yy106:
+ YYDEBUG(106, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(144, *YYCURSOR);
+ YYDEBUG(107, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1220 "Zend/zend_language_scanner.l"
+#line 1195 "Zend/zend_language_scanner.l"
{
return T_NS_SEPARATOR;
}
-#line 2673 "Zend/zend_language_scanner.c"
-yy145:
- YYDEBUG(145, *YYCURSOR);
+#line 2332 "Zend/zend_language_scanner.c"
+yy108:
+ YYDEBUG(108, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '/') {
- if (yych == '.') goto yy486;
- goto yy139;
+ if (yych == '.') goto yy439;
+ goto yy102;
} else {
- if (yych <= '9') goto yy482;
- if (yych == '=') goto yy484;
- goto yy139;
+ if (yych <= '9') goto yy435;
+ if (yych == '=') goto yy437;
+ goto yy102;
}
-yy146:
- YYDEBUG(146, *YYCURSOR);
+yy109:
+ YYDEBUG(109, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '=') goto yy102;
+ if (yych <= '>') goto yy429;
+ if (yych <= '?') goto yy431;
+ goto yy102;
+yy110:
+ YYDEBUG(110, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'E') {
- if (yych == 'A') goto yy470;
- if (yych <= 'D') goto yy187;
- goto yy471;
+ if (yych == 'A') goto yy417;
+ if (yych <= 'D') goto yy150;
+ goto yy418;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy187;
- goto yy470;
+ if (yych <= '`') goto yy150;
+ goto yy417;
} else {
- if (yych == 'e') goto yy471;
- goto yy187;
+ if (yych == 'e') goto yy418;
+ goto yy150;
}
}
-yy147:
- YYDEBUG(147, *YYCURSOR);
+yy111:
+ YYDEBUG(111, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy467;
- if (yych == 'a') goto yy467;
- goto yy187;
-yy148:
- YYDEBUG(148, *YYCURSOR);
+ if (yych == 'A') goto yy414;
+ if (yych == 'a') goto yy414;
+ goto yy150;
+yy112:
+ YYDEBUG(112, *YYCURSOR);
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'S') {
if (yych <= 'D') {
if (yych <= ' ') {
- if (yych == '\t') goto yy392;
- if (yych <= 0x1F) goto yy139;
- goto yy392;
+ if (yych == '\t') goto yy339;
+ if (yych <= 0x1F) goto yy102;
+ goto yy339;
} else {
- if (yych <= '@') goto yy139;
- if (yych == 'C') goto yy139;
- goto yy392;
+ if (yych <= '@') goto yy102;
+ if (yych == 'C') goto yy102;
+ goto yy339;
}
} else {
if (yych <= 'I') {
- if (yych == 'F') goto yy392;
- if (yych <= 'H') goto yy139;
- goto yy392;
+ if (yych == 'F') goto yy339;
+ if (yych <= 'H') goto yy102;
+ goto yy339;
} else {
- if (yych == 'O') goto yy392;
- if (yych <= 'Q') goto yy139;
- goto yy392;
+ if (yych == 'O') goto yy339;
+ if (yych <= 'Q') goto yy102;
+ goto yy339;
}
}
} else {
if (yych <= 'f') {
if (yych <= 'b') {
- if (yych == 'U') goto yy392;
- if (yych <= '`') goto yy139;
- goto yy392;
+ if (yych == 'U') goto yy339;
+ if (yych <= '`') goto yy102;
+ goto yy339;
} else {
- if (yych == 'd') goto yy392;
- if (yych <= 'e') goto yy139;
- goto yy392;
+ if (yych == 'd') goto yy339;
+ if (yych <= 'e') goto yy102;
+ goto yy339;
}
} else {
if (yych <= 'o') {
- if (yych == 'i') goto yy392;
- if (yych <= 'n') goto yy139;
- goto yy392;
+ if (yych == 'i') goto yy339;
+ if (yych <= 'n') goto yy102;
+ goto yy339;
} else {
if (yych <= 's') {
- if (yych <= 'q') goto yy139;
- goto yy392;
+ if (yych <= 'q') goto yy102;
+ goto yy339;
} else {
- if (yych == 'u') goto yy392;
- goto yy139;
+ if (yych == 'u') goto yy339;
+ goto yy102;
}
}
}
}
-yy149:
- YYDEBUG(149, *YYCURSOR);
+yy113:
+ YYDEBUG(113, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'S') {
- if (yych == 'N') goto yy383;
- if (yych <= 'R') goto yy187;
- goto yy384;
+ if (yych == 'N') goto yy330;
+ if (yych <= 'R') goto yy150;
+ goto yy331;
} else {
if (yych <= 'n') {
- if (yych <= 'm') goto yy187;
- goto yy383;
+ if (yych <= 'm') goto yy150;
+ goto yy330;
} else {
- if (yych == 's') goto yy384;
- goto yy187;
+ if (yych == 's') goto yy331;
+ goto yy150;
}
}
-yy150:
- YYDEBUG(150, *YYCURSOR);
+yy114:
+ YYDEBUG(114, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '_') goto yy301;
- goto yy187;
-yy151:
- YYDEBUG(151, *YYCURSOR);
+ if (yych == '_') goto yy248;
+ goto yy150;
+yy115:
+ YYDEBUG(115, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '<') goto yy139;
- if (yych <= '=') goto yy295;
- if (yych <= '>') goto yy297;
- goto yy139;
-yy152:
- YYDEBUG(152, *YYCURSOR);
+ if (yych <= '<') goto yy102;
+ if (yych <= '=') goto yy242;
+ if (yych <= '>') goto yy244;
+ goto yy102;
+yy116:
+ YYDEBUG(116, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy291;
- if (yych == 'i') goto yy291;
- goto yy187;
-yy153:
- YYDEBUG(153, *YYCURSOR);
+ if (yych == 'I') goto yy238;
+ if (yych == 'i') goto yy238;
+ goto yy150;
+yy117:
+ YYDEBUG(117, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '+') goto yy289;
- if (yych == '=') goto yy287;
- goto yy139;
-yy154:
- YYDEBUG(154, *YYCURSOR);
+ if (yych == '+') goto yy236;
+ if (yych == '=') goto yy234;
+ goto yy102;
+yy118:
+ YYDEBUG(118, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy284;
- goto yy139;
-yy155:
- YYDEBUG(155, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= ';') {
- if (yych == '/') goto yy256;
- goto yy139;
- } else {
- if (yych <= '<') goto yy254;
- if (yych <= '=') goto yy257;
- if (yych <= '>') goto yy259;
- goto yy139;
- }
-yy156:
- YYDEBUG(156, *YYCURSOR);
+ if (yych == '=') goto yy231;
+ goto yy102;
+yy119:
+ YYDEBUG(119, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '<') goto yy139;
- if (yych <= '=') goto yy250;
- if (yych <= '>') goto yy248;
- goto yy139;
-yy157:
- YYDEBUG(157, *YYCURSOR);
+ if (yych <= ';') goto yy102;
+ if (yych <= '<') goto yy209;
+ if (yych <= '=') goto yy211;
+ if (yych <= '>') goto yy213;
+ goto yy102;
+yy120:
+ YYDEBUG(120, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '*') goto yy242;
- if (yych == '=') goto yy244;
- goto yy139;
-yy158:
- YYDEBUG(158, *YYCURSOR);
+ if (yych <= '<') goto yy102;
+ if (yych <= '=') goto yy205;
+ if (yych <= '>') goto yy203;
+ goto yy102;
+yy121:
+ YYDEBUG(121, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '*') goto yy197;
+ if (yych == '=') goto yy199;
+ goto yy102;
+yy122:
+ YYDEBUG(122, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '.') {
- if (yych == '*') goto yy234;
- goto yy139;
+ if (yych == '*') goto yy189;
+ goto yy102;
} else {
- if (yych <= '/') goto yy236;
- if (yych == '=') goto yy237;
- goto yy139;
+ if (yych <= '/') goto yy191;
+ if (yych == '=') goto yy192;
+ goto yy102;
}
-yy159:
- YYDEBUG(159, *YYCURSOR);
+yy123:
+ YYDEBUG(123, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '<') goto yy139;
- if (yych <= '=') goto yy230;
- if (yych <= '>') goto yy228;
- goto yy139;
-yy160:
- YYDEBUG(160, *YYCURSOR);
+ if (yych == '=') goto yy187;
+ goto yy102;
+yy124:
+ YYDEBUG(124, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '&') goto yy224;
- if (yych == '=') goto yy226;
- goto yy139;
-yy161:
- YYDEBUG(161, *YYCURSOR);
+ if (yych == '&') goto yy183;
+ if (yych == '=') goto yy185;
+ goto yy102;
+yy125:
+ YYDEBUG(125, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy222;
- if (yych == '|') goto yy220;
- goto yy139;
-yy162:
- YYDEBUG(162, *YYCURSOR);
+ if (yych == '=') goto yy181;
+ if (yych == '|') goto yy179;
+ goto yy102;
+yy126:
+ YYDEBUG(126, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '=') goto yy218;
- goto yy139;
-yy163:
- YYDEBUG(163, *YYCURSOR);
+ if (yych == '=') goto yy177;
+ goto yy102;
+yy127:
+ YYDEBUG(127, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy216;
- if (yych == 'r') goto yy216;
- goto yy187;
-yy164:
- YYDEBUG(164, *YYCURSOR);
+ if (yych == 'R') goto yy175;
+ if (yych == 'r') goto yy175;
+ goto yy150;
+yy128:
+ YYDEBUG(128, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy213;
- if (yych == 'o') goto yy213;
- goto yy187;
-yy165:
- YYDEBUG(165, *YYCURSOR);
+ if (yych == 'O') goto yy172;
+ if (yych == 'o') goto yy172;
+ goto yy150;
+yy129:
+ YYDEBUG(129, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy139;
- if (yych <= 'Z') goto yy210;
- if (yych <= '^') goto yy139;
- goto yy210;
+ if (yych <= '@') goto yy102;
+ if (yych <= 'Z') goto yy169;
+ if (yych <= '^') goto yy102;
+ goto yy169;
} else {
- if (yych <= '`') goto yy139;
- if (yych <= 'z') goto yy210;
- if (yych <= '~') goto yy139;
- goto yy210;
+ if (yych <= '`') goto yy102;
+ if (yych <= 'z') goto yy169;
+ if (yych <= '~') goto yy102;
+ goto yy169;
}
-yy166:
- YYDEBUG(166, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy139;
-yy167:
- YYDEBUG(167, *YYCURSOR);
+yy130:
+ YYDEBUG(130, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '>') goto yy206;
- goto yy139;
-yy168:
- YYDEBUG(168, *YYCURSOR);
+ goto yy102;
+yy131:
+ YYDEBUG(131, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(169, *YYCURSOR);
+ YYDEBUG(132, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1477 "Zend/zend_language_scanner.l"
+#line 1456 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return '{';
}
-#line 2912 "Zend/zend_language_scanner.c"
-yy170:
- YYDEBUG(170, *YYCURSOR);
+#line 2566 "Zend/zend_language_scanner.c"
+yy133:
+ YYDEBUG(133, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(171, *YYCURSOR);
+ YYDEBUG(134, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1489 "Zend/zend_language_scanner.l"
+#line 1468 "Zend/zend_language_scanner.l"
{
RESET_DOC_COMMENT();
if (!zend_stack_is_empty(&SCNG(state_stack))) {
@@ -2922,41 +2576,41 @@ yy170:
}
return '}';
}
-#line 2926 "Zend/zend_language_scanner.c"
-yy172:
- YYDEBUG(172, *YYCURSOR);
+#line 2580 "Zend/zend_language_scanner.c"
+yy135:
+ YYDEBUG(135, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'E') {
if (yych <= '9') {
- if (yych == '.') goto yy188;
- if (yych >= '0') goto yy191;
+ if (yych == '.') goto yy151;
+ if (yych >= '0') goto yy154;
} else {
- if (yych == 'B') goto yy199;
- if (yych >= 'E') goto yy193;
+ if (yych == 'B') goto yy162;
+ if (yych >= 'E') goto yy156;
}
} else {
if (yych <= 'b') {
- if (yych == 'X') goto yy198;
- if (yych >= 'b') goto yy199;
+ if (yych == 'X') goto yy161;
+ if (yych >= 'b') goto yy162;
} else {
if (yych <= 'e') {
- if (yych >= 'e') goto yy193;
+ if (yych >= 'e') goto yy156;
} else {
- if (yych == 'x') goto yy198;
+ if (yych == 'x') goto yy161;
}
}
}
-yy173:
- YYDEBUG(173, *YYCURSOR);
+yy136:
+ YYDEBUG(136, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1537 "Zend/zend_language_scanner.l"
+#line 1516 "Zend/zend_language_scanner.l"
{
- if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0));
+ if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
} else {
errno = 0;
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
if (errno == ERANGE) { /* Overflow */
if (yytext[0] == '0') { /* octal overflow */
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL));
@@ -2968,35 +2622,35 @@ yy173:
}
return T_LNUMBER;
}
-#line 2972 "Zend/zend_language_scanner.c"
-yy174:
- YYDEBUG(174, *YYCURSOR);
+#line 2626 "Zend/zend_language_scanner.c"
+yy137:
+ YYDEBUG(137, *YYCURSOR);
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '9') {
- if (yych == '.') goto yy188;
- if (yych <= '/') goto yy173;
- goto yy191;
+ if (yych == '.') goto yy151;
+ if (yych <= '/') goto yy136;
+ goto yy154;
} else {
if (yych <= 'E') {
- if (yych <= 'D') goto yy173;
- goto yy193;
+ if (yych <= 'D') goto yy136;
+ goto yy156;
} else {
- if (yych == 'e') goto yy193;
- goto yy173;
+ if (yych == 'e') goto yy156;
+ goto yy136;
}
}
-yy175:
- YYDEBUG(175, *YYCURSOR);
+yy138:
+ YYDEBUG(138, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy187;
-yy176:
- YYDEBUG(176, *YYCURSOR);
+ goto yy150;
+yy139:
+ YYDEBUG(139, *YYCURSOR);
++YYCURSOR;
-yy177:
- YYDEBUG(177, *YYCURSOR);
+yy140:
+ YYDEBUG(140, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1888 "Zend/zend_language_scanner.l"
+#line 1725 "Zend/zend_language_scanner.l"
{
while (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR++) {
@@ -3008,11 +2662,6 @@ yy177:
case '\n':
CG(zend_lineno)++;
break;
- case '%':
- if (!CG(asp_tags)) {
- continue;
- }
- /* fall through */
case '?':
if (*YYCURSOR == '>') {
YYCURSOR--;
@@ -3030,14 +2679,14 @@ yy177:
return T_COMMENT;
}
-#line 3034 "Zend/zend_language_scanner.c"
-yy178:
- YYDEBUG(178, *YYCURSOR);
+#line 2683 "Zend/zend_language_scanner.c"
+yy141:
+ YYDEBUG(141, *YYCURSOR);
++YYCURSOR;
-yy179:
- YYDEBUG(179, *YYCURSOR);
+yy142:
+ YYDEBUG(142, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1974 "Zend/zend_language_scanner.l"
+#line 1793 "Zend/zend_language_scanner.l"
{
register char *s, *t;
char *end;
@@ -3059,6 +2708,7 @@ yy179:
/* Unclosed single quotes; treat similar to double quotes, but without a separate token
* for ' (unrecognized by parser), instead of old flex fallback to "Unexpected character..."
* rule, which continued in ST_IN_SCRIPTING state after the quote */
+ ZVAL_NULL(zendlval);
return T_ENCAPSED_AND_WHITESPACE;
}
}
@@ -3067,7 +2717,7 @@ yy179:
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
- end = s+Z_STRSIZE_P(zendlval);
+ end = s+Z_STRLEN_P(zendlval);
while (s<end) {
if (*s=='\\') {
s++;
@@ -3076,7 +2726,7 @@ yy179:
case '\\':
case '\'':
*t++ = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
default:
*t++ = '\\';
@@ -3099,20 +2749,20 @@ yy179:
char *str = NULL;
s = Z_STRVAL_P(zendlval);
// TODO: avoid reallocation ???
- SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
+ SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
ZVAL_STRINGL(zendlval, str, sz);
efree(s);
}
return T_CONSTANT_ENCAPSED_STRING;
}
-#line 3109 "Zend/zend_language_scanner.c"
-yy180:
- YYDEBUG(180, *YYCURSOR);
+#line 2759 "Zend/zend_language_scanner.c"
+yy143:
+ YYDEBUG(143, *YYCURSOR);
++YYCURSOR;
-yy181:
- YYDEBUG(181, *YYCURSOR);
+yy144:
+ YYDEBUG(144, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2043 "Zend/zend_language_scanner.l"
+#line 1863 "Zend/zend_language_scanner.l"
{
int bprefix = (yytext[0] != '"') ? 1 : 0;
@@ -3153,24 +2803,24 @@ yy181:
BEGIN(ST_DOUBLE_QUOTES);
return '"';
}
-#line 3157 "Zend/zend_language_scanner.c"
-yy182:
- YYDEBUG(182, *YYCURSOR);
+#line 2807 "Zend/zend_language_scanner.c"
+yy145:
+ YYDEBUG(145, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(183, *YYCURSOR);
+ YYDEBUG(146, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2133 "Zend/zend_language_scanner.l"
+#line 1953 "Zend/zend_language_scanner.l"
{
BEGIN(ST_BACKQUOTE);
return '`';
}
-#line 3168 "Zend/zend_language_scanner.c"
-yy184:
- YYDEBUG(184, *YYCURSOR);
+#line 2818 "Zend/zend_language_scanner.c"
+yy147:
+ YYDEBUG(147, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(185, *YYCURSOR);
+ YYDEBUG(148, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2395 "Zend/zend_language_scanner.l"
+#line 2215 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -3179,131 +2829,131 @@ yy184:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 3183 "Zend/zend_language_scanner.c"
-yy186:
- YYDEBUG(186, *YYCURSOR);
+#line 2833 "Zend/zend_language_scanner.c"
+yy149:
+ YYDEBUG(149, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy187:
- YYDEBUG(187, *YYCURSOR);
+yy150:
+ YYDEBUG(150, *YYCURSOR);
if (yybm[0+yych] & 4) {
- goto yy186;
+ goto yy149;
}
- goto yy124;
-yy188:
- YYDEBUG(188, *YYCURSOR);
+ goto yy87;
+yy151:
+ YYDEBUG(151, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(189, *YYCURSOR);
+ YYDEBUG(152, *YYCURSOR);
if (yybm[0+yych] & 8) {
- goto yy188;
+ goto yy151;
}
- if (yych == 'E') goto yy193;
- if (yych == 'e') goto yy193;
-yy190:
- YYDEBUG(190, *YYCURSOR);
+ if (yych == 'E') goto yy156;
+ if (yych == 'e') goto yy156;
+yy153:
+ YYDEBUG(153, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1592 "Zend/zend_language_scanner.l"
+#line 1571 "Zend/zend_language_scanner.l"
{
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL));
return T_DNUMBER;
}
-#line 3215 "Zend/zend_language_scanner.c"
-yy191:
- YYDEBUG(191, *YYCURSOR);
+#line 2865 "Zend/zend_language_scanner.c"
+yy154:
+ YYDEBUG(154, *YYCURSOR);
yyaccept = 2;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(192, *YYCURSOR);
+ YYDEBUG(155, *YYCURSOR);
if (yych <= '9') {
- if (yych == '.') goto yy188;
- if (yych <= '/') goto yy173;
- goto yy191;
+ if (yych == '.') goto yy151;
+ if (yych <= '/') goto yy136;
+ goto yy154;
} else {
if (yych <= 'E') {
- if (yych <= 'D') goto yy173;
+ if (yych <= 'D') goto yy136;
} else {
- if (yych != 'e') goto yy173;
+ if (yych != 'e') goto yy136;
}
}
-yy193:
- YYDEBUG(193, *YYCURSOR);
+yy156:
+ YYDEBUG(156, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= ',') {
- if (yych == '+') goto yy195;
+ if (yych == '+') goto yy158;
} else {
- if (yych <= '-') goto yy195;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy196;
+ if (yych <= '-') goto yy158;
+ if (yych <= '/') goto yy157;
+ if (yych <= '9') goto yy159;
}
-yy194:
- YYDEBUG(194, *YYCURSOR);
+yy157:
+ YYDEBUG(157, *YYCURSOR);
YYCURSOR = YYMARKER;
if (yyaccept <= 2) {
if (yyaccept <= 1) {
if (yyaccept <= 0) {
- goto yy124;
+ goto yy87;
} else {
- goto yy139;
+ goto yy102;
}
} else {
- goto yy173;
+ goto yy136;
}
} else {
if (yyaccept <= 4) {
if (yyaccept <= 3) {
- goto yy190;
+ goto yy153;
} else {
- goto yy235;
+ goto yy190;
}
} else {
- goto yy255;
+ goto yy210;
}
}
-yy195:
- YYDEBUG(195, *YYCURSOR);
+yy158:
+ YYDEBUG(158, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych <= '/') goto yy194;
- if (yych >= ':') goto yy194;
-yy196:
- YYDEBUG(196, *YYCURSOR);
+ if (yych <= '/') goto yy157;
+ if (yych >= ':') goto yy157;
+yy159:
+ YYDEBUG(159, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(197, *YYCURSOR);
- if (yych <= '/') goto yy190;
- if (yych <= '9') goto yy196;
- goto yy190;
-yy198:
- YYDEBUG(198, *YYCURSOR);
+ YYDEBUG(160, *YYCURSOR);
+ if (yych <= '/') goto yy153;
+ if (yych <= '9') goto yy159;
+ goto yy153;
+yy161:
+ YYDEBUG(161, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 32) {
- goto yy203;
+ goto yy166;
}
- goto yy194;
-yy199:
- YYDEBUG(199, *YYCURSOR);
+ goto yy157;
+yy162:
+ YYDEBUG(162, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 16) {
- goto yy200;
+ goto yy163;
}
- goto yy194;
-yy200:
- YYDEBUG(200, *YYCURSOR);
+ goto yy157;
+yy163:
+ YYDEBUG(163, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(201, *YYCURSOR);
+ YYDEBUG(164, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy200;
+ goto yy163;
}
- YYDEBUG(202, *YYCURSOR);
+ YYDEBUG(165, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1514 "Zend/zend_language_scanner.l"
+#line 1493 "Zend/zend_language_scanner.l"
{
char *bin = yytext + 2; /* Skip "0b" */
int len = yyleng - 2;
@@ -3314,11 +2964,11 @@ yy200:
--len;
}
- if (len < SIZEOF_ZEND_INT * 8) {
+ if (len < SIZEOF_ZEND_LONG * 8) {
if (len == 0) {
- ZVAL_INT(zendlval, 0);
+ ZVAL_LONG(zendlval, 0);
} else {
- ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(bin, NULL, 2));
}
return T_LNUMBER;
} else {
@@ -3326,19 +2976,19 @@ yy200:
return T_DNUMBER;
}
}
-#line 3330 "Zend/zend_language_scanner.c"
-yy203:
- YYDEBUG(203, *YYCURSOR);
+#line 2980 "Zend/zend_language_scanner.c"
+yy166:
+ YYDEBUG(166, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(204, *YYCURSOR);
+ YYDEBUG(167, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy203;
+ goto yy166;
}
- YYDEBUG(205, *YYCURSOR);
+ YYDEBUG(168, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1555 "Zend/zend_language_scanner.l"
+#line 1534 "Zend/zend_language_scanner.l"
{
char *hex = yytext + 2; /* Skip "0x" */
int len = yyleng - 2;
@@ -3349,11 +2999,11 @@ yy203:
len--;
}
- if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) {
+ if (len < SIZEOF_ZEND_LONG * 2 || (len == SIZEOF_ZEND_LONG * 2 && *hex <= '7')) {
if (len == 0) {
- ZVAL_INT(zendlval, 0);
+ ZVAL_LONG(zendlval, 0);
} else {
- ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(hex, NULL, 16));
}
return T_LNUMBER;
} else {
@@ -3361,190 +3011,137 @@ yy203:
return T_DNUMBER;
}
}
-#line 3365 "Zend/zend_language_scanner.c"
-yy206:
- YYDEBUG(206, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy208;
- if (yych == '\r') goto yy209;
-yy207:
- YYDEBUG(207, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1955 "Zend/zend_language_scanner.l"
- {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(INITIAL);
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
-}
-#line 3380 "Zend/zend_language_scanner.c"
-yy208:
- YYDEBUG(208, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy207;
-yy209:
- YYDEBUG(209, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy208;
- goto yy207;
-yy210:
- YYDEBUG(210, *YYCURSOR);
+#line 3015 "Zend/zend_language_scanner.c"
+yy169:
+ YYDEBUG(169, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(211, *YYCURSOR);
+ YYDEBUG(170, *YYCURSOR);
if (yych <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy210;
+ if (yych >= '0') goto yy169;
} else {
- if (yych <= '@') goto yy212;
- if (yych <= 'Z') goto yy210;
+ if (yych <= '@') goto yy171;
+ if (yych <= 'Z') goto yy169;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy210;
+ if (yych <= '_') goto yy169;
} else {
- if (yych <= 'z') goto yy210;
- if (yych >= 0x7F) goto yy210;
+ if (yych <= 'z') goto yy169;
+ if (yych >= 0x7F) goto yy169;
}
}
-yy212:
- YYDEBUG(212, *YYCURSOR);
+yy171:
+ YYDEBUG(171, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1860 "Zend/zend_language_scanner.l"
+#line 1696 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 3419 "Zend/zend_language_scanner.c"
-yy213:
- YYDEBUG(213, *YYCURSOR);
+#line 3045 "Zend/zend_language_scanner.c"
+yy172:
+ YYDEBUG(172, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy214;
- if (yych != 'r') goto yy187;
-yy214:
- YYDEBUG(214, *YYCURSOR);
+ if (yych == 'R') goto yy173;
+ if (yych != 'r') goto yy150;
+yy173:
+ YYDEBUG(173, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(215, *YYCURSOR);
+ YYDEBUG(174, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1460 "Zend/zend_language_scanner.l"
+#line 1439 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_XOR;
}
-#line 3437 "Zend/zend_language_scanner.c"
-yy216:
- YYDEBUG(216, *YYCURSOR);
+#line 3063 "Zend/zend_language_scanner.c"
+yy175:
+ YYDEBUG(175, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(217, *YYCURSOR);
+ YYDEBUG(176, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1452 "Zend/zend_language_scanner.l"
+#line 1431 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_OR;
}
-#line 3450 "Zend/zend_language_scanner.c"
-yy218:
- YYDEBUG(218, *YYCURSOR);
+#line 3076 "Zend/zend_language_scanner.c"
+yy177:
+ YYDEBUG(177, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(219, *YYCURSOR);
+ YYDEBUG(178, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1440 "Zend/zend_language_scanner.l"
+#line 1419 "Zend/zend_language_scanner.l"
{
return T_XOR_EQUAL;
}
-#line 3460 "Zend/zend_language_scanner.c"
-yy220:
- YYDEBUG(220, *YYCURSOR);
+#line 3086 "Zend/zend_language_scanner.c"
+yy179:
+ YYDEBUG(179, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(221, *YYCURSOR);
+ YYDEBUG(180, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1444 "Zend/zend_language_scanner.l"
+#line 1423 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_OR;
}
-#line 3470 "Zend/zend_language_scanner.c"
-yy222:
- YYDEBUG(222, *YYCURSOR);
+#line 3096 "Zend/zend_language_scanner.c"
+yy181:
+ YYDEBUG(181, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(223, *YYCURSOR);
+ YYDEBUG(182, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1436 "Zend/zend_language_scanner.l"
+#line 1415 "Zend/zend_language_scanner.l"
{
return T_OR_EQUAL;
}
-#line 3480 "Zend/zend_language_scanner.c"
-yy224:
- YYDEBUG(224, *YYCURSOR);
+#line 3106 "Zend/zend_language_scanner.c"
+yy183:
+ YYDEBUG(183, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(225, *YYCURSOR);
+ YYDEBUG(184, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1448 "Zend/zend_language_scanner.l"
+#line 1427 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_AND;
}
-#line 3490 "Zend/zend_language_scanner.c"
-yy226:
- YYDEBUG(226, *YYCURSOR);
+#line 3116 "Zend/zend_language_scanner.c"
+yy185:
+ YYDEBUG(185, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(227, *YYCURSOR);
+ YYDEBUG(186, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1432 "Zend/zend_language_scanner.l"
+#line 1411 "Zend/zend_language_scanner.l"
{
return T_AND_EQUAL;
}
-#line 3500 "Zend/zend_language_scanner.c"
-yy228:
- YYDEBUG(228, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy232;
- if (yych == '\r') goto yy233;
-yy229:
- YYDEBUG(229, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 1962 "Zend/zend_language_scanner.l"
- {
- if (CG(asp_tags)) {
- BEGIN(INITIAL);
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- yyless(1);
- return yytext[0];
- }
-}
-#line 3520 "Zend/zend_language_scanner.c"
-yy230:
- YYDEBUG(230, *YYCURSOR);
+#line 3126 "Zend/zend_language_scanner.c"
+yy187:
+ YYDEBUG(187, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(231, *YYCURSOR);
+ YYDEBUG(188, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1420 "Zend/zend_language_scanner.l"
+#line 1399 "Zend/zend_language_scanner.l"
{
return T_MOD_EQUAL;
}
-#line 3530 "Zend/zend_language_scanner.c"
-yy232:
- YYDEBUG(232, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy229;
-yy233:
- YYDEBUG(233, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy232;
- goto yy229;
-yy234:
- YYDEBUG(234, *YYCURSOR);
+#line 3136 "Zend/zend_language_scanner.c"
+yy189:
+ YYDEBUG(189, *YYCURSOR);
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych == '*') goto yy239;
-yy235:
- YYDEBUG(235, *YYCURSOR);
+ if (yych == '*') goto yy194;
+yy190:
+ YYDEBUG(190, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1922 "Zend/zend_language_scanner.l"
+#line 1754 "Zend/zend_language_scanner.l"
{
int doc_com;
@@ -3571,308 +3168,257 @@ yy235:
HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) {
- CG(doc_comment) = STR_INIT(yytext, yyleng, 0);
+ CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
return T_DOC_COMMENT;
}
return T_COMMENT;
}
-#line 3581 "Zend/zend_language_scanner.c"
-yy236:
- YYDEBUG(236, *YYCURSOR);
+#line 3178 "Zend/zend_language_scanner.c"
+yy191:
+ YYDEBUG(191, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy177;
-yy237:
- YYDEBUG(237, *YYCURSOR);
+ goto yy140;
+yy192:
+ YYDEBUG(192, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(238, *YYCURSOR);
+ YYDEBUG(193, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1412 "Zend/zend_language_scanner.l"
+#line 1391 "Zend/zend_language_scanner.l"
{
return T_DIV_EQUAL;
}
-#line 3595 "Zend/zend_language_scanner.c"
-yy239:
- YYDEBUG(239, *YYCURSOR);
+#line 3192 "Zend/zend_language_scanner.c"
+yy194:
+ YYDEBUG(194, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 64) {
- goto yy240;
+ goto yy195;
}
- goto yy194;
-yy240:
- YYDEBUG(240, *YYCURSOR);
+ goto yy157;
+yy195:
+ YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(241, *YYCURSOR);
+ YYDEBUG(196, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy240;
+ goto yy195;
}
- goto yy235;
-yy242:
- YYDEBUG(242, *YYCURSOR);
+ goto yy190;
+yy197:
+ YYDEBUG(197, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy246;
- YYDEBUG(243, *YYCURSOR);
+ if ((yych = *YYCURSOR) == '=') goto yy201;
+ YYDEBUG(198, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1404 "Zend/zend_language_scanner.l"
+#line 1383 "Zend/zend_language_scanner.l"
{
return T_POW;
}
-#line 3623 "Zend/zend_language_scanner.c"
-yy244:
- YYDEBUG(244, *YYCURSOR);
+#line 3220 "Zend/zend_language_scanner.c"
+yy199:
+ YYDEBUG(199, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(245, *YYCURSOR);
+ YYDEBUG(200, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1400 "Zend/zend_language_scanner.l"
+#line 1379 "Zend/zend_language_scanner.l"
{
return T_MUL_EQUAL;
}
-#line 3633 "Zend/zend_language_scanner.c"
-yy246:
- YYDEBUG(246, *YYCURSOR);
+#line 3230 "Zend/zend_language_scanner.c"
+yy201:
+ YYDEBUG(201, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(247, *YYCURSOR);
+ YYDEBUG(202, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1408 "Zend/zend_language_scanner.l"
+#line 1387 "Zend/zend_language_scanner.l"
{
return T_POW_EQUAL;
}
-#line 3643 "Zend/zend_language_scanner.c"
-yy248:
- YYDEBUG(248, *YYCURSOR);
+#line 3240 "Zend/zend_language_scanner.c"
+yy203:
+ YYDEBUG(203, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy252;
- YYDEBUG(249, *YYCURSOR);
+ if ((yych = *YYCURSOR) == '=') goto yy207;
+ YYDEBUG(204, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1468 "Zend/zend_language_scanner.l"
+#line 1447 "Zend/zend_language_scanner.l"
{
return T_SR;
}
-#line 3654 "Zend/zend_language_scanner.c"
-yy250:
- YYDEBUG(250, *YYCURSOR);
+#line 3251 "Zend/zend_language_scanner.c"
+yy205:
+ YYDEBUG(205, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(251, *YYCURSOR);
+ YYDEBUG(206, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1388 "Zend/zend_language_scanner.l"
+#line 1367 "Zend/zend_language_scanner.l"
{
return T_IS_GREATER_OR_EQUAL;
}
-#line 3664 "Zend/zend_language_scanner.c"
-yy252:
- YYDEBUG(252, *YYCURSOR);
+#line 3261 "Zend/zend_language_scanner.c"
+yy207:
+ YYDEBUG(207, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(253, *YYCURSOR);
+ YYDEBUG(208, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1428 "Zend/zend_language_scanner.l"
+#line 1407 "Zend/zend_language_scanner.l"
{
return T_SR_EQUAL;
}
-#line 3674 "Zend/zend_language_scanner.c"
-yy254:
- YYDEBUG(254, *YYCURSOR);
+#line 3271 "Zend/zend_language_scanner.c"
+yy209:
+ YYDEBUG(209, *YYCURSOR);
yyaccept = 5;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= ';') goto yy255;
- if (yych <= '<') goto yy270;
- if (yych <= '=') goto yy268;
-yy255:
- YYDEBUG(255, *YYCURSOR);
+ if (yych <= ';') goto yy210;
+ if (yych <= '<') goto yy217;
+ if (yych <= '=') goto yy215;
+yy210:
+ YYDEBUG(210, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1464 "Zend/zend_language_scanner.l"
+#line 1443 "Zend/zend_language_scanner.l"
{
return T_SL;
}
-#line 3689 "Zend/zend_language_scanner.c"
-yy256:
- YYDEBUG(256, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy261;
- if (yych == 's') goto yy261;
- goto yy194;
-yy257:
- YYDEBUG(257, *YYCURSOR);
+#line 3286 "Zend/zend_language_scanner.c"
+yy211:
+ YYDEBUG(211, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(258, *YYCURSOR);
+ YYDEBUG(212, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1384 "Zend/zend_language_scanner.l"
+#line 1363 "Zend/zend_language_scanner.l"
{
return T_IS_SMALLER_OR_EQUAL;
}
-#line 3705 "Zend/zend_language_scanner.c"
-yy259:
- YYDEBUG(259, *YYCURSOR);
+#line 3296 "Zend/zend_language_scanner.c"
+yy213:
+ YYDEBUG(213, *YYCURSOR);
++YYCURSOR;
-yy260:
- YYDEBUG(260, *YYCURSOR);
+yy214:
+ YYDEBUG(214, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1380 "Zend/zend_language_scanner.l"
+#line 1359 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_EQUAL;
}
-#line 3716 "Zend/zend_language_scanner.c"
-yy261:
- YYDEBUG(261, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'C') goto yy262;
- if (yych != 'c') goto yy194;
-yy262:
- YYDEBUG(262, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy263;
- if (yych != 'r') goto yy194;
-yy263:
- YYDEBUG(263, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'I') goto yy264;
- if (yych != 'i') goto yy194;
-yy264:
- YYDEBUG(264, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'P') goto yy265;
- if (yych != 'p') goto yy194;
-yy265:
- YYDEBUG(265, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'T') goto yy266;
- if (yych != 't') goto yy194;
-yy266:
- YYDEBUG(266, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(3);
- yych = *YYCURSOR;
- YYDEBUG(267, *YYCURSOR);
- if (yych <= '\r') {
- if (yych <= 0x08) goto yy194;
- if (yych <= '\n') goto yy266;
- if (yych <= '\f') goto yy194;
- goto yy266;
- } else {
- if (yych <= ' ') {
- if (yych <= 0x1F) goto yy194;
- goto yy266;
- } else {
- if (yych == '>') goto yy206;
- goto yy194;
- }
- }
-yy268:
- YYDEBUG(268, *YYCURSOR);
+#line 3307 "Zend/zend_language_scanner.c"
+yy215:
+ YYDEBUG(215, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(269, *YYCURSOR);
+ YYDEBUG(216, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1424 "Zend/zend_language_scanner.l"
+#line 1403 "Zend/zend_language_scanner.l"
{
return T_SL_EQUAL;
}
-#line 3771 "Zend/zend_language_scanner.c"
-yy270:
- YYDEBUG(270, *YYCURSOR);
+#line 3317 "Zend/zend_language_scanner.c"
+yy217:
+ YYDEBUG(217, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(271, *YYCURSOR);
+ YYDEBUG(218, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy270;
+ goto yy217;
}
if (yych <= 'Z') {
if (yych <= '&') {
- if (yych == '"') goto yy275;
- goto yy194;
+ if (yych == '"') goto yy222;
+ goto yy157;
} else {
- if (yych <= '\'') goto yy274;
- if (yych <= '@') goto yy194;
+ if (yych <= '\'') goto yy221;
+ if (yych <= '@') goto yy157;
}
} else {
if (yych <= '`') {
- if (yych != '_') goto yy194;
+ if (yych != '_') goto yy157;
} else {
- if (yych <= 'z') goto yy272;
- if (yych <= '~') goto yy194;
+ if (yych <= 'z') goto yy219;
+ if (yych <= '~') goto yy157;
}
}
-yy272:
- YYDEBUG(272, *YYCURSOR);
+yy219:
+ YYDEBUG(219, *YYCURSOR);
++YYCURSOR;
YYFILL(2);
yych = *YYCURSOR;
- YYDEBUG(273, *YYCURSOR);
+ YYDEBUG(220, *YYCURSOR);
if (yych <= '@') {
if (yych <= '\f') {
- if (yych == '\n') goto yy279;
- goto yy194;
+ if (yych == '\n') goto yy226;
+ goto yy157;
} else {
- if (yych <= '\r') goto yy281;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy272;
- goto yy194;
+ if (yych <= '\r') goto yy228;
+ if (yych <= '/') goto yy157;
+ if (yych <= '9') goto yy219;
+ goto yy157;
}
} else {
if (yych <= '_') {
- if (yych <= 'Z') goto yy272;
- if (yych <= '^') goto yy194;
- goto yy272;
+ if (yych <= 'Z') goto yy219;
+ if (yych <= '^') goto yy157;
+ goto yy219;
} else {
- if (yych <= '`') goto yy194;
- if (yych <= 'z') goto yy272;
- if (yych <= '~') goto yy194;
- goto yy272;
+ if (yych <= '`') goto yy157;
+ if (yych <= 'z') goto yy219;
+ if (yych <= '~') goto yy157;
+ goto yy219;
}
}
-yy274:
- YYDEBUG(274, *YYCURSOR);
+yy221:
+ YYDEBUG(221, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\'') goto yy194;
- if (yych <= '/') goto yy283;
- if (yych <= '9') goto yy194;
- goto yy283;
-yy275:
- YYDEBUG(275, *YYCURSOR);
+ if (yych == '\'') goto yy157;
+ if (yych <= '/') goto yy230;
+ if (yych <= '9') goto yy157;
+ goto yy230;
+yy222:
+ YYDEBUG(222, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '"') goto yy194;
- if (yych <= '/') goto yy277;
- if (yych <= '9') goto yy194;
- goto yy277;
-yy276:
- YYDEBUG(276, *YYCURSOR);
+ if (yych == '"') goto yy157;
+ if (yych <= '/') goto yy224;
+ if (yych <= '9') goto yy157;
+ goto yy224;
+yy223:
+ YYDEBUG(223, *YYCURSOR);
++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
-yy277:
- YYDEBUG(277, *YYCURSOR);
+yy224:
+ YYDEBUG(224, *YYCURSOR);
if (yych <= 'Z') {
if (yych <= '/') {
- if (yych != '"') goto yy194;
+ if (yych != '"') goto yy157;
} else {
- if (yych <= '9') goto yy276;
- if (yych <= '@') goto yy194;
- goto yy276;
+ if (yych <= '9') goto yy223;
+ if (yych <= '@') goto yy157;
+ goto yy223;
}
} else {
if (yych <= '`') {
- if (yych == '_') goto yy276;
- goto yy194;
+ if (yych == '_') goto yy223;
+ goto yy157;
} else {
- if (yych <= 'z') goto yy276;
- if (yych <= '~') goto yy194;
- goto yy276;
+ if (yych <= 'z') goto yy223;
+ if (yych <= '~') goto yy157;
+ goto yy223;
}
}
-yy278:
- YYDEBUG(278, *YYCURSOR);
+yy225:
+ YYDEBUG(225, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy279;
- if (yych == '\r') goto yy281;
- goto yy194;
-yy279:
- YYDEBUG(279, *YYCURSOR);
+ if (yych == '\n') goto yy226;
+ if (yych == '\r') goto yy228;
+ goto yy157;
+yy226:
+ YYDEBUG(226, *YYCURSOR);
++YYCURSOR;
-yy280:
- YYDEBUG(280, *YYCURSOR);
+yy227:
+ YYDEBUG(227, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2085 "Zend/zend_language_scanner.l"
+#line 1905 "Zend/zend_language_scanner.l"
{
char *s;
int bprefix = (yytext[0] != '<') ? 1 : 0;
@@ -3919,3326 +3465,3272 @@ yy280:
return T_START_HEREDOC;
}
-#line 3923 "Zend/zend_language_scanner.c"
-yy281:
- YYDEBUG(281, *YYCURSOR);
+#line 3469 "Zend/zend_language_scanner.c"
+yy228:
+ YYDEBUG(228, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '\n') goto yy279;
- goto yy280;
-yy282:
- YYDEBUG(282, *YYCURSOR);
+ if (yych == '\n') goto yy226;
+ goto yy227;
+yy229:
+ YYDEBUG(229, *YYCURSOR);
++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
-yy283:
- YYDEBUG(283, *YYCURSOR);
+yy230:
+ YYDEBUG(230, *YYCURSOR);
if (yych <= 'Z') {
if (yych <= '/') {
- if (yych == '\'') goto yy278;
- goto yy194;
+ if (yych == '\'') goto yy225;
+ goto yy157;
} else {
- if (yych <= '9') goto yy282;
- if (yych <= '@') goto yy194;
- goto yy282;
+ if (yych <= '9') goto yy229;
+ if (yych <= '@') goto yy157;
+ goto yy229;
}
} else {
if (yych <= '`') {
- if (yych == '_') goto yy282;
- goto yy194;
+ if (yych == '_') goto yy229;
+ goto yy157;
} else {
- if (yych <= 'z') goto yy282;
- if (yych <= '~') goto yy194;
- goto yy282;
+ if (yych <= 'z') goto yy229;
+ if (yych <= '~') goto yy157;
+ goto yy229;
}
}
-yy284:
- YYDEBUG(284, *YYCURSOR);
+yy231:
+ YYDEBUG(231, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '=') goto yy260;
- YYDEBUG(285, *YYCURSOR);
+ if (yych != '=') goto yy214;
+ YYDEBUG(232, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(286, *YYCURSOR);
+ YYDEBUG(233, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1372 "Zend/zend_language_scanner.l"
+#line 1351 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_IDENTICAL;
}
-#line 3967 "Zend/zend_language_scanner.c"
-yy287:
- YYDEBUG(287, *YYCURSOR);
+#line 3513 "Zend/zend_language_scanner.c"
+yy234:
+ YYDEBUG(234, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(288, *YYCURSOR);
+ YYDEBUG(235, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1392 "Zend/zend_language_scanner.l"
+#line 1371 "Zend/zend_language_scanner.l"
{
return T_PLUS_EQUAL;
}
-#line 3977 "Zend/zend_language_scanner.c"
-yy289:
- YYDEBUG(289, *YYCURSOR);
+#line 3523 "Zend/zend_language_scanner.c"
+yy236:
+ YYDEBUG(236, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(290, *YYCURSOR);
+ YYDEBUG(237, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1360 "Zend/zend_language_scanner.l"
+#line 1339 "Zend/zend_language_scanner.l"
{
return T_INC;
}
-#line 3987 "Zend/zend_language_scanner.c"
-yy291:
- YYDEBUG(291, *YYCURSOR);
+#line 3533 "Zend/zend_language_scanner.c"
+yy238:
+ YYDEBUG(238, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy292;
- if (yych != 's') goto yy187;
-yy292:
- YYDEBUG(292, *YYCURSOR);
+ if (yych == 'S') goto yy239;
+ if (yych != 's') goto yy150;
+yy239:
+ YYDEBUG(239, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy293;
- if (yych != 't') goto yy187;
-yy293:
- YYDEBUG(293, *YYCURSOR);
+ if (yych == 'T') goto yy240;
+ if (yych != 't') goto yy150;
+yy240:
+ YYDEBUG(240, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(294, *YYCURSOR);
+ YYDEBUG(241, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1348 "Zend/zend_language_scanner.l"
+#line 1327 "Zend/zend_language_scanner.l"
{
return T_LIST;
}
-#line 4010 "Zend/zend_language_scanner.c"
-yy295:
- YYDEBUG(295, *YYCURSOR);
+#line 3556 "Zend/zend_language_scanner.c"
+yy242:
+ YYDEBUG(242, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '=') goto yy299;
- YYDEBUG(296, *YYCURSOR);
+ if ((yych = *YYCURSOR) == '=') goto yy246;
+ YYDEBUG(243, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1376 "Zend/zend_language_scanner.l"
+#line 1355 "Zend/zend_language_scanner.l"
{
return T_IS_EQUAL;
}
-#line 4021 "Zend/zend_language_scanner.c"
-yy297:
- YYDEBUG(297, *YYCURSOR);
+#line 3567 "Zend/zend_language_scanner.c"
+yy244:
+ YYDEBUG(244, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(298, *YYCURSOR);
+ YYDEBUG(245, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1344 "Zend/zend_language_scanner.l"
+#line 1323 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_ARROW;
}
-#line 4031 "Zend/zend_language_scanner.c"
-yy299:
- YYDEBUG(299, *YYCURSOR);
+#line 3577 "Zend/zend_language_scanner.c"
+yy246:
+ YYDEBUG(246, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(300, *YYCURSOR);
+ YYDEBUG(247, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1368 "Zend/zend_language_scanner.l"
+#line 1347 "Zend/zend_language_scanner.l"
{
return T_IS_IDENTICAL;
}
-#line 4041 "Zend/zend_language_scanner.c"
-yy301:
- YYDEBUG(301, *YYCURSOR);
+#line 3587 "Zend/zend_language_scanner.c"
+yy248:
+ YYDEBUG(248, *YYCURSOR);
yych = *++YYCURSOR;
YYDEBUG(-1, yych);
switch (yych) {
case 'C':
- case 'c': goto yy303;
+ case 'c': goto yy250;
case 'D':
- case 'd': goto yy308;
+ case 'd': goto yy255;
case 'F':
- case 'f': goto yy305;
+ case 'f': goto yy252;
case 'H':
- case 'h': goto yy302;
+ case 'h': goto yy249;
case 'L':
- case 'l': goto yy307;
+ case 'l': goto yy254;
case 'M':
- case 'm': goto yy306;
+ case 'm': goto yy253;
case 'N':
- case 'n': goto yy309;
+ case 'n': goto yy256;
case 'T':
- case 't': goto yy304;
- default: goto yy187;
+ case 't': goto yy251;
+ default: goto yy150;
}
-yy302:
- YYDEBUG(302, *YYCURSOR);
+yy249:
+ YYDEBUG(249, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy370;
- if (yych == 'a') goto yy370;
- goto yy187;
-yy303:
- YYDEBUG(303, *YYCURSOR);
+ if (yych == 'A') goto yy317;
+ if (yych == 'a') goto yy317;
+ goto yy150;
+yy250:
+ YYDEBUG(250, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy363;
- if (yych == 'l') goto yy363;
- goto yy187;
-yy304:
- YYDEBUG(304, *YYCURSOR);
+ if (yych == 'L') goto yy310;
+ if (yych == 'l') goto yy310;
+ goto yy150;
+yy251:
+ YYDEBUG(251, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy356;
- if (yych == 'r') goto yy356;
- goto yy187;
-yy305:
- YYDEBUG(305, *YYCURSOR);
+ if (yych == 'R') goto yy303;
+ if (yych == 'r') goto yy303;
+ goto yy150;
+yy252:
+ YYDEBUG(252, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'U') {
- if (yych == 'I') goto yy340;
- if (yych <= 'T') goto yy187;
- goto yy341;
+ if (yych == 'I') goto yy287;
+ if (yych <= 'T') goto yy150;
+ goto yy288;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy187;
- goto yy340;
+ if (yych <= 'h') goto yy150;
+ goto yy287;
} else {
- if (yych == 'u') goto yy341;
- goto yy187;
+ if (yych == 'u') goto yy288;
+ goto yy150;
}
}
-yy306:
- YYDEBUG(306, *YYCURSOR);
+yy253:
+ YYDEBUG(253, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy332;
- if (yych == 'e') goto yy332;
- goto yy187;
-yy307:
- YYDEBUG(307, *YYCURSOR);
+ if (yych == 'E') goto yy279;
+ if (yych == 'e') goto yy279;
+ goto yy150;
+yy254:
+ YYDEBUG(254, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy326;
- if (yych == 'i') goto yy326;
- goto yy187;
-yy308:
- YYDEBUG(308, *YYCURSOR);
+ if (yych == 'I') goto yy273;
+ if (yych == 'i') goto yy273;
+ goto yy150;
+yy255:
+ YYDEBUG(255, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy321;
- if (yych == 'i') goto yy321;
- goto yy187;
-yy309:
- YYDEBUG(309, *YYCURSOR);
+ if (yych == 'I') goto yy268;
+ if (yych == 'i') goto yy268;
+ goto yy150;
+yy256:
+ YYDEBUG(256, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy310;
- if (yych != 'a') goto yy187;
-yy310:
- YYDEBUG(310, *YYCURSOR);
+ if (yych == 'A') goto yy257;
+ if (yych != 'a') goto yy150;
+yy257:
+ YYDEBUG(257, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy311;
- if (yych != 'm') goto yy187;
-yy311:
- YYDEBUG(311, *YYCURSOR);
+ if (yych == 'M') goto yy258;
+ if (yych != 'm') goto yy150;
+yy258:
+ YYDEBUG(258, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy312;
- if (yych != 'e') goto yy187;
-yy312:
- YYDEBUG(312, *YYCURSOR);
+ if (yych == 'E') goto yy259;
+ if (yych != 'e') goto yy150;
+yy259:
+ YYDEBUG(259, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy313;
- if (yych != 's') goto yy187;
-yy313:
- YYDEBUG(313, *YYCURSOR);
+ if (yych == 'S') goto yy260;
+ if (yych != 's') goto yy150;
+yy260:
+ YYDEBUG(260, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy314;
- if (yych != 'p') goto yy187;
-yy314:
- YYDEBUG(314, *YYCURSOR);
+ if (yych == 'P') goto yy261;
+ if (yych != 'p') goto yy150;
+yy261:
+ YYDEBUG(261, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy315;
- if (yych != 'a') goto yy187;
-yy315:
- YYDEBUG(315, *YYCURSOR);
+ if (yych == 'A') goto yy262;
+ if (yych != 'a') goto yy150;
+yy262:
+ YYDEBUG(262, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy316;
- if (yych != 'c') goto yy187;
-yy316:
- YYDEBUG(316, *YYCURSOR);
+ if (yych == 'C') goto yy263;
+ if (yych != 'c') goto yy150;
+yy263:
+ YYDEBUG(263, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy317;
- if (yych != 'e') goto yy187;
-yy317:
- YYDEBUG(317, *YYCURSOR);
+ if (yych == 'E') goto yy264;
+ if (yych != 'e') goto yy150;
+yy264:
+ YYDEBUG(264, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(318, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(265, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(319, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(266, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(320, *YYCURSOR);
+ YYDEBUG(267, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1707 "Zend/zend_language_scanner.l"
+#line 1604 "Zend/zend_language_scanner.l"
{
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- ZVAL_DUP(zendlval, &CG(current_namespace));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_NS_C;
}
-#line 4180 "Zend/zend_language_scanner.c"
-yy321:
- YYDEBUG(321, *YYCURSOR);
+#line 3721 "Zend/zend_language_scanner.c"
+yy268:
+ YYDEBUG(268, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy322;
- if (yych != 'r') goto yy187;
-yy322:
- YYDEBUG(322, *YYCURSOR);
+ if (yych == 'R') goto yy269;
+ if (yych != 'r') goto yy150;
+yy269:
+ YYDEBUG(269, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(323, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(270, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(324, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(271, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(325, *YYCURSOR);
+ YYDEBUG(272, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1682 "Zend/zend_language_scanner.l"
+#line 1600 "Zend/zend_language_scanner.l"
{
- zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
- zend_string *dirname;
-
- if (!filename) {
- filename = STR_EMPTY_ALLOC();
- }
-
- dirname = STR_INIT(filename->val, filename->len, 0);
- zend_dirname(dirname->val, dirname->len);
-
- if (strcmp(dirname->val, ".") == 0) {
- dirname = STR_REALLOC(dirname, MAXPATHLEN, 0);
-#if HAVE_GETCWD
- VCWD_GETCWD(dirname->val, MAXPATHLEN);
-#elif HAVE_GETWD
- VCWD_GETWD(dirname->val);
-#endif
- }
-
- dirname->len = strlen(dirname->val);
- ZVAL_STR(zendlval, dirname);
return T_DIR;
}
-#line 4225 "Zend/zend_language_scanner.c"
-yy326:
- YYDEBUG(326, *YYCURSOR);
+#line 3745 "Zend/zend_language_scanner.c"
+yy273:
+ YYDEBUG(273, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy327;
- if (yych != 'n') goto yy187;
-yy327:
- YYDEBUG(327, *YYCURSOR);
+ if (yych == 'N') goto yy274;
+ if (yych != 'n') goto yy150;
+yy274:
+ YYDEBUG(274, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy328;
- if (yych != 'e') goto yy187;
-yy328:
- YYDEBUG(328, *YYCURSOR);
+ if (yych == 'E') goto yy275;
+ if (yych != 'e') goto yy150;
+yy275:
+ YYDEBUG(275, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(329, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(276, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(330, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(277, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(331, *YYCURSOR);
+ YYDEBUG(278, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1666 "Zend/zend_language_scanner.l"
+#line 1592 "Zend/zend_language_scanner.l"
{
- ZVAL_INT(zendlval, CG(zend_lineno));
return T_LINE;
}
-#line 4255 "Zend/zend_language_scanner.c"
-yy332:
- YYDEBUG(332, *YYCURSOR);
+#line 3774 "Zend/zend_language_scanner.c"
+yy279:
+ YYDEBUG(279, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy333;
- if (yych != 't') goto yy187;
-yy333:
- YYDEBUG(333, *YYCURSOR);
+ if (yych == 'T') goto yy280;
+ if (yych != 't') goto yy150;
+yy280:
+ YYDEBUG(280, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy334;
- if (yych != 'h') goto yy187;
-yy334:
- YYDEBUG(334, *YYCURSOR);
+ if (yych == 'H') goto yy281;
+ if (yych != 'h') goto yy150;
+yy281:
+ YYDEBUG(281, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy335;
- if (yych != 'o') goto yy187;
-yy335:
- YYDEBUG(335, *YYCURSOR);
+ if (yych == 'O') goto yy282;
+ if (yych != 'o') goto yy150;
+yy282:
+ YYDEBUG(282, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy336;
- if (yych != 'd') goto yy187;
-yy336:
- YYDEBUG(336, *YYCURSOR);
+ if (yych == 'D') goto yy283;
+ if (yych != 'd') goto yy150;
+yy283:
+ YYDEBUG(283, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(337, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(284, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(338, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(285, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(339, *YYCURSOR);
+ YYDEBUG(286, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1634 "Zend/zend_language_scanner.l"
+#line 1588 "Zend/zend_language_scanner.l"
{
- if (CG(active_class_entry)) {
- int len = 0;
-
- if (CG(active_class_entry)->name) {
- len += CG(active_class_entry)->name->len;
- }
- if (CG(active_op_array) && CG(active_op_array)->function_name) {
- len += sizeof("::")-1;
- len += CG(active_op_array)->function_name->len;
- }
- ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0));
- len = 0;
- if (CG(active_class_entry)->name) {
- memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
- len += CG(active_class_entry)->name->len;
- }
- if (CG(active_op_array) && CG(active_op_array)->function_name) {
- memcpy(Z_STRVAL_P(zendlval) + len, "::", sizeof("::")-1);
- len += sizeof("::")-1;
- memcpy(Z_STRVAL_P(zendlval) + len, CG(active_op_array)->function_name->val, CG(active_op_array)->function_name->len);
- len += CG(active_op_array)->function_name->len;
- }
- Z_STRVAL_P(zendlval)[len] = 0;
- } else if (CG(active_op_array) && CG(active_op_array)->function_name) {
- ZVAL_STR(zendlval, STR_COPY(CG(active_op_array)->function_name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_METHOD_C;
}
-#line 4322 "Zend/zend_language_scanner.c"
-yy340:
- YYDEBUG(340, *YYCURSOR);
+#line 3813 "Zend/zend_language_scanner.c"
+yy287:
+ YYDEBUG(287, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy351;
- if (yych == 'l') goto yy351;
- goto yy187;
-yy341:
- YYDEBUG(341, *YYCURSOR);
+ if (yych == 'L') goto yy298;
+ if (yych == 'l') goto yy298;
+ goto yy150;
+yy288:
+ YYDEBUG(288, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy342;
- if (yych != 'n') goto yy187;
-yy342:
- YYDEBUG(342, *YYCURSOR);
+ if (yych == 'N') goto yy289;
+ if (yych != 'n') goto yy150;
+yy289:
+ YYDEBUG(289, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy343;
- if (yych != 'c') goto yy187;
-yy343:
- YYDEBUG(343, *YYCURSOR);
+ if (yych == 'C') goto yy290;
+ if (yych != 'c') goto yy150;
+yy290:
+ YYDEBUG(290, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy344;
- if (yych != 't') goto yy187;
-yy344:
- YYDEBUG(344, *YYCURSOR);
+ if (yych == 'T') goto yy291;
+ if (yych != 't') goto yy150;
+yy291:
+ YYDEBUG(291, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy345;
- if (yych != 'i') goto yy187;
-yy345:
- YYDEBUG(345, *YYCURSOR);
+ if (yych == 'I') goto yy292;
+ if (yych != 'i') goto yy150;
+yy292:
+ YYDEBUG(292, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy346;
- if (yych != 'o') goto yy187;
-yy346:
- YYDEBUG(346, *YYCURSOR);
+ if (yych == 'O') goto yy293;
+ if (yych != 'o') goto yy150;
+yy293:
+ YYDEBUG(293, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy347;
- if (yych != 'n') goto yy187;
-yy347:
- YYDEBUG(347, *YYCURSOR);
+ if (yych == 'N') goto yy294;
+ if (yych != 'n') goto yy150;
+yy294:
+ YYDEBUG(294, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(348, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(295, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(349, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(296, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(350, *YYCURSOR);
+ YYDEBUG(297, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1624 "Zend/zend_language_scanner.l"
+#line 1584 "Zend/zend_language_scanner.l"
{
- zend_op_array *op_array = CG(active_op_array);
- if (op_array && op_array->function_name) {
- ZVAL_STR(zendlval, STR_COPY(op_array->function_name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_FUNC_C;
}
-#line 4383 "Zend/zend_language_scanner.c"
-yy351:
- YYDEBUG(351, *YYCURSOR);
+#line 3868 "Zend/zend_language_scanner.c"
+yy298:
+ YYDEBUG(298, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy352;
- if (yych != 'e') goto yy187;
-yy352:
- YYDEBUG(352, *YYCURSOR);
+ if (yych == 'E') goto yy299;
+ if (yych != 'e') goto yy150;
+yy299:
+ YYDEBUG(299, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(353, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(300, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(354, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(301, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(355, *YYCURSOR);
+ YYDEBUG(302, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1671 "Zend/zend_language_scanner.l"
+#line 1596 "Zend/zend_language_scanner.l"
{
- zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
-
- if (!filename) {
- ZVAL_EMPTY_STRING(zendlval);
- } else {
- ZVAL_STR(zendlval, STR_COPY(filename));
- }
return T_FILE;
}
-#line 4414 "Zend/zend_language_scanner.c"
-yy356:
- YYDEBUG(356, *YYCURSOR);
+#line 3892 "Zend/zend_language_scanner.c"
+yy303:
+ YYDEBUG(303, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy357;
- if (yych != 'a') goto yy187;
-yy357:
- YYDEBUG(357, *YYCURSOR);
+ if (yych == 'A') goto yy304;
+ if (yych != 'a') goto yy150;
+yy304:
+ YYDEBUG(304, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy358;
- if (yych != 'i') goto yy187;
-yy358:
- YYDEBUG(358, *YYCURSOR);
+ if (yych == 'I') goto yy305;
+ if (yych != 'i') goto yy150;
+yy305:
+ YYDEBUG(305, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy359;
- if (yych != 't') goto yy187;
-yy359:
- YYDEBUG(359, *YYCURSOR);
+ if (yych == 'T') goto yy306;
+ if (yych != 't') goto yy150;
+yy306:
+ YYDEBUG(306, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(360, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(307, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(361, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(308, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(362, *YYCURSOR);
+ YYDEBUG(309, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1614 "Zend/zend_language_scanner.l"
+#line 1580 "Zend/zend_language_scanner.l"
{
- zend_class_entry *ce = CG(active_class_entry);
- if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- ZVAL_STR(zendlval, STR_COPY(ce->name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_TRAIT_C;
}
-#line 4454 "Zend/zend_language_scanner.c"
-yy363:
- YYDEBUG(363, *YYCURSOR);
+#line 3926 "Zend/zend_language_scanner.c"
+yy310:
+ YYDEBUG(310, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy364;
- if (yych != 'a') goto yy187;
-yy364:
- YYDEBUG(364, *YYCURSOR);
+ if (yych == 'A') goto yy311;
+ if (yych != 'a') goto yy150;
+yy311:
+ YYDEBUG(311, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy365;
- if (yych != 's') goto yy187;
-yy365:
- YYDEBUG(365, *YYCURSOR);
+ if (yych == 'S') goto yy312;
+ if (yych != 's') goto yy150;
+yy312:
+ YYDEBUG(312, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy366;
- if (yych != 's') goto yy187;
-yy366:
- YYDEBUG(366, *YYCURSOR);
+ if (yych == 'S') goto yy313;
+ if (yych != 's') goto yy150;
+yy313:
+ YYDEBUG(313, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(367, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(314, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(368, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(315, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(369, *YYCURSOR);
+ YYDEBUG(316, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1597 "Zend/zend_language_scanner.l"
+#line 1576 "Zend/zend_language_scanner.l"
{
- zend_class_entry *ce = CG(active_class_entry);
- if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- /* We create a special __CLASS__ constant that is going to be resolved
- at run-time */
- ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1);
- Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX;
- } else {
- if (ce && ce->name) {
- ZVAL_STR(zendlval, STR_COPY(ce->name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
- }
return T_CLASS_C;
}
-#line 4501 "Zend/zend_language_scanner.c"
-yy370:
- YYDEBUG(370, *YYCURSOR);
+#line 3960 "Zend/zend_language_scanner.c"
+yy317:
+ YYDEBUG(317, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy371;
- if (yych != 'l') goto yy187;
-yy371:
- YYDEBUG(371, *YYCURSOR);
+ if (yych == 'L') goto yy318;
+ if (yych != 'l') goto yy150;
+yy318:
+ YYDEBUG(318, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy372;
- if (yych != 't') goto yy187;
-yy372:
- YYDEBUG(372, *YYCURSOR);
+ if (yych == 'T') goto yy319;
+ if (yych != 't') goto yy150;
+yy319:
+ YYDEBUG(319, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '_') goto yy187;
- YYDEBUG(373, *YYCURSOR);
+ if (yych != '_') goto yy150;
+ YYDEBUG(320, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy374;
- if (yych != 'c') goto yy187;
-yy374:
- YYDEBUG(374, *YYCURSOR);
+ if (yych == 'C') goto yy321;
+ if (yych != 'c') goto yy150;
+yy321:
+ YYDEBUG(321, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy375;
- if (yych != 'o') goto yy187;
-yy375:
- YYDEBUG(375, *YYCURSOR);
+ if (yych == 'O') goto yy322;
+ if (yych != 'o') goto yy150;
+yy322:
+ YYDEBUG(322, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy376;
- if (yych != 'm') goto yy187;
-yy376:
- YYDEBUG(376, *YYCURSOR);
+ if (yych == 'M') goto yy323;
+ if (yych != 'm') goto yy150;
+yy323:
+ YYDEBUG(323, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy377;
- if (yych != 'p') goto yy187;
-yy377:
- YYDEBUG(377, *YYCURSOR);
+ if (yych == 'P') goto yy324;
+ if (yych != 'p') goto yy150;
+yy324:
+ YYDEBUG(324, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy378;
- if (yych != 'i') goto yy187;
-yy378:
- YYDEBUG(378, *YYCURSOR);
+ if (yych == 'I') goto yy325;
+ if (yych != 'i') goto yy150;
+yy325:
+ YYDEBUG(325, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy379;
- if (yych != 'l') goto yy187;
-yy379:
- YYDEBUG(379, *YYCURSOR);
+ if (yych == 'L') goto yy326;
+ if (yych != 'l') goto yy150;
+yy326:
+ YYDEBUG(326, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy380;
- if (yych != 'e') goto yy187;
-yy380:
- YYDEBUG(380, *YYCURSOR);
+ if (yych == 'E') goto yy327;
+ if (yych != 'e') goto yy150;
+yy327:
+ YYDEBUG(327, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy381;
- if (yych != 'r') goto yy187;
-yy381:
- YYDEBUG(381, *YYCURSOR);
+ if (yych == 'R') goto yy328;
+ if (yych != 'r') goto yy150;
+yy328:
+ YYDEBUG(328, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(382, *YYCURSOR);
+ YYDEBUG(329, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1312 "Zend/zend_language_scanner.l"
+#line 1291 "Zend/zend_language_scanner.l"
{
return T_HALT_COMPILER;
}
-#line 4567 "Zend/zend_language_scanner.c"
-yy383:
- YYDEBUG(383, *YYCURSOR);
+#line 4026 "Zend/zend_language_scanner.c"
+yy330:
+ YYDEBUG(330, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy387;
- if (yych == 's') goto yy387;
- goto yy187;
-yy384:
- YYDEBUG(384, *YYCURSOR);
+ if (yych == 'S') goto yy334;
+ if (yych == 's') goto yy334;
+ goto yy150;
+yy331:
+ YYDEBUG(331, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy385;
- if (yych != 'e') goto yy187;
-yy385:
- YYDEBUG(385, *YYCURSOR);
+ if (yych == 'E') goto yy332;
+ if (yych != 'e') goto yy150;
+yy332:
+ YYDEBUG(332, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(386, *YYCURSOR);
+ YYDEBUG(333, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1292 "Zend/zend_language_scanner.l"
+#line 1271 "Zend/zend_language_scanner.l"
{
return T_USE;
}
-#line 4591 "Zend/zend_language_scanner.c"
-yy387:
- YYDEBUG(387, *YYCURSOR);
+#line 4050 "Zend/zend_language_scanner.c"
+yy334:
+ YYDEBUG(334, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy388;
- if (yych != 'e') goto yy187;
-yy388:
- YYDEBUG(388, *YYCURSOR);
+ if (yych == 'E') goto yy335;
+ if (yych != 'e') goto yy150;
+yy335:
+ YYDEBUG(335, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy389;
- if (yych != 't') goto yy187;
-yy389:
- YYDEBUG(389, *YYCURSOR);
+ if (yych == 'T') goto yy336;
+ if (yych != 't') goto yy150;
+yy336:
+ YYDEBUG(336, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(390, *YYCURSOR);
+ YYDEBUG(337, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1340 "Zend/zend_language_scanner.l"
+#line 1319 "Zend/zend_language_scanner.l"
{
return T_UNSET;
}
-#line 4614 "Zend/zend_language_scanner.c"
-yy391:
- YYDEBUG(391, *YYCURSOR);
+#line 4073 "Zend/zend_language_scanner.c"
+yy338:
+ YYDEBUG(338, *YYCURSOR);
++YYCURSOR;
YYFILL(7);
yych = *YYCURSOR;
-yy392:
- YYDEBUG(392, *YYCURSOR);
+yy339:
+ YYDEBUG(339, *YYCURSOR);
if (yych <= 'S') {
if (yych <= 'D') {
if (yych <= ' ') {
- if (yych == '\t') goto yy391;
- if (yych <= 0x1F) goto yy194;
- goto yy391;
+ if (yych == '\t') goto yy338;
+ if (yych <= 0x1F) goto yy157;
+ goto yy338;
} else {
if (yych <= 'A') {
- if (yych <= '@') goto yy194;
- goto yy396;
+ if (yych <= '@') goto yy157;
+ goto yy343;
} else {
- if (yych <= 'B') goto yy394;
- if (yych <= 'C') goto yy194;
- goto yy399;
+ if (yych <= 'B') goto yy341;
+ if (yych <= 'C') goto yy157;
+ goto yy346;
}
}
} else {
if (yych <= 'I') {
- if (yych == 'F') goto yy400;
- if (yych <= 'H') goto yy194;
- goto yy401;
+ if (yych == 'F') goto yy347;
+ if (yych <= 'H') goto yy157;
+ goto yy348;
} else {
if (yych <= 'O') {
- if (yych <= 'N') goto yy194;
- goto yy395;
+ if (yych <= 'N') goto yy157;
+ goto yy342;
} else {
- if (yych <= 'Q') goto yy194;
- if (yych <= 'R') goto yy398;
- goto yy397;
+ if (yych <= 'Q') goto yy157;
+ if (yych <= 'R') goto yy345;
+ goto yy344;
}
}
}
} else {
if (yych <= 'f') {
if (yych <= 'a') {
- if (yych == 'U') goto yy393;
- if (yych <= '`') goto yy194;
- goto yy396;
+ if (yych == 'U') goto yy340;
+ if (yych <= '`') goto yy157;
+ goto yy343;
} else {
if (yych <= 'c') {
- if (yych <= 'b') goto yy394;
- goto yy194;
+ if (yych <= 'b') goto yy341;
+ goto yy157;
} else {
- if (yych <= 'd') goto yy399;
- if (yych <= 'e') goto yy194;
- goto yy400;
+ if (yych <= 'd') goto yy346;
+ if (yych <= 'e') goto yy157;
+ goto yy347;
}
}
} else {
if (yych <= 'q') {
if (yych <= 'i') {
- if (yych <= 'h') goto yy194;
- goto yy401;
+ if (yych <= 'h') goto yy157;
+ goto yy348;
} else {
- if (yych == 'o') goto yy395;
- goto yy194;
+ if (yych == 'o') goto yy342;
+ goto yy157;
}
} else {
if (yych <= 's') {
- if (yych <= 'r') goto yy398;
- goto yy397;
+ if (yych <= 'r') goto yy345;
+ goto yy344;
} else {
- if (yych != 'u') goto yy194;
+ if (yych != 'u') goto yy157;
}
}
}
}
-yy393:
- YYDEBUG(393, *YYCURSOR);
+yy340:
+ YYDEBUG(340, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy460;
- if (yych == 'n') goto yy460;
- goto yy194;
-yy394:
- YYDEBUG(394, *YYCURSOR);
+ if (yych == 'N') goto yy407;
+ if (yych == 'n') goto yy407;
+ goto yy157;
+yy341:
+ YYDEBUG(341, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'I') goto yy447;
- if (yych <= 'N') goto yy194;
- goto yy448;
+ if (yych == 'I') goto yy394;
+ if (yych <= 'N') goto yy157;
+ goto yy395;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy194;
- goto yy447;
+ if (yych <= 'h') goto yy157;
+ goto yy394;
} else {
- if (yych == 'o') goto yy448;
- goto yy194;
+ if (yych == 'o') goto yy395;
+ goto yy157;
}
}
-yy395:
- YYDEBUG(395, *YYCURSOR);
+yy342:
+ YYDEBUG(342, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy439;
- if (yych == 'b') goto yy439;
- goto yy194;
-yy396:
- YYDEBUG(396, *YYCURSOR);
+ if (yych == 'B') goto yy386;
+ if (yych == 'b') goto yy386;
+ goto yy157;
+yy343:
+ YYDEBUG(343, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy432;
- if (yych == 'r') goto yy432;
- goto yy194;
-yy397:
- YYDEBUG(397, *YYCURSOR);
+ if (yych == 'R') goto yy379;
+ if (yych == 'r') goto yy379;
+ goto yy157;
+yy344:
+ YYDEBUG(344, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy424;
- if (yych == 't') goto yy424;
- goto yy194;
-yy398:
- YYDEBUG(398, *YYCURSOR);
+ if (yych == 'T') goto yy371;
+ if (yych == 't') goto yy371;
+ goto yy157;
+yy345:
+ YYDEBUG(345, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy422;
- if (yych == 'e') goto yy422;
- goto yy194;
-yy399:
- YYDEBUG(399, *YYCURSOR);
+ if (yych == 'E') goto yy369;
+ if (yych == 'e') goto yy369;
+ goto yy157;
+yy346:
+ YYDEBUG(346, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy418;
- if (yych == 'o') goto yy418;
- goto yy194;
-yy400:
- YYDEBUG(400, *YYCURSOR);
+ if (yych == 'O') goto yy365;
+ if (yych == 'o') goto yy365;
+ goto yy157;
+yy347:
+ YYDEBUG(347, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy411;
- if (yych == 'l') goto yy411;
- goto yy194;
-yy401:
- YYDEBUG(401, *YYCURSOR);
+ if (yych == 'L') goto yy358;
+ if (yych == 'l') goto yy358;
+ goto yy157;
+yy348:
+ YYDEBUG(348, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy402;
- if (yych != 'n') goto yy194;
-yy402:
- YYDEBUG(402, *YYCURSOR);
+ if (yych == 'N') goto yy349;
+ if (yych != 'n') goto yy157;
+yy349:
+ YYDEBUG(349, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy403;
- if (yych != 't') goto yy194;
-yy403:
- YYDEBUG(403, *YYCURSOR);
+ if (yych == 'T') goto yy350;
+ if (yych != 't') goto yy157;
+yy350:
+ YYDEBUG(350, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy404;
- if (yych != 'e') goto yy406;
-yy404:
- YYDEBUG(404, *YYCURSOR);
+ if (yych == 'E') goto yy351;
+ if (yych != 'e') goto yy353;
+yy351:
+ YYDEBUG(351, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'G') goto yy409;
- if (yych == 'g') goto yy409;
- goto yy194;
-yy405:
- YYDEBUG(405, *YYCURSOR);
+ if (yych == 'G') goto yy356;
+ if (yych == 'g') goto yy356;
+ goto yy157;
+yy352:
+ YYDEBUG(352, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy406:
- YYDEBUG(406, *YYCURSOR);
+yy353:
+ YYDEBUG(353, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy405;
- goto yy194;
+ if (yych == '\t') goto yy352;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy405;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy352;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(407, *YYCURSOR);
+ YYDEBUG(354, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(408, *YYCURSOR);
+ YYDEBUG(355, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1240 "Zend/zend_language_scanner.l"
+#line 1219 "Zend/zend_language_scanner.l"
{
return T_INT_CAST;
}
-#line 4790 "Zend/zend_language_scanner.c"
-yy409:
- YYDEBUG(409, *YYCURSOR);
+#line 4249 "Zend/zend_language_scanner.c"
+yy356:
+ YYDEBUG(356, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy410;
- if (yych != 'e') goto yy194;
-yy410:
- YYDEBUG(410, *YYCURSOR);
+ if (yych == 'E') goto yy357;
+ if (yych != 'e') goto yy157;
+yy357:
+ YYDEBUG(357, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy405;
- if (yych == 'r') goto yy405;
- goto yy194;
-yy411:
- YYDEBUG(411, *YYCURSOR);
+ if (yych == 'R') goto yy352;
+ if (yych == 'r') goto yy352;
+ goto yy157;
+yy358:
+ YYDEBUG(358, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy412;
- if (yych != 'o') goto yy194;
-yy412:
- YYDEBUG(412, *YYCURSOR);
+ if (yych == 'O') goto yy359;
+ if (yych != 'o') goto yy157;
+yy359:
+ YYDEBUG(359, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy413;
- if (yych != 'a') goto yy194;
-yy413:
- YYDEBUG(413, *YYCURSOR);
+ if (yych == 'A') goto yy360;
+ if (yych != 'a') goto yy157;
+yy360:
+ YYDEBUG(360, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy414;
- if (yych != 't') goto yy194;
-yy414:
- YYDEBUG(414, *YYCURSOR);
+ if (yych == 'T') goto yy361;
+ if (yych != 't') goto yy157;
+yy361:
+ YYDEBUG(361, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(415, *YYCURSOR);
+ YYDEBUG(362, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy414;
- goto yy194;
+ if (yych == '\t') goto yy361;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy414;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy361;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(416, *YYCURSOR);
+ YYDEBUG(363, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(417, *YYCURSOR);
+ YYDEBUG(364, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1244 "Zend/zend_language_scanner.l"
+#line 1223 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_CAST;
}
-#line 4838 "Zend/zend_language_scanner.c"
-yy418:
- YYDEBUG(418, *YYCURSOR);
+#line 4297 "Zend/zend_language_scanner.c"
+yy365:
+ YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy419;
- if (yych != 'u') goto yy194;
-yy419:
- YYDEBUG(419, *YYCURSOR);
+ if (yych == 'U') goto yy366;
+ if (yych != 'u') goto yy157;
+yy366:
+ YYDEBUG(366, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy420;
- if (yych != 'b') goto yy194;
-yy420:
- YYDEBUG(420, *YYCURSOR);
+ if (yych == 'B') goto yy367;
+ if (yych != 'b') goto yy157;
+yy367:
+ YYDEBUG(367, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy421;
- if (yych != 'l') goto yy194;
-yy421:
- YYDEBUG(421, *YYCURSOR);
+ if (yych == 'L') goto yy368;
+ if (yych != 'l') goto yy157;
+yy368:
+ YYDEBUG(368, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy414;
- if (yych == 'e') goto yy414;
- goto yy194;
-yy422:
- YYDEBUG(422, *YYCURSOR);
+ if (yych == 'E') goto yy361;
+ if (yych == 'e') goto yy361;
+ goto yy157;
+yy369:
+ YYDEBUG(369, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy423;
- if (yych != 'a') goto yy194;
-yy423:
- YYDEBUG(423, *YYCURSOR);
+ if (yych == 'A') goto yy370;
+ if (yych != 'a') goto yy157;
+yy370:
+ YYDEBUG(370, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy414;
- if (yych == 'l') goto yy414;
- goto yy194;
-yy424:
- YYDEBUG(424, *YYCURSOR);
+ if (yych == 'L') goto yy361;
+ if (yych == 'l') goto yy361;
+ goto yy157;
+yy371:
+ YYDEBUG(371, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy425;
- if (yych != 'r') goto yy194;
-yy425:
- YYDEBUG(425, *YYCURSOR);
+ if (yych == 'R') goto yy372;
+ if (yych != 'r') goto yy157;
+yy372:
+ YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy426;
- if (yych != 'i') goto yy194;
-yy426:
- YYDEBUG(426, *YYCURSOR);
+ if (yych == 'I') goto yy373;
+ if (yych != 'i') goto yy157;
+yy373:
+ YYDEBUG(373, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy427;
- if (yych != 'n') goto yy194;
-yy427:
- YYDEBUG(427, *YYCURSOR);
+ if (yych == 'N') goto yy374;
+ if (yych != 'n') goto yy157;
+yy374:
+ YYDEBUG(374, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'G') goto yy428;
- if (yych != 'g') goto yy194;
-yy428:
- YYDEBUG(428, *YYCURSOR);
+ if (yych == 'G') goto yy375;
+ if (yych != 'g') goto yy157;
+yy375:
+ YYDEBUG(375, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(429, *YYCURSOR);
+ YYDEBUG(376, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy428;
- goto yy194;
+ if (yych == '\t') goto yy375;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy428;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy375;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(430, *YYCURSOR);
+ YYDEBUG(377, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(431, *YYCURSOR);
+ YYDEBUG(378, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1248 "Zend/zend_language_scanner.l"
+#line 1227 "Zend/zend_language_scanner.l"
{
return T_STRING_CAST;
}
-#line 4912 "Zend/zend_language_scanner.c"
-yy432:
- YYDEBUG(432, *YYCURSOR);
+#line 4371 "Zend/zend_language_scanner.c"
+yy379:
+ YYDEBUG(379, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy433;
- if (yych != 'r') goto yy194;
-yy433:
- YYDEBUG(433, *YYCURSOR);
+ if (yych == 'R') goto yy380;
+ if (yych != 'r') goto yy157;
+yy380:
+ YYDEBUG(380, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy434;
- if (yych != 'a') goto yy194;
-yy434:
- YYDEBUG(434, *YYCURSOR);
+ if (yych == 'A') goto yy381;
+ if (yych != 'a') goto yy157;
+yy381:
+ YYDEBUG(381, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy435;
- if (yych != 'y') goto yy194;
-yy435:
- YYDEBUG(435, *YYCURSOR);
+ if (yych == 'Y') goto yy382;
+ if (yych != 'y') goto yy157;
+yy382:
+ YYDEBUG(382, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(436, *YYCURSOR);
+ YYDEBUG(383, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy435;
- goto yy194;
+ if (yych == '\t') goto yy382;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy435;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy382;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(437, *YYCURSOR);
+ YYDEBUG(384, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(438, *YYCURSOR);
+ YYDEBUG(385, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1252 "Zend/zend_language_scanner.l"
+#line 1231 "Zend/zend_language_scanner.l"
{
return T_ARRAY_CAST;
}
-#line 4949 "Zend/zend_language_scanner.c"
-yy439:
- YYDEBUG(439, *YYCURSOR);
+#line 4408 "Zend/zend_language_scanner.c"
+yy386:
+ YYDEBUG(386, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'J') goto yy440;
- if (yych != 'j') goto yy194;
-yy440:
- YYDEBUG(440, *YYCURSOR);
+ if (yych == 'J') goto yy387;
+ if (yych != 'j') goto yy157;
+yy387:
+ YYDEBUG(387, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy441;
- if (yych != 'e') goto yy194;
-yy441:
- YYDEBUG(441, *YYCURSOR);
+ if (yych == 'E') goto yy388;
+ if (yych != 'e') goto yy157;
+yy388:
+ YYDEBUG(388, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy442;
- if (yych != 'c') goto yy194;
-yy442:
- YYDEBUG(442, *YYCURSOR);
+ if (yych == 'C') goto yy389;
+ if (yych != 'c') goto yy157;
+yy389:
+ YYDEBUG(389, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy443;
- if (yych != 't') goto yy194;
-yy443:
- YYDEBUG(443, *YYCURSOR);
+ if (yych == 'T') goto yy390;
+ if (yych != 't') goto yy157;
+yy390:
+ YYDEBUG(390, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(444, *YYCURSOR);
+ YYDEBUG(391, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy443;
- goto yy194;
+ if (yych == '\t') goto yy390;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy443;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy390;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(445, *YYCURSOR);
+ YYDEBUG(392, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(446, *YYCURSOR);
+ YYDEBUG(393, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1256 "Zend/zend_language_scanner.l"
+#line 1235 "Zend/zend_language_scanner.l"
{
return T_OBJECT_CAST;
}
-#line 4991 "Zend/zend_language_scanner.c"
-yy447:
- YYDEBUG(447, *YYCURSOR);
+#line 4450 "Zend/zend_language_scanner.c"
+yy394:
+ YYDEBUG(394, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy457;
- if (yych == 'n') goto yy457;
- goto yy194;
-yy448:
- YYDEBUG(448, *YYCURSOR);
+ if (yych == 'N') goto yy404;
+ if (yych == 'n') goto yy404;
+ goto yy157;
+yy395:
+ YYDEBUG(395, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy449;
- if (yych != 'o') goto yy194;
-yy449:
- YYDEBUG(449, *YYCURSOR);
+ if (yych == 'O') goto yy396;
+ if (yych != 'o') goto yy157;
+yy396:
+ YYDEBUG(396, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy450;
- if (yych != 'l') goto yy194;
-yy450:
- YYDEBUG(450, *YYCURSOR);
+ if (yych == 'L') goto yy397;
+ if (yych != 'l') goto yy157;
+yy397:
+ YYDEBUG(397, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy455;
- if (yych == 'e') goto yy455;
- goto yy452;
-yy451:
- YYDEBUG(451, *YYCURSOR);
+ if (yych == 'E') goto yy402;
+ if (yych == 'e') goto yy402;
+ goto yy399;
+yy398:
+ YYDEBUG(398, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy452:
- YYDEBUG(452, *YYCURSOR);
+yy399:
+ YYDEBUG(399, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy451;
- goto yy194;
+ if (yych == '\t') goto yy398;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy451;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy398;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(453, *YYCURSOR);
+ YYDEBUG(400, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(454, *YYCURSOR);
+ YYDEBUG(401, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1260 "Zend/zend_language_scanner.l"
+#line 1239 "Zend/zend_language_scanner.l"
{
return T_BOOL_CAST;
}
-#line 5036 "Zend/zend_language_scanner.c"
-yy455:
- YYDEBUG(455, *YYCURSOR);
+#line 4495 "Zend/zend_language_scanner.c"
+yy402:
+ YYDEBUG(402, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy456;
- if (yych != 'a') goto yy194;
-yy456:
- YYDEBUG(456, *YYCURSOR);
+ if (yych == 'A') goto yy403;
+ if (yych != 'a') goto yy157;
+yy403:
+ YYDEBUG(403, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy451;
- if (yych == 'n') goto yy451;
- goto yy194;
-yy457:
- YYDEBUG(457, *YYCURSOR);
+ if (yych == 'N') goto yy398;
+ if (yych == 'n') goto yy398;
+ goto yy157;
+yy404:
+ YYDEBUG(404, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy458;
- if (yych != 'a') goto yy194;
-yy458:
- YYDEBUG(458, *YYCURSOR);
+ if (yych == 'A') goto yy405;
+ if (yych != 'a') goto yy157;
+yy405:
+ YYDEBUG(405, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy459;
- if (yych != 'r') goto yy194;
-yy459:
- YYDEBUG(459, *YYCURSOR);
+ if (yych == 'R') goto yy406;
+ if (yych != 'r') goto yy157;
+yy406:
+ YYDEBUG(406, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy428;
- if (yych == 'y') goto yy428;
- goto yy194;
-yy460:
- YYDEBUG(460, *YYCURSOR);
+ if (yych == 'Y') goto yy375;
+ if (yych == 'y') goto yy375;
+ goto yy157;
+yy407:
+ YYDEBUG(407, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy461;
- if (yych != 's') goto yy194;
-yy461:
- YYDEBUG(461, *YYCURSOR);
+ if (yych == 'S') goto yy408;
+ if (yych != 's') goto yy157;
+yy408:
+ YYDEBUG(408, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy462;
- if (yych != 'e') goto yy194;
-yy462:
- YYDEBUG(462, *YYCURSOR);
+ if (yych == 'E') goto yy409;
+ if (yych != 'e') goto yy157;
+yy409:
+ YYDEBUG(409, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy463;
- if (yych != 't') goto yy194;
-yy463:
- YYDEBUG(463, *YYCURSOR);
+ if (yych == 'T') goto yy410;
+ if (yych != 't') goto yy157;
+yy410:
+ YYDEBUG(410, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(464, *YYCURSOR);
+ YYDEBUG(411, *YYCURSOR);
if (yych <= 0x1F) {
- if (yych == '\t') goto yy463;
- goto yy194;
+ if (yych == '\t') goto yy410;
+ goto yy157;
} else {
- if (yych <= ' ') goto yy463;
- if (yych != ')') goto yy194;
+ if (yych <= ' ') goto yy410;
+ if (yych != ')') goto yy157;
}
- YYDEBUG(465, *YYCURSOR);
+ YYDEBUG(412, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(466, *YYCURSOR);
+ YYDEBUG(413, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1264 "Zend/zend_language_scanner.l"
+#line 1243 "Zend/zend_language_scanner.l"
{
return T_UNSET_CAST;
}
-#line 5100 "Zend/zend_language_scanner.c"
-yy467:
- YYDEBUG(467, *YYCURSOR);
+#line 4559 "Zend/zend_language_scanner.c"
+yy414:
+ YYDEBUG(414, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy468;
- if (yych != 'r') goto yy187;
-yy468:
- YYDEBUG(468, *YYCURSOR);
+ if (yych == 'R') goto yy415;
+ if (yych != 'r') goto yy150;
+yy415:
+ YYDEBUG(415, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(469, *YYCURSOR);
+ YYDEBUG(416, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1236 "Zend/zend_language_scanner.l"
+#line 1215 "Zend/zend_language_scanner.l"
{
return T_VAR;
}
-#line 5118 "Zend/zend_language_scanner.c"
-yy470:
- YYDEBUG(470, *YYCURSOR);
+#line 4577 "Zend/zend_language_scanner.c"
+yy417:
+ YYDEBUG(417, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy474;
- if (yych == 'm') goto yy474;
- goto yy187;
-yy471:
- YYDEBUG(471, *YYCURSOR);
+ if (yych == 'M') goto yy421;
+ if (yych == 'm') goto yy421;
+ goto yy150;
+yy418:
+ YYDEBUG(418, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy472;
- if (yych != 'w') goto yy187;
-yy472:
- YYDEBUG(472, *YYCURSOR);
+ if (yych == 'W') goto yy419;
+ if (yych != 'w') goto yy150;
+yy419:
+ YYDEBUG(419, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(473, *YYCURSOR);
+ YYDEBUG(420, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1228 "Zend/zend_language_scanner.l"
+#line 1207 "Zend/zend_language_scanner.l"
{
return T_NEW;
}
-#line 5142 "Zend/zend_language_scanner.c"
-yy474:
- YYDEBUG(474, *YYCURSOR);
+#line 4601 "Zend/zend_language_scanner.c"
+yy421:
+ YYDEBUG(421, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy475;
- if (yych != 'e') goto yy187;
-yy475:
- YYDEBUG(475, *YYCURSOR);
+ if (yych == 'E') goto yy422;
+ if (yych != 'e') goto yy150;
+yy422:
+ YYDEBUG(422, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy476;
- if (yych != 's') goto yy187;
-yy476:
- YYDEBUG(476, *YYCURSOR);
+ if (yych == 'S') goto yy423;
+ if (yych != 's') goto yy150;
+yy423:
+ YYDEBUG(423, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy477;
- if (yych != 'p') goto yy187;
-yy477:
- YYDEBUG(477, *YYCURSOR);
+ if (yych == 'P') goto yy424;
+ if (yych != 'p') goto yy150;
+yy424:
+ YYDEBUG(424, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy478;
- if (yych != 'a') goto yy187;
-yy478:
- YYDEBUG(478, *YYCURSOR);
+ if (yych == 'A') goto yy425;
+ if (yych != 'a') goto yy150;
+yy425:
+ YYDEBUG(425, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy479;
- if (yych != 'c') goto yy187;
-yy479:
- YYDEBUG(479, *YYCURSOR);
+ if (yych == 'C') goto yy426;
+ if (yych != 'c') goto yy150;
+yy426:
+ YYDEBUG(426, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy480;
- if (yych != 'e') goto yy187;
-yy480:
- YYDEBUG(480, *YYCURSOR);
+ if (yych == 'E') goto yy427;
+ if (yych != 'e') goto yy150;
+yy427:
+ YYDEBUG(427, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(481, *YYCURSOR);
+ YYDEBUG(428, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1288 "Zend/zend_language_scanner.l"
+#line 1267 "Zend/zend_language_scanner.l"
{
return T_NAMESPACE;
}
-#line 5185 "Zend/zend_language_scanner.c"
-yy482:
- YYDEBUG(482, *YYCURSOR);
+#line 4644 "Zend/zend_language_scanner.c"
+yy429:
+ YYDEBUG(429, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy433;
+ if (yych == '\r') goto yy434;
+yy430:
+ YYDEBUG(430, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1787 "Zend/zend_language_scanner.l"
+ {
+ BEGIN(INITIAL);
+ return T_CLOSE_TAG; /* implicit ';' at php-end tag */
+}
+#line 4658 "Zend/zend_language_scanner.c"
+yy431:
+ YYDEBUG(431, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(432, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 1203 "Zend/zend_language_scanner.l"
+ {
+ return T_COALESCE;
+}
+#line 4668 "Zend/zend_language_scanner.c"
+yy433:
+ YYDEBUG(433, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy430;
+yy434:
+ YYDEBUG(434, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy433;
+ goto yy430;
+yy435:
+ YYDEBUG(435, *YYCURSOR);
yyaccept = 3;
YYMARKER = ++YYCURSOR;
YYFILL(3);
yych = *YYCURSOR;
- YYDEBUG(483, *YYCURSOR);
+ YYDEBUG(436, *YYCURSOR);
if (yych <= 'D') {
- if (yych <= '/') goto yy190;
- if (yych <= '9') goto yy482;
- goto yy190;
+ if (yych <= '/') goto yy153;
+ if (yych <= '9') goto yy435;
+ goto yy153;
} else {
- if (yych <= 'E') goto yy193;
- if (yych == 'e') goto yy193;
- goto yy190;
+ if (yych <= 'E') goto yy156;
+ if (yych == 'e') goto yy156;
+ goto yy153;
}
-yy484:
- YYDEBUG(484, *YYCURSOR);
+yy437:
+ YYDEBUG(437, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(485, *YYCURSOR);
+ YYDEBUG(438, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1416 "Zend/zend_language_scanner.l"
+#line 1395 "Zend/zend_language_scanner.l"
{
return T_CONCAT_EQUAL;
}
-#line 5211 "Zend/zend_language_scanner.c"
-yy486:
- YYDEBUG(486, *YYCURSOR);
+#line 4703 "Zend/zend_language_scanner.c"
+yy439:
+ YYDEBUG(439, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych != '.') goto yy194;
- YYDEBUG(487, *YYCURSOR);
+ if (yych != '.') goto yy157;
+ YYDEBUG(440, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(488, *YYCURSOR);
+ YYDEBUG(441, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1224 "Zend/zend_language_scanner.l"
+#line 1199 "Zend/zend_language_scanner.l"
{
return T_ELLIPSIS;
}
-#line 5224 "Zend/zend_language_scanner.c"
-yy489:
- YYDEBUG(489, *YYCURSOR);
+#line 4716 "Zend/zend_language_scanner.c"
+yy442:
+ YYDEBUG(442, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(490, *YYCURSOR);
+ YYDEBUG(443, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1216 "Zend/zend_language_scanner.l"
+#line 1191 "Zend/zend_language_scanner.l"
{
return T_PAAMAYIM_NEKUDOTAYIM;
}
-#line 5234 "Zend/zend_language_scanner.c"
-yy491:
- YYDEBUG(491, *YYCURSOR);
+#line 4726 "Zend/zend_language_scanner.c"
+yy444:
+ YYDEBUG(444, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy492:
- YYDEBUG(492, *YYCURSOR);
+yy445:
+ YYDEBUG(445, *YYCURSOR);
if (yych <= '\f') {
- if (yych <= 0x08) goto yy141;
- if (yych <= '\n') goto yy491;
- goto yy141;
+ if (yych <= 0x08) goto yy104;
+ if (yych <= '\n') goto yy444;
+ goto yy104;
} else {
- if (yych <= '\r') goto yy491;
- if (yych == ' ') goto yy491;
- goto yy141;
+ if (yych <= '\r') goto yy444;
+ if (yych == ' ') goto yy444;
+ goto yy104;
}
-yy493:
- YYDEBUG(493, *YYCURSOR);
+yy446:
+ YYDEBUG(446, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(494, *YYCURSOR);
+ YYDEBUG(447, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1396 "Zend/zend_language_scanner.l"
+#line 1375 "Zend/zend_language_scanner.l"
{
return T_MINUS_EQUAL;
}
-#line 5260 "Zend/zend_language_scanner.c"
-yy495:
- YYDEBUG(495, *YYCURSOR);
+#line 4752 "Zend/zend_language_scanner.c"
+yy448:
+ YYDEBUG(448, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(496, *YYCURSOR);
+ YYDEBUG(449, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1364 "Zend/zend_language_scanner.l"
+#line 1343 "Zend/zend_language_scanner.l"
{
return T_DEC;
}
-#line 5270 "Zend/zend_language_scanner.c"
-yy497:
- YYDEBUG(497, *YYCURSOR);
+#line 4762 "Zend/zend_language_scanner.c"
+yy450:
+ YYDEBUG(450, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(498, *YYCURSOR);
+ YYDEBUG(451, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1189 "Zend/zend_language_scanner.l"
+#line 1165 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
return T_OBJECT_OPERATOR;
}
-#line 5281 "Zend/zend_language_scanner.c"
-yy499:
- YYDEBUG(499, *YYCURSOR);
+#line 4773 "Zend/zend_language_scanner.c"
+yy452:
+ YYDEBUG(452, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'I') goto yy506;
- if (yych <= 'N') goto yy187;
- goto yy507;
+ if (yych == 'I') goto yy459;
+ if (yych <= 'N') goto yy150;
+ goto yy460;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy187;
- goto yy506;
+ if (yych <= 'h') goto yy150;
+ goto yy459;
} else {
- if (yych == 'o') goto yy507;
- goto yy187;
+ if (yych == 'o') goto yy460;
+ goto yy150;
}
}
-yy500:
- YYDEBUG(500, *YYCURSOR);
+yy453:
+ YYDEBUG(453, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy501;
- if (yych != 'b') goto yy187;
-yy501:
- YYDEBUG(501, *YYCURSOR);
+ if (yych == 'B') goto yy454;
+ if (yych != 'b') goto yy150;
+yy454:
+ YYDEBUG(454, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy502;
- if (yych != 'l') goto yy187;
-yy502:
- YYDEBUG(502, *YYCURSOR);
+ if (yych == 'L') goto yy455;
+ if (yych != 'l') goto yy150;
+yy455:
+ YYDEBUG(455, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy503;
- if (yych != 'i') goto yy187;
-yy503:
- YYDEBUG(503, *YYCURSOR);
+ if (yych == 'I') goto yy456;
+ if (yych != 'i') goto yy150;
+yy456:
+ YYDEBUG(456, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy504;
- if (yych != 'c') goto yy187;
-yy504:
- YYDEBUG(504, *YYCURSOR);
+ if (yych == 'C') goto yy457;
+ if (yych != 'c') goto yy150;
+yy457:
+ YYDEBUG(457, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(505, *YYCURSOR);
+ YYDEBUG(458, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1336 "Zend/zend_language_scanner.l"
+#line 1315 "Zend/zend_language_scanner.l"
{
return T_PUBLIC;
}
-#line 5330 "Zend/zend_language_scanner.c"
-yy506:
- YYDEBUG(506, *YYCURSOR);
+#line 4822 "Zend/zend_language_scanner.c"
+yy459:
+ YYDEBUG(459, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'V') {
- if (yych == 'N') goto yy515;
- if (yych <= 'U') goto yy187;
- goto yy516;
+ if (yych == 'N') goto yy468;
+ if (yych <= 'U') goto yy150;
+ goto yy469;
} else {
if (yych <= 'n') {
- if (yych <= 'm') goto yy187;
- goto yy515;
+ if (yych <= 'm') goto yy150;
+ goto yy468;
} else {
- if (yych == 'v') goto yy516;
- goto yy187;
+ if (yych == 'v') goto yy469;
+ goto yy150;
}
}
-yy507:
- YYDEBUG(507, *YYCURSOR);
+yy460:
+ YYDEBUG(460, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy508;
- if (yych != 't') goto yy187;
-yy508:
- YYDEBUG(508, *YYCURSOR);
+ if (yych == 'T') goto yy461;
+ if (yych != 't') goto yy150;
+yy461:
+ YYDEBUG(461, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy509;
- if (yych != 'e') goto yy187;
-yy509:
- YYDEBUG(509, *YYCURSOR);
+ if (yych == 'E') goto yy462;
+ if (yych != 'e') goto yy150;
+yy462:
+ YYDEBUG(462, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy510;
- if (yych != 'c') goto yy187;
-yy510:
- YYDEBUG(510, *YYCURSOR);
+ if (yych == 'C') goto yy463;
+ if (yych != 'c') goto yy150;
+yy463:
+ YYDEBUG(463, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy511;
- if (yych != 't') goto yy187;
-yy511:
- YYDEBUG(511, *YYCURSOR);
+ if (yych == 'T') goto yy464;
+ if (yych != 't') goto yy150;
+yy464:
+ YYDEBUG(464, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy512;
- if (yych != 'e') goto yy187;
-yy512:
- YYDEBUG(512, *YYCURSOR);
+ if (yych == 'E') goto yy465;
+ if (yych != 'e') goto yy150;
+yy465:
+ YYDEBUG(465, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy513;
- if (yych != 'd') goto yy187;
-yy513:
- YYDEBUG(513, *YYCURSOR);
+ if (yych == 'D') goto yy466;
+ if (yych != 'd') goto yy150;
+yy466:
+ YYDEBUG(466, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(514, *YYCURSOR);
+ YYDEBUG(467, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1332 "Zend/zend_language_scanner.l"
+#line 1311 "Zend/zend_language_scanner.l"
{
return T_PROTECTED;
}
-#line 5389 "Zend/zend_language_scanner.c"
-yy515:
- YYDEBUG(515, *YYCURSOR);
+#line 4881 "Zend/zend_language_scanner.c"
+yy468:
+ YYDEBUG(468, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy521;
- if (yych == 't') goto yy521;
- goto yy187;
-yy516:
- YYDEBUG(516, *YYCURSOR);
+ if (yych == 'T') goto yy474;
+ if (yych == 't') goto yy474;
+ goto yy150;
+yy469:
+ YYDEBUG(469, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy517;
- if (yych != 'a') goto yy187;
-yy517:
- YYDEBUG(517, *YYCURSOR);
+ if (yych == 'A') goto yy470;
+ if (yych != 'a') goto yy150;
+yy470:
+ YYDEBUG(470, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy518;
- if (yych != 't') goto yy187;
-yy518:
- YYDEBUG(518, *YYCURSOR);
+ if (yych == 'T') goto yy471;
+ if (yych != 't') goto yy150;
+yy471:
+ YYDEBUG(471, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy519;
- if (yych != 'e') goto yy187;
-yy519:
- YYDEBUG(519, *YYCURSOR);
+ if (yych == 'E') goto yy472;
+ if (yych != 'e') goto yy150;
+yy472:
+ YYDEBUG(472, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(520, *YYCURSOR);
+ YYDEBUG(473, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1328 "Zend/zend_language_scanner.l"
+#line 1307 "Zend/zend_language_scanner.l"
{
return T_PRIVATE;
}
-#line 5423 "Zend/zend_language_scanner.c"
-yy521:
- YYDEBUG(521, *YYCURSOR);
+#line 4915 "Zend/zend_language_scanner.c"
+yy474:
+ YYDEBUG(474, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(522, *YYCURSOR);
+ YYDEBUG(475, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1165 "Zend/zend_language_scanner.l"
+#line 1141 "Zend/zend_language_scanner.l"
{
return T_PRINT;
}
-#line 5436 "Zend/zend_language_scanner.c"
-yy523:
- YYDEBUG(523, *YYCURSOR);
+#line 4928 "Zend/zend_language_scanner.c"
+yy476:
+ YYDEBUG(476, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy528;
- if (yych == 'o') goto yy528;
- goto yy187;
-yy524:
- YYDEBUG(524, *YYCURSOR);
+ if (yych == 'O') goto yy481;
+ if (yych == 'o') goto yy481;
+ goto yy150;
+yy477:
+ YYDEBUG(477, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy525;
- if (yych != 't') goto yy187;
-yy525:
- YYDEBUG(525, *YYCURSOR);
+ if (yych == 'T') goto yy478;
+ if (yych != 't') goto yy150;
+yy478:
+ YYDEBUG(478, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy526;
- if (yych != 'o') goto yy187;
-yy526:
- YYDEBUG(526, *YYCURSOR);
+ if (yych == 'O') goto yy479;
+ if (yych != 'o') goto yy150;
+yy479:
+ YYDEBUG(479, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(527, *YYCURSOR);
+ YYDEBUG(480, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1157 "Zend/zend_language_scanner.l"
+#line 1133 "Zend/zend_language_scanner.l"
{
return T_GOTO;
}
-#line 5465 "Zend/zend_language_scanner.c"
-yy528:
- YYDEBUG(528, *YYCURSOR);
+#line 4957 "Zend/zend_language_scanner.c"
+yy481:
+ YYDEBUG(481, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy529;
- if (yych != 'b') goto yy187;
-yy529:
- YYDEBUG(529, *YYCURSOR);
+ if (yych == 'B') goto yy482;
+ if (yych != 'b') goto yy150;
+yy482:
+ YYDEBUG(482, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy530;
- if (yych != 'a') goto yy187;
-yy530:
- YYDEBUG(530, *YYCURSOR);
+ if (yych == 'A') goto yy483;
+ if (yych != 'a') goto yy150;
+yy483:
+ YYDEBUG(483, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy531;
- if (yych != 'l') goto yy187;
-yy531:
- YYDEBUG(531, *YYCURSOR);
+ if (yych == 'L') goto yy484;
+ if (yych != 'l') goto yy150;
+yy484:
+ YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(532, *YYCURSOR);
+ YYDEBUG(485, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1300 "Zend/zend_language_scanner.l"
+#line 1279 "Zend/zend_language_scanner.l"
{
return T_GLOBAL;
}
-#line 5493 "Zend/zend_language_scanner.c"
-yy533:
- YYDEBUG(533, *YYCURSOR);
+#line 4985 "Zend/zend_language_scanner.c"
+yy486:
+ YYDEBUG(486, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '<') goto yy541;
- goto yy194;
-yy534:
- YYDEBUG(534, *YYCURSOR);
+ if (yych == '<') goto yy494;
+ goto yy157;
+yy487:
+ YYDEBUG(487, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy181;
-yy535:
- YYDEBUG(535, *YYCURSOR);
+ goto yy144;
+yy488:
+ YYDEBUG(488, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy179;
-yy536:
- YYDEBUG(536, *YYCURSOR);
+ goto yy142;
+yy489:
+ YYDEBUG(489, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy537;
- if (yych != 'e') goto yy187;
-yy537:
- YYDEBUG(537, *YYCURSOR);
+ if (yych == 'E') goto yy490;
+ if (yych != 'e') goto yy150;
+yy490:
+ YYDEBUG(490, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy538;
- if (yych != 'a') goto yy187;
-yy538:
- YYDEBUG(538, *YYCURSOR);
+ if (yych == 'A') goto yy491;
+ if (yych != 'a') goto yy150;
+yy491:
+ YYDEBUG(491, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'K') goto yy539;
- if (yych != 'k') goto yy187;
-yy539:
- YYDEBUG(539, *YYCURSOR);
+ if (yych == 'K') goto yy492;
+ if (yych != 'k') goto yy150;
+yy492:
+ YYDEBUG(492, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(540, *YYCURSOR);
+ YYDEBUG(493, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1149 "Zend/zend_language_scanner.l"
+#line 1125 "Zend/zend_language_scanner.l"
{
return T_BREAK;
}
-#line 5534 "Zend/zend_language_scanner.c"
-yy541:
- YYDEBUG(541, *YYCURSOR);
+#line 5026 "Zend/zend_language_scanner.c"
+yy494:
+ YYDEBUG(494, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == '<') goto yy270;
- goto yy194;
-yy542:
- YYDEBUG(542, *YYCURSOR);
+ if (yych == '<') goto yy217;
+ goto yy157;
+yy495:
+ YYDEBUG(495, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy549;
- if (yych == 'a') goto yy549;
- goto yy187;
-yy543:
- YYDEBUG(543, *YYCURSOR);
+ if (yych == 'A') goto yy502;
+ if (yych == 'a') goto yy502;
+ goto yy150;
+yy496:
+ YYDEBUG(496, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy544;
- if (yych != 'i') goto yy187;
-yy544:
- YYDEBUG(544, *YYCURSOR);
+ if (yych == 'I') goto yy497;
+ if (yych != 'i') goto yy150;
+yy497:
+ YYDEBUG(497, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy545;
- if (yych != 't') goto yy187;
-yy545:
- YYDEBUG(545, *YYCURSOR);
+ if (yych == 'T') goto yy498;
+ if (yych != 't') goto yy150;
+yy498:
+ YYDEBUG(498, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy546;
- if (yych != 'c') goto yy187;
-yy546:
- YYDEBUG(546, *YYCURSOR);
+ if (yych == 'C') goto yy499;
+ if (yych != 'c') goto yy150;
+yy499:
+ YYDEBUG(499, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy547;
- if (yych != 'h') goto yy187;
-yy547:
- YYDEBUG(547, *YYCURSOR);
+ if (yych == 'H') goto yy500;
+ if (yych != 'h') goto yy150;
+yy500:
+ YYDEBUG(500, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(548, *YYCURSOR);
+ YYDEBUG(501, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1133 "Zend/zend_language_scanner.l"
+#line 1109 "Zend/zend_language_scanner.l"
{
return T_SWITCH;
}
-#line 5578 "Zend/zend_language_scanner.c"
-yy549:
- YYDEBUG(549, *YYCURSOR);
+#line 5070 "Zend/zend_language_scanner.c"
+yy502:
+ YYDEBUG(502, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy550;
- if (yych != 't') goto yy187;
-yy550:
- YYDEBUG(550, *YYCURSOR);
+ if (yych == 'T') goto yy503;
+ if (yych != 't') goto yy150;
+yy503:
+ YYDEBUG(503, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy551;
- if (yych != 'i') goto yy187;
-yy551:
- YYDEBUG(551, *YYCURSOR);
+ if (yych == 'I') goto yy504;
+ if (yych != 'i') goto yy150;
+yy504:
+ YYDEBUG(504, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy552;
- if (yych != 'c') goto yy187;
-yy552:
- YYDEBUG(552, *YYCURSOR);
+ if (yych == 'C') goto yy505;
+ if (yych != 'c') goto yy150;
+yy505:
+ YYDEBUG(505, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(553, *YYCURSOR);
+ YYDEBUG(506, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1316 "Zend/zend_language_scanner.l"
+#line 1295 "Zend/zend_language_scanner.l"
{
return T_STATIC;
}
-#line 5606 "Zend/zend_language_scanner.c"
-yy554:
- YYDEBUG(554, *YYCURSOR);
+#line 5098 "Zend/zend_language_scanner.c"
+yy507:
+ YYDEBUG(507, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy565;
- if (yych == 's') goto yy565;
- goto yy187;
-yy555:
- YYDEBUG(555, *YYCURSOR);
+ if (yych == 'S') goto yy518;
+ if (yych == 's') goto yy518;
+ goto yy150;
+yy508:
+ YYDEBUG(508, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy563;
- if (yych == 'd') goto yy563;
- goto yy187;
-yy556:
- YYDEBUG(556, *YYCURSOR);
+ if (yych == 'D') goto yy516;
+ if (yych == 'd') goto yy516;
+ goto yy150;
+yy509:
+ YYDEBUG(509, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy559;
- if (yych == 'r') goto yy559;
- goto yy187;
-yy557:
- YYDEBUG(557, *YYCURSOR);
+ if (yych == 'R') goto yy512;
+ if (yych == 'r') goto yy512;
+ goto yy150;
+yy510:
+ YYDEBUG(510, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(558, *YYCURSOR);
+ YYDEBUG(511, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1129 "Zend/zend_language_scanner.l"
+#line 1105 "Zend/zend_language_scanner.l"
{
return T_AS;
}
-#line 5637 "Zend/zend_language_scanner.c"
-yy559:
- YYDEBUG(559, *YYCURSOR);
+#line 5129 "Zend/zend_language_scanner.c"
+yy512:
+ YYDEBUG(512, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy560;
- if (yych != 'a') goto yy187;
-yy560:
- YYDEBUG(560, *YYCURSOR);
+ if (yych == 'A') goto yy513;
+ if (yych != 'a') goto yy150;
+yy513:
+ YYDEBUG(513, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy561;
- if (yych != 'y') goto yy187;
-yy561:
- YYDEBUG(561, *YYCURSOR);
+ if (yych == 'Y') goto yy514;
+ if (yych != 'y') goto yy150;
+yy514:
+ YYDEBUG(514, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(562, *YYCURSOR);
+ YYDEBUG(515, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1352 "Zend/zend_language_scanner.l"
+#line 1331 "Zend/zend_language_scanner.l"
{
return T_ARRAY;
}
-#line 5660 "Zend/zend_language_scanner.c"
-yy563:
- YYDEBUG(563, *YYCURSOR);
+#line 5152 "Zend/zend_language_scanner.c"
+yy516:
+ YYDEBUG(516, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(564, *YYCURSOR);
+ YYDEBUG(517, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1456 "Zend/zend_language_scanner.l"
+#line 1435 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_AND;
}
-#line 5673 "Zend/zend_language_scanner.c"
-yy565:
- YYDEBUG(565, *YYCURSOR);
+#line 5165 "Zend/zend_language_scanner.c"
+yy518:
+ YYDEBUG(518, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy566;
- if (yych != 't') goto yy187;
-yy566:
- YYDEBUG(566, *YYCURSOR);
+ if (yych == 'T') goto yy519;
+ if (yych != 't') goto yy150;
+yy519:
+ YYDEBUG(519, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy567;
- if (yych != 'r') goto yy187;
-yy567:
- YYDEBUG(567, *YYCURSOR);
+ if (yych == 'R') goto yy520;
+ if (yych != 'r') goto yy150;
+yy520:
+ YYDEBUG(520, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy568;
- if (yych != 'a') goto yy187;
-yy568:
- YYDEBUG(568, *YYCURSOR);
+ if (yych == 'A') goto yy521;
+ if (yych != 'a') goto yy150;
+yy521:
+ YYDEBUG(521, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy569;
- if (yych != 'c') goto yy187;
-yy569:
- YYDEBUG(569, *YYCURSOR);
+ if (yych == 'C') goto yy522;
+ if (yych != 'c') goto yy150;
+yy522:
+ YYDEBUG(522, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy570;
- if (yych != 't') goto yy187;
-yy570:
- YYDEBUG(570, *YYCURSOR);
+ if (yych == 'T') goto yy523;
+ if (yych != 't') goto yy150;
+yy523:
+ YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(571, *YYCURSOR);
+ YYDEBUG(524, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1320 "Zend/zend_language_scanner.l"
+#line 1299 "Zend/zend_language_scanner.l"
{
return T_ABSTRACT;
}
-#line 5711 "Zend/zend_language_scanner.c"
-yy572:
- YYDEBUG(572, *YYCURSOR);
+#line 5203 "Zend/zend_language_scanner.c"
+yy525:
+ YYDEBUG(525, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy573;
- if (yych != 'i') goto yy187;
-yy573:
- YYDEBUG(573, *YYCURSOR);
+ if (yych == 'I') goto yy526;
+ if (yych != 'i') goto yy150;
+yy526:
+ YYDEBUG(526, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy574;
- if (yych != 'l') goto yy187;
-yy574:
- YYDEBUG(574, *YYCURSOR);
+ if (yych == 'L') goto yy527;
+ if (yych != 'l') goto yy150;
+yy527:
+ YYDEBUG(527, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy575;
- if (yych != 'e') goto yy187;
-yy575:
- YYDEBUG(575, *YYCURSOR);
+ if (yych == 'E') goto yy528;
+ if (yych != 'e') goto yy150;
+yy528:
+ YYDEBUG(528, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(576, *YYCURSOR);
+ YYDEBUG(529, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1089 "Zend/zend_language_scanner.l"
+#line 1065 "Zend/zend_language_scanner.l"
{
return T_WHILE;
}
-#line 5739 "Zend/zend_language_scanner.c"
-yy577:
- YYDEBUG(577, *YYCURSOR);
+#line 5231 "Zend/zend_language_scanner.c"
+yy530:
+ YYDEBUG(530, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(578, *YYCURSOR);
+ YYDEBUG(531, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1073 "Zend/zend_language_scanner.l"
+#line 1049 "Zend/zend_language_scanner.l"
{
return T_IF;
}
-#line 5752 "Zend/zend_language_scanner.c"
-yy579:
- YYDEBUG(579, *YYCURSOR);
+#line 5244 "Zend/zend_language_scanner.c"
+yy532:
+ YYDEBUG(532, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy621;
- if (yych == 'p') goto yy621;
- goto yy187;
-yy580:
- YYDEBUG(580, *YYCURSOR);
+ if (yych == 'P') goto yy574;
+ if (yych == 'p') goto yy574;
+ goto yy150;
+yy533:
+ YYDEBUG(533, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
if (yych <= 'C') {
- if (yych <= 'B') goto yy187;
- goto yy588;
+ if (yych <= 'B') goto yy150;
+ goto yy541;
} else {
- if (yych <= 'R') goto yy187;
- if (yych <= 'S') goto yy586;
- goto yy587;
+ if (yych <= 'R') goto yy150;
+ if (yych <= 'S') goto yy539;
+ goto yy540;
}
} else {
if (yych <= 'r') {
- if (yych == 'c') goto yy588;
- goto yy187;
+ if (yych == 'c') goto yy541;
+ goto yy150;
} else {
- if (yych <= 's') goto yy586;
- if (yych <= 't') goto yy587;
- goto yy187;
+ if (yych <= 's') goto yy539;
+ if (yych <= 't') goto yy540;
+ goto yy150;
}
}
-yy581:
- YYDEBUG(581, *YYCURSOR);
+yy534:
+ YYDEBUG(534, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy582;
- if (yych != 's') goto yy187;
-yy582:
- YYDEBUG(582, *YYCURSOR);
+ if (yych == 'S') goto yy535;
+ if (yych != 's') goto yy150;
+yy535:
+ YYDEBUG(535, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy583;
- if (yych != 'e') goto yy187;
-yy583:
- YYDEBUG(583, *YYCURSOR);
+ if (yych == 'E') goto yy536;
+ if (yych != 'e') goto yy150;
+yy536:
+ YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy584;
- if (yych != 't') goto yy187;
-yy584:
- YYDEBUG(584, *YYCURSOR);
+ if (yych == 'T') goto yy537;
+ if (yych != 't') goto yy150;
+yy537:
+ YYDEBUG(537, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(585, *YYCURSOR);
+ YYDEBUG(538, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1304 "Zend/zend_language_scanner.l"
+#line 1283 "Zend/zend_language_scanner.l"
{
return T_ISSET;
}
-#line 5808 "Zend/zend_language_scanner.c"
-yy586:
- YYDEBUG(586, *YYCURSOR);
+#line 5300 "Zend/zend_language_scanner.c"
+yy539:
+ YYDEBUG(539, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy607;
- if (yych == 't') goto yy607;
- goto yy187;
-yy587:
- YYDEBUG(587, *YYCURSOR);
+ if (yych == 'T') goto yy560;
+ if (yych == 't') goto yy560;
+ goto yy150;
+yy540:
+ YYDEBUG(540, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy600;
- if (yych == 'e') goto yy600;
- goto yy187;
-yy588:
- YYDEBUG(588, *YYCURSOR);
+ if (yych == 'E') goto yy553;
+ if (yych == 'e') goto yy553;
+ goto yy150;
+yy541:
+ YYDEBUG(541, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy589;
- if (yych != 'l') goto yy187;
-yy589:
- YYDEBUG(589, *YYCURSOR);
+ if (yych == 'L') goto yy542;
+ if (yych != 'l') goto yy150;
+yy542:
+ YYDEBUG(542, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy590;
- if (yych != 'u') goto yy187;
-yy590:
- YYDEBUG(590, *YYCURSOR);
+ if (yych == 'U') goto yy543;
+ if (yych != 'u') goto yy150;
+yy543:
+ YYDEBUG(543, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy591;
- if (yych != 'd') goto yy187;
-yy591:
- YYDEBUG(591, *YYCURSOR);
+ if (yych == 'D') goto yy544;
+ if (yych != 'd') goto yy150;
+yy544:
+ YYDEBUG(544, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy592;
- if (yych != 'e') goto yy187;
-yy592:
- YYDEBUG(592, *YYCURSOR);
+ if (yych == 'E') goto yy545;
+ if (yych != 'e') goto yy150;
+yy545:
+ YYDEBUG(545, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy186;
+ if (yych >= '0') goto yy149;
} else {
- if (yych <= '@') goto yy593;
- if (yych <= 'Z') goto yy186;
+ if (yych <= '@') goto yy546;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy594;
+ if (yych <= '_') goto yy547;
} else {
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy593:
- YYDEBUG(593, *YYCURSOR);
+yy546:
+ YYDEBUG(546, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1272 "Zend/zend_language_scanner.l"
+#line 1251 "Zend/zend_language_scanner.l"
{
return T_INCLUDE;
}
-#line 5866 "Zend/zend_language_scanner.c"
-yy594:
- YYDEBUG(594, *YYCURSOR);
+#line 5358 "Zend/zend_language_scanner.c"
+yy547:
+ YYDEBUG(547, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy595;
- if (yych != 'o') goto yy187;
-yy595:
- YYDEBUG(595, *YYCURSOR);
+ if (yych == 'O') goto yy548;
+ if (yych != 'o') goto yy150;
+yy548:
+ YYDEBUG(548, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy596;
- if (yych != 'n') goto yy187;
-yy596:
- YYDEBUG(596, *YYCURSOR);
+ if (yych == 'N') goto yy549;
+ if (yych != 'n') goto yy150;
+yy549:
+ YYDEBUG(549, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy597;
- if (yych != 'c') goto yy187;
-yy597:
- YYDEBUG(597, *YYCURSOR);
+ if (yych == 'C') goto yy550;
+ if (yych != 'c') goto yy150;
+yy550:
+ YYDEBUG(550, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy598;
- if (yych != 'e') goto yy187;
-yy598:
- YYDEBUG(598, *YYCURSOR);
+ if (yych == 'E') goto yy551;
+ if (yych != 'e') goto yy150;
+yy551:
+ YYDEBUG(551, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(599, *YYCURSOR);
+ YYDEBUG(552, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1276 "Zend/zend_language_scanner.l"
+#line 1255 "Zend/zend_language_scanner.l"
{
return T_INCLUDE_ONCE;
}
-#line 5899 "Zend/zend_language_scanner.c"
-yy600:
- YYDEBUG(600, *YYCURSOR);
+#line 5391 "Zend/zend_language_scanner.c"
+yy553:
+ YYDEBUG(553, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy601;
- if (yych != 'r') goto yy187;
-yy601:
- YYDEBUG(601, *YYCURSOR);
+ if (yych == 'R') goto yy554;
+ if (yych != 'r') goto yy150;
+yy554:
+ YYDEBUG(554, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy602;
- if (yych != 'f') goto yy187;
-yy602:
- YYDEBUG(602, *YYCURSOR);
+ if (yych == 'F') goto yy555;
+ if (yych != 'f') goto yy150;
+yy555:
+ YYDEBUG(555, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy603;
- if (yych != 'a') goto yy187;
-yy603:
- YYDEBUG(603, *YYCURSOR);
+ if (yych == 'A') goto yy556;
+ if (yych != 'a') goto yy150;
+yy556:
+ YYDEBUG(556, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy604;
- if (yych != 'c') goto yy187;
-yy604:
- YYDEBUG(604, *YYCURSOR);
+ if (yych == 'C') goto yy557;
+ if (yych != 'c') goto yy150;
+yy557:
+ YYDEBUG(557, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy605;
- if (yych != 'e') goto yy187;
-yy605:
- YYDEBUG(605, *YYCURSOR);
+ if (yych == 'E') goto yy558;
+ if (yych != 'e') goto yy150;
+yy558:
+ YYDEBUG(558, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(606, *YYCURSOR);
+ YYDEBUG(559, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1173 "Zend/zend_language_scanner.l"
+#line 1149 "Zend/zend_language_scanner.l"
{
return T_INTERFACE;
}
-#line 5937 "Zend/zend_language_scanner.c"
-yy607:
- YYDEBUG(607, *YYCURSOR);
+#line 5429 "Zend/zend_language_scanner.c"
+yy560:
+ YYDEBUG(560, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'E') {
- if (yych == 'A') goto yy608;
- if (yych <= 'D') goto yy187;
- goto yy609;
+ if (yych == 'A') goto yy561;
+ if (yych <= 'D') goto yy150;
+ goto yy562;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy187;
+ if (yych <= '`') goto yy150;
} else {
- if (yych == 'e') goto yy609;
- goto yy187;
+ if (yych == 'e') goto yy562;
+ goto yy150;
}
}
-yy608:
- YYDEBUG(608, *YYCURSOR);
+yy561:
+ YYDEBUG(561, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy615;
- if (yych == 'n') goto yy615;
- goto yy187;
-yy609:
- YYDEBUG(609, *YYCURSOR);
+ if (yych == 'N') goto yy568;
+ if (yych == 'n') goto yy568;
+ goto yy150;
+yy562:
+ YYDEBUG(562, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy610;
- if (yych != 'a') goto yy187;
-yy610:
- YYDEBUG(610, *YYCURSOR);
+ if (yych == 'A') goto yy563;
+ if (yych != 'a') goto yy150;
+yy563:
+ YYDEBUG(563, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy611;
- if (yych != 'd') goto yy187;
-yy611:
- YYDEBUG(611, *YYCURSOR);
+ if (yych == 'D') goto yy564;
+ if (yych != 'd') goto yy150;
+yy564:
+ YYDEBUG(564, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy612;
- if (yych != 'o') goto yy187;
-yy612:
- YYDEBUG(612, *YYCURSOR);
+ if (yych == 'O') goto yy565;
+ if (yych != 'o') goto yy150;
+yy565:
+ YYDEBUG(565, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy613;
- if (yych != 'f') goto yy187;
-yy613:
- YYDEBUG(613, *YYCURSOR);
+ if (yych == 'F') goto yy566;
+ if (yych != 'f') goto yy150;
+yy566:
+ YYDEBUG(566, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(614, *YYCURSOR);
+ YYDEBUG(567, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1296 "Zend/zend_language_scanner.l"
+#line 1275 "Zend/zend_language_scanner.l"
{
return T_INSTEADOF;
}
-#line 5991 "Zend/zend_language_scanner.c"
-yy615:
- YYDEBUG(615, *YYCURSOR);
+#line 5483 "Zend/zend_language_scanner.c"
+yy568:
+ YYDEBUG(568, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy616;
- if (yych != 'c') goto yy187;
-yy616:
- YYDEBUG(616, *YYCURSOR);
+ if (yych == 'C') goto yy569;
+ if (yych != 'c') goto yy150;
+yy569:
+ YYDEBUG(569, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy617;
- if (yych != 'e') goto yy187;
-yy617:
- YYDEBUG(617, *YYCURSOR);
+ if (yych == 'E') goto yy570;
+ if (yych != 'e') goto yy150;
+yy570:
+ YYDEBUG(570, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy618;
- if (yych != 'o') goto yy187;
-yy618:
- YYDEBUG(618, *YYCURSOR);
+ if (yych == 'O') goto yy571;
+ if (yych != 'o') goto yy150;
+yy571:
+ YYDEBUG(571, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy619;
- if (yych != 'f') goto yy187;
-yy619:
- YYDEBUG(619, *YYCURSOR);
+ if (yych == 'F') goto yy572;
+ if (yych != 'f') goto yy150;
+yy572:
+ YYDEBUG(572, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(620, *YYCURSOR);
+ YYDEBUG(573, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1125 "Zend/zend_language_scanner.l"
+#line 1101 "Zend/zend_language_scanner.l"
{
return T_INSTANCEOF;
}
-#line 6024 "Zend/zend_language_scanner.c"
-yy621:
- YYDEBUG(621, *YYCURSOR);
+#line 5516 "Zend/zend_language_scanner.c"
+yy574:
+ YYDEBUG(574, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy622;
- if (yych != 'l') goto yy187;
-yy622:
- YYDEBUG(622, *YYCURSOR);
+ if (yych == 'L') goto yy575;
+ if (yych != 'l') goto yy150;
+yy575:
+ YYDEBUG(575, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy623;
- if (yych != 'e') goto yy187;
-yy623:
- YYDEBUG(623, *YYCURSOR);
+ if (yych == 'E') goto yy576;
+ if (yych != 'e') goto yy150;
+yy576:
+ YYDEBUG(576, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'M') goto yy624;
- if (yych != 'm') goto yy187;
-yy624:
- YYDEBUG(624, *YYCURSOR);
+ if (yych == 'M') goto yy577;
+ if (yych != 'm') goto yy150;
+yy577:
+ YYDEBUG(577, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy625;
- if (yych != 'e') goto yy187;
-yy625:
- YYDEBUG(625, *YYCURSOR);
+ if (yych == 'E') goto yy578;
+ if (yych != 'e') goto yy150;
+yy578:
+ YYDEBUG(578, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy626;
- if (yych != 'n') goto yy187;
-yy626:
- YYDEBUG(626, *YYCURSOR);
+ if (yych == 'N') goto yy579;
+ if (yych != 'n') goto yy150;
+yy579:
+ YYDEBUG(579, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy627;
- if (yych != 't') goto yy187;
-yy627:
- YYDEBUG(627, *YYCURSOR);
+ if (yych == 'T') goto yy580;
+ if (yych != 't') goto yy150;
+yy580:
+ YYDEBUG(580, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy628;
- if (yych != 's') goto yy187;
-yy628:
- YYDEBUG(628, *YYCURSOR);
+ if (yych == 'S') goto yy581;
+ if (yych != 's') goto yy150;
+yy581:
+ YYDEBUG(581, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(629, *YYCURSOR);
+ YYDEBUG(582, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1185 "Zend/zend_language_scanner.l"
+#line 1161 "Zend/zend_language_scanner.l"
{
return T_IMPLEMENTS;
}
-#line 6072 "Zend/zend_language_scanner.c"
-yy630:
- YYDEBUG(630, *YYCURSOR);
+#line 5564 "Zend/zend_language_scanner.c"
+yy583:
+ YYDEBUG(583, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy638;
- if (yych == 'r') goto yy638;
- goto yy187;
-yy631:
- YYDEBUG(631, *YYCURSOR);
+ if (yych == 'R') goto yy591;
+ if (yych == 'r') goto yy591;
+ goto yy150;
+yy584:
+ YYDEBUG(584, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'Y') {
- if (yych == 'A') goto yy634;
- if (yych <= 'X') goto yy187;
+ if (yych == 'A') goto yy587;
+ if (yych <= 'X') goto yy150;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy187;
- goto yy634;
+ if (yych <= '`') goto yy150;
+ goto yy587;
} else {
- if (yych != 'y') goto yy187;
+ if (yych != 'y') goto yy150;
}
}
- YYDEBUG(632, *YYCURSOR);
+ YYDEBUG(585, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(633, *YYCURSOR);
+ YYDEBUG(586, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1057 "Zend/zend_language_scanner.l"
+#line 1033 "Zend/zend_language_scanner.l"
{
return T_TRY;
}
-#line 6104 "Zend/zend_language_scanner.c"
-yy634:
- YYDEBUG(634, *YYCURSOR);
+#line 5596 "Zend/zend_language_scanner.c"
+yy587:
+ YYDEBUG(587, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy635;
- if (yych != 'i') goto yy187;
-yy635:
- YYDEBUG(635, *YYCURSOR);
+ if (yych == 'I') goto yy588;
+ if (yych != 'i') goto yy150;
+yy588:
+ YYDEBUG(588, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy636;
- if (yych != 't') goto yy187;
-yy636:
- YYDEBUG(636, *YYCURSOR);
+ if (yych == 'T') goto yy589;
+ if (yych != 't') goto yy150;
+yy589:
+ YYDEBUG(589, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(637, *YYCURSOR);
+ YYDEBUG(590, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1177 "Zend/zend_language_scanner.l"
+#line 1153 "Zend/zend_language_scanner.l"
{
return T_TRAIT;
}
-#line 6127 "Zend/zend_language_scanner.c"
-yy638:
- YYDEBUG(638, *YYCURSOR);
+#line 5619 "Zend/zend_language_scanner.c"
+yy591:
+ YYDEBUG(591, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy639;
- if (yych != 'o') goto yy187;
-yy639:
- YYDEBUG(639, *YYCURSOR);
+ if (yych == 'O') goto yy592;
+ if (yych != 'o') goto yy150;
+yy592:
+ YYDEBUG(592, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy640;
- if (yych != 'w') goto yy187;
-yy640:
- YYDEBUG(640, *YYCURSOR);
+ if (yych == 'W') goto yy593;
+ if (yych != 'w') goto yy150;
+yy593:
+ YYDEBUG(593, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(641, *YYCURSOR);
+ YYDEBUG(594, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1069 "Zend/zend_language_scanner.l"
+#line 1045 "Zend/zend_language_scanner.l"
{
return T_THROW;
}
-#line 6150 "Zend/zend_language_scanner.c"
-yy642:
- YYDEBUG(642, *YYCURSOR);
+#line 5642 "Zend/zend_language_scanner.c"
+yy595:
+ YYDEBUG(595, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy643;
- if (yych != 'e') goto yy187;
-yy643:
- YYDEBUG(643, *YYCURSOR);
+ if (yych == 'E') goto yy596;
+ if (yych != 'e') goto yy150;
+yy596:
+ YYDEBUG(596, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy644;
- if (yych != 'l') goto yy187;
-yy644:
- YYDEBUG(644, *YYCURSOR);
+ if (yych == 'L') goto yy597;
+ if (yych != 'l') goto yy150;
+yy597:
+ YYDEBUG(597, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy645;
- if (yych != 'd') goto yy187;
-yy645:
- YYDEBUG(645, *YYCURSOR);
+ if (yych == 'D') goto yy598;
+ if (yych != 'd') goto yy150;
+yy598:
+ YYDEBUG(598, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(646, *YYCURSOR);
+ YYDEBUG(599, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1053 "Zend/zend_language_scanner.l"
+#line 1029 "Zend/zend_language_scanner.l"
{
return T_YIELD;
}
-#line 6178 "Zend/zend_language_scanner.c"
-yy647:
- YYDEBUG(647, *YYCURSOR);
+#line 5670 "Zend/zend_language_scanner.c"
+yy600:
+ YYDEBUG(600, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
- if (yych == 'Q') goto yy649;
- if (yych <= 'S') goto yy187;
+ if (yych == 'Q') goto yy602;
+ if (yych <= 'S') goto yy150;
} else {
if (yych <= 'q') {
- if (yych <= 'p') goto yy187;
- goto yy649;
+ if (yych <= 'p') goto yy150;
+ goto yy602;
} else {
- if (yych != 't') goto yy187;
+ if (yych != 't') goto yy150;
}
}
- YYDEBUG(648, *YYCURSOR);
+ YYDEBUG(601, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy661;
- if (yych == 'u') goto yy661;
- goto yy187;
-yy649:
- YYDEBUG(649, *YYCURSOR);
+ if (yych == 'U') goto yy614;
+ if (yych == 'u') goto yy614;
+ goto yy150;
+yy602:
+ YYDEBUG(602, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy650;
- if (yych != 'u') goto yy187;
-yy650:
- YYDEBUG(650, *YYCURSOR);
+ if (yych == 'U') goto yy603;
+ if (yych != 'u') goto yy150;
+yy603:
+ YYDEBUG(603, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy651;
- if (yych != 'i') goto yy187;
-yy651:
- YYDEBUG(651, *YYCURSOR);
+ if (yych == 'I') goto yy604;
+ if (yych != 'i') goto yy150;
+yy604:
+ YYDEBUG(604, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy652;
- if (yych != 'r') goto yy187;
-yy652:
- YYDEBUG(652, *YYCURSOR);
+ if (yych == 'R') goto yy605;
+ if (yych != 'r') goto yy150;
+yy605:
+ YYDEBUG(605, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy653;
- if (yych != 'e') goto yy187;
-yy653:
- YYDEBUG(653, *YYCURSOR);
+ if (yych == 'E') goto yy606;
+ if (yych != 'e') goto yy150;
+yy606:
+ YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy186;
+ if (yych >= '0') goto yy149;
} else {
- if (yych <= '@') goto yy654;
- if (yych <= 'Z') goto yy186;
+ if (yych <= '@') goto yy607;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy655;
+ if (yych <= '_') goto yy608;
} else {
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy654:
- YYDEBUG(654, *YYCURSOR);
+yy607:
+ YYDEBUG(607, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1280 "Zend/zend_language_scanner.l"
+#line 1259 "Zend/zend_language_scanner.l"
{
return T_REQUIRE;
}
-#line 6243 "Zend/zend_language_scanner.c"
-yy655:
- YYDEBUG(655, *YYCURSOR);
+#line 5735 "Zend/zend_language_scanner.c"
+yy608:
+ YYDEBUG(608, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy656;
- if (yych != 'o') goto yy187;
-yy656:
- YYDEBUG(656, *YYCURSOR);
+ if (yych == 'O') goto yy609;
+ if (yych != 'o') goto yy150;
+yy609:
+ YYDEBUG(609, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy657;
- if (yych != 'n') goto yy187;
-yy657:
- YYDEBUG(657, *YYCURSOR);
+ if (yych == 'N') goto yy610;
+ if (yych != 'n') goto yy150;
+yy610:
+ YYDEBUG(610, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy658;
- if (yych != 'c') goto yy187;
-yy658:
- YYDEBUG(658, *YYCURSOR);
+ if (yych == 'C') goto yy611;
+ if (yych != 'c') goto yy150;
+yy611:
+ YYDEBUG(611, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy659;
- if (yych != 'e') goto yy187;
-yy659:
- YYDEBUG(659, *YYCURSOR);
+ if (yych == 'E') goto yy612;
+ if (yych != 'e') goto yy150;
+yy612:
+ YYDEBUG(612, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(660, *YYCURSOR);
+ YYDEBUG(613, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1284 "Zend/zend_language_scanner.l"
+#line 1263 "Zend/zend_language_scanner.l"
{
return T_REQUIRE_ONCE;
}
-#line 6276 "Zend/zend_language_scanner.c"
-yy661:
- YYDEBUG(661, *YYCURSOR);
+#line 5768 "Zend/zend_language_scanner.c"
+yy614:
+ YYDEBUG(614, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy662;
- if (yych != 'r') goto yy187;
-yy662:
- YYDEBUG(662, *YYCURSOR);
+ if (yych == 'R') goto yy615;
+ if (yych != 'r') goto yy150;
+yy615:
+ YYDEBUG(615, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy663;
- if (yych != 'n') goto yy187;
-yy663:
- YYDEBUG(663, *YYCURSOR);
+ if (yych == 'N') goto yy616;
+ if (yych != 'n') goto yy150;
+yy616:
+ YYDEBUG(616, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(664, *YYCURSOR);
+ YYDEBUG(617, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1049 "Zend/zend_language_scanner.l"
+#line 1025 "Zend/zend_language_scanner.l"
{
return T_RETURN;
}
-#line 6299 "Zend/zend_language_scanner.c"
-yy665:
- YYDEBUG(665, *YYCURSOR);
+#line 5791 "Zend/zend_language_scanner.c"
+yy618:
+ YYDEBUG(618, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
if (yych <= 'L') {
- if (yych <= 'K') goto yy187;
- goto yy688;
+ if (yych <= 'K') goto yy150;
+ goto yy641;
} else {
- if (yych <= 'R') goto yy187;
- if (yych <= 'S') goto yy687;
- goto yy686;
+ if (yych <= 'R') goto yy150;
+ if (yych <= 'S') goto yy640;
+ goto yy639;
}
} else {
if (yych <= 'r') {
- if (yych == 'l') goto yy688;
- goto yy187;
+ if (yych == 'l') goto yy641;
+ goto yy150;
} else {
- if (yych <= 's') goto yy687;
- if (yych <= 't') goto yy686;
- goto yy187;
+ if (yych <= 's') goto yy640;
+ if (yych <= 't') goto yy639;
+ goto yy150;
}
}
-yy666:
- YYDEBUG(666, *YYCURSOR);
+yy619:
+ YYDEBUG(619, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'O') {
- if (yych == 'A') goto yy678;
- if (yych <= 'N') goto yy187;
- goto yy679;
+ if (yych == 'A') goto yy631;
+ if (yych <= 'N') goto yy150;
+ goto yy632;
} else {
if (yych <= 'a') {
- if (yych <= '`') goto yy187;
- goto yy678;
+ if (yych <= '`') goto yy150;
+ goto yy631;
} else {
- if (yych == 'o') goto yy679;
- goto yy187;
+ if (yych == 'o') goto yy632;
+ goto yy150;
}
}
-yy667:
- YYDEBUG(667, *YYCURSOR);
+yy620:
+ YYDEBUG(620, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy668;
- if (yych != 'n') goto yy187;
-yy668:
- YYDEBUG(668, *YYCURSOR);
+ if (yych == 'N') goto yy621;
+ if (yych != 'n') goto yy150;
+yy621:
+ YYDEBUG(621, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
- if (yych <= 'R') goto yy187;
- if (yych >= 'T') goto yy670;
+ if (yych <= 'R') goto yy150;
+ if (yych >= 'T') goto yy623;
} else {
- if (yych <= 'r') goto yy187;
- if (yych <= 's') goto yy669;
- if (yych <= 't') goto yy670;
- goto yy187;
+ if (yych <= 'r') goto yy150;
+ if (yych <= 's') goto yy622;
+ if (yych <= 't') goto yy623;
+ goto yy150;
}
-yy669:
- YYDEBUG(669, *YYCURSOR);
+yy622:
+ YYDEBUG(622, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy676;
- if (yych == 't') goto yy676;
- goto yy187;
-yy670:
- YYDEBUG(670, *YYCURSOR);
+ if (yych == 'T') goto yy629;
+ if (yych == 't') goto yy629;
+ goto yy150;
+yy623:
+ YYDEBUG(623, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy671;
- if (yych != 'i') goto yy187;
-yy671:
- YYDEBUG(671, *YYCURSOR);
+ if (yych == 'I') goto yy624;
+ if (yych != 'i') goto yy150;
+yy624:
+ YYDEBUG(624, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy672;
- if (yych != 'n') goto yy187;
-yy672:
- YYDEBUG(672, *YYCURSOR);
+ if (yych == 'N') goto yy625;
+ if (yych != 'n') goto yy150;
+yy625:
+ YYDEBUG(625, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy673;
- if (yych != 'u') goto yy187;
-yy673:
- YYDEBUG(673, *YYCURSOR);
+ if (yych == 'U') goto yy626;
+ if (yych != 'u') goto yy150;
+yy626:
+ YYDEBUG(626, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy674;
- if (yych != 'e') goto yy187;
-yy674:
- YYDEBUG(674, *YYCURSOR);
+ if (yych == 'E') goto yy627;
+ if (yych != 'e') goto yy150;
+yy627:
+ YYDEBUG(627, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(675, *YYCURSOR);
+ YYDEBUG(628, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1153 "Zend/zend_language_scanner.l"
+#line 1129 "Zend/zend_language_scanner.l"
{
return T_CONTINUE;
}
-#line 6393 "Zend/zend_language_scanner.c"
-yy676:
- YYDEBUG(676, *YYCURSOR);
+#line 5885 "Zend/zend_language_scanner.c"
+yy629:
+ YYDEBUG(629, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(677, *YYCURSOR);
+ YYDEBUG(630, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1045 "Zend/zend_language_scanner.l"
+#line 1021 "Zend/zend_language_scanner.l"
{
return T_CONST;
}
-#line 6406 "Zend/zend_language_scanner.c"
-yy678:
- YYDEBUG(678, *YYCURSOR);
+#line 5898 "Zend/zend_language_scanner.c"
+yy631:
+ YYDEBUG(631, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy683;
- if (yych == 's') goto yy683;
- goto yy187;
-yy679:
- YYDEBUG(679, *YYCURSOR);
+ if (yych == 'S') goto yy636;
+ if (yych == 's') goto yy636;
+ goto yy150;
+yy632:
+ YYDEBUG(632, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy680;
- if (yych != 'n') goto yy187;
-yy680:
- YYDEBUG(680, *YYCURSOR);
+ if (yych == 'N') goto yy633;
+ if (yych != 'n') goto yy150;
+yy633:
+ YYDEBUG(633, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy681;
- if (yych != 'e') goto yy187;
-yy681:
- YYDEBUG(681, *YYCURSOR);
+ if (yych == 'E') goto yy634;
+ if (yych != 'e') goto yy150;
+yy634:
+ YYDEBUG(634, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(682, *YYCURSOR);
+ YYDEBUG(635, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1232 "Zend/zend_language_scanner.l"
+#line 1211 "Zend/zend_language_scanner.l"
{
return T_CLONE;
}
-#line 6435 "Zend/zend_language_scanner.c"
-yy683:
- YYDEBUG(683, *YYCURSOR);
+#line 5927 "Zend/zend_language_scanner.c"
+yy636:
+ YYDEBUG(636, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy684;
- if (yych != 's') goto yy187;
-yy684:
- YYDEBUG(684, *YYCURSOR);
+ if (yych == 'S') goto yy637;
+ if (yych != 's') goto yy150;
+yy637:
+ YYDEBUG(637, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(685, *YYCURSOR);
+ YYDEBUG(638, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1169 "Zend/zend_language_scanner.l"
+#line 1145 "Zend/zend_language_scanner.l"
{
return T_CLASS;
}
-#line 6453 "Zend/zend_language_scanner.c"
-yy686:
- YYDEBUG(686, *YYCURSOR);
+#line 5945 "Zend/zend_language_scanner.c"
+yy639:
+ YYDEBUG(639, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy697;
- if (yych == 'c') goto yy697;
- goto yy187;
-yy687:
- YYDEBUG(687, *YYCURSOR);
+ if (yych == 'C') goto yy650;
+ if (yych == 'c') goto yy650;
+ goto yy150;
+yy640:
+ YYDEBUG(640, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy695;
- if (yych == 'e') goto yy695;
- goto yy187;
-yy688:
- YYDEBUG(688, *YYCURSOR);
+ if (yych == 'E') goto yy648;
+ if (yych == 'e') goto yy648;
+ goto yy150;
+yy641:
+ YYDEBUG(641, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy689;
- if (yych != 'l') goto yy187;
-yy689:
- YYDEBUG(689, *YYCURSOR);
+ if (yych == 'L') goto yy642;
+ if (yych != 'l') goto yy150;
+yy642:
+ YYDEBUG(642, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy690;
- if (yych != 'a') goto yy187;
-yy690:
- YYDEBUG(690, *YYCURSOR);
+ if (yych == 'A') goto yy643;
+ if (yych != 'a') goto yy150;
+yy643:
+ YYDEBUG(643, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'B') goto yy691;
- if (yych != 'b') goto yy187;
-yy691:
- YYDEBUG(691, *YYCURSOR);
+ if (yych == 'B') goto yy644;
+ if (yych != 'b') goto yy150;
+yy644:
+ YYDEBUG(644, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy692;
- if (yych != 'l') goto yy187;
-yy692:
- YYDEBUG(692, *YYCURSOR);
+ if (yych == 'L') goto yy645;
+ if (yych != 'l') goto yy150;
+yy645:
+ YYDEBUG(645, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy693;
- if (yych != 'e') goto yy187;
-yy693:
- YYDEBUG(693, *YYCURSOR);
+ if (yych == 'E') goto yy646;
+ if (yych != 'e') goto yy150;
+yy646:
+ YYDEBUG(646, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(694, *YYCURSOR);
+ YYDEBUG(647, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1356 "Zend/zend_language_scanner.l"
+#line 1335 "Zend/zend_language_scanner.l"
{
return T_CALLABLE;
}
-#line 6503 "Zend/zend_language_scanner.c"
-yy695:
- YYDEBUG(695, *YYCURSOR);
+#line 5995 "Zend/zend_language_scanner.c"
+yy648:
+ YYDEBUG(648, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(696, *YYCURSOR);
+ YYDEBUG(649, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1141 "Zend/zend_language_scanner.l"
+#line 1117 "Zend/zend_language_scanner.l"
{
return T_CASE;
}
-#line 6516 "Zend/zend_language_scanner.c"
-yy697:
- YYDEBUG(697, *YYCURSOR);
+#line 6008 "Zend/zend_language_scanner.c"
+yy650:
+ YYDEBUG(650, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy698;
- if (yych != 'h') goto yy187;
-yy698:
- YYDEBUG(698, *YYCURSOR);
+ if (yych == 'H') goto yy651;
+ if (yych != 'h') goto yy150;
+yy651:
+ YYDEBUG(651, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(699, *YYCURSOR);
+ YYDEBUG(652, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1061 "Zend/zend_language_scanner.l"
+#line 1037 "Zend/zend_language_scanner.l"
{
return T_CATCH;
}
-#line 6534 "Zend/zend_language_scanner.c"
-yy700:
- YYDEBUG(700, *YYCURSOR);
+#line 6026 "Zend/zend_language_scanner.c"
+yy653:
+ YYDEBUG(653, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy717;
- if (yych == 'n') goto yy717;
- goto yy187;
-yy701:
- YYDEBUG(701, *YYCURSOR);
+ if (yych == 'N') goto yy670;
+ if (yych == 'n') goto yy670;
+ goto yy150;
+yy654:
+ YYDEBUG(654, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy710;
- if (yych == 'r') goto yy710;
- goto yy187;
-yy702:
- YYDEBUG(702, *YYCURSOR);
+ if (yych == 'R') goto yy663;
+ if (yych == 'r') goto yy663;
+ goto yy150;
+yy655:
+ YYDEBUG(655, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy703;
- if (yych != 'n') goto yy187;
-yy703:
- YYDEBUG(703, *YYCURSOR);
+ if (yych == 'N') goto yy656;
+ if (yych != 'n') goto yy150;
+yy656:
+ YYDEBUG(656, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy704;
- if (yych != 'c') goto yy187;
-yy704:
- YYDEBUG(704, *YYCURSOR);
+ if (yych == 'C') goto yy657;
+ if (yych != 'c') goto yy150;
+yy657:
+ YYDEBUG(657, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy705;
- if (yych != 't') goto yy187;
-yy705:
- YYDEBUG(705, *YYCURSOR);
+ if (yych == 'T') goto yy658;
+ if (yych != 't') goto yy150;
+yy658:
+ YYDEBUG(658, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy706;
- if (yych != 'i') goto yy187;
-yy706:
- YYDEBUG(706, *YYCURSOR);
+ if (yych == 'I') goto yy659;
+ if (yych != 'i') goto yy150;
+yy659:
+ YYDEBUG(659, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy707;
- if (yych != 'o') goto yy187;
-yy707:
- YYDEBUG(707, *YYCURSOR);
+ if (yych == 'O') goto yy660;
+ if (yych != 'o') goto yy150;
+yy660:
+ YYDEBUG(660, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy708;
- if (yych != 'n') goto yy187;
-yy708:
- YYDEBUG(708, *YYCURSOR);
+ if (yych == 'N') goto yy661;
+ if (yych != 'n') goto yy150;
+yy661:
+ YYDEBUG(661, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(709, *YYCURSOR);
+ YYDEBUG(662, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1041 "Zend/zend_language_scanner.l"
+#line 1017 "Zend/zend_language_scanner.l"
{
return T_FUNCTION;
}
-#line 6589 "Zend/zend_language_scanner.c"
-yy710:
- YYDEBUG(710, *YYCURSOR);
+#line 6081 "Zend/zend_language_scanner.c"
+yy663:
+ YYDEBUG(663, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy711;
- if (yych <= '9') goto yy186;
+ if (yych <= '/') goto yy664;
+ if (yych <= '9') goto yy149;
} else {
- if (yych == 'E') goto yy712;
- if (yych <= 'Z') goto yy186;
+ if (yych == 'E') goto yy665;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= 'd') {
- if (yych != '`') goto yy186;
+ if (yych != '`') goto yy149;
} else {
- if (yych <= 'e') goto yy712;
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'e') goto yy665;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy711:
- YYDEBUG(711, *YYCURSOR);
+yy664:
+ YYDEBUG(664, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1101 "Zend/zend_language_scanner.l"
+#line 1077 "Zend/zend_language_scanner.l"
{
return T_FOR;
}
-#line 6617 "Zend/zend_language_scanner.c"
-yy712:
- YYDEBUG(712, *YYCURSOR);
+#line 6109 "Zend/zend_language_scanner.c"
+yy665:
+ YYDEBUG(665, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy713;
- if (yych != 'a') goto yy187;
-yy713:
- YYDEBUG(713, *YYCURSOR);
+ if (yych == 'A') goto yy666;
+ if (yych != 'a') goto yy150;
+yy666:
+ YYDEBUG(666, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy714;
- if (yych != 'c') goto yy187;
-yy714:
- YYDEBUG(714, *YYCURSOR);
+ if (yych == 'C') goto yy667;
+ if (yych != 'c') goto yy150;
+yy667:
+ YYDEBUG(667, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy715;
- if (yych != 'h') goto yy187;
-yy715:
- YYDEBUG(715, *YYCURSOR);
+ if (yych == 'H') goto yy668;
+ if (yych != 'h') goto yy150;
+yy668:
+ YYDEBUG(668, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(716, *YYCURSOR);
+ YYDEBUG(669, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1109 "Zend/zend_language_scanner.l"
+#line 1085 "Zend/zend_language_scanner.l"
{
return T_FOREACH;
}
-#line 6645 "Zend/zend_language_scanner.c"
-yy717:
- YYDEBUG(717, *YYCURSOR);
+#line 6137 "Zend/zend_language_scanner.c"
+yy670:
+ YYDEBUG(670, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy718;
- if (yych != 'a') goto yy187;
-yy718:
- YYDEBUG(718, *YYCURSOR);
+ if (yych == 'A') goto yy671;
+ if (yych != 'a') goto yy150;
+yy671:
+ YYDEBUG(671, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy719;
- if (yych != 'l') goto yy187;
-yy719:
- YYDEBUG(719, *YYCURSOR);
+ if (yych == 'L') goto yy672;
+ if (yych != 'l') goto yy150;
+yy672:
+ YYDEBUG(672, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy720;
- if (yych <= '9') goto yy186;
+ if (yych <= '/') goto yy673;
+ if (yych <= '9') goto yy149;
} else {
- if (yych == 'L') goto yy721;
- if (yych <= 'Z') goto yy186;
+ if (yych == 'L') goto yy674;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= 'k') {
- if (yych != '`') goto yy186;
+ if (yych != '`') goto yy149;
} else {
- if (yych <= 'l') goto yy721;
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'l') goto yy674;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy720:
- YYDEBUG(720, *YYCURSOR);
+yy673:
+ YYDEBUG(673, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1324 "Zend/zend_language_scanner.l"
+#line 1303 "Zend/zend_language_scanner.l"
{
return T_FINAL;
}
-#line 6683 "Zend/zend_language_scanner.c"
-yy721:
- YYDEBUG(721, *YYCURSOR);
+#line 6175 "Zend/zend_language_scanner.c"
+yy674:
+ YYDEBUG(674, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy722;
- if (yych != 'y') goto yy187;
-yy722:
- YYDEBUG(722, *YYCURSOR);
+ if (yych == 'Y') goto yy675;
+ if (yych != 'y') goto yy150;
+yy675:
+ YYDEBUG(675, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(723, *YYCURSOR);
+ YYDEBUG(676, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1065 "Zend/zend_language_scanner.l"
+#line 1041 "Zend/zend_language_scanner.l"
{
return T_FINALLY;
}
-#line 6701 "Zend/zend_language_scanner.c"
-yy724:
- YYDEBUG(724, *YYCURSOR);
+#line 6193 "Zend/zend_language_scanner.c"
+yy677:
+ YYDEBUG(677, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'F') {
- if (yych == 'C') goto yy730;
- if (yych <= 'E') goto yy187;
- goto yy731;
+ if (yych == 'C') goto yy683;
+ if (yych <= 'E') goto yy150;
+ goto yy684;
} else {
if (yych <= 'c') {
- if (yych <= 'b') goto yy187;
- goto yy730;
+ if (yych <= 'b') goto yy150;
+ goto yy683;
} else {
- if (yych == 'f') goto yy731;
- goto yy187;
+ if (yych == 'f') goto yy684;
+ goto yy150;
}
}
-yy725:
- YYDEBUG(725, *YYCURSOR);
+yy678:
+ YYDEBUG(678, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy728;
- if (yych == 'e') goto yy728;
- goto yy187;
-yy726:
- YYDEBUG(726, *YYCURSOR);
+ if (yych == 'E') goto yy681;
+ if (yych == 'e') goto yy681;
+ goto yy150;
+yy679:
+ YYDEBUG(679, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(727, *YYCURSOR);
+ YYDEBUG(680, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1097 "Zend/zend_language_scanner.l"
+#line 1073 "Zend/zend_language_scanner.l"
{
return T_DO;
}
-#line 6736 "Zend/zend_language_scanner.c"
-yy728:
- YYDEBUG(728, *YYCURSOR);
+#line 6228 "Zend/zend_language_scanner.c"
+yy681:
+ YYDEBUG(681, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(729, *YYCURSOR);
+ YYDEBUG(682, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1037 "Zend/zend_language_scanner.l"
+#line 1013 "Zend/zend_language_scanner.l"
{
return T_EXIT;
}
-#line 6749 "Zend/zend_language_scanner.c"
-yy730:
- YYDEBUG(730, *YYCURSOR);
+#line 6241 "Zend/zend_language_scanner.c"
+yy683:
+ YYDEBUG(683, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy737;
- if (yych == 'l') goto yy737;
- goto yy187;
-yy731:
- YYDEBUG(731, *YYCURSOR);
+ if (yych == 'L') goto yy690;
+ if (yych == 'l') goto yy690;
+ goto yy150;
+yy684:
+ YYDEBUG(684, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy732;
- if (yych != 'a') goto yy187;
-yy732:
- YYDEBUG(732, *YYCURSOR);
+ if (yych == 'A') goto yy685;
+ if (yych != 'a') goto yy150;
+yy685:
+ YYDEBUG(685, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'U') goto yy733;
- if (yych != 'u') goto yy187;
-yy733:
- YYDEBUG(733, *YYCURSOR);
+ if (yych == 'U') goto yy686;
+ if (yych != 'u') goto yy150;
+yy686:
+ YYDEBUG(686, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy734;
- if (yych != 'l') goto yy187;
-yy734:
- YYDEBUG(734, *YYCURSOR);
+ if (yych == 'L') goto yy687;
+ if (yych != 'l') goto yy150;
+yy687:
+ YYDEBUG(687, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy735;
- if (yych != 't') goto yy187;
-yy735:
- YYDEBUG(735, *YYCURSOR);
+ if (yych == 'T') goto yy688;
+ if (yych != 't') goto yy150;
+yy688:
+ YYDEBUG(688, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(736, *YYCURSOR);
+ YYDEBUG(689, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1145 "Zend/zend_language_scanner.l"
+#line 1121 "Zend/zend_language_scanner.l"
{
return T_DEFAULT;
}
-#line 6788 "Zend/zend_language_scanner.c"
-yy737:
- YYDEBUG(737, *YYCURSOR);
+#line 6280 "Zend/zend_language_scanner.c"
+yy690:
+ YYDEBUG(690, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy738;
- if (yych != 'a') goto yy187;
-yy738:
- YYDEBUG(738, *YYCURSOR);
+ if (yych == 'A') goto yy691;
+ if (yych != 'a') goto yy150;
+yy691:
+ YYDEBUG(691, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy739;
- if (yych != 'r') goto yy187;
-yy739:
- YYDEBUG(739, *YYCURSOR);
+ if (yych == 'R') goto yy692;
+ if (yych != 'r') goto yy150;
+yy692:
+ YYDEBUG(692, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy740;
- if (yych != 'e') goto yy187;
-yy740:
- YYDEBUG(740, *YYCURSOR);
+ if (yych == 'E') goto yy693;
+ if (yych != 'e') goto yy150;
+yy693:
+ YYDEBUG(693, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(741, *YYCURSOR);
+ YYDEBUG(694, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1117 "Zend/zend_language_scanner.l"
+#line 1093 "Zend/zend_language_scanner.l"
{
return T_DECLARE;
}
-#line 6816 "Zend/zend_language_scanner.c"
-yy742:
- YYDEBUG(742, *YYCURSOR);
+#line 6308 "Zend/zend_language_scanner.c"
+yy695:
+ YYDEBUG(695, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy804;
- if (yych == 'h') goto yy804;
- goto yy187;
-yy743:
- YYDEBUG(743, *YYCURSOR);
+ if (yych == 'H') goto yy757;
+ if (yych == 'h') goto yy757;
+ goto yy150;
+yy696:
+ YYDEBUG(696, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy798;
- if (yych == 's') goto yy798;
- goto yy187;
-yy744:
- YYDEBUG(744, *YYCURSOR);
+ if (yych == 'S') goto yy751;
+ if (yych == 's') goto yy751;
+ goto yy150;
+yy697:
+ YYDEBUG(697, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'P') goto yy794;
- if (yych == 'p') goto yy794;
- goto yy187;
-yy745:
- YYDEBUG(745, *YYCURSOR);
+ if (yych == 'P') goto yy747;
+ if (yych == 'p') goto yy747;
+ goto yy150;
+yy698:
+ YYDEBUG(698, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy760;
- if (yych == 'd') goto yy760;
- goto yy187;
-yy746:
- YYDEBUG(746, *YYCURSOR);
+ if (yych == 'D') goto yy713;
+ if (yych == 'd') goto yy713;
+ goto yy150;
+yy699:
+ YYDEBUG(699, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy757;
- if (yych == 'a') goto yy757;
- goto yy187;
-yy747:
- YYDEBUG(747, *YYCURSOR);
+ if (yych == 'A') goto yy710;
+ if (yych == 'a') goto yy710;
+ goto yy150;
+yy700:
+ YYDEBUG(700, *YYCURSOR);
yych = *++YYCURSOR;
if (yych <= 'T') {
- if (yych == 'I') goto yy748;
- if (yych <= 'S') goto yy187;
- goto yy749;
+ if (yych == 'I') goto yy701;
+ if (yych <= 'S') goto yy150;
+ goto yy702;
} else {
if (yych <= 'i') {
- if (yych <= 'h') goto yy187;
+ if (yych <= 'h') goto yy150;
} else {
- if (yych == 't') goto yy749;
- goto yy187;
+ if (yych == 't') goto yy702;
+ goto yy150;
}
}
-yy748:
- YYDEBUG(748, *YYCURSOR);
+yy701:
+ YYDEBUG(701, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy755;
- if (yych == 't') goto yy755;
- goto yy187;
-yy749:
- YYDEBUG(749, *YYCURSOR);
+ if (yych == 'T') goto yy708;
+ if (yych == 't') goto yy708;
+ goto yy150;
+yy702:
+ YYDEBUG(702, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy750;
- if (yych != 'e') goto yy187;
-yy750:
- YYDEBUG(750, *YYCURSOR);
+ if (yych == 'E') goto yy703;
+ if (yych != 'e') goto yy150;
+yy703:
+ YYDEBUG(703, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'N') goto yy751;
- if (yych != 'n') goto yy187;
-yy751:
- YYDEBUG(751, *YYCURSOR);
+ if (yych == 'N') goto yy704;
+ if (yych != 'n') goto yy150;
+yy704:
+ YYDEBUG(704, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'D') goto yy752;
- if (yych != 'd') goto yy187;
-yy752:
- YYDEBUG(752, *YYCURSOR);
+ if (yych == 'D') goto yy705;
+ if (yych != 'd') goto yy150;
+yy705:
+ YYDEBUG(705, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'S') goto yy753;
- if (yych != 's') goto yy187;
-yy753:
- YYDEBUG(753, *YYCURSOR);
+ if (yych == 'S') goto yy706;
+ if (yych != 's') goto yy150;
+yy706:
+ YYDEBUG(706, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(754, *YYCURSOR);
+ YYDEBUG(707, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1181 "Zend/zend_language_scanner.l"
+#line 1157 "Zend/zend_language_scanner.l"
{
return T_EXTENDS;
}
-#line 6900 "Zend/zend_language_scanner.c"
-yy755:
- YYDEBUG(755, *YYCURSOR);
+#line 6392 "Zend/zend_language_scanner.c"
+yy708:
+ YYDEBUG(708, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(756, *YYCURSOR);
+ YYDEBUG(709, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1033 "Zend/zend_language_scanner.l"
+#line 1009 "Zend/zend_language_scanner.l"
{
return T_EXIT;
}
-#line 6913 "Zend/zend_language_scanner.c"
-yy757:
- YYDEBUG(757, *YYCURSOR);
+#line 6405 "Zend/zend_language_scanner.c"
+yy710:
+ YYDEBUG(710, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy758;
- if (yych != 'l') goto yy187;
-yy758:
- YYDEBUG(758, *YYCURSOR);
+ if (yych == 'L') goto yy711;
+ if (yych != 'l') goto yy150;
+yy711:
+ YYDEBUG(711, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(759, *YYCURSOR);
+ YYDEBUG(712, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1268 "Zend/zend_language_scanner.l"
+#line 1247 "Zend/zend_language_scanner.l"
{
return T_EVAL;
}
-#line 6931 "Zend/zend_language_scanner.c"
-yy760:
- YYDEBUG(760, *YYCURSOR);
+#line 6423 "Zend/zend_language_scanner.c"
+yy713:
+ YYDEBUG(713, *YYCURSOR);
yych = *++YYCURSOR;
YYDEBUG(-1, yych);
switch (yych) {
case 'D':
- case 'd': goto yy761;
+ case 'd': goto yy714;
case 'F':
- case 'f': goto yy762;
+ case 'f': goto yy715;
case 'I':
- case 'i': goto yy763;
+ case 'i': goto yy716;
case 'S':
- case 's': goto yy764;
+ case 's': goto yy717;
case 'W':
- case 'w': goto yy765;
- default: goto yy187;
+ case 'w': goto yy718;
+ default: goto yy150;
}
-yy761:
- YYDEBUG(761, *YYCURSOR);
+yy714:
+ YYDEBUG(714, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy787;
- if (yych == 'e') goto yy787;
- goto yy187;
-yy762:
- YYDEBUG(762, *YYCURSOR);
+ if (yych == 'E') goto yy740;
+ if (yych == 'e') goto yy740;
+ goto yy150;
+yy715:
+ YYDEBUG(715, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy779;
- if (yych == 'o') goto yy779;
- goto yy187;
-yy763:
- YYDEBUG(763, *YYCURSOR);
+ if (yych == 'O') goto yy732;
+ if (yych == 'o') goto yy732;
+ goto yy150;
+yy716:
+ YYDEBUG(716, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy777;
- if (yych == 'f') goto yy777;
- goto yy187;
-yy764:
- YYDEBUG(764, *YYCURSOR);
+ if (yych == 'F') goto yy730;
+ if (yych == 'f') goto yy730;
+ goto yy150;
+yy717:
+ YYDEBUG(717, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'W') goto yy771;
- if (yych == 'w') goto yy771;
- goto yy187;
-yy765:
- YYDEBUG(765, *YYCURSOR);
+ if (yych == 'W') goto yy724;
+ if (yych == 'w') goto yy724;
+ goto yy150;
+yy718:
+ YYDEBUG(718, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy766;
- if (yych != 'h') goto yy187;
-yy766:
- YYDEBUG(766, *YYCURSOR);
+ if (yych == 'H') goto yy719;
+ if (yych != 'h') goto yy150;
+yy719:
+ YYDEBUG(719, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy767;
- if (yych != 'i') goto yy187;
-yy767:
- YYDEBUG(767, *YYCURSOR);
+ if (yych == 'I') goto yy720;
+ if (yych != 'i') goto yy150;
+yy720:
+ YYDEBUG(720, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy768;
- if (yych != 'l') goto yy187;
-yy768:
- YYDEBUG(768, *YYCURSOR);
+ if (yych == 'L') goto yy721;
+ if (yych != 'l') goto yy150;
+yy721:
+ YYDEBUG(721, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy769;
- if (yych != 'e') goto yy187;
-yy769:
- YYDEBUG(769, *YYCURSOR);
+ if (yych == 'E') goto yy722;
+ if (yych != 'e') goto yy150;
+yy722:
+ YYDEBUG(722, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(770, *YYCURSOR);
+ YYDEBUG(723, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1093 "Zend/zend_language_scanner.l"
+#line 1069 "Zend/zend_language_scanner.l"
{
return T_ENDWHILE;
}
-#line 7005 "Zend/zend_language_scanner.c"
-yy771:
- YYDEBUG(771, *YYCURSOR);
+#line 6497 "Zend/zend_language_scanner.c"
+yy724:
+ YYDEBUG(724, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'I') goto yy772;
- if (yych != 'i') goto yy187;
-yy772:
- YYDEBUG(772, *YYCURSOR);
+ if (yych == 'I') goto yy725;
+ if (yych != 'i') goto yy150;
+yy725:
+ YYDEBUG(725, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy773;
- if (yych != 't') goto yy187;
-yy773:
- YYDEBUG(773, *YYCURSOR);
+ if (yych == 'T') goto yy726;
+ if (yych != 't') goto yy150;
+yy726:
+ YYDEBUG(726, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy774;
- if (yych != 'c') goto yy187;
-yy774:
- YYDEBUG(774, *YYCURSOR);
+ if (yych == 'C') goto yy727;
+ if (yych != 'c') goto yy150;
+yy727:
+ YYDEBUG(727, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy775;
- if (yych != 'h') goto yy187;
-yy775:
- YYDEBUG(775, *YYCURSOR);
+ if (yych == 'H') goto yy728;
+ if (yych != 'h') goto yy150;
+yy728:
+ YYDEBUG(728, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(776, *YYCURSOR);
+ YYDEBUG(729, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1137 "Zend/zend_language_scanner.l"
+#line 1113 "Zend/zend_language_scanner.l"
{
return T_ENDSWITCH;
}
-#line 7038 "Zend/zend_language_scanner.c"
-yy777:
- YYDEBUG(777, *YYCURSOR);
+#line 6530 "Zend/zend_language_scanner.c"
+yy730:
+ YYDEBUG(730, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(778, *YYCURSOR);
+ YYDEBUG(731, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1081 "Zend/zend_language_scanner.l"
+#line 1057 "Zend/zend_language_scanner.l"
{
return T_ENDIF;
}
-#line 7051 "Zend/zend_language_scanner.c"
-yy779:
- YYDEBUG(779, *YYCURSOR);
+#line 6543 "Zend/zend_language_scanner.c"
+yy732:
+ YYDEBUG(732, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy780;
- if (yych != 'r') goto yy187;
-yy780:
- YYDEBUG(780, *YYCURSOR);
+ if (yych == 'R') goto yy733;
+ if (yych != 'r') goto yy150;
+yy733:
+ YYDEBUG(733, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy781;
- if (yych <= '9') goto yy186;
+ if (yych <= '/') goto yy734;
+ if (yych <= '9') goto yy149;
} else {
- if (yych == 'E') goto yy782;
- if (yych <= 'Z') goto yy186;
+ if (yych == 'E') goto yy735;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= 'd') {
- if (yych != '`') goto yy186;
+ if (yych != '`') goto yy149;
} else {
- if (yych <= 'e') goto yy782;
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'e') goto yy735;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy781:
- YYDEBUG(781, *YYCURSOR);
+yy734:
+ YYDEBUG(734, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1105 "Zend/zend_language_scanner.l"
+#line 1081 "Zend/zend_language_scanner.l"
{
return T_ENDFOR;
}
-#line 7084 "Zend/zend_language_scanner.c"
-yy782:
- YYDEBUG(782, *YYCURSOR);
+#line 6576 "Zend/zend_language_scanner.c"
+yy735:
+ YYDEBUG(735, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy783;
- if (yych != 'a') goto yy187;
-yy783:
- YYDEBUG(783, *YYCURSOR);
+ if (yych == 'A') goto yy736;
+ if (yych != 'a') goto yy150;
+yy736:
+ YYDEBUG(736, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy784;
- if (yych != 'c') goto yy187;
-yy784:
- YYDEBUG(784, *YYCURSOR);
+ if (yych == 'C') goto yy737;
+ if (yych != 'c') goto yy150;
+yy737:
+ YYDEBUG(737, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'H') goto yy785;
- if (yych != 'h') goto yy187;
-yy785:
- YYDEBUG(785, *YYCURSOR);
+ if (yych == 'H') goto yy738;
+ if (yych != 'h') goto yy150;
+yy738:
+ YYDEBUG(738, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(786, *YYCURSOR);
+ YYDEBUG(739, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1113 "Zend/zend_language_scanner.l"
+#line 1089 "Zend/zend_language_scanner.l"
{
return T_ENDFOREACH;
}
-#line 7112 "Zend/zend_language_scanner.c"
-yy787:
- YYDEBUG(787, *YYCURSOR);
+#line 6604 "Zend/zend_language_scanner.c"
+yy740:
+ YYDEBUG(740, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'C') goto yy788;
- if (yych != 'c') goto yy187;
-yy788:
- YYDEBUG(788, *YYCURSOR);
+ if (yych == 'C') goto yy741;
+ if (yych != 'c') goto yy150;
+yy741:
+ YYDEBUG(741, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'L') goto yy789;
- if (yych != 'l') goto yy187;
-yy789:
- YYDEBUG(789, *YYCURSOR);
+ if (yych == 'L') goto yy742;
+ if (yych != 'l') goto yy150;
+yy742:
+ YYDEBUG(742, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'A') goto yy790;
- if (yych != 'a') goto yy187;
-yy790:
- YYDEBUG(790, *YYCURSOR);
+ if (yych == 'A') goto yy743;
+ if (yych != 'a') goto yy150;
+yy743:
+ YYDEBUG(743, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'R') goto yy791;
- if (yych != 'r') goto yy187;
-yy791:
- YYDEBUG(791, *YYCURSOR);
+ if (yych == 'R') goto yy744;
+ if (yych != 'r') goto yy150;
+yy744:
+ YYDEBUG(744, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy792;
- if (yych != 'e') goto yy187;
-yy792:
- YYDEBUG(792, *YYCURSOR);
+ if (yych == 'E') goto yy745;
+ if (yych != 'e') goto yy150;
+yy745:
+ YYDEBUG(745, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(793, *YYCURSOR);
+ YYDEBUG(746, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1121 "Zend/zend_language_scanner.l"
+#line 1097 "Zend/zend_language_scanner.l"
{
return T_ENDDECLARE;
}
-#line 7150 "Zend/zend_language_scanner.c"
-yy794:
- YYDEBUG(794, *YYCURSOR);
+#line 6642 "Zend/zend_language_scanner.c"
+yy747:
+ YYDEBUG(747, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'T') goto yy795;
- if (yych != 't') goto yy187;
-yy795:
- YYDEBUG(795, *YYCURSOR);
+ if (yych == 'T') goto yy748;
+ if (yych != 't') goto yy150;
+yy748:
+ YYDEBUG(748, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'Y') goto yy796;
- if (yych != 'y') goto yy187;
-yy796:
- YYDEBUG(796, *YYCURSOR);
+ if (yych == 'Y') goto yy749;
+ if (yych != 'y') goto yy150;
+yy749:
+ YYDEBUG(749, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(797, *YYCURSOR);
+ YYDEBUG(750, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1308 "Zend/zend_language_scanner.l"
+#line 1287 "Zend/zend_language_scanner.l"
{
return T_EMPTY;
}
-#line 7173 "Zend/zend_language_scanner.c"
-yy798:
- YYDEBUG(798, *YYCURSOR);
+#line 6665 "Zend/zend_language_scanner.c"
+yy751:
+ YYDEBUG(751, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'E') goto yy799;
- if (yych != 'e') goto yy187;
-yy799:
- YYDEBUG(799, *YYCURSOR);
+ if (yych == 'E') goto yy752;
+ if (yych != 'e') goto yy150;
+yy752:
+ YYDEBUG(752, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '^') {
if (yych <= '@') {
- if (yych <= '/') goto yy800;
- if (yych <= '9') goto yy186;
+ if (yych <= '/') goto yy753;
+ if (yych <= '9') goto yy149;
} else {
- if (yych == 'I') goto yy801;
- if (yych <= 'Z') goto yy186;
+ if (yych == 'I') goto yy754;
+ if (yych <= 'Z') goto yy149;
}
} else {
if (yych <= 'h') {
- if (yych != '`') goto yy186;
+ if (yych != '`') goto yy149;
} else {
- if (yych <= 'i') goto yy801;
- if (yych <= 'z') goto yy186;
- if (yych >= 0x7F) goto yy186;
+ if (yych <= 'i') goto yy754;
+ if (yych <= 'z') goto yy149;
+ if (yych >= 0x7F) goto yy149;
}
}
-yy800:
- YYDEBUG(800, *YYCURSOR);
+yy753:
+ YYDEBUG(753, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1085 "Zend/zend_language_scanner.l"
+#line 1061 "Zend/zend_language_scanner.l"
{
return T_ELSE;
}
-#line 7206 "Zend/zend_language_scanner.c"
-yy801:
- YYDEBUG(801, *YYCURSOR);
+#line 6698 "Zend/zend_language_scanner.c"
+yy754:
+ YYDEBUG(754, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'F') goto yy802;
- if (yych != 'f') goto yy187;
-yy802:
- YYDEBUG(802, *YYCURSOR);
+ if (yych == 'F') goto yy755;
+ if (yych != 'f') goto yy150;
+yy755:
+ YYDEBUG(755, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(803, *YYCURSOR);
+ YYDEBUG(756, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1077 "Zend/zend_language_scanner.l"
+#line 1053 "Zend/zend_language_scanner.l"
{
return T_ELSEIF;
}
-#line 7224 "Zend/zend_language_scanner.c"
-yy804:
- YYDEBUG(804, *YYCURSOR);
+#line 6716 "Zend/zend_language_scanner.c"
+yy757:
+ YYDEBUG(757, *YYCURSOR);
yych = *++YYCURSOR;
- if (yych == 'O') goto yy805;
- if (yych != 'o') goto yy187;
-yy805:
- YYDEBUG(805, *YYCURSOR);
+ if (yych == 'O') goto yy758;
+ if (yych != 'o') goto yy150;
+yy758:
+ YYDEBUG(758, *YYCURSOR);
++YYCURSOR;
if (yybm[0+(yych = *YYCURSOR)] & 4) {
- goto yy186;
+ goto yy149;
}
- YYDEBUG(806, *YYCURSOR);
+ YYDEBUG(759, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1161 "Zend/zend_language_scanner.l"
+#line 1137 "Zend/zend_language_scanner.l"
{
return T_ECHO;
}
-#line 7242 "Zend/zend_language_scanner.c"
+#line 6734 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_LOOKING_FOR_PROPERTY:
@@ -7277,112 +6769,111 @@ yyc_ST_LOOKING_FOR_PROPERTY:
64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64,
};
- YYDEBUG(807, *YYCURSOR);
+ YYDEBUG(760, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '-') {
if (yych <= '\r') {
- if (yych <= 0x08) goto yy815;
- if (yych <= '\n') goto yy809;
- if (yych <= '\f') goto yy815;
+ if (yych <= 0x08) goto yy768;
+ if (yych <= '\n') goto yy762;
+ if (yych <= '\f') goto yy768;
} else {
- if (yych == ' ') goto yy809;
- if (yych <= ',') goto yy815;
- goto yy811;
+ if (yych == ' ') goto yy762;
+ if (yych <= ',') goto yy768;
+ goto yy764;
}
} else {
if (yych <= '_') {
- if (yych <= '@') goto yy815;
- if (yych <= 'Z') goto yy813;
- if (yych <= '^') goto yy815;
- goto yy813;
+ if (yych <= '@') goto yy768;
+ if (yych <= 'Z') goto yy766;
+ if (yych <= '^') goto yy768;
+ goto yy766;
} else {
- if (yych <= '`') goto yy815;
- if (yych <= 'z') goto yy813;
- if (yych <= '~') goto yy815;
- goto yy813;
+ if (yych <= '`') goto yy768;
+ if (yych <= 'z') goto yy766;
+ if (yych <= '~') goto yy768;
+ goto yy766;
}
}
-yy809:
- YYDEBUG(809, *YYCURSOR);
+yy762:
+ YYDEBUG(762, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy821;
-yy810:
- YYDEBUG(810, *YYCURSOR);
+ goto yy774;
+yy763:
+ YYDEBUG(763, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1194 "Zend/zend_language_scanner.l"
+#line 1170 "Zend/zend_language_scanner.l"
{
- DUMMY_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 7321 "Zend/zend_language_scanner.c"
-yy811:
- YYDEBUG(811, *YYCURSOR);
+#line 6812 "Zend/zend_language_scanner.c"
+yy764:
+ YYDEBUG(764, *YYCURSOR);
++YYCURSOR;
- if ((yych = *YYCURSOR) == '>') goto yy818;
-yy812:
- YYDEBUG(812, *YYCURSOR);
+ if ((yych = *YYCURSOR) == '>') goto yy771;
+yy765:
+ YYDEBUG(765, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1210 "Zend/zend_language_scanner.l"
+#line 1185 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
goto restart;
}
-#line 7335 "Zend/zend_language_scanner.c"
-yy813:
- YYDEBUG(813, *YYCURSOR);
+#line 6826 "Zend/zend_language_scanner.c"
+yy766:
+ YYDEBUG(766, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy817;
-yy814:
- YYDEBUG(814, *YYCURSOR);
+ goto yy770;
+yy767:
+ YYDEBUG(767, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1204 "Zend/zend_language_scanner.l"
+#line 1179 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
zend_copy_value(zendlval, yytext, yyleng);
return T_STRING;
}
-#line 7350 "Zend/zend_language_scanner.c"
-yy815:
- YYDEBUG(815, *YYCURSOR);
+#line 6841 "Zend/zend_language_scanner.c"
+yy768:
+ YYDEBUG(768, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy812;
-yy816:
- YYDEBUG(816, *YYCURSOR);
+ goto yy765;
+yy769:
+ YYDEBUG(769, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy817:
- YYDEBUG(817, *YYCURSOR);
+yy770:
+ YYDEBUG(770, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy816;
+ goto yy769;
}
- goto yy814;
-yy818:
- YYDEBUG(818, *YYCURSOR);
+ goto yy767;
+yy771:
+ YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(819, *YYCURSOR);
+ YYDEBUG(772, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1200 "Zend/zend_language_scanner.l"
+#line 1175 "Zend/zend_language_scanner.l"
{
return T_OBJECT_OPERATOR;
}
-#line 7375 "Zend/zend_language_scanner.c"
-yy820:
- YYDEBUG(820, *YYCURSOR);
+#line 6866 "Zend/zend_language_scanner.c"
+yy773:
+ YYDEBUG(773, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy821:
- YYDEBUG(821, *YYCURSOR);
+yy774:
+ YYDEBUG(774, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy820;
+ goto yy773;
}
- goto yy810;
+ goto yy763;
}
/* *********************************** */
yyc_ST_LOOKING_FOR_VARNAME:
@@ -7421,74 +6912,74 @@ yyc_ST_LOOKING_FOR_VARNAME:
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
};
- YYDEBUG(822, *YYCURSOR);
+ YYDEBUG(775, *YYCURSOR);
YYFILL(2);
yych = *YYCURSOR;
if (yych <= '_') {
- if (yych <= '@') goto yy826;
- if (yych <= 'Z') goto yy824;
- if (yych <= '^') goto yy826;
+ if (yych <= '@') goto yy779;
+ if (yych <= 'Z') goto yy777;
+ if (yych <= '^') goto yy779;
} else {
- if (yych <= '`') goto yy826;
- if (yych <= 'z') goto yy824;
- if (yych <= '~') goto yy826;
+ if (yych <= '`') goto yy779;
+ if (yych <= 'z') goto yy777;
+ if (yych <= '~') goto yy779;
}
-yy824:
- YYDEBUG(824, *YYCURSOR);
+yy777:
+ YYDEBUG(777, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= '_') {
if (yych <= '@') {
- if (yych <= '/') goto yy825;
- if (yych <= '9') goto yy828;
+ if (yych <= '/') goto yy778;
+ if (yych <= '9') goto yy781;
} else {
- if (yych <= '[') goto yy828;
- if (yych >= '_') goto yy828;
+ if (yych <= '[') goto yy781;
+ if (yych >= '_') goto yy781;
}
} else {
if (yych <= '|') {
- if (yych <= '`') goto yy825;
- if (yych <= 'z') goto yy828;
+ if (yych <= '`') goto yy778;
+ if (yych <= 'z') goto yy781;
} else {
- if (yych != '~') goto yy828;
+ if (yych != '~') goto yy781;
}
}
-yy825:
- YYDEBUG(825, *YYCURSOR);
+yy778:
+ YYDEBUG(778, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1507 "Zend/zend_language_scanner.l"
+#line 1486 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
goto restart;
}
-#line 7467 "Zend/zend_language_scanner.c"
-yy826:
- YYDEBUG(826, *YYCURSOR);
+#line 6958 "Zend/zend_language_scanner.c"
+yy779:
+ YYDEBUG(779, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy825;
-yy827:
- YYDEBUG(827, *YYCURSOR);
+ goto yy778;
+yy780:
+ YYDEBUG(780, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy828:
- YYDEBUG(828, *YYCURSOR);
+yy781:
+ YYDEBUG(781, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy827;
+ goto yy780;
}
- if (yych == '[') goto yy830;
- if (yych == '}') goto yy830;
- YYDEBUG(829, *YYCURSOR);
+ if (yych == '[') goto yy783;
+ if (yych == '}') goto yy783;
+ YYDEBUG(782, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy825;
-yy830:
- YYDEBUG(830, *YYCURSOR);
+ goto yy778;
+yy783:
+ YYDEBUG(783, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(831, *YYCURSOR);
+ YYDEBUG(784, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1498 "Zend/zend_language_scanner.l"
+#line 1477 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
zend_copy_value(zendlval, yytext, yyleng);
@@ -7496,18 +6987,18 @@ yy830:
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return T_STRING_VARNAME;
}
-#line 7500 "Zend/zend_language_scanner.c"
+#line 6991 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_NOWDOC:
- YYDEBUG(832, *YYCURSOR);
+ YYDEBUG(785, *YYCURSOR);
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(834, *YYCURSOR);
+ YYDEBUG(787, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(835, *YYCURSOR);
+ YYDEBUG(788, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2338 "Zend/zend_language_scanner.l"
+#line 2158 "Zend/zend_language_scanner.l"
{
int newline = 0;
@@ -7563,7 +7054,7 @@ nowdoc_scan_done:
HANDLE_NEWLINES(yytext, yyleng - newline);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 7567 "Zend/zend_language_scanner.c"
+#line 7058 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_VAR_OFFSET:
{
@@ -7601,158 +7092,159 @@ yyc_ST_VAR_OFFSET:
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
};
- YYDEBUG(836, *YYCURSOR);
+ YYDEBUG(789, *YYCURSOR);
YYFILL(3);
yych = *YYCURSOR;
if (yych <= '/') {
if (yych <= ' ') {
if (yych <= '\f') {
- if (yych <= 0x08) goto yy850;
- if (yych <= '\n') goto yy846;
- goto yy850;
+ if (yych <= 0x08) goto yy803;
+ if (yych <= '\n') goto yy799;
+ goto yy803;
} else {
- if (yych <= '\r') goto yy846;
- if (yych <= 0x1F) goto yy850;
- goto yy846;
+ if (yych <= '\r') goto yy799;
+ if (yych <= 0x1F) goto yy803;
+ goto yy799;
}
} else {
if (yych <= '$') {
- if (yych <= '"') goto yy845;
- if (yych <= '#') goto yy846;
- goto yy841;
+ if (yych <= '"') goto yy798;
+ if (yych <= '#') goto yy799;
+ goto yy794;
} else {
- if (yych == '\'') goto yy846;
- goto yy845;
+ if (yych == '\'') goto yy799;
+ goto yy798;
}
}
} else {
if (yych <= '\\') {
if (yych <= '@') {
- if (yych <= '0') goto yy838;
- if (yych <= '9') goto yy840;
- goto yy845;
+ if (yych <= '0') goto yy791;
+ if (yych <= '9') goto yy793;
+ goto yy798;
} else {
- if (yych <= 'Z') goto yy848;
- if (yych <= '[') goto yy845;
- goto yy846;
+ if (yych <= 'Z') goto yy801;
+ if (yych <= '[') goto yy798;
+ goto yy799;
}
} else {
if (yych <= '_') {
- if (yych <= ']') goto yy843;
- if (yych <= '^') goto yy845;
- goto yy848;
+ if (yych <= ']') goto yy796;
+ if (yych <= '^') goto yy798;
+ goto yy801;
} else {
- if (yych <= '`') goto yy845;
- if (yych <= 'z') goto yy848;
- if (yych <= '~') goto yy845;
- goto yy848;
+ if (yych <= '`') goto yy798;
+ if (yych <= 'z') goto yy801;
+ if (yych <= '~') goto yy798;
+ goto yy801;
}
}
}
-yy838:
- YYDEBUG(838, *YYCURSOR);
+yy791:
+ YYDEBUG(791, *YYCURSOR);
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'W') {
if (yych <= '9') {
- if (yych >= '0') goto yy862;
+ if (yych >= '0') goto yy815;
} else {
- if (yych == 'B') goto yy859;
+ if (yych == 'B') goto yy812;
}
} else {
if (yych <= 'b') {
- if (yych <= 'X') goto yy861;
- if (yych >= 'b') goto yy859;
+ if (yych <= 'X') goto yy814;
+ if (yych >= 'b') goto yy812;
} else {
- if (yych == 'x') goto yy861;
+ if (yych == 'x') goto yy814;
}
}
-yy839:
- YYDEBUG(839, *YYCURSOR);
+yy792:
+ YYDEBUG(792, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1578 "Zend/zend_language_scanner.l"
+#line 1557 "Zend/zend_language_scanner.l"
{ /* Offset could be treated as a long */
- if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1 || (yyleng == MAX_LENGTH_OF_ZEND_INT - 1 && strcmp(yytext, int_min_digits) < 0)) {
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10));
+ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 10));
} else {
ZVAL_STRINGL(zendlval, yytext, yyleng);
}
return T_NUM_STRING;
}
-#line 7683 "Zend/zend_language_scanner.c"
-yy840:
- YYDEBUG(840, *YYCURSOR);
+#line 7174 "Zend/zend_language_scanner.c"
+yy793:
+ YYDEBUG(793, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy858;
-yy841:
- YYDEBUG(841, *YYCURSOR);
+ goto yy811;
+yy794:
+ YYDEBUG(794, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) <= '_') {
- if (yych <= '@') goto yy842;
- if (yych <= 'Z') goto yy854;
- if (yych >= '_') goto yy854;
+ if (yych <= '@') goto yy795;
+ if (yych <= 'Z') goto yy807;
+ if (yych >= '_') goto yy807;
} else {
- if (yych <= '`') goto yy842;
- if (yych <= 'z') goto yy854;
- if (yych >= 0x7F) goto yy854;
+ if (yych <= '`') goto yy795;
+ if (yych <= 'z') goto yy807;
+ if (yych >= 0x7F) goto yy807;
}
-yy842:
- YYDEBUG(842, *YYCURSOR);
+yy795:
+ YYDEBUG(795, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1870 "Zend/zend_language_scanner.l"
+#line 1706 "Zend/zend_language_scanner.l"
{
/* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */
return yytext[0];
}
-#line 7708 "Zend/zend_language_scanner.c"
-yy843:
- YYDEBUG(843, *YYCURSOR);
+#line 7199 "Zend/zend_language_scanner.c"
+yy796:
+ YYDEBUG(796, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(844, *YYCURSOR);
+ YYDEBUG(797, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1865 "Zend/zend_language_scanner.l"
+#line 1701 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
return ']';
}
-#line 7719 "Zend/zend_language_scanner.c"
-yy845:
- YYDEBUG(845, *YYCURSOR);
+#line 7210 "Zend/zend_language_scanner.c"
+yy798:
+ YYDEBUG(798, *YYCURSOR);
yych = *++YYCURSOR;
- goto yy842;
-yy846:
- YYDEBUG(846, *YYCURSOR);
+ goto yy795;
+yy799:
+ YYDEBUG(799, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(847, *YYCURSOR);
+ YYDEBUG(800, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1875 "Zend/zend_language_scanner.l"
+#line 1711 "Zend/zend_language_scanner.l"
{
/* Invalid rule to return a more explicit parse error with proper line number */
yyless(0);
yy_pop_state(TSRMLS_C);
+ ZVAL_NULL(zendlval);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 7736 "Zend/zend_language_scanner.c"
-yy848:
- YYDEBUG(848, *YYCURSOR);
+#line 7228 "Zend/zend_language_scanner.c"
+yy801:
+ YYDEBUG(801, *YYCURSOR);
++YYCURSOR;
yych = *YYCURSOR;
- goto yy853;
-yy849:
- YYDEBUG(849, *YYCURSOR);
+ goto yy806;
+yy802:
+ YYDEBUG(802, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1882 "Zend/zend_language_scanner.l"
+#line 1719 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
return T_STRING;
}
-#line 7750 "Zend/zend_language_scanner.c"
-yy850:
- YYDEBUG(850, *YYCURSOR);
+#line 7242 "Zend/zend_language_scanner.c"
+yy803:
+ YYDEBUG(803, *YYCURSOR);
++YYCURSOR;
- YYDEBUG(851, *YYCURSOR);
+ YYDEBUG(804, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2395 "Zend/zend_language_scanner.l"
+#line 2215 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -7761,115 +7253,115 @@ yy850:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 7765 "Zend/zend_language_scanner.c"
-yy852:
- YYDEBUG(852, *YYCURSOR);
+#line 7257 "Zend/zend_language_scanner.c"
+yy805:
+ YYDEBUG(805, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy853:
- YYDEBUG(853, *YYCURSOR);
+yy806:
+ YYDEBUG(806, *YYCURSOR);
if (yybm[0+yych] & 16) {
- goto yy852;
+ goto yy805;
}
- goto yy849;
-yy854:
- YYDEBUG(854, *YYCURSOR);
+ goto yy802;
+yy807:
+ YYDEBUG(807, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(855, *YYCURSOR);
+ YYDEBUG(808, *YYCURSOR);
if (yych <= '^') {
if (yych <= '9') {
- if (yych >= '0') goto yy854;
+ if (yych >= '0') goto yy807;
} else {
- if (yych <= '@') goto yy856;
- if (yych <= 'Z') goto yy854;
+ if (yych <= '@') goto yy809;
+ if (yych <= 'Z') goto yy807;
}
} else {
if (yych <= '`') {
- if (yych <= '_') goto yy854;
+ if (yych <= '_') goto yy807;
} else {
- if (yych <= 'z') goto yy854;
- if (yych >= 0x7F) goto yy854;
+ if (yych <= 'z') goto yy807;
+ if (yych >= 0x7F) goto yy807;
}
}
-yy856:
- YYDEBUG(856, *YYCURSOR);
+yy809:
+ YYDEBUG(809, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1860 "Zend/zend_language_scanner.l"
+#line 1696 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
return T_VARIABLE;
}
-#line 7806 "Zend/zend_language_scanner.c"
-yy857:
- YYDEBUG(857, *YYCURSOR);
+#line 7298 "Zend/zend_language_scanner.c"
+yy810:
+ YYDEBUG(810, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
-yy858:
- YYDEBUG(858, *YYCURSOR);
+yy811:
+ YYDEBUG(811, *YYCURSOR);
if (yybm[0+yych] & 32) {
- goto yy857;
+ goto yy810;
}
- goto yy839;
-yy859:
- YYDEBUG(859, *YYCURSOR);
+ goto yy792;
+yy812:
+ YYDEBUG(812, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
- goto yy867;
+ goto yy820;
}
-yy860:
- YYDEBUG(860, *YYCURSOR);
+yy813:
+ YYDEBUG(813, *YYCURSOR);
YYCURSOR = YYMARKER;
- goto yy839;
-yy861:
- YYDEBUG(861, *YYCURSOR);
+ goto yy792;
+yy814:
+ YYDEBUG(814, *YYCURSOR);
yych = *++YYCURSOR;
if (yybm[0+yych] & 64) {
- goto yy865;
+ goto yy818;
}
- goto yy860;
-yy862:
- YYDEBUG(862, *YYCURSOR);
+ goto yy813;
+yy815:
+ YYDEBUG(815, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(863, *YYCURSOR);
- if (yych <= '/') goto yy864;
- if (yych <= '9') goto yy862;
-yy864:
- YYDEBUG(864, *YYCURSOR);
+ YYDEBUG(816, *YYCURSOR);
+ if (yych <= '/') goto yy817;
+ if (yych <= '9') goto yy815;
+yy817:
+ YYDEBUG(817, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1587 "Zend/zend_language_scanner.l"
+#line 1566 "Zend/zend_language_scanner.l"
{ /* Offset must be treated as a string */
ZVAL_STRINGL(zendlval, yytext, yyleng);
return T_NUM_STRING;
}
-#line 7851 "Zend/zend_language_scanner.c"
-yy865:
- YYDEBUG(865, *YYCURSOR);
+#line 7343 "Zend/zend_language_scanner.c"
+yy818:
+ YYDEBUG(818, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(866, *YYCURSOR);
+ YYDEBUG(819, *YYCURSOR);
if (yybm[0+yych] & 64) {
- goto yy865;
+ goto yy818;
}
- goto yy864;
-yy867:
- YYDEBUG(867, *YYCURSOR);
+ goto yy817;
+yy820:
+ YYDEBUG(820, *YYCURSOR);
++YYCURSOR;
YYFILL(1);
yych = *YYCURSOR;
- YYDEBUG(868, *YYCURSOR);
+ YYDEBUG(821, *YYCURSOR);
if (yybm[0+yych] & 128) {
- goto yy867;
+ goto yy820;
}
- goto yy864;
+ goto yy817;
}
}
-#line 2404 "Zend/zend_language_scanner.l"
+#line 2224 "Zend/zend_language_scanner.l"
}
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index b6cad8f217..572b8713cb 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -126,7 +126,7 @@ BEGIN_EXTERN_C()
static size_t encoding_filter_script_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
- assert(internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding));
+ ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length, internal_encoding, LANG_SCNG(script_encoding) TSRMLS_CC);
}
@@ -144,7 +144,7 @@ LANG_SCNG(script_encoding), zend_multibyte_encoding_utf8 TSRMLS_CC);
static size_t encoding_filter_intermediate_to_internal(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC)
{
const zend_encoding *internal_encoding = zend_multibyte_get_internal_encoding(TSRMLS_C);
- assert(internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding));
+ ZEND_ASSERT(internal_encoding);
return zend_multibyte_encoding_converter(to, to_length, from, from_length,
internal_encoding, zend_multibyte_encoding_utf8 TSRMLS_CC);
}
@@ -533,9 +533,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename;
}
- compiled_filename = STR_INIT(file_path, strlen(file_path), 0);
+ compiled_filename = zend_string_init(file_path, strlen(file_path), 0);
zend_set_compiled_filename(compiled_filename TSRMLS_CC);
- STR_RELEASE(compiled_filename);
+ zend_string_release(compiled_filename);
if (CG(start_lineno)) {
CG(zend_lineno) = CG(start_lineno);
@@ -556,19 +556,15 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
zend_lex_state original_lex_state;
zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval=NULL;
int compiler_result;
zend_bool compilation_successful=0;
- znode retval_znode;
+ zval retval_zv;
zend_bool original_in_compilation = CG(in_compilation);
- retval_znode.op_type = IS_CONST;
- ZVAL_INT(&retval_znode.u.constant, 1);
+ ZVAL_LONG(&retval_zv, 1);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- retval = op_array; /* success oriented */
-
if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
@@ -583,27 +579,31 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
CG(active_op_array) = op_array;
zend_stack_push(&CG(context_stack), (void *) &CG(context));
zend_init_compiler_context(TSRMLS_C);
+ CG(ast_arena) = zend_arena_create(1024 * 32);
compiler_result = zendparse(TSRMLS_C);
- zend_do_return(&retval_znode, 0 TSRMLS_CC);
- CG(in_compilation) = original_in_compilation;
if (compiler_result != 0) { /* parser error */
zend_bailout();
}
+ zend_compile_top_stmt(CG(ast) TSRMLS_CC);
+ zend_ast_destroy(CG(ast));
+ zend_arena_destroy(CG(ast_arena));
+ zend_do_end_compilation(TSRMLS_C);
+ zend_emit_final_return(&retval_zv TSRMLS_CC);
+ CG(in_compilation) = original_in_compilation;
compilation_successful=1;
}
- if (retval) {
- CG(active_op_array) = original_active_op_array;
- if (compilation_successful) {
- pass_two(op_array TSRMLS_CC);
- zend_release_labels(0 TSRMLS_CC);
- } else {
- efree(op_array);
- retval = NULL;
- }
+ CG(active_op_array) = original_active_op_array;
+ if (compilation_successful) {
+ pass_two(op_array TSRMLS_CC);
+ zend_release_labels(0 TSRMLS_CC);
+ } else {
+ efree_size(op_array, sizeof(zend_op_array));
+ op_array = NULL;
}
+
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
- return retval;
+ return op_array;
}
@@ -629,7 +629,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) {
if (!file_handle.opened_path) {
- file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRSIZE_P(filename));
+ file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
}
zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path));
@@ -653,8 +653,8 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
zend_string *new_compiled_filename;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
- old_len = Z_STRSIZE_P(str);
- Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0);
+ old_len = Z_STRLEN_P(str);
+ Z_STR_P(str) = zend_string_realloc(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1);
@@ -683,9 +683,9 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
yy_scan_buffer(buf, size TSRMLS_CC);
- new_compiled_filename = STR_INIT(filename, strlen(filename), 0);
+ new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
- STR_RELEASE(new_compiled_filename);
+ zend_string_release(new_compiled_filename);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
RESET_DOC_COMMENT();
@@ -718,63 +718,50 @@ ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D)
zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
{
zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval;
+ zend_op_array *op_array = NULL;
zval tmp;
- int compiler_result;
zend_bool original_in_compilation = CG(in_compilation);
- if (Z_STRSIZE_P(source_string)==0) {
- efree(op_array);
+ if (Z_STRLEN_P(source_string)==0) {
return NULL;
}
- CG(in_compilation) = 1;
-
ZVAL_DUP(&tmp, source_string);
convert_to_string(&tmp);
source_string = &tmp;
-
+
+ CG(in_compilation) = 1;
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
- if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC)==FAILURE) {
- efree(op_array);
- retval = NULL;
- } else {
- zend_bool orig_interactive = CG(interactive);
-
- CG(interactive) = 0;
- init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
- CG(interactive) = orig_interactive;
- CG(active_op_array) = op_array;
- zend_stack_push(&CG(context_stack), (void *) &CG(context));
- zend_init_compiler_context(TSRMLS_C);
+ if (zend_prepare_string_for_scanning(source_string, filename TSRMLS_CC) == SUCCESS) {
+ CG(ast) = NULL;
+ CG(ast_arena) = zend_arena_create(1024 * 32);
BEGIN(ST_IN_SCRIPTING);
- compiler_result = zendparse(TSRMLS_C);
- if (SCNG(script_filtered)) {
- efree(SCNG(script_filtered));
- SCNG(script_filtered) = NULL;
- }
-
- if (compiler_result != 0) {
- CG(active_op_array) = original_active_op_array;
- CG(unclean_shutdown)=1;
- destroy_op_array(op_array TSRMLS_CC);
- efree(op_array);
- retval = NULL;
- } else {
- zend_do_return(NULL, 0 TSRMLS_CC);
- CG(active_op_array) = original_active_op_array;
+ if (!zendparse(TSRMLS_C)) {
+ zend_op_array *original_active_op_array = CG(active_op_array);
+ op_array = emalloc(sizeof(zend_op_array));
+ init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
+ CG(active_op_array) = op_array;
+
+ zend_stack_push(&CG(context_stack), (void *) &CG(context));
+ zend_init_compiler_context(TSRMLS_C);
+ zend_compile_top_stmt(CG(ast) TSRMLS_CC);
+ zend_do_end_compilation(TSRMLS_C);
+ zend_emit_final_return(NULL TSRMLS_CC);
pass_two(op_array TSRMLS_CC);
zend_release_labels(0 TSRMLS_CC);
- retval = op_array;
+
+ CG(active_op_array) = original_active_op_array;
}
+
+ zend_ast_destroy(CG(ast));
+ zend_arena_destroy(CG(ast_arena));
}
+
zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
zval_dtor(&tmp);
CG(in_compilation) = original_in_compilation;
- return retval;
+ return op_array;
}
@@ -856,7 +843,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(yy_cursor) = new_yy_start + (SCNG(yy_cursor) - SCNG(yy_start));
SCNG(yy_marker) = new_yy_start + (SCNG(yy_marker) - SCNG(yy_start));
SCNG(yy_text) = new_yy_start + (SCNG(yy_text) - SCNG(yy_start));
- SCNG(yy_limit) = new_yy_start + (SCNG(yy_limit) - SCNG(yy_start));
+ SCNG(yy_limit) = new_yy_start + length;
SCNG(yy_start) = new_yy_start;
}
@@ -874,15 +861,6 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
ZVAL_STRINGL(zendlval, yytext, yyleng); \
}
-// TODO: some extensions might need content, but we don't copy it intentional ???
-#if 0
-# define DUMMY_STRINGL(zendlval, yytext, yyleng) \
- ZVAL_STRINGL(zendlval, yytext, yyleng)
-#else
-# define DUMMY_STRINGL(zendlval, yytext, yyleng) \
- ZVAL_EMPTY_STRING(zendlval)
-#endif
-
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
{
register char *s, *t;
@@ -892,7 +870,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
- end = s+Z_STRSIZE_P(zendlval);
+ end = s+Z_STRLEN_P(zendlval);
while (s<end) {
if (*s=='\\') {
s++;
@@ -904,23 +882,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
switch(*s) {
case 'n':
*t++ = '\n';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'r':
*t++ = '\r';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 't':
*t++ = '\t';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'f':
*t++ = '\f';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'v':
*t++ = '\v';
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'e':
#ifdef PHP_WIN32
@@ -928,7 +906,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
#else
*t++ = '\e';
#endif
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case '"':
case '`':
@@ -940,22 +918,22 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
case '\\':
case '$':
*t++ = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
case 'x':
case 'X':
if (ZEND_IS_HEX(*(s+1))) {
char hex_buf[3] = { 0, 0, 0 };
- Z_STRSIZE_P(zendlval)--; /* for the 'x' */
+ Z_STRLEN_P(zendlval)--; /* for the 'x' */
hex_buf[0] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_HEX(*(s+1))) {
hex_buf[1] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
}
- *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16);
+ *t++ = (char) ZEND_STRTOL(hex_buf, NULL, 16);
} else {
*t++ = '\\';
*t++ = *s;
@@ -967,16 +945,16 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
char octal_buf[4] = { 0, 0, 0, 0 };
octal_buf[0] = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) {
octal_buf[1] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) {
octal_buf[2] = *(++s);
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
}
}
- *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8);
+ *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8);
} else {
*t++ = '\\';
*t++ = *s;
@@ -998,9 +976,9 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
unsigned char *str;
// TODO: avoid realocation ???
s = Z_STRVAL_P(zendlval);
- SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
+ SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
zval_ptr_dtor(zendlval);
- ZVAL_STRINGL(zendlval, str, sz);
+ ZVAL_STRINGL(zendlval, (char *) str, sz);
efree(str);
}
}
@@ -1011,8 +989,6 @@ int lex_scan(zval *zendlval TSRMLS_DC)
restart:
SCNG(yy_text) = YYCURSOR;
-yymore_restart:
-
/*!re2c
re2c:yyfill:check = 0;
LNUM [0-9]+
@@ -1192,7 +1168,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
@@ -1225,6 +1200,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_ELLIPSIS;
}
+<ST_IN_SCRIPTING>"??" {
+ return T_COALESCE;
+}
+
<ST_IN_SCRIPTING>"new" {
return T_NEW;
}
@@ -1521,11 +1500,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
--len;
}
- if (len < SIZEOF_ZEND_INT * 8) {
+ if (len < SIZEOF_ZEND_LONG * 8) {
if (len == 0) {
- ZVAL_INT(zendlval, 0);
+ ZVAL_LONG(zendlval, 0);
} else {
- ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(bin, NULL, 2));
}
return T_LNUMBER;
} else {
@@ -1535,11 +1514,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>{LNUM} {
- if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0));
+ if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
} else {
errno = 0;
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0));
if (errno == ERANGE) { /* Overflow */
if (yytext[0] == '0') { /* octal overflow */
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL));
@@ -1562,11 +1541,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
len--;
}
- if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) {
+ if (len < SIZEOF_ZEND_LONG * 2 || (len == SIZEOF_ZEND_LONG * 2 && *hex <= '7')) {
if (len == 0) {
- ZVAL_INT(zendlval, 0);
+ ZVAL_LONG(zendlval, 0);
} else {
- ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16));
+ ZVAL_LONG(zendlval, ZEND_STRTOL(hex, NULL, 16));
}
return T_LNUMBER;
} else {
@@ -1576,8 +1555,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_VAR_OFFSET>[0]|([1-9][0-9]*) { /* Offset could be treated as a long */
- if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1 || (yyleng == MAX_LENGTH_OF_ZEND_INT - 1 && strcmp(yytext, int_min_digits) < 0)) {
- ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10));
+ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
+ ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 10));
} else {
ZVAL_STRINGL(zendlval, yytext, yyleng);
}
@@ -1595,171 +1574,45 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__CLASS__" {
- zend_class_entry *ce = CG(active_class_entry);
- if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- /* We create a special __CLASS__ constant that is going to be resolved
- at run-time */
- ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1);
- Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX;
- } else {
- if (ce && ce->name) {
- ZVAL_STR(zendlval, STR_COPY(ce->name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
- }
return T_CLASS_C;
}
<ST_IN_SCRIPTING>"__TRAIT__" {
- zend_class_entry *ce = CG(active_class_entry);
- if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- ZVAL_STR(zendlval, STR_COPY(ce->name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_TRAIT_C;
}
<ST_IN_SCRIPTING>"__FUNCTION__" {
- zend_op_array *op_array = CG(active_op_array);
- if (op_array && op_array->function_name) {
- ZVAL_STR(zendlval, STR_COPY(op_array->function_name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_FUNC_C;
}
<ST_IN_SCRIPTING>"__METHOD__" {
- if (CG(active_class_entry)) {
- int len = 0;
-
- if (CG(active_class_entry)->name) {
- len += CG(active_class_entry)->name->len;
- }
- if (CG(active_op_array) && CG(active_op_array)->function_name) {
- len += sizeof("::")-1;
- len += CG(active_op_array)->function_name->len;
- }
- ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0));
- len = 0;
- if (CG(active_class_entry)->name) {
- memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
- len += CG(active_class_entry)->name->len;
- }
- if (CG(active_op_array) && CG(active_op_array)->function_name) {
- memcpy(Z_STRVAL_P(zendlval) + len, "::", sizeof("::")-1);
- len += sizeof("::")-1;
- memcpy(Z_STRVAL_P(zendlval) + len, CG(active_op_array)->function_name->val, CG(active_op_array)->function_name->len);
- len += CG(active_op_array)->function_name->len;
- }
- Z_STRVAL_P(zendlval)[len] = 0;
- } else if (CG(active_op_array) && CG(active_op_array)->function_name) {
- ZVAL_STR(zendlval, STR_COPY(CG(active_op_array)->function_name));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_METHOD_C;
}
<ST_IN_SCRIPTING>"__LINE__" {
- ZVAL_INT(zendlval, CG(zend_lineno));
return T_LINE;
}
<ST_IN_SCRIPTING>"__FILE__" {
- zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
-
- if (!filename) {
- ZVAL_EMPTY_STRING(zendlval);
- } else {
- ZVAL_STR(zendlval, STR_COPY(filename));
- }
return T_FILE;
}
<ST_IN_SCRIPTING>"__DIR__" {
- zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
- zend_string *dirname;
-
- if (!filename) {
- filename = STR_EMPTY_ALLOC();
- }
-
- dirname = STR_INIT(filename->val, filename->len, 0);
- zend_dirname(dirname->val, dirname->len);
-
- if (strcmp(dirname->val, ".") == 0) {
- dirname = STR_REALLOC(dirname, MAXPATHLEN, 0);
-#if HAVE_GETCWD
- VCWD_GETCWD(dirname->val, MAXPATHLEN);
-#elif HAVE_GETWD
- VCWD_GETWD(dirname->val);
-#endif
- }
-
- dirname->len = strlen(dirname->val);
- ZVAL_STR(zendlval, dirname);
return T_DIR;
}
<ST_IN_SCRIPTING>"__NAMESPACE__" {
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- ZVAL_DUP(zendlval, &CG(current_namespace));
- } else {
- ZVAL_EMPTY_STRING(zendlval);
- }
return T_NS_C;
}
-<INITIAL>"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"'php'"){WHITESPACE}*">" {
- YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
-
- if (bracket != SCNG(yy_text)) {
- /* Handle previously scanned HTML, as possible <script> tags found are assumed to not be PHP's */
- YYCURSOR = bracket;
- goto inline_html;
- }
-
- HANDLE_NEWLINES(yytext, yyleng);
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
-}
-
-
-<INITIAL>"<%=" {
- if (CG(asp_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
- } else {
- goto inline_char_handler;
- }
-}
-
<INITIAL>"<?=" {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
}
-<INITIAL>"<%" {
- if (CG(asp_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- goto inline_char_handler;
- }
-}
-
-
<INITIAL>"<?php"([ \t]|{NEWLINE}) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
@@ -1768,7 +1621,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<?" {
if (CG(short_tags)) {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
@@ -1788,35 +1640,19 @@ inline_char_handler:
YYCURSOR = ptr ? ptr + 1 : YYLIMIT;
- if (YYCURSOR < YYLIMIT) {
- switch (*YYCURSOR) {
- case '?':
- if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
- break;
- }
- continue;
- case '%':
- if (CG(asp_tags)) {
- break;
- }
- continue;
- case 's':
- case 'S':
- /* Probably NOT an opening PHP <script> tag, so don't end the HTML chunk yet
- * If it is, the PHP <script> tag rule checks for any HTML scanned before it */
- YYCURSOR--;
- yymore();
- default:
- continue;
- }
-
- YYCURSOR--;
+ if (YYCURSOR >= YYLIMIT) {
+ break;
}
- break;
+ if (*YYCURSOR == '?') {
+ if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
+
+ YYCURSOR--;
+ break;
+ }
+ }
}
-inline_html:
yyleng = YYCURSOR - SCNG(yy_text);
if (SCNG(output_filter)) {
@@ -1876,6 +1712,7 @@ inline_html:
/* Invalid rule to return a more explicit parse error with proper line number */
yyless(0);
yy_pop_state(TSRMLS_C);
+ ZVAL_NULL(zendlval);
return T_ENCAPSED_AND_WHITESPACE;
}
@@ -1896,11 +1733,6 @@ inline_html:
case '\n':
CG(zend_lineno)++;
break;
- case '%':
- if (!CG(asp_tags)) {
- continue;
- }
- /* fall through */
case '?':
if (*YYCURSOR == '>') {
YYCURSOR--;
@@ -1945,32 +1777,19 @@ inline_html:
HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) {
- CG(doc_comment) = STR_INIT(yytext, yyleng, 0);
+ CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
return T_DOC_COMMENT;
}
return T_COMMENT;
}
-<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
- DUMMY_STRINGL(zendlval, yytext, yyleng);
+<ST_IN_SCRIPTING>"?>"{NEWLINE}? {
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
}
-<ST_IN_SCRIPTING>"%>"{NEWLINE}? {
- if (CG(asp_tags)) {
- BEGIN(INITIAL);
- DUMMY_STRINGL(zendlval, yytext, yyleng);
- return T_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- yyless(1);
- return yytext[0];
- }
-}
-
-
<ST_IN_SCRIPTING>b?['] {
register char *s, *t;
char *end;
@@ -1992,6 +1811,7 @@ inline_html:
/* Unclosed single quotes; treat similar to double quotes, but without a separate token
* for ' (unrecognized by parser), instead of old flex fallback to "Unexpected character..."
* rule, which continued in ST_IN_SCRIPTING state after the quote */
+ ZVAL_NULL(zendlval);
return T_ENCAPSED_AND_WHITESPACE;
}
}
@@ -2000,7 +1820,7 @@ inline_html:
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
- end = s+Z_STRSIZE_P(zendlval);
+ end = s+Z_STRLEN_P(zendlval);
while (s<end) {
if (*s=='\\') {
s++;
@@ -2009,7 +1829,7 @@ inline_html:
case '\\':
case '\'':
*t++ = *s;
- Z_STRSIZE_P(zendlval)--;
+ Z_STRLEN_P(zendlval)--;
break;
default:
*t++ = '\\';
@@ -2032,7 +1852,7 @@ inline_html:
char *str = NULL;
s = Z_STRVAL_P(zendlval);
// TODO: avoid reallocation ???
- SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC);
+ SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC);
ZVAL_STRINGL(zendlval, str, sz);
efree(s);
}
@@ -2151,7 +1971,7 @@ inline_html:
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
- Z_IVAL_P(zendlval) = (zend_int_t) '{';
+ Z_LVAL_P(zendlval) = (zend_long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index bb340ae490..d8141f8664 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -169,7 +169,7 @@ void list_entry_destructor(zval *zv)
zend_resource_dtor(res TSRMLS_CC);
}
- efree(res);
+ efree_size(res, sizeof(zend_resource));
}
void plist_entry_destructor(zval *zv)
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
index ad74bd56cb..0fb49abf5b 100644
--- a/Zend/zend_llist.c
+++ b/Zend/zend_llist.c
@@ -126,32 +126,26 @@ ZEND_API void zend_llist_clean(zend_llist *l)
}
-ZEND_API void *zend_llist_remove_tail(zend_llist *l)
+ZEND_API void zend_llist_remove_tail(zend_llist *l)
{
- zend_llist_element *old_tail;
- void *data;
-
- if ((old_tail = l->tail)) {
- if (old_tail->prev) {
- old_tail->prev->next = NULL;
- } else {
- l->head = NULL;
- }
-
- data = old_tail->data;
-
- l->tail = old_tail->prev;
- if (l->dtor) {
- l->dtor(data);
- }
- pefree(old_tail, l->persistent);
-
- --l->count;
+ zend_llist_element *old_tail = l->tail;
+ if (!old_tail) {
+ return;
+ }
- return data;
+ if (old_tail->prev) {
+ old_tail->prev->next = NULL;
+ } else {
+ l->head = NULL;
}
- return NULL;
+ l->tail = old_tail->prev;
+ --l->count;
+
+ if (l->dtor) {
+ l->dtor(old_tail->data);
+ }
+ pefree(old_tail, l->persistent);
}
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
index b05ece8077..602884c27d 100644
--- a/Zend/zend_llist.h
+++ b/Zend/zend_llist.h
@@ -53,7 +53,7 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
ZEND_API void zend_llist_destroy(zend_llist *l);
ZEND_API void zend_llist_clean(zend_llist *l);
-ZEND_API void *zend_llist_remove_tail(zend_llist *l);
+ZEND_API void zend_llist_remove_tail(zend_llist *l);
ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
diff --git a/Zend/zend_long.h b/Zend/zend_long.h
new file mode 100644
index 0000000000..0fcc3116ae
--- /dev/null
+++ b/Zend/zend_long.h
@@ -0,0 +1,133 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Anatol Belski <ab@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+
+#ifndef ZEND_LONG_H
+#define ZEND_LONG_H
+
+#include "main/php_stdint.h"
+
+/* This is the heart of the whole int64 enablement in zval. */
+#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
+# define ZEND_ENABLE_ZVAL_LONG64 1
+#endif
+
+/* Integer types. */
+#ifdef ZEND_ENABLE_ZVAL_LONG64
+typedef int64_t zend_long;
+typedef uint64_t zend_ulong;
+typedef int64_t zend_off_t;
+# define ZEND_LONG_MAX INT64_MAX
+# define ZEND_LONG_MIN INT64_MIN
+# define ZEND_ULONG_MAX UINT64_MAX
+# ifdef _WIN64
+# define Z_L(i) i##i64
+# define Z_UL(i) i##Ui64
+# else
+# define Z_L(i) i##LL
+# define Z_UL(i) i##ULL
+# endif
+# define SIZEOF_ZEND_LONG 8
+#else
+typedef int32_t zend_long;
+typedef uint32_t zend_ulong;
+typedef int32_t zend_off_t;
+# define ZEND_LONG_MAX INT32_MAX
+# define ZEND_LONG_MIN INT32_MIN
+# define ZEND_ULONG_MAX UINT32_MAX
+# define Z_L(i) INT32_C(i)
+# define Z_UL(i) UINT32_C(i)
+# define SIZEOF_ZEND_LONG 4
+#endif
+
+
+/* Conversion macros. */
+#define ZEND_LTOA_BUF_LEN 65
+
+#ifdef ZEND_ENABLE_ZVAL_LONG64
+# define ZEND_LONG_FMT "%" PRId64
+# define ZEND_ULONG_FMT "%" PRIu64
+# define ZEND_LONG_FMT_SPEC PRId64
+# define ZEND_ULONG_FMT_SPEC PRIu64
+# ifdef PHP_WIN32
+# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10)
+# define ZEND_ATOL(i, s) i = _atoi64((s))
+# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base))
+# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base))
+# define ZEND_STRTOL_PTR _strtoi64
+# define ZEND_STRTOUL_PTR _strtoui64
+# define ZEND_ABS _abs64
+# else
+# define ZEND_LTOA(i, s, len) \
+ do { \
+ int st = snprintf((s), (len), ZEND_LONG_FMT, (i)); \
+ (s)[st] = '\0'; \
+ } while (0)
+# define ZEND_ATOL(i, s) (i) = atoll((s))
+# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base))
+# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base))
+# define ZEND_STRTOL_PTR strtoll
+# define ZEND_STRTOUL_PTR strtoull
+# define ZEND_ABS imaxabs
+# endif
+#else
+# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base))
+# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base))
+# define ZEND_LONG_FMT "%" PRId32
+# define ZEND_ULONG_FMT "%" PRIu32
+# define ZEND_LONG_FMT_SPEC PRId32
+# define ZEND_ULONG_FMT_SPEC PRIu32
+# ifdef PHP_WIN32
+# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10)
+# define ZEND_ATOL(i, s) i = atol((s))
+# else
+# define ZEND_LTOA(i, s, len) \
+ do { \
+ int st = snprintf((s), (len), ZEND_LONG_FMT, (i)); \
+ (s)[st] = '\0'; \
+ } while (0)
+# define ZEND_ATOL(i, s) (i) = atol((s))
+# endif
+# define ZEND_STRTOL_PTR strtol
+# define ZEND_STRTOUL_PTR strtoul
+# define ZEND_ABS abs
+#endif
+
+#if SIZEOF_ZEND_LONG == 4
+# define MAX_LENGTH_OF_LONG 11
+# define LONG_MIN_DIGITS "2147483648"
+#elif SIZEOF_ZEND_LONG == 8
+# define MAX_LENGTH_OF_LONG 20
+# define LONG_MIN_DIGITS "9223372036854775808"
+#else
+# error "Unknown SIZEOF_ZEND_LONG"
+#endif
+
+static const char long_min_digits[] = LONG_MIN_DIGITS;
+
+#endif /* ZEND_LONG_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
index 7f1c6c18ec..6dce8fb6ac 100644
--- a/Zend/zend_multiply.h
+++ b/Zend/zend_multiply.h
@@ -19,10 +19,13 @@
/* $Id$ */
+#ifndef ZEND_MULTIPLY_H
+#define ZEND_MULTIPLY_H
+
#if defined(__i386__) && defined(__GNUC__)
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_int_t __tmpvar; \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long __tmpvar; \
__asm__ ("imul %3,%0\n" \
"adc $0,%1" \
: "=r"(__tmpvar),"=r"(usedval) \
@@ -33,8 +36,8 @@
#elif defined(__x86_64__) && defined(__GNUC__)
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_int_t __tmpvar; \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long __tmpvar; \
__asm__ ("imul %3,%0\n" \
"adc $0,%1" \
: "=r"(__tmpvar),"=r"(usedval) \
@@ -45,8 +48,8 @@
#elif defined(__arm__) && defined(__GNUC__)
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_int_t __tmpvar; \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long __tmpvar; \
__asm__("smull %0, %1, %2, %3\n" \
"sub %1, %1, %0, asr #31" \
: "=r"(__tmpvar), "=r"(usedval) \
@@ -57,8 +60,8 @@
#elif defined(__aarch64__) && defined(__GNUC__)
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_int_t __tmpvar; \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long __tmpvar; \
__asm__("mul %0, %2, %3\n" \
"smulh %1, %2, %3\n" \
"sub %1, %1, %0, asr #63\n" \
@@ -70,8 +73,8 @@
#elif defined(ZEND_WIN32)
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_int_t __lres = (a) * (b); \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ zend_long __lres = (a) * (b); \
long double __dres = (long double)(a) * (long double)(b); \
long double __delta = (long double) __lres - __dres; \
if ( ((usedval) = (( __dres + __delta ) != __dres))) { \
@@ -81,11 +84,11 @@
} \
} while (0)
-#elif SIZEOF_ZEND_INT == 4 && defined(HAVE_ZEND_LONG64)
+#elif SIZEOF_ZEND_LONG == 4
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
- zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \
- if (__result > ZEND_INT_MAX || __result < ZEND_INT_MIN) { \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ int64_t __result = (int64_t) (a) * (int64_t) (b); \
+ if (__result > ZEND_LONG_MAX || __result < ZEND_LONG_MIN) { \
(dval) = (double) __result; \
(usedval) = 1; \
} else { \
@@ -96,7 +99,7 @@
#else
-#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
long __lres = (a) * (b); \
long double __dres = (long double)(a) * (long double)(b); \
long double __delta = (long double) __lres - __dres; \
@@ -108,3 +111,138 @@
} while (0)
#endif
+
+#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ size_t res = nmemb;
+ size_t m_overflow = 0;
+
+ __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1"
+ : "=&a"(res), "=&d" (m_overflow)
+ : "%0"(res),
+ "rm"(size),
+ "rm"(offset));
+
+ if (UNEXPECTED(m_overflow)) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return res;
+}
+
+#elif defined(__GNUC__) && defined(__x86_64__)
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ size_t res = nmemb;
+ zend_ulong m_overflow = 0;
+
+#ifdef __ILP32__ /* x32 */
+# define LP_SUFF "l"
+#else /* amd64 */
+# define LP_SUFF "q"
+#endif
+
+ __asm__ ("mul" LP_SUFF " %3\n\t"
+ "add %4,%0\n\t"
+ "adc $0,%1"
+ : "=&a"(res), "=&d" (m_overflow)
+ : "%0"(res),
+ "rm"(size),
+ "rm"(offset));
+
+#undef LP_SUFF
+ if (UNEXPECTED(m_overflow)) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return res;
+}
+
+#elif defined(__GNUC__) && defined(__arm__)
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ size_t res;
+ zend_ulong m_overflow;
+
+ __asm__ ("umlal %0,%1,%2,%3"
+ : "=r"(res), "=r"(m_overflow)
+ : "r"(nmemb),
+ "r"(size),
+ "0"(offset),
+ "1"(0));
+
+ if (UNEXPECTED(m_overflow)) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return res;
+}
+
+#elif defined(__GNUC__) && defined(__aarch64__)
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ size_t res;
+ zend_ulong m_overflow;
+
+ __asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr"
+ : "=&r"(res), "=&r"(m_overflow)
+ : "r"(nmemb),
+ "r"(size),
+ "r"(offset));
+
+ if (UNEXPECTED(m_overflow)) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return res;
+}
+
+#elif SIZEOF_SIZE_T == 4
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ uint64_t res = (uint64_t) nmemb * (uint64_t) size + (uint64_t) offset;
+
+ if (UNEXPECTED(res > UINT64_C(0xFFFFFFFF))) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return (size_t) res;
+}
+
+#else
+
+static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
+{
+ size_t res = nmemb * size + offset;
+ double _d = (double)nmemb * (double)size + (double)offset;
+ double _delta = (double)res - _d;
+
+ if (UNEXPECTED((_d + _delta ) != _d)) {
+ *overflow = 1;
+ return 0;
+ }
+ *overflow = 0;
+ return res;
+}
+#endif
+
+#endif /* ZEND_MULTIPLY_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index a0ff59b292..6679cb1e46 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -159,7 +159,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC
*is_temp = 1;
ALLOC_HASHTABLE(ht);
*ht = *Z_ARRVAL(retval);
- efree(Z_ARR(retval));
+ efree_size(Z_ARR(retval), sizeof(zend_array));
return ht;
} else {
*is_temp = 0;
@@ -385,9 +385,9 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
}
/* }}} */
-ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */
+ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
{
- return zend_get_property_info_quick(ce, Z_STR_P(member), silent, NULL TSRMLS_CC);
+ return zend_get_property_info_quick(ce, member, silent, NULL TSRMLS_CC);
}
/* }}} */
@@ -397,16 +397,16 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
const char *class_name = NULL;
const char *prop_name;
zend_string *member;
- int prop_name_len;
+ size_t prop_name_len;
if (prop_info_name->val[0] == 0) {
- zend_unmangle_property_name_ex(prop_info_name->val, prop_info_name->len, &class_name, &prop_name, &prop_name_len);
- member = STR_INIT(prop_name, prop_name_len, 0);
+ zend_unmangle_property_name_ex(prop_info_name, &class_name, &prop_name, &prop_name_len);
+ member = zend_string_init(prop_name, prop_name_len, 0);
} else {
- member = STR_COPY(prop_info_name);
+ member = zend_string_copy(prop_info_name);
}
property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC);
- STR_RELEASE(member);
+ zend_string_release(member);
if (!property_info) {
return FAILURE;
}
@@ -423,7 +423,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
}
/* }}} */
-static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */
+static zend_long *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */
{
zend_property_info info;
zval stub, *guard;
@@ -434,10 +434,12 @@ static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info
info.name = Z_STR_P(member);
} else if(property_info->name->val[0] == '\0'){
const char *class_name = NULL, *prop_name = NULL;
- zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name);
+ size_t prop_name_len;
+ zend_unmangle_property_name_ex(property_info->name, &class_name,
+ &prop_name, &prop_name_len);
if (class_name) {
/* use unmangled name for protected properties */
- str = info.name = STR_INIT(prop_name, strlen(prop_name), 0);
+ str = info.name = zend_string_init(prop_name, prop_name_len, 0);
property_info = &info;
}
}
@@ -446,17 +448,17 @@ static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info
zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
} else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) {
if (str) {
- STR_RELEASE(str);
+ zend_string_release(str);
}
- return &Z_IVAL_P(guard);
+ return &Z_LVAL_P(guard);
}
- ZVAL_INT(&stub, 0);
+ ZVAL_LONG(&stub, 0);
guard = zend_hash_add_new(zobj->guards, property_info->name, &stub);
if (str) {
- STR_RELEASE(str);
+ zend_string_release(str);
}
- return &Z_IVAL_P(guard);
+ return &Z_LVAL_P(guard);
}
/* }}} */
@@ -473,8 +475,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_DUP(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -501,7 +502,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
/* magic get */
if (zobj->ce->__get) {
- zend_int_t *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, property_info, member);
if (!((*guard) & IN_GET)) {
zval tmp_object;
@@ -526,7 +527,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
zval_ptr_dtor(&tmp_object);
} else {
if (Z_STRVAL_P(member)[0] == '\0') {
- if (Z_STRSIZE_P(member) == 0) {
+ if (Z_STRLEN_P(member) == 0) {
zend_error(E_ERROR, "Cannot access empty property");
} else {
zend_error(E_ERROR, "Cannot access property started with '\\0'");
@@ -565,8 +566,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_DUP(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -635,7 +635,7 @@ found:
/* magic set */
if (zobj->ce->__set) {
- zend_int_t *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, property_info, member);
if (!((*guard) & IN_SET)) {
zval tmp_object;
@@ -651,7 +651,7 @@ found:
goto write_std_property;
} else {
if (Z_STRVAL_P(member)[0] == '\0') {
- if (Z_STRSIZE_P(member) == 0) {
+ if (Z_STRLEN_P(member) == 0) {
zend_error(E_ERROR, "Cannot access empty property");
} else {
zend_error(E_ERROR, "Cannot access property started with '\\0'");
@@ -659,12 +659,12 @@ found:
}
}
} else if (EXPECTED(property_info != NULL)) {
+ zval tmp;
+
write_std_property:
- /* if we assign referenced variable, we should separate it */
if (Z_REFCOUNTED_P(value)) {
if (Z_ISREF_P(value)) {
- zval tmp;
-
+ /* if we assign referenced variable, we should separate it */
ZVAL_DUP(&tmp, Z_REFVAL_P(value));
value = &tmp;
} else {
@@ -778,14 +778,13 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
zval tmp_member;
zval *retval, tmp;
zend_property_info *property_info;
- zend_int_t *guard;
+ zend_long *guard;
zobj = Z_OBJ_P(object);
ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_DUP(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -813,10 +812,6 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
(guard = zend_get_property_guard(zobj, property_info, member)) == NULL ||
(property_info && ((*guard) & IN_GET))) {
- /* we don't have access controls - will just add it */
- if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
- }
ZVAL_NULL(&tmp);
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
property_info->offset >= 0) {
@@ -828,6 +823,12 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
}
retval = zend_hash_update(zobj->properties, property_info->name, &tmp);
}
+
+ /* Notice is thrown after creation of the property, to avoid EG(std_property_info)
+ * being overwritten in an error handler. */
+ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
+ zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
+ }
} else {
/* we do have getter - fail and let it try again with usual get/set */
retval = NULL;
@@ -851,8 +852,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_DUP(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -875,7 +875,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
/* magic unset */
if (zobj->ce->__unset) {
- zend_int_t *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, property_info, member);
if (!((*guard) & IN_UNSET)) {
zval tmp_object;
@@ -887,7 +887,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
zval_ptr_dtor(&tmp_object);
} else {
if (Z_STRVAL_P(member)[0] == '\0') {
- if (Z_STRSIZE_P(member) == 0) {
+ if (Z_STRLEN_P(member) == 0) {
zend_error(E_ERROR, "Cannot access empty property");
} else {
zend_error(E_ERROR, "Cannot access property started with '\\0'");
@@ -919,7 +919,7 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
- zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->func;
+ zend_internal_function *func = (zend_internal_function *)EX(func);
zval method_name, method_args;
zval method_result;
zend_class_entry *ce = Z_OBJCE_P(getThis());
@@ -951,7 +951,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
zval_ptr_dtor(&method_name);
/* destruct the function also, then - we have allocated it in get_method */
- efree(func);
+ efree_size(func, sizeof(zend_internal_function));
}
/* }}} */
@@ -1046,9 +1046,9 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry
//??? keep compatibility for "\0" characters
//??? see: Zend/tests/bug46238.phpt
if (UNEXPECTED(strlen(method_name->val) != method_name->len)) {
- call_user_call->function_name = STR_INIT(method_name->val, strlen(method_name->val), 0);
+ call_user_call->function_name = zend_string_init(method_name->val, strlen(method_name->val), 0);
} else {
- call_user_call->function_name = STR_COPY(method_name);
+ call_user_call->function_name = zend_string_copy(method_name);
}
return (union _zend_function *)call_user_call;
@@ -1089,7 +1089,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
/* Ensure that if we're calling a private function, we're allowed to do so.
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/
- updated_fbc = zend_check_private_int(fbc, zobj->handlers->get_class_entry(zobj TSRMLS_CC), lc_method_name TSRMLS_CC);
+ updated_fbc = zend_check_private_int(fbc, zobj->ce, lc_method_name TSRMLS_CC);
if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
@@ -1137,7 +1137,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
- zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->func;
+ zend_internal_function *func = (zend_internal_function *)EX(func);
zval method_name, method_args;
zval method_result;
zend_class_entry *ce = EG(scope);
@@ -1168,7 +1168,7 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{
zval_ptr_dtor(&method_name);
/* destruct the function also, then - we have allocated it in get_method */
- efree(func);
+ efree_size(func, sizeof(zend_internal_function));
}
/* }}} */
@@ -1185,9 +1185,9 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
//??? keep compatibility for "\0" characters
//??? see: Zend/tests/bug46238.phpt
if (UNEXPECTED(strlen(method_name->val) != method_name->len)) {
- callstatic_user_call->function_name = STR_INIT(method_name->val, strlen(method_name->val), 0);
+ callstatic_user_call->function_name = zend_string_init(method_name->val, strlen(method_name->val), 0);
} else {
- callstatic_user_call->function_name = STR_COPY(method_name);
+ callstatic_user_call->function_name = zend_string_copy(method_name);
}
return (zend_function *)callstatic_user_call;
@@ -1205,7 +1205,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
if (EXPECTED(key != NULL)) {
lc_function_name = Z_STR_P(key);
} else {
- lc_function_name = STR_ALLOC(function_name->len, 0);
+ lc_function_name = zend_string_alloc(function_name->len, 0);
zend_str_tolower_copy(lc_function_name->val, function_name->val, function_name->len);
}
@@ -1226,12 +1226,11 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
fbc = Z_FUNC_P(func);
} else {
if (UNEXPECTED(!key)) {
- STR_FREE(lc_function_name);
+ zend_string_free(lc_function_name);
}
if (ce->__call &&
- Z_OBJ(EG(This)) &&
- Z_OBJ_HT(EG(This))->get_class_entry &&
- instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
+ Z_OBJ(EG(current_execute_data)->This) &&
+ instanceof_function(Z_OBJCE(EG(current_execute_data)->This), ce TSRMLS_CC)) {
return zend_get_user_call_function(ce, function_name);
} else if (ce->__callstatic) {
return zend_get_user_callstatic_function(ce, function_name);
@@ -1278,7 +1277,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
if (UNEXPECTED(!key)) {
- STR_FREE(lc_function_name);
+ zend_string_free(lc_function_name);
}
return fbc;
@@ -1404,10 +1403,10 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
Z_OBJ_UNPROTECT_RECURSION(o2);
return 1;
}
- if (Z_IVAL(result) != 0) {
+ if (Z_LVAL(result) != 0) {
Z_OBJ_UNPROTECT_RECURSION(o1);
Z_OBJ_UNPROTECT_RECURSION(o2);
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
} else {
Z_OBJ_UNPROTECT_RECURSION(o1);
@@ -1449,8 +1448,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_DUP(&tmp_member, member);
- convert_to_string(&tmp_member);
+ ZVAL_STR(&tmp_member, zval_get_string(member));
member = &tmp_member;
cache_slot = NULL;
}
@@ -1485,7 +1483,7 @@ found:
result = 0;
if ((has_set_exists != 2) && zobj->ce->__isset) {
- zend_int_t *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, property_info, member);
if (!((*guard) & IN_ISSET)) {
zval rv;
@@ -1527,26 +1525,9 @@ exit:
}
/* }}} */
-zend_class_entry *zend_std_object_get_class(const zend_object *object TSRMLS_DC) /* {{{ */
-{
- return object->ce;
-}
-/* }}} */
-
-zend_string* zend_std_object_get_class_name(const zend_object *zobj, int parent TSRMLS_DC) /* {{{ */
+zend_string *zend_std_object_get_class_name(const zend_object *zobj TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce;
-
- if (parent) {
- if (!zobj->ce->parent) {
- return NULL;
- }
- ce = zobj->ce->parent;
- } else {
- ce = zobj->ce;
- }
-
- return STR_COPY(ce->name);
+ return zend_string_copy(zobj->ce->name);
}
/* }}} */
@@ -1586,13 +1567,13 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
case _IS_BOOL:
ZVAL_BOOL(writeobj, 1);
return SUCCESS;
- case IS_INT:
+ case IS_LONG:
ce = Z_OBJCE_P(readobj);
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val);
if (readobj == writeobj) {
zval_dtor(readobj);
}
- ZVAL_INT(writeobj, 1);
+ ZVAL_LONG(writeobj, 1);
return SUCCESS;
case IS_DOUBLE:
ce = Z_OBJCE_P(readobj);
@@ -1662,7 +1643,6 @@ ZEND_API zend_object_handlers std_object_handlers = {
zend_std_get_method, /* get_method */
NULL, /* call_method */
zend_std_get_constructor, /* get_constructor */
- zend_std_object_get_class, /* get_class_entry */
zend_std_object_get_class_name, /* get_class_name */
zend_std_compare_objects, /* compare_objects */
zend_std_cast_object_tostring, /* cast_object */
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index a11269c925..2b06ebdf3d 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -95,8 +95,10 @@ typedef void (*zend_object_dtor_obj_t)(zend_object *object TSRMLS_DC);
typedef void (*zend_object_free_obj_t)(zend_object *object TSRMLS_DC);
typedef zend_object* (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
-typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zend_object *object TSRMLS_DC);
-typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object, int parent TSRMLS_DC);
+/* Get class name for display in var_dump and other debugging functions.
+ * Must be defined and must return a non-NULL value. */
+typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object TSRMLS_DC);
+
typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC);
@@ -106,7 +108,7 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_D
/* updates *count to hold the number of elements present and returns SUCCESS.
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
-typedef int (*zend_object_count_elements_t)(zval *object, zend_int_t *count TSRMLS_DC);
+typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count TSRMLS_DC);
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zend_object **obj_ptr TSRMLS_DC);
@@ -137,7 +139,6 @@ struct _zend_object_handlers {
zend_object_get_method_t get_method;
zend_object_call_method_t call_method;
zend_object_get_constructor_t get_constructor;
- zend_object_get_class_entry_t get_class_entry;
zend_object_get_class_name_t get_class_name;
zend_object_compare_t compare_objects;
zend_object_cast_t cast_object;
@@ -159,17 +160,13 @@ ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce,
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot TSRMLS_DC);
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object TSRMLS_DC);
-ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
+ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC);
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC);
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC);
ZEND_API void rebuild_object_properties(zend_object *zobj);
-
-#define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
-#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
-
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index c254b33fb2..40d37b3d36 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -149,12 +149,12 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
}
if (old_object->properties) {
zval *prop, new_prop;
- zend_uint_t num_key;
+ zend_ulong num_key;
zend_string *key;
if (!new_object->properties) {
ALLOC_HASHTABLE(new_object->properties);
- zend_hash_init(new_object->properties, 8, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(new_object->properties, zend_hash_num_elements(old_object->properties), NULL, ZVAL_PTR_DTOR, 0);
}
ZEND_HASH_FOREACH_KEY_VAL(old_object->properties, num_key, key, prop) {
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index c1b2f3ba6e..04dd82b6a0 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -25,7 +25,7 @@
#include "zend_API.h"
#include "zend_objects_API.h"
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size)
+ZEND_API void zend_objects_store_init(zend_objects_store *objects, uint32_t init_size)
{
objects->object_buckets = (zend_object **) emalloc(init_size * sizeof(zend_object*));
objects->top = 1; /* Skip 0 so that handles are true */
@@ -42,7 +42,7 @@ ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
{
- zend_uint i;
+ uint32_t i;
for (i = 1; i < objects->top ; i++) {
zend_object *obj = objects->object_buckets[i];
@@ -60,7 +60,7 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
{
- zend_uint i;
+ uint32_t i;
if (!objects->object_buckets) {
return;
@@ -76,7 +76,7 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC)
{
- zend_uint i;
+ uint32_t i;
/* Free object properties but don't free object their selves */
for (i = objects->top - 1; i > 0 ; i--) {
@@ -134,7 +134,7 @@ ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC)
ZEND_API void zend_objects_store_free(zend_object *object TSRMLS_DC) /* {{{ */
{
- zend_uint handle = object->handle;
+ uint32_t handle = object->handle;
void *ptr = ((char*)object) - object->handlers->offset;
GC_REMOVE_FROM_BUFFER(object);
@@ -169,7 +169,7 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
}
if (GC_REFCOUNT(object) == 0) {
- zend_uint handle = object->handle;
+ uint32_t handle = object->handle;
void *ptr;
EG(objects_store).object_buckets[handle] = SET_OBJ_INVALID(object);
@@ -219,107 +219,11 @@ ZEND_API void zend_object_store_ctor_failed(zend_object *obj TSRMLS_DC)
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
}
-/* Proxy objects workings */
-typedef struct _zend_proxy_object {
- zend_object std;
- zval object;
- zval property;
-} zend_proxy_object;
-
-static zend_object_handlers zend_object_proxy_handlers;
-
-ZEND_API void zend_objects_proxy_destroy(zend_object *object TSRMLS_DC)
-{
-}
-
-ZEND_API void zend_objects_proxy_free_storage(zend_proxy_object *object TSRMLS_DC)
-{
- zval_ptr_dtor(&object->object);
- zval_ptr_dtor(&object->property);
- efree(object);
-}
-
-ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_object **object_clone TSRMLS_DC)
-{
- *object_clone = emalloc(sizeof(zend_proxy_object));
- (*object_clone)->object = object->object;
- (*object_clone)->property = object->property;
- Z_ADDREF_P(&(*object_clone)->property);
- Z_ADDREF_P(&(*object_clone)->object);
-}
-
-ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC)
-{
- zend_proxy_object *obj = emalloc(sizeof(zend_proxy_object));
-
- GC_REFCOUNT(obj) = 1;
- GC_TYPE_INFO(obj) = IS_OBJECT;
- obj->std.ce = NULL;
- obj->std.properties = NULL;
- obj->std.guards = NULL;
- obj->std.handlers = &zend_object_proxy_handlers;
-
- ZVAL_COPY(&obj->object, object);
- ZVAL_DUP(&obj->property, member);
-
- return (zend_object*)obj;
-}
-
-ZEND_API void zend_object_proxy_set(zval *property, zval *value TSRMLS_DC)
-{
- zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
-
- if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->write_property) {
- Z_OBJ_HT(probj->object)->write_property(&probj->object, &probj->property, value, NULL TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
- }
-}
-
-ZEND_API zval* zend_object_proxy_get(zval *property, zval *rv TSRMLS_DC)
-{
- zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
-
- if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->read_property) {
- return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, NULL, rv TSRMLS_CC);
- } else {
- zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
- }
-
- return NULL;
-}
-
ZEND_API zend_object_handlers *zend_get_std_object_handlers(void)
{
return &std_object_handlers;
}
-static zend_object_handlers zend_object_proxy_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
-
- NULL, /* read_property */
- NULL, /* write_property */
- NULL, /* read dimension */
- NULL, /* write_dimension */
- NULL, /* get_property_ptr_ptr */
- zend_object_proxy_get, /* get */
- zend_object_proxy_set, /* set */
- NULL, /* has_property */
- NULL, /* unset_property */
- NULL, /* has_dimension */
- NULL, /* unset_dimension */
- NULL, /* get_properties */
- NULL, /* get_method */
- NULL, /* call_method */
- NULL, /* get_constructor */
- NULL, /* get_class_entry */
- NULL, /* get_class_name */
- NULL, /* compare_objects */
- NULL, /* cast_object */
- NULL, /* count_elements */
-};
-
-
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index 4d6afe6842..362d79a68c 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -37,25 +37,18 @@
} while (0)
-#define OBJ_RELEASE(obj) do { \
- zend_object *_obj = (obj); \
- if (--GC_REFCOUNT(_obj) == 0) { \
- zend_objects_store_del(_obj TSRMLS_CC); \
- } else { \
- gc_possible_root(&_obj->gc TSRMLS_CC); \
- } \
- } while (0)
+#define OBJ_RELEASE(obj) zend_object_release(obj TSRMLS_CC)
typedef struct _zend_objects_store {
zend_object **object_buckets;
- zend_uint top;
- zend_uint size;
+ uint32_t top;
+ uint32_t size;
int free_list_head;
} zend_objects_store;
/* Global store handling functions */
BEGIN_EXTERN_C()
-ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
+ZEND_API void zend_objects_store_init(zend_objects_store *objects, uint32_t init_size);
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
@@ -78,6 +71,15 @@ ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS
ZEND_API zend_object_handlers *zend_get_std_object_handlers(void);
END_EXTERN_C()
+static zend_always_inline void zend_object_release(zend_object *obj TSRMLS_DC)
+{
+ if (--GC_REFCOUNT(obj) == 0) {
+ zend_objects_store_del(obj TSRMLS_CC);
+ } else if (UNEXPECTED(!GC_INFO(obj))) {
+ gc_possible_root(&obj->gc TSRMLS_CC);
+ }
+}
+
#endif /* ZEND_OBJECTS_H */
/*
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 1c0b06fa8c..5902abd4c5 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -43,7 +43,7 @@ static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend
}
}
-static void op_array_alloc_ops(zend_op_array *op_array, zend_uint size)
+static void op_array_alloc_ops(zend_op_array *op_array, uint32_t size)
{
op_array->opcodes = erealloc(op_array->opcodes, size * sizeof(zend_op));
}
@@ -52,14 +52,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
{
op_array->type = type;
- if (CG(interactive)) {
- /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants
- * will become invalid
- */
- initial_ops_size = INITIAL_INTERACTIVE_OP_ARRAY_SIZE;
- }
-
- op_array->refcount = (zend_uint *) emalloc(sizeof(zend_uint));
+ op_array->refcount = (uint32_t *) emalloc(sizeof(uint32_t));
*op_array->refcount = 1;
op_array->last = 0;
op_array->opcodes = NULL;
@@ -79,6 +72,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->required_num_args = 0;
op_array->scope = NULL;
+ op_array->prototype = NULL;
op_array->brk_cont_array = NULL;
op_array->try_catch_array = NULL;
@@ -86,11 +80,10 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->static_variables = NULL;
op_array->last_try_catch = 0;
- op_array->has_finally_block = 0;
op_array->this_var = -1;
- op_array->fn_flags = CG(interactive)?ZEND_ACC_INTERACTIVE:0;
+ op_array->fn_flags = 0;
op_array->early_binding = -1;
@@ -107,16 +100,12 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
{
- switch (function->type) {
- case ZEND_USER_FUNCTION:
- destroy_op_array((zend_op_array *) function TSRMLS_CC);
- break;
- case ZEND_INTERNAL_FUNCTION:
- if (function->common.function_name) {
- STR_RELEASE(function->common.function_name);
- }
- /* do nothing */
- break;
+ if (function->type == ZEND_USER_FUNCTION) {
+ destroy_op_array(&function->op_array TSRMLS_CC);
+ } else {
+ ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
+ ZEND_ASSERT(function->common.function_name);
+ zend_string_release(function->common.function_name);
}
}
@@ -125,11 +114,18 @@ ZEND_API void zend_function_dtor(zval *zv)
zend_function *function = Z_PTR_P(zv);
TSRMLS_FETCH();
- destroy_zend_function(function TSRMLS_CC);
- if (function->type == ZEND_INTERNAL_FUNCTION) {
- pefree(function, 1);
- } else if (!function->common.function_name) {
- efree(function);
+ if (function->type == ZEND_USER_FUNCTION) {
+ ZEND_ASSERT(function->common.function_name);
+ destroy_op_array(&function->op_array TSRMLS_CC);
+ /* op_arrays are allocated on arena, so we don't have to free them */
+//??? efree_size(function, sizeof(zend_op_array));
+ } else {
+ ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
+ ZEND_ASSERT(function->common.function_name);
+ zend_string_release(function->common.function_name);
+ if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
+ pefree(function, 1);
+ }
}
}
@@ -198,16 +194,16 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce)
while (ce->trait_aliases[i]) {
if (ce->trait_aliases[i]->trait_method) {
if (ce->trait_aliases[i]->trait_method->method_name) {
- STR_RELEASE(ce->trait_aliases[i]->trait_method->method_name);
+ zend_string_release(ce->trait_aliases[i]->trait_method->method_name);
}
if (ce->trait_aliases[i]->trait_method->class_name) {
- STR_RELEASE(ce->trait_aliases[i]->trait_method->class_name);
+ zend_string_release(ce->trait_aliases[i]->trait_method->class_name);
}
efree(ce->trait_aliases[i]->trait_method);
}
if (ce->trait_aliases[i]->alias) {
- STR_RELEASE(ce->trait_aliases[i]->alias);
+ zend_string_release(ce->trait_aliases[i]->alias);
}
efree(ce->trait_aliases[i]);
@@ -221,8 +217,8 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce)
size_t i = 0;
while (ce->trait_precedences[i]) {
- STR_RELEASE(ce->trait_precedences[i]->trait_method->method_name);
- STR_RELEASE(ce->trait_precedences[i]->trait_method->class_name);
+ zend_string_release(ce->trait_precedences[i]->trait_method->method_name);
+ zend_string_release(ce->trait_precedences[i]->trait_method->class_name);
efree(ce->trait_precedences[i]->trait_method);
if (ce->trait_precedences[i]->exclude_from_classes) {
@@ -266,14 +262,14 @@ ZEND_API void destroy_zend_class(zval *zv)
efree(ce->default_static_members_table);
}
zend_hash_destroy(&ce->properties_info);
- STR_RELEASE(ce->name);
+ zend_string_release(ce->name);
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces);
}
if (ce->info.user.doc_comment) {
- STR_RELEASE(ce->info.user.doc_comment);
+ zend_string_release(ce->info.user.doc_comment);
}
_destroy_zend_class_traits_info(ce);
@@ -299,7 +295,7 @@ ZEND_API void destroy_zend_class(zval *zv)
free(ce->default_static_members_table);
}
zend_hash_destroy(&ce->properties_info);
- STR_RELEASE(ce->name);
+ zend_string_release(ce->name);
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0) {
@@ -321,7 +317,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
{
zval *literal = op_array->literals;
zval *end;
- zend_uint i;
+ uint32_t i;
if (op_array->static_variables) {
zend_hash_destroy(op_array->static_variables);
@@ -336,13 +332,13 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
return;
}
- efree(op_array->refcount);
+ efree_size(op_array->refcount, sizeof(*(op_array->refcount)));
if (op_array->vars) {
i = op_array->last_var;
while (i > 0) {
i--;
- STR_RELEASE(op_array->vars[i]);
+ zend_string_release(op_array->vars[i]);
}
efree(op_array->vars);
}
@@ -350,7 +346,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
if (literal) {
end = literal + op_array->last_literal;
while (literal < end) {
- zval_dtor(literal);
+ zval_ptr_dtor_nogc(literal);
literal++;
}
efree(op_array->literals);
@@ -358,10 +354,10 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
efree(op_array->opcodes);
if (op_array->function_name) {
- STR_RELEASE(op_array->function_name);
+ zend_string_release(op_array->function_name);
}
if (op_array->doc_comment) {
- STR_RELEASE(op_array->doc_comment);
+ zend_string_release(op_array->doc_comment);
}
if (op_array->brk_cont_array) {
efree(op_array->brk_cont_array);
@@ -392,16 +388,10 @@ void init_op(zend_op *op TSRMLS_DC)
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC)
{
- zend_uint next_op_num = op_array->last++;
+ uint32_t next_op_num = op_array->last++;
zend_op *next_op;
if (next_op_num >= CG(context).opcodes_size) {
- if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) {
- /* we messed up */
- zend_printf("Ran out of opcode space!\n"
- "You should probably consider writing this huge script into a file!\n");
- zend_bailout();
- }
CG(context).opcodes_size *= 4;
op_array_alloc_ops(op_array, CG(context).opcodes_size);
}
@@ -455,9 +445,9 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a
}
}
-static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_num, zend_uint dst_num TSRMLS_DC)
+static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
{
- zend_uint i;
+ int i;
for (i = 0; i < op_array->last_try_catch; i++) {
if ((op_num < op_array->try_catch_array[i].finally_op ||
@@ -480,10 +470,10 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu
}
}
-static void zend_adjust_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint start, zend_uint end TSRMLS_DC)
+static void zend_adjust_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t start, uint32_t end TSRMLS_DC)
{
int i;
- zend_uint op_num = 0;
+ uint32_t op_num = 0;
for (i = 0; i < op_array->last_try_catch; i++) {
if (op_array->try_catch_array[i].finally_op > start
@@ -501,10 +491,10 @@ static void zend_adjust_fast_call(zend_op_array *op_array, zend_uint fast_call,
}
}
-static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint fast_call, zend_uint op_num TSRMLS_DC)
+static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t fast_call, uint32_t op_num TSRMLS_DC)
{
int i;
- zend_uint finally_op_num = 0;
+ uint32_t finally_op_num = 0;
for (i = 0; i < op_array->last_try_catch; i++) {
if (op_num >= op_array->try_catch_array[i].finally_op
@@ -523,13 +513,13 @@ static void zend_resolve_fast_call(zend_op_array *op_array, zend_uint fast_call,
}
}
-static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num, zend_uint dst_num TSRMLS_DC)
+static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num TSRMLS_DC)
{
- zend_uint start_op;
+ uint32_t start_op;
zend_op *opline;
- zend_uint i = op_array->last_try_catch;
+ uint32_t i = op_array->last_try_catch;
- if (dst_num != (zend_uint)-1) {
+ if (dst_num != (uint32_t)-1) {
zend_check_finally_breakout(op_array, op_num, dst_num TSRMLS_CC);
}
@@ -601,10 +591,10 @@ static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num,
}
}
-static void zend_resolve_finally_ret(zend_op_array *op_array, zend_uint op_num TSRMLS_DC)
+static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num TSRMLS_DC)
{
int i;
- zend_uint catch_op_num = 0, finally_op_num = 0;
+ uint32_t catch_op_num = 0, finally_op_num = 0;
for (i = 0; i < op_array->last_try_catch; i++) {
if (op_array->try_catch_array[i].try_op > op_num) {
@@ -631,7 +621,7 @@ static void zend_resolve_finally_ret(zend_op_array *op_array, zend_uint op_num T
static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
{
- zend_uint i, j;
+ uint32_t i, j;
zend_op *opline;
for (i = 0, j = op_array->last; i < j; i++) {
@@ -640,7 +630,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
- zend_resolve_finally_call(op_array, i, (zend_uint)-1 TSRMLS_CC);
+ zend_resolve_finally_call(op_array, i, (uint32_t)-1 TSRMLS_CC);
break;
case ZEND_BRK:
case ZEND_CONT:
@@ -648,7 +638,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
int nest_levels, array_offset;
zend_brk_cont_element *jmp_to;
- nest_levels = Z_IVAL(op_array->literals[opline->op2.constant]);
+ nest_levels = Z_LVAL(op_array->literals[opline->op2.constant]);
if ((array_offset = opline->op1.opline_num) != -1) {
do {
jmp_to = &op_array->brk_cont_array[array_offset];
@@ -661,8 +651,8 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
}
}
case ZEND_GOTO:
- if (Z_TYPE(op_array->literals[opline->op2.constant]) != IS_INT) {
- zend_uint num = opline->op2.constant;
+ if (Z_TYPE(op_array->literals[opline->op2.constant]) != IS_LONG) {
+ uint32_t num = opline->op2.constant;
opline->op2.zv = &op_array->literals[opline->op2.constant];
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
opline->op2.constant = num;
@@ -690,7 +680,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
if (!ZEND_USER_CODE(op_array->type)) {
return 0;
}
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
zend_resolve_finally_calls(op_array TSRMLS_CC);
}
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
@@ -700,15 +690,15 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
}
- if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).vars_size != op_array->last_var) {
+ if (CG(context).vars_size != op_array->last_var) {
op_array->vars = (zend_string**) erealloc(op_array->vars, sizeof(zend_string*)*op_array->last_var);
CG(context).vars_size = op_array->last_var;
}
- if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).opcodes_size != op_array->last) {
+ if (CG(context).opcodes_size != op_array->last) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
CG(context).opcodes_size = op_array->last;
}
- if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).literals_size != op_array->last_literal) {
+ if (CG(context).literals_size != op_array->last_literal) {
op_array->literals = (zval*)erealloc(op_array->literals, sizeof(zval) * op_array->last_literal);
CG(context).literals_size = op_array->last_literal;
}
@@ -718,23 +708,23 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
if (opline->op1_type == IS_CONST) {
opline->op1.zv = &op_array->literals[opline->op1.constant];
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
- opline->op1.var = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op1.var);
+ opline->op1.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op1.var);
}
if (opline->op2_type == IS_CONST) {
opline->op2.zv = &op_array->literals[opline->op2.constant];
} else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
- opline->op2.var = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op2.var);
+ opline->op2.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op2.var);
}
if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
- opline->result.var = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->result.var);
+ opline->result.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->result.var);
}
switch (opline->opcode) {
case ZEND_DECLARE_INHERITED_CLASS:
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
- opline->extended_value = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->extended_value);
+ opline->extended_value = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->extended_value);
break;
case ZEND_GOTO:
- if (Z_TYPE_P(opline->op2.zv) != IS_INT) {
+ if (Z_TYPE_P(opline->op2.zv) != IS_LONG) {
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
}
/* break omitted intentionally */
@@ -751,7 +741,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
case ZEND_NEW:
case ZEND_FE_RESET:
case ZEND_FE_FETCH:
@@ -795,13 +785,10 @@ ZEND_API unary_op_type get_unary_op(int opcode)
switch (opcode) {
case ZEND_BW_NOT:
return (unary_op_type) bitwise_not_function;
- break;
case ZEND_BOOL_NOT:
return (unary_op_type) boolean_not_function;
- break;
default:
return (unary_op_type) NULL;
- break;
}
}
@@ -811,74 +798,54 @@ ZEND_API binary_op_type get_binary_op(int opcode)
case ZEND_ADD:
case ZEND_ASSIGN_ADD:
return (binary_op_type) add_function;
- break;
case ZEND_SUB:
case ZEND_ASSIGN_SUB:
return (binary_op_type) sub_function;
- break;
case ZEND_MUL:
case ZEND_ASSIGN_MUL:
return (binary_op_type) mul_function;
- break;
case ZEND_POW:
return (binary_op_type) pow_function;
- break;
case ZEND_DIV:
case ZEND_ASSIGN_DIV:
return (binary_op_type) div_function;
- break;
case ZEND_MOD:
case ZEND_ASSIGN_MOD:
return (binary_op_type) mod_function;
- break;
case ZEND_SL:
case ZEND_ASSIGN_SL:
return (binary_op_type) shift_left_function;
- break;
case ZEND_SR:
case ZEND_ASSIGN_SR:
return (binary_op_type) shift_right_function;
- break;
case ZEND_CONCAT:
case ZEND_ASSIGN_CONCAT:
return (binary_op_type) concat_function;
- break;
case ZEND_IS_IDENTICAL:
return (binary_op_type) is_identical_function;
- break;
case ZEND_IS_NOT_IDENTICAL:
return (binary_op_type) is_not_identical_function;
- break;
case ZEND_IS_EQUAL:
return (binary_op_type) is_equal_function;
- break;
case ZEND_IS_NOT_EQUAL:
return (binary_op_type) is_not_equal_function;
- break;
case ZEND_IS_SMALLER:
return (binary_op_type) is_smaller_function;
- break;
case ZEND_IS_SMALLER_OR_EQUAL:
return (binary_op_type) is_smaller_or_equal_function;
- break;
case ZEND_BW_OR:
case ZEND_ASSIGN_BW_OR:
return (binary_op_type) bitwise_or_function;
- break;
case ZEND_BW_AND:
case ZEND_ASSIGN_BW_AND:
return (binary_op_type) bitwise_and_function;
- break;
case ZEND_BW_XOR:
case ZEND_ASSIGN_BW_XOR:
return (binary_op_type) bitwise_xor_function;
- break;
case ZEND_BOOL_XOR:
return (binary_op_type) boolean_xor_function;
- break;
default:
return (binary_op_type) NULL;
- break;
}
}
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 6a81999495..b0a0e7519e 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -86,7 +86,7 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */
if (!str_len) {
str_len = strlen(str);
}
- retval = ZEND_STRTOI(str, NULL, 0);
+ retval = ZEND_STRTOL(str, NULL, 0);
if (str_len>0) {
switch (str[str_len-1]) {
case 'g':
@@ -107,14 +107,14 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */
}
/* }}} */
-ZEND_API zend_int_t zend_atol(const char *str, int str_len) /* {{{ */
+ZEND_API zend_long zend_atol(const char *str, int str_len) /* {{{ */
{
- zend_int_t retval;
+ zend_long retval;
if (!str_len) {
str_len = strlen(str);
}
- retval = ZEND_STRTOI(str, NULL, 0);
+ retval = ZEND_STRTOL(str, NULL, 0);
if (str_len>0) {
switch (str[str_len-1]) {
case 'g':
@@ -135,52 +135,6 @@ ZEND_API zend_int_t zend_atol(const char *str, int str_len) /* {{{ */
}
/* }}} */
-ZEND_API double zend_string_to_double(const char *number, zend_uint length) /* {{{ */
-{
- double divisor = 10.0;
- double result = 0.0;
- double exponent;
- const char *end = number+length;
- const char *digit = number;
-
- if (!length) {
- return result;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result *= 10;
- result += *digit - '0';
- } else if (*digit == '.') {
- digit++;
- break;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
-
- while (digit < end) {
- if ((*digit <= '9' && *digit >= '0')) {
- result += (*digit - '0') / divisor;
- divisor *= 10;
- } else if (toupper(*digit) == 'E') {
- exponent = (double) atoi(digit+1);
- result *= pow(10.0, exponent);
- return result;
- } else {
- return result;
- }
- digit++;
- }
- return result;
-}
-/* }}} */
-
ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
{
try_again:
@@ -198,28 +152,28 @@ try_again:
zend_string *str;
str = Z_STR_P(op);
- if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_IVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
- ZVAL_INT(op, 0);
+ if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
+ ZVAL_LONG(op, 0);
}
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
case IS_NULL:
case IS_FALSE:
- ZVAL_INT(op, 0);
+ ZVAL_LONG(op, 0);
break;
case IS_TRUE:
- ZVAL_INT(op, 1);
+ ZVAL_LONG(op, 1);
break;
case IS_RESOURCE:
{
- zend_int_t l = Z_RES_HANDLE_P(op);
+ zend_long l = Z_RES_HANDLE_P(op);
zval_ptr_dtor(op);
- ZVAL_INT(op, l);
+ ZVAL_LONG(op, l);
}
break;
case IS_OBJECT:
- convert_to_int_base(op, 10);
+ convert_to_long_base(op, 10);
break;
}
}
@@ -228,36 +182,36 @@ try_again:
/* {{{ zendi_convert_scalar_to_number */
#define zendi_convert_scalar_to_number(op, holder, result) \
if (op==result) { \
- if (Z_TYPE_P(op) != IS_INT) { \
+ if (Z_TYPE_P(op) != IS_LONG) { \
convert_scalar_to_number(op TSRMLS_CC); \
} \
} else { \
switch (Z_TYPE_P(op)) { \
case IS_STRING: \
{ \
- if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRSIZE_P(op), &Z_IVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
- ZVAL_INT(&(holder), 0); \
+ if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
+ ZVAL_LONG(&(holder), 0); \
} \
(op) = &(holder); \
break; \
} \
case IS_NULL: \
case IS_FALSE: \
- ZVAL_INT(&(holder), 0); \
+ ZVAL_LONG(&(holder), 0); \
(op) = &(holder); \
break; \
case IS_TRUE: \
- ZVAL_INT(&(holder), 1); \
+ ZVAL_LONG(&(holder), 1); \
(op) = &(holder); \
break; \
case IS_RESOURCE: \
- ZVAL_INT(&(holder), Z_RES_HANDLE_P(op)); \
+ ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
(op) = &(holder); \
break; \
case IS_OBJECT: \
ZVAL_DUP(&(holder), op); \
- convert_to_int_base(&(holder), 10); \
- if (Z_TYPE(holder) == IS_INT) { \
+ convert_to_long_base(&(holder), 10); \
+ if (Z_TYPE(holder) == IS_LONG) { \
(op) = &(holder); \
} \
break; \
@@ -266,38 +220,38 @@ try_again:
/* }}} */
-/* {{{ zendi_convert_to_int */
-#define zendi_convert_to_int(op, holder, result) \
+/* {{{ zendi_convert_to_long */
+#define zendi_convert_to_long(op, holder, result) \
if (op == result) { \
- convert_to_int(op); \
- } else if (Z_TYPE_P(op) != IS_INT) { \
+ convert_to_long(op); \
+ } else if (Z_TYPE_P(op) != IS_LONG) { \
switch (Z_TYPE_P(op)) { \
case IS_NULL: \
case IS_FALSE: \
- ZVAL_INT(&(holder), 0); \
+ ZVAL_LONG(&(holder), 0); \
break; \
case IS_TRUE: \
- ZVAL_INT(&(holder), 1); \
+ ZVAL_LONG(&(holder), 1); \
break; \
case IS_DOUBLE: \
- ZVAL_INT(&holder, zend_dval_to_ival(Z_DVAL_P(op)));\
+ ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\
break; \
case IS_STRING: \
- ZVAL_INT(&holder, ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10));\
+ ZVAL_LONG(&holder, ZEND_STRTOL(Z_STRVAL_P(op), NULL, 10));\
break; \
case IS_ARRAY: \
- ZVAL_INT(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
+ ZVAL_LONG(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
break; \
case IS_OBJECT: \
ZVAL_DUP(&(holder), (op)); \
- convert_to_int_base(&(holder), 10); \
+ convert_to_long_base(&(holder), 10); \
break; \
case IS_RESOURCE: \
- ZVAL_INT(&holder, Z_RES_HANDLE_P(op)); \
+ ZVAL_LONG(&holder, Z_RES_HANDLE_P(op)); \
break; \
default: \
zend_error(E_WARNING, "Cannot convert to ordinal value"); \
- ZVAL_INT(&holder, 0); \
+ ZVAL_LONG(&holder, 0); \
break; \
} \
(op) = &(holder); \
@@ -318,15 +272,15 @@ try_again:
case IS_RESOURCE: \
ZVAL_BOOL(&holder, Z_RES_HANDLE_P(op) ? 1 : 0); \
break; \
- case IS_INT: \
- ZVAL_BOOL(&holder, Z_IVAL_P(op) ? 1 : 0); \
+ case IS_LONG: \
+ ZVAL_BOOL(&holder, Z_LVAL_P(op) ? 1 : 0); \
break; \
case IS_DOUBLE: \
ZVAL_BOOL(&holder, Z_DVAL_P(op) ? 1 : 0); \
break; \
case IS_STRING: \
- if (Z_STRSIZE_P(op) == 0 \
- || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \
+ if (Z_STRLEN_P(op) == 0 \
+ || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \
ZVAL_BOOL(&holder, 0); \
} else { \
ZVAL_BOOL(&holder, 1); \
@@ -368,66 +322,66 @@ try_again:
/* }}} */
-ZEND_API void convert_to_int(zval *op) /* {{{ */
+ZEND_API void convert_to_long(zval *op) /* {{{ */
{
- if (Z_TYPE_P(op) != IS_INT) {
- convert_to_int_base(op, 10);
+ if (Z_TYPE_P(op) != IS_LONG) {
+ convert_to_long_base(op, 10);
}
}
/* }}} */
-ZEND_API void convert_to_int_base(zval *op, int base) /* {{{ */
+ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
{
- zend_int_t tmp;
+ zend_long tmp;
switch (Z_TYPE_P(op)) {
case IS_NULL:
case IS_FALSE:
- ZVAL_INT(op, 0);
+ ZVAL_LONG(op, 0);
break;
case IS_TRUE:
- ZVAL_INT(op, 1);
+ ZVAL_LONG(op, 1);
break;
case IS_RESOURCE: {
- zend_int_t l = Z_RES_HANDLE_P(op);
+ zend_long l = Z_RES_HANDLE_P(op);
zval_ptr_dtor(op);
- ZVAL_INT(op, l);
+ ZVAL_LONG(op, l);
}
/* break missing intentionally */
- Z_TYPE_INFO_P(op) = IS_INT;
+ Z_TYPE_INFO_P(op) = IS_LONG;
break;
- case IS_INT:
+ case IS_LONG:
break;
case IS_DOUBLE:
- ZVAL_INT(op, zend_dval_to_ival(Z_DVAL_P(op)));
+ ZVAL_LONG(op, zend_dval_to_lval(Z_DVAL_P(op)));
break;
case IS_STRING:
{
zend_string *str = Z_STR_P(op);
- ZVAL_INT(op, strtol(str->val, NULL, base));
- STR_RELEASE(str);
+ ZVAL_LONG(op, ZEND_STRTOL(str->val, NULL, base));
+ zend_string_release(str);
}
break;
case IS_ARRAY:
tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
zval_dtor(op);
- ZVAL_INT(op, tmp);
+ ZVAL_LONG(op, tmp);
break;
case IS_OBJECT:
{
zval dst;
TSRMLS_FETCH();
- convert_object_to_type(op, &dst, IS_INT, convert_to_int);
+ convert_object_to_type(op, &dst, IS_LONG, convert_to_long);
zval_dtor(op);
- if (Z_TYPE(dst) == IS_INT) {
+ if (Z_TYPE(dst) == IS_LONG) {
ZVAL_COPY_VALUE(op, &dst);
} else {
zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
- ZVAL_INT(op, 1);
+ ZVAL_LONG(op, 1);
}
return;
}
@@ -454,8 +408,8 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
ZVAL_DOUBLE(op, d);
}
break;
- case IS_INT:
- ZVAL_DOUBLE(op, (double) Z_IVAL_P(op));
+ case IS_LONG:
+ ZVAL_DOUBLE(op, (double) Z_LVAL_P(op));
break;
case IS_DOUBLE:
break;
@@ -464,7 +418,7 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
zend_string *str = Z_STR_P(op);
ZVAL_DOUBLE(op, zend_strtod(str->val, NULL));
- STR_RELEASE(str);
+ zend_string_release(str);
}
break;
case IS_ARRAY:
@@ -527,14 +481,14 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
ZVAL_BOOL(op, 0);
break;
case IS_RESOURCE: {
- zend_int_t l = (Z_RES_HANDLE_P(op) ? 1 : 0);
+ zend_long l = (Z_RES_HANDLE_P(op) ? 1 : 0);
zval_ptr_dtor(op);
ZVAL_BOOL(op, l);
}
break;
- case IS_INT:
- ZVAL_BOOL(op, Z_IVAL_P(op) ? 1 : 0);
+ case IS_LONG:
+ ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0);
break;
case IS_DOUBLE:
ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0);
@@ -549,7 +503,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
} else {
ZVAL_BOOL(op, 1);
}
- STR_RELEASE(str);
+ zend_string_release(str);
}
break;
case IS_ARRAY:
@@ -586,6 +540,7 @@ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
switch (Z_TYPE_P(op)) {
+ case IS_UNDEF:
case IS_NULL:
case IS_FALSE: {
TSRMLS_FETCH();
@@ -593,18 +548,18 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
break;
}
case IS_TRUE:
- ZVAL_NEW_STR(op, STR_INIT("1", 1, 0));
+ ZVAL_NEW_STR(op, zend_string_init("1", 1, 0));
break;
case IS_STRING:
break;
case IS_RESOURCE: {
- char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT];
- int len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(op));
- ZVAL_NEW_STR(op, STR_INIT(buf, len, 0));
+ char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
+ int len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(op));
+ ZVAL_NEW_STR(op, zend_string_init(buf, len, 0));
break;
}
- case IS_INT: {
- ZVAL_NEW_STR(op, zend_int_to_str(Z_IVAL_P(op)));
+ case IS_LONG: {
+ ZVAL_NEW_STR(op, zend_long_to_str(Z_LVAL_P(op)));
break;
}
case IS_DOUBLE: {
@@ -620,7 +575,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
zval_dtor(op);
- ZVAL_NEW_STR(op, STR_INIT("Array", sizeof("Array")-1, 0));
+ ZVAL_NEW_STR(op, zend_string_init("Array", sizeof("Array")-1, 0));
break;
case IS_OBJECT: {
zval dst;
@@ -634,7 +589,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
} else {
zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val);
zval_dtor(op);
- ZVAL_NEW_STR(op, STR_INIT("Object", sizeof("Object")-1, 0));
+ ZVAL_NEW_STR(op, zend_string_init("Object", sizeof("Object")-1, 0));
}
break;
}
@@ -716,7 +671,7 @@ ZEND_API void convert_to_object(zval *op) /* {{{ */
memcpy(properties, Z_ARRVAL_P(op), sizeof(HashTable));
object_and_properties_init(op, zend_standard_class_def, properties);
if (--GC_REFCOUNT(arr) == 0) {
- efree(arr);
+ efree_size(arr, sizeof(zend_array));
}
break;
}
@@ -736,7 +691,7 @@ ZEND_API void convert_to_object(zval *op) /* {{{ */
}
/* }}} */
-ZEND_API void multi_convert_to_int_ex(int argc, ...) /* {{{ */
+ZEND_API void multi_convert_to_long_ex(int argc, ...) /* {{{ */
{
zval *arg;
va_list ap;
@@ -745,7 +700,7 @@ ZEND_API void multi_convert_to_int_ex(int argc, ...) /* {{{ */
while (argc--) {
arg = va_arg(ap, zval *);
- convert_to_int_ex(arg);
+ convert_to_long_ex(arg);
}
va_end(ap);
@@ -784,7 +739,7 @@ ZEND_API void multi_convert_to_string_ex(int argc, ...) /* {{{ */
}
/* }}} */
-ZEND_API zend_int_t _zval_get_int_func(zval *op TSRMLS_DC) /* {{{ */
+ZEND_API zend_long _zval_get_long_func(zval *op TSRMLS_DC) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op)) {
@@ -795,20 +750,20 @@ try_again:
return 1;
case IS_RESOURCE:
return Z_RES_HANDLE_P(op);
- case IS_INT:
- return Z_IVAL_P(op);
+ case IS_LONG:
+ return Z_LVAL_P(op);
case IS_DOUBLE:
- return zend_dval_to_ival(Z_DVAL_P(op));
+ return zend_dval_to_lval(Z_DVAL_P(op));
case IS_STRING:
- return ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10);
+ return ZEND_STRTOL(Z_STRVAL_P(op), NULL, 10);
case IS_ARRAY:
return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1 : 0;
case IS_OBJECT:
{
zval dst;
- convert_object_to_type(op, &dst, IS_INT, convert_to_int);
- if (Z_TYPE(dst) == IS_INT) {
- return Z_IVAL(dst);
+ convert_object_to_type(op, &dst, IS_LONG, convert_to_long);
+ if (Z_TYPE(dst) == IS_LONG) {
+ return Z_LVAL(dst);
} else {
zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
return 1;
@@ -834,8 +789,8 @@ try_again:
return 1.0;
case IS_RESOURCE:
return (double) Z_RES_HANDLE_P(op);
- case IS_INT:
- return (double) Z_IVAL_P(op);
+ case IS_LONG:
+ return (double) Z_LVAL_P(op);
case IS_DOUBLE:
return Z_DVAL_P(op);
case IS_STRING:
@@ -868,29 +823,28 @@ ZEND_API zend_string *_zval_get_string_func(zval *op TSRMLS_DC) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op)) {
+ case IS_UNDEF:
case IS_NULL:
case IS_FALSE:
return STR_EMPTY_ALLOC();
- case IS_STRING:
- return STR_COPY(Z_STR_P(op));
case IS_TRUE:
- return STR_INIT("1", 1, 0);
+ return zend_string_init("1", 1, 0);
case IS_RESOURCE: {
- char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT];
+ char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
int len;
- len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(op));
- return STR_INIT(buf, len, 0);
+ len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(op));
+ return zend_string_init(buf, len, 0);
}
- case IS_INT: {
- return zend_int_to_str(Z_IVAL_P(op));
+ case IS_LONG: {
+ return zend_long_to_str(Z_LVAL_P(op));
}
case IS_DOUBLE: {
return zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op));
}
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
- return STR_INIT("Array", sizeof("Array")-1, 0);
+ return zend_string_init("Array", sizeof("Array")-1, 0);
case IS_OBJECT: {
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object) {
@@ -912,6 +866,8 @@ try_again:
case IS_REFERENCE:
op = Z_REFVAL_P(op);
goto try_again;
+ case IS_STRING:
+ return zend_string_copy(Z_STR_P(op));
EMPTY_SWITCH_DEFAULT_CASE()
}
return NULL;
@@ -925,26 +881,26 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT): {
- zend_int_t lval = Z_IVAL_P(op1) + Z_IVAL_P(op2);
+ case TYPE_PAIR(IS_LONG, IS_LONG): {
+ zend_long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2);
/* check for overflow by comparing sign bits */
- if ((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK)
- && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) {
+ if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
+ && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) {
- ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) + (double) Z_IVAL_P(op2));
+ ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
} else {
- ZVAL_INT(result, lval);
+ ZVAL_LONG(result, lval);
}
return SUCCESS;
}
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) + Z_DVAL_P(op2));
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2));
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_IVAL_P(op2)));
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -989,26 +945,26 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT): {
- zend_int_t lval = Z_IVAL_P(op1) - Z_IVAL_P(op2);
+ case TYPE_PAIR(IS_LONG, IS_LONG): {
+ zend_long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2);
/* check for overflow by comparing sign bits */
- if ((Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(op2) & LONG_SIGN_MASK)
- && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) {
+ if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
+ && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) {
- ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) - (double) Z_IVAL_P(op2));
+ ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
} else {
- ZVAL_INT(result, lval);
+ ZVAL_LONG(result, lval);
}
return SUCCESS;
}
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) - Z_DVAL_P(op2));
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2));
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_IVAL_P(op2)));
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -1042,20 +998,20 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT): {
- zend_int_t overflow;
+ case TYPE_PAIR(IS_LONG, IS_LONG): {
+ zend_long overflow;
- ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1),Z_IVAL_P(op2), Z_IVAL_P(result),Z_DVAL_P(result),overflow);
- Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_INT;
+ ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow);
+ Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
return SUCCESS;
}
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) * Z_DVAL_P(op2));
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2));
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_IVAL_P(op2)));
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -1089,32 +1045,32 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT):
- if (Z_IVAL_P(op2) >= 0) {
- zend_int_t l1 = 1, l2 = Z_IVAL_P(op1), i = Z_IVAL_P(op2);
+ case TYPE_PAIR(IS_LONG, IS_LONG):
+ if (Z_LVAL_P(op2) >= 0) {
+ zend_long l1 = 1, l2 = Z_LVAL_P(op1), i = Z_LVAL_P(op2);
if (i == 0) {
- ZVAL_INT(result, 1L);
+ ZVAL_LONG(result, 1L);
return SUCCESS;
} else if (l2 == 0) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
}
while (i >= 1) {
- zend_int_t overflow;
+ zend_long overflow;
double dval = 0.0;
if (i % 2) {
--i;
- ZEND_SIGNED_MULTIPLY_INT(l1, l2, l1, dval, overflow);
+ ZEND_SIGNED_MULTIPLY_LONG(l1, l2, l1, dval, overflow);
if (overflow) {
ZVAL_DOUBLE(result, dval * pow(l2, i));
return SUCCESS;
}
} else {
i /= 2;
- ZEND_SIGNED_MULTIPLY_INT(l2, l2, l2, dval, overflow);
+ ZEND_SIGNED_MULTIPLY_LONG(l2, l2, l2, dval, overflow);
if (overflow) {
ZVAL_DOUBLE(result, (double)l1 * pow(dval, i));
return SUCCESS;
@@ -1122,18 +1078,18 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
}
}
/* i == 0 */
- ZVAL_INT(result, l1);
+ ZVAL_LONG(result, l1);
} else {
- ZVAL_DOUBLE(result, pow((double)Z_IVAL_P(op1), (double)Z_IVAL_P(op2)));
+ ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), (double)Z_LVAL_P(op2)));
}
return SUCCESS;
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
- ZVAL_DOUBLE(result, pow((double)Z_IVAL_P(op1), Z_DVAL_P(op2)));
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
+ ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), Z_DVAL_P(op2)));
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_IVAL_P(op2)));
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_LVAL_P(op2)));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -1149,13 +1105,13 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW);
if (Z_TYPE_P(op1) == IS_ARRAY) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result);
}
if (Z_TYPE_P(op2) == IS_ARRAY) {
- ZVAL_INT(result, 1L);
+ ZVAL_LONG(result, 1L);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op2, op2_copy, result);
@@ -1177,39 +1133,39 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT):
- if (Z_IVAL_P(op2) == 0) {
+ case TYPE_PAIR(IS_LONG, IS_LONG):
+ if (Z_LVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE; /* division by zero */
- } else if (Z_IVAL_P(op2) == -1 && Z_IVAL_P(op1) == ZEND_INT_MIN) {
+ } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN) {
/* Prevent overflow error/crash */
- ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1);
+ ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1);
return SUCCESS;
}
- if (Z_IVAL_P(op1) % Z_IVAL_P(op2) == 0) { /* integer */
- ZVAL_INT(result, Z_IVAL_P(op1) / Z_IVAL_P(op2));
+ if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */
+ ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
} else {
- ZVAL_DOUBLE(result, ((double) Z_IVAL_P(op1)) / Z_IVAL_P(op2));
+ ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2));
}
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- if (Z_IVAL_P(op2) == 0) {
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ if (Z_LVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE; /* division by zero */
}
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_IVAL_P(op2));
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2));
return SUCCESS;
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
if (Z_DVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE; /* division by zero */
}
- ZVAL_DOUBLE(result, (double)Z_IVAL_P(op1) / Z_DVAL_P(op2));
+ ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -1244,31 +1200,31 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_MOD);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
}
- if (Z_IVAL_P(op2) == 0) {
+ if (Z_LVAL_P(op2) == 0) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE; /* modulus by zero */
}
- if (Z_IVAL_P(op2) == -1) {
+ if (Z_LVAL_P(op2) == -1) {
/* Prevent overflow error/crash if op1==LONG_MIN */
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
}
- ZVAL_INT(result, op1_lval % Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval % Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1276,7 +1232,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
if ((Z_TYPE_P(op1) != IS_FALSE && Z_TYPE_P(op1) != IS_TRUE) ||
(Z_TYPE_P(op2) != IS_FALSE && Z_TYPE_P(op2) != IS_TRUE)) {
@@ -1317,18 +1273,18 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
{
switch (Z_TYPE_P(op1)) {
- case IS_INT:
- ZVAL_INT(result, ~Z_IVAL_P(op1));
+ case IS_LONG:
+ ZVAL_LONG(result, ~Z_LVAL_P(op1));
return SUCCESS;
case IS_DOUBLE:
- ZVAL_INT(result, ~zend_dval_to_ival(Z_DVAL_P(op1)));
+ ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1)));
return SUCCESS;
case IS_STRING: {
- zend_size_t i;
+ size_t i;
zval op1_copy = *op1;
- ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE(op1_copy), 0));
- for (i = 0; i < Z_STRSIZE(op1_copy); i++) {
+ ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN(op1_copy), 0));
+ for (i = 0; i < Z_STRLEN(op1_copy); i++) {
Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i];
}
Z_STRVAL_P(result)[i] = 0;
@@ -1346,14 +1302,14 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
zend_string *str;
- zend_size_t i;
+ size_t i;
- if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
shorter = op2;
} else {
@@ -1361,29 +1317,29 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
shorter = op1;
}
- str = STR_ALLOC(Z_STRSIZE_P(longer), 0);
- for (i = 0; i < Z_STRSIZE_P(shorter); i++) {
+ str = zend_string_alloc(Z_STRLEN_P(longer), 0);
+ for (i = 0; i < Z_STRLEN_P(shorter); i++) {
str->val[i] = Z_STRVAL_P(longer)[i] | Z_STRVAL_P(shorter)[i];
}
- memcpy(str->val + i, Z_STRVAL_P(longer) + i, Z_STRSIZE_P(longer) - i + 1);
+ memcpy(str->val + i, Z_STRVAL_P(longer) + i, Z_STRLEN_P(longer) - i + 1);
if (result==op1) {
- STR_RELEASE(Z_STR_P(result));
+ zend_string_release(Z_STR_P(result));
}
ZVAL_NEW_STR(result, str);
return SUCCESS;
}
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_OR);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
}
- ZVAL_INT(result, op1_lval | Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval | Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1391,14 +1347,14 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
zend_string *str;
- zend_size_t i;
+ size_t i;
- if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
shorter = op2;
} else {
@@ -1406,29 +1362,29 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
shorter = op1;
}
- str = STR_ALLOC(Z_STRSIZE_P(shorter), 0);
- for (i = 0; i < Z_STRSIZE_P(shorter); i++) {
+ str = zend_string_alloc(Z_STRLEN_P(shorter), 0);
+ for (i = 0; i < Z_STRLEN_P(shorter); i++) {
str->val[i] = Z_STRVAL_P(shorter)[i] & Z_STRVAL_P(longer)[i];
}
str->val[i] = 0;
if (result==op1) {
- STR_RELEASE(Z_STR_P(result));
+ zend_string_release(Z_STR_P(result));
}
ZVAL_NEW_STR(result, str);
return SUCCESS;
}
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_AND);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
}
- ZVAL_INT(result, op1_lval & Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval & Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1436,14 +1392,14 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
zend_string *str;
- zend_size_t i;
+ size_t i;
- if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
shorter = op2;
} else {
@@ -1451,29 +1407,29 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
shorter = op1;
}
- str = STR_ALLOC(Z_STRSIZE_P(shorter), 0);
- for (i = 0; i < Z_STRSIZE_P(shorter); i++) {
+ str = zend_string_alloc(Z_STRLEN_P(shorter), 0);
+ for (i = 0; i < Z_STRLEN_P(shorter); i++) {
str->val[i] = Z_STRVAL_P(shorter)[i] ^ Z_STRVAL_P(longer)[i];
}
str->val[i] = 0;
if (result==op1) {
- STR_RELEASE(Z_STR_P(result));
+ zend_string_release(Z_STR_P(result));
}
ZVAL_NEW_STR(result, str);
return SUCCESS;
}
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_XOR);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
}
- ZVAL_INT(result, op1_lval ^ Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval ^ Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1481,19 +1437,31 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SL);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
+ }
+
+ /* prevent wrapping quirkiness on some processors where << 64 + x == << x */
+ if (Z_LVAL_P(op2) >= SIZEOF_ZEND_LONG * 8) {
+ ZVAL_LONG(result, 0);
+ return SUCCESS;
+ }
+
+ if (Z_LVAL_P(op2) < 0) {
+ zend_error(E_WARNING, "Bit shift by negative number");
+ ZVAL_FALSE(result);
+ return FAILURE;
}
- ZVAL_INT(result, op1_lval << Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval << Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1501,19 +1469,31 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
zval op1_copy, op2_copy;
- zend_int_t op1_lval;
+ zend_long op1_lval;
- if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) {
+ if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SR);
- zendi_convert_to_int(op1, op1_copy, result);
- op1_lval = Z_IVAL_P(op1);
- zendi_convert_to_int(op2, op2_copy, result);
+ zendi_convert_to_long(op1, op1_copy, result);
+ op1_lval = Z_LVAL_P(op1);
+ zendi_convert_to_long(op2, op2_copy, result);
} else {
- op1_lval = Z_IVAL_P(op1);
+ op1_lval = Z_LVAL_P(op1);
+ }
+
+ /* prevent wrapping quirkiness on some processors where >> 64 + x == >> x */
+ if (Z_LVAL_P(op2) >= SIZEOF_ZEND_LONG * 8) {
+ ZVAL_LONG(result, (Z_LVAL_P(op1) < 0) ? -1 : 0);
+ return SUCCESS;
+ }
+
+ if (Z_LVAL_P(op2) < 0) {
+ zend_error(E_WARNING, "Bit shift by negative number");
+ ZVAL_FALSE(result);
+ return FAILURE;
}
- ZVAL_INT(result, op1_lval >> Z_IVAL_P(op2));
+ ZVAL_LONG(result, op1_lval >> Z_LVAL_P(op2));
return SUCCESS;
}
/* }}} */
@@ -1521,10 +1501,10 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
/* must support result==op1 */
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
- zend_size_t length = Z_STRSIZE_P(op1) + 1;
- zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0);
+ size_t length = Z_STRLEN_P(op1) + 1;
+ zend_string *buf = zend_string_realloc(Z_STR_P(op1), length, 0);
- buf->val[length - 1] = (char) Z_IVAL_P(op2);
+ buf->val[length - 1] = (char) Z_LVAL_P(op2);
buf->val[length] = 0;
ZVAL_NEW_STR(result, buf);
return SUCCESS;
@@ -1534,11 +1514,11 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
/* must support result==op1 */
ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
- zend_size_t op1_len = Z_STRSIZE_P(op1);
- zend_size_t length = op1_len + Z_STRSIZE_P(op2);
- zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0);
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t length = op1_len + Z_STRLEN_P(op2);
+ zend_string *buf = zend_string_realloc(Z_STR_P(op1), length, 0);
- memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRSIZE_P(op2));
+ memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
buf->val[length] = 0;
ZVAL_NEW_STR(result, buf);
return SUCCESS;
@@ -1575,29 +1555,33 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
op2 = &op2_copy;
}
- if (result==op1 && !IS_INTERNED(Z_STR_P(op1))) { /* special case, perform operations on result */
- zend_size_t op1_len = Z_STRSIZE_P(op1);
- zend_size_t op2_len = Z_STRSIZE_P(op2);
- zend_size_t res_len = op1_len + op2_len;
+ {
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t op2_len = Z_STRLEN_P(op2);
+ size_t result_len = op1_len + op2_len;
+ zend_string *result_str;
- if (Z_STRSIZE_P(result) < 0 || (zend_size_t) (op1_len + op2_len) < 0) {
- ZVAL_EMPTY_STRING(result);
- zend_error(E_ERROR, "String size overflow");
+ if (op1_len > SIZE_MAX - op2_len) {
+ zend_error_noreturn(E_ERROR, "String size overflow");
}
- Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len, 0 );
- Z_TYPE_INFO_P(result) = IS_STRING_EX;
- memcpy(Z_STRVAL_P(result) + op1_len, Z_STRVAL_P(op2), op2_len);
- Z_STRVAL_P(result)[res_len]=0;
- } else {
- zend_size_t length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2);
- zend_string *buf = STR_ALLOC(length, 0);
+ if (result == op1 && Z_REFCOUNTED_P(result)) {
+ /* special case, perform operations on result */
+ result_str = zend_string_realloc(Z_STR_P(result), result_len, 0);
+ } else {
+ result_str = zend_string_alloc(result_len, 0);
+ memcpy(result_str->val, Z_STRVAL_P(op1), op1_len);
+ }
+
+ /* This has to happen first to account for the cases where result == op1 == op2 and
+ * the realloc is done. In this case this line will also update Z_STRVAL_P(op2) to
+ * point to the new string. The first op2_len bytes of result will still be the same. */
+ ZVAL_NEW_STR(result, result_str);
- memcpy(buf->val, Z_STRVAL_P(op1), Z_STRSIZE_P(op1));
- memcpy(buf->val + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2));
- buf->val[length] = 0;
- ZVAL_NEW_STR(result, buf);
+ memcpy(result_str->val + op1_len, Z_STRVAL_P(op2), op2_len);
+ result_str->val[result_len] = '\0';
}
+
if (UNEXPECTED(use_copy1)) {
zval_dtor(op1);
}
@@ -1614,13 +1598,13 @@ ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend
zend_string *str2 = zval_get_string(op2);
if (case_insensitive) {
- ZVAL_INT(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len));
+ ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len));
} else {
- ZVAL_INT(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len));
+ ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len));
}
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
return SUCCESS;
}
/* }}} */
@@ -1630,18 +1614,18 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) &&
EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
} else {
- ZVAL_INT(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)));
+ ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)));
}
} else {
zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2);
- ZVAL_INT(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len));
+ ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len));
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
}
return SUCCESS;
}
@@ -1652,18 +1636,18 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) &&
EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
} else {
- ZVAL_INT(result, zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)));
+ ZVAL_LONG(result, zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)));
}
} else {
zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2);
- ZVAL_INT(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len));
+ ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len));
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
}
return SUCCESS;
}
@@ -1675,10 +1659,10 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T
zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2);
- ZVAL_INT(result, strcoll(str1->val, str2->val));
+ ZVAL_LONG(result, strcoll(str1->val, str2->val));
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
return SUCCESS;
}
/* }}} */
@@ -1691,7 +1675,7 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_
d1 = zval_get_double(op1);
d2 = zval_get_double(op2);
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(d1 - d2));
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(d1 - d2));
return SUCCESS;
}
@@ -1718,26 +1702,26 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
- case TYPE_PAIR(IS_INT, IS_INT):
- ZVAL_INT(result, Z_IVAL_P(op1)>Z_IVAL_P(op2)?1:(Z_IVAL_P(op1)<Z_IVAL_P(op2)?-1:0));
+ case TYPE_PAIR(IS_LONG, IS_LONG):
+ ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0));
return SUCCESS;
- case TYPE_PAIR(IS_DOUBLE, IS_INT):
- Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_IVAL_P(op2);
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ case TYPE_PAIR(IS_DOUBLE, IS_LONG):
+ Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2);
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
return SUCCESS;
- case TYPE_PAIR(IS_INT, IS_DOUBLE):
- Z_DVAL_P(result) = (double)Z_IVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ case TYPE_PAIR(IS_LONG, IS_DOUBLE):
+ Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2);
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
return SUCCESS;
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
} else {
Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
}
return SUCCESS;
@@ -1750,39 +1734,39 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
case TYPE_PAIR(IS_FALSE, IS_NULL):
case TYPE_PAIR(IS_FALSE, IS_FALSE):
case TYPE_PAIR(IS_TRUE, IS_TRUE):
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
case TYPE_PAIR(IS_NULL, IS_TRUE):
- ZVAL_INT(result, -1);
+ ZVAL_LONG(result, -1);
return SUCCESS;
case TYPE_PAIR(IS_TRUE, IS_NULL):
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
return SUCCESS;
case TYPE_PAIR(IS_STRING, IS_STRING):
if (Z_STR_P(op1) == Z_STR_P(op2)) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
}
zendi_smart_strcmp(result, op1, op2);
return SUCCESS;
case TYPE_PAIR(IS_NULL, IS_STRING):
- ZVAL_INT(result, Z_STRSIZE_P(op2) == 0 ? 0 : -1);
+ ZVAL_LONG(result, Z_STRLEN_P(op2) == 0 ? 0 : -1);
return SUCCESS;
case TYPE_PAIR(IS_STRING, IS_NULL):
- ZVAL_INT(result, Z_STRSIZE_P(op1) == 0 ? 0 : 1);
+ ZVAL_LONG(result, Z_STRLEN_P(op1) == 0 ? 0 : 1);
return SUCCESS;
case TYPE_PAIR(IS_OBJECT, IS_NULL):
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
return SUCCESS;
case TYPE_PAIR(IS_NULL, IS_OBJECT):
- ZVAL_INT(result, -1);
+ ZVAL_LONG(result, -1);
return SUCCESS;
default:
@@ -1803,11 +1787,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
if (Z_TYPE_P(op1) == IS_OBJECT && Z_TYPE_P(op2) == IS_OBJECT) {
if (Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
/* object handles are identical, apparently this is the same object */
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return SUCCESS;
}
if (Z_OBJ_HANDLER_P(op1, compare_objects) == Z_OBJ_HANDLER_P(op2, compare_objects)) {
- ZVAL_INT(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2 TSRMLS_CC));
+ ZVAL_LONG(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2 TSRMLS_CC));
return SUCCESS;
}
}
@@ -1821,7 +1805,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
} else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
ZVAL_UNDEF(&tmp_free);
if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2)) TSRMLS_CC) == FAILURE) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return SUCCESS;
}
@@ -1840,7 +1824,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
} else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
ZVAL_UNDEF(&tmp_free);
if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1)) TSRMLS_CC) == FAILURE) {
- ZVAL_INT(result, -1);
+ ZVAL_LONG(result, -1);
zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return SUCCESS;
}
@@ -1848,26 +1832,26 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
return SUCCESS;
}
}
if (!converted) {
if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) {
zendi_convert_to_boolean(op2, op2_copy, result);
- ZVAL_INT(result, (Z_TYPE_P(op2) == IS_TRUE) ? -1 : 0);
+ ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? -1 : 0);
return SUCCESS;
} else if (Z_TYPE_P(op2) == IS_NULL || Z_TYPE_P(op2) == IS_FALSE) {
zendi_convert_to_boolean(op1, op1_copy, result);
- ZVAL_INT(result, (Z_TYPE_P(op1) == IS_TRUE) ? 1 : 0);
+ ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 1 : 0);
return SUCCESS;
} else if (Z_TYPE_P(op1) == IS_TRUE) {
zendi_convert_to_boolean(op2, op2_copy, result);
- ZVAL_INT(result, (Z_TYPE_P(op2) == IS_TRUE) ? 0 : 1);
+ ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? 0 : 1);
return SUCCESS;
} else if (Z_TYPE_P(op2) == IS_TRUE) {
zendi_convert_to_boolean(op1, op1_copy, result);
- ZVAL_INT(result, (Z_TYPE_P(op1) == IS_TRUE) ? 0 : -1);
+ ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 0 : -1);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result);
@@ -1875,19 +1859,19 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
converted = 1;
}
} else if (Z_TYPE_P(op1)==IS_ARRAY) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
return SUCCESS;
} else if (Z_TYPE_P(op2)==IS_ARRAY) {
- ZVAL_INT(result, -1);
+ ZVAL_LONG(result, -1);
return SUCCESS;
} else if (Z_TYPE_P(op1)==IS_OBJECT) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
return SUCCESS;
} else if (Z_TYPE_P(op2)==IS_OBJECT) {
- ZVAL_INT(result, -1);
+ ZVAL_LONG(result, -1);
return SUCCESS;
} else {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return FAILURE;
}
}
@@ -1925,8 +1909,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
case IS_TRUE:
ZVAL_BOOL(result, 1);
break;
- case IS_INT:
- ZVAL_BOOL(result, Z_IVAL_P(op1) == Z_IVAL_P(op2));
+ case IS_LONG:
+ ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
break;
case IS_RESOURCE:
ZVAL_BOOL(result, Z_RES_P(op1) == Z_RES_P(op2));
@@ -1938,8 +1922,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
if (Z_STR_P(op1) == Z_STR_P(op2)) {
ZVAL_BOOL(result, 1);
} else {
- ZVAL_BOOL(result, (Z_STRSIZE_P(op1) == Z_STRSIZE_P(op2))
- && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1))));
+ ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
+ && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
}
break;
case IS_ARRAY:
@@ -1976,7 +1960,7 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /*
if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
return FAILURE;
}
- ZVAL_BOOL(result, (Z_IVAL_P(result) == 0));
+ ZVAL_BOOL(result, (Z_LVAL_P(result) == 0));
return SUCCESS;
}
/* }}} */
@@ -1986,7 +1970,7 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
return FAILURE;
}
- ZVAL_BOOL(result, (Z_IVAL_P(result) != 0));
+ ZVAL_BOOL(result, (Z_LVAL_P(result) != 0));
return SUCCESS;
}
/* }}} */
@@ -1996,7 +1980,7 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
return FAILURE;
}
- ZVAL_BOOL(result, (Z_IVAL_P(result) < 0));
+ ZVAL_BOOL(result, (Z_LVAL_P(result) < 0));
return SUCCESS;
}
/* }}} */
@@ -2006,14 +1990,14 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR
if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
return FAILURE;
}
- ZVAL_BOOL(result, (Z_IVAL_P(result) <= 0));
+ ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0));
return SUCCESS;
}
/* }}} */
ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC) /* {{{ */
{
- zend_uint i;
+ uint32_t i;
for (i=0; i<instance_ce->num_interfaces; i++) {
if (instanceof_function(instance_ce->interfaces[i], ce TSRMLS_CC)) {
@@ -2046,31 +2030,31 @@ ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, cons
static void increment_string(zval *str) /* {{{ */
{
int carry=0;
- zend_size_t pos=Z_STRSIZE_P(str)-1;
+ size_t pos=Z_STRLEN_P(str)-1;
char *s;
zend_string *t;
int last=0; /* Shut up the compiler warning */
int ch;
- if (Z_STRSIZE_P(str) == 0) {
- STR_RELEASE(Z_STR_P(str));
- Z_STR_P(str) = STR_INIT("1", sizeof("1")-1, 0);
+ if (Z_STRLEN_P(str) == 0) {
+ zend_string_release(Z_STR_P(str));
+ Z_STR_P(str) = zend_string_init("1", sizeof("1")-1, 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
return;
}
- if (IS_INTERNED(Z_STR_P(str))) {
- Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRSIZE_P(str), 0);
+ if (!Z_REFCOUNTED_P(str)) {
+ Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX;
} else if (Z_REFCOUNT_P(str) > 1) {
Z_DELREF_P(str);
- Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRSIZE_P(str), 0);
+ Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
} else {
- STR_FORGET_HASH_VAL(Z_STR_P(str));
+ zend_string_forget_hash_val(Z_STR_P(str));
}
s = Z_STRVAL_P(str);
- while (pos >= 0) {
+ do {
ch = s[pos];
if (ch >= 'a' && ch <= 'z') {
if (ch == 'z') {
@@ -2106,13 +2090,12 @@ static void increment_string(zval *str) /* {{{ */
if (carry == 0) {
break;
}
- pos--;
- }
+ } while (pos-- > 0);
if (carry) {
- t = STR_ALLOC(Z_STRSIZE_P(str)+1, 0);
- memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRSIZE_P(str));
- t->val[Z_STRSIZE_P(str) + 1] = '\0';
+ t = zend_string_alloc(Z_STRLEN_P(str)+1, 0);
+ memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRLEN_P(str));
+ t->val[Z_STRLEN_P(str) + 1] = '\0';
switch (last) {
case NUMERIC:
t->val[0] = '1';
@@ -2124,7 +2107,7 @@ static void increment_string(zval *str) /* {{{ */
t->val[0] = 'a';
break;
}
- STR_FREE(Z_STR_P(str));
+ zend_string_free(Z_STR_P(str));
ZVAL_NEW_STR(str, t);
}
}
@@ -2134,38 +2117,38 @@ ZEND_API int increment_function(zval *op1) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op1)) {
- case IS_INT:
- if (Z_IVAL_P(op1) == ZEND_INT_MAX) {
+ case IS_LONG:
+ if (Z_LVAL_P(op1) == ZEND_LONG_MAX) {
/* switch to double */
- double d = (double)Z_IVAL_P(op1);
+ double d = (double)Z_LVAL_P(op1);
ZVAL_DOUBLE(op1, d+1);
} else {
- Z_IVAL_P(op1)++;
+ Z_LVAL_P(op1)++;
}
break;
case IS_DOUBLE:
Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1;
break;
case IS_NULL:
- ZVAL_INT(op1, 1);
+ ZVAL_LONG(op1, 1);
break;
case IS_STRING: {
- zend_int_t lval;
+ zend_long lval;
double dval;
- switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) {
- case IS_INT:
- STR_RELEASE(Z_STR_P(op1));
- if (lval == ZEND_INT_MAX) {
+ switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
+ case IS_LONG:
+ zend_string_release(Z_STR_P(op1));
+ if (lval == ZEND_LONG_MAX) {
/* switch to double */
double d = (double)lval;
ZVAL_DOUBLE(op1, d+1);
} else {
- ZVAL_INT(op1, lval+1);
+ ZVAL_LONG(op1, lval+1);
}
break;
case IS_DOUBLE:
- STR_RELEASE(Z_STR_P(op1));
+ zend_string_release(Z_STR_P(op1));
ZVAL_DOUBLE(op1, dval+1);
break;
default:
@@ -2176,12 +2159,24 @@ try_again:
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, get)
+ && Z_OBJ_HANDLER_P(op1, set)) {
+ /* proxy object */
+ zval rv;
+ zval *val;
+ TSRMLS_FETCH();
+
+ val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv TSRMLS_CC);
+ Z_ADDREF_P(val);
+ fast_increment_function(val);
+ Z_OBJ_HANDLER_P(op1, set)(op1, val TSRMLS_CC);
+ zval_ptr_dtor(val);
+ } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
TSRMLS_FETCH();
- ZVAL_INT(&op2, 1);
+ ZVAL_LONG(&op2, 1);
res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, &op2 TSRMLS_CC);
zval_ptr_dtor(&op2);
@@ -2200,51 +2195,63 @@ try_again:
ZEND_API int decrement_function(zval *op1) /* {{{ */
{
- zend_int_t lval;
+ zend_long lval;
double dval;
try_again:
switch (Z_TYPE_P(op1)) {
- case IS_INT:
- if (Z_IVAL_P(op1) == ZEND_INT_MIN) {
- double d = (double)Z_IVAL_P(op1);
+ case IS_LONG:
+ if (Z_LVAL_P(op1) == ZEND_LONG_MIN) {
+ double d = (double)Z_LVAL_P(op1);
ZVAL_DOUBLE(op1, d-1);
} else {
- Z_IVAL_P(op1)--;
+ Z_LVAL_P(op1)--;
}
break;
case IS_DOUBLE:
Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1;
break;
case IS_STRING: /* Like perl we only support string increment */
- if (Z_STRSIZE_P(op1) == 0) { /* consider as 0 */
- STR_RELEASE(Z_STR_P(op1));
- ZVAL_INT(op1, -1);
+ if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */
+ zend_string_release(Z_STR_P(op1));
+ ZVAL_LONG(op1, -1);
break;
}
- switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) {
- case IS_INT:
- STR_RELEASE(Z_STR_P(op1));
- if (lval == ZEND_INT_MIN) {
+ switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
+ case IS_LONG:
+ zend_string_release(Z_STR_P(op1));
+ if (lval == ZEND_LONG_MIN) {
double d = (double)lval;
ZVAL_DOUBLE(op1, d-1);
} else {
- ZVAL_INT(op1, lval-1);
+ ZVAL_LONG(op1, lval-1);
}
break;
case IS_DOUBLE:
- STR_RELEASE(Z_STR_P(op1));
+ zend_string_release(Z_STR_P(op1));
ZVAL_DOUBLE(op1, dval - 1);
break;
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, get)
+ && Z_OBJ_HANDLER_P(op1, set)) {
+ /* proxy object */
+ zval rv;
+ zval *val;
+ TSRMLS_FETCH();
+
+ val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv TSRMLS_CC);
+ Z_ADDREF_P(val);
+ fast_decrement_function(val);
+ Z_OBJ_HANDLER_P(op1, set)(op1, val TSRMLS_CC);
+ zval_ptr_dtor(val);
+ } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
TSRMLS_FETCH();
- ZVAL_INT(&op2, 1);
+ ZVAL_LONG(&op2, 1);
res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, &op2 TSRMLS_CC);
zval_ptr_dtor(&op2);
@@ -2277,7 +2284,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */
/* }}} */
#endif
-ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t length) /* {{{ */
+ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, size_t length) /* {{{ */
{
register unsigned char *str = (unsigned char*)source;
register unsigned char *result = (unsigned char*)dest;
@@ -2292,13 +2299,13 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t
}
/* }}} */
-ZEND_API char *zend_str_tolower_dup(const char *source, zend_size_t length) /* {{{ */
+ZEND_API char *zend_str_tolower_dup(const char *source, size_t length) /* {{{ */
{
return zend_str_tolower_copy((char *)emalloc(length+1), source, length);
}
/* }}} */
-ZEND_API void zend_str_tolower(char *str, zend_size_t length) /* {{{ */
+ZEND_API void zend_str_tolower(char *str, size_t length) /* {{{ */
{
register unsigned char *p = (unsigned char*)str;
register unsigned char *end = p + length;
@@ -2310,7 +2317,7 @@ ZEND_API void zend_str_tolower(char *str, zend_size_t length) /* {{{ */
}
/* }}} */
-ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */
+ZEND_API int zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */
{
int retval;
@@ -2326,7 +2333,7 @@ ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2
}
/* }}} */
-ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */
+ZEND_API int zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */
{
int retval;
@@ -2342,9 +2349,9 @@ ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s
}
/* }}} */
-ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */
+ZEND_API int zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */
{
- zend_size_t len;
+ size_t len;
int c1, c2;
if (s1 == s2) {
@@ -2364,9 +2371,9 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char
}
/* }}} */
-ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */
+ZEND_API int zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */
{
- zend_size_t len;
+ size_t len;
int c1, c2;
if (s1 == s2) {
@@ -2385,9 +2392,9 @@ ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const cha
}
/* }}} */
-ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */
+ZEND_API int zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */
{
- zend_size_t len;
+ size_t len;
int c1, c2;
if (s1 == s2) {
@@ -2407,9 +2414,9 @@ ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const ch
}
/* }}} */
-ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */
+ZEND_API int zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */
{
- zend_size_t len;
+ size_t len;
int c1, c2;
if (s1 == s2) {
@@ -2430,25 +2437,25 @@ ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const c
ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */
{
- return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2));
+ return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2));
}
/* }}} */
ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */
{
- return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_IVAL_P(s3));
+ return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3));
}
/* }}} */
ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */
{
- return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2));
+ return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2));
}
/* }}} */
ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */
{
- return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_IVAL_P(s3));
+ return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3));
}
/* }}} */
@@ -2456,12 +2463,12 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
{
int ret1, ret2;
int oflow1, oflow2;
- zend_int_t lval1 = 0, lval2 = 0;
+ zend_long lval1 = 0, lval2 = 0;
double dval1 = 0.0, dval2 = 0.0;
- if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), &lval1, &dval1, 0, &oflow1)) &&
- (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRSIZE_P(s2), &lval2, &dval2, 0, &oflow2))) {
-#if ZEND_UINT_MAX == 0xFFFFFFFF
+ if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) &&
+ (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) {
+#if ZEND_ULONG_MAX == 0xFFFFFFFF
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
|| (oflow1 == -1 && dval1 < -9007199254740991.))) {
@@ -2476,13 +2483,13 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
if (ret1!=IS_DOUBLE) {
if (oflow2) {
/* 2nd operand is integer > LONG_MAX (oflow2==1) or < LONG_MIN (-1) */
- ZVAL_INT(result, -1 * oflow2);
+ ZVAL_LONG(result, -1 * oflow2);
return;
}
dval1 = (double) lval1;
} else if (ret2!=IS_DOUBLE) {
if (oflow1) {
- ZVAL_INT(result, oflow1);
+ ZVAL_LONG(result, oflow1);
return;
}
dval2 = (double) lval2;
@@ -2492,14 +2499,14 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
goto string_cmp;
}
Z_DVAL_P(result) = dval1 - dval2;
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
} else { /* they both have to be long's */
- ZVAL_INT(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0));
+ ZVAL_LONG(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0));
}
} else {
string_cmp:
- Z_IVAL_P(result) = zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2));
- ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_IVAL_P(result)));
+ Z_LVAL_P(result) = zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2));
+ ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)));
}
}
/* }}} */
@@ -2511,7 +2518,7 @@ static int hash_zval_compare_function(zval *z1, zval *z2 TSRMLS_DC) /* {{{ */
if (compare_function(&result, z1, z2 TSRMLS_CC)==FAILURE) {
return 1;
}
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
/* }}} */
@@ -2523,7 +2530,7 @@ ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_
ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */
{
- ZVAL_INT(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC));
+ ZVAL_LONG(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC));
}
/* }}} */
@@ -2536,14 +2543,14 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) /*
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
if (Z_OBJ_P(o1) == Z_OBJ_P(o2)) {
- ZVAL_INT(result, 0);
+ ZVAL_LONG(result, 0);
return;
}
if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
} else {
- ZVAL_INT(result, Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC));
+ ZVAL_LONG(result, Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC));
}
}
/* }}} */
@@ -2558,19 +2565,155 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
}
/* }}} */
-ZEND_API zend_string *zend_int_to_str(zend_int_t num) /* {{{ */
+ZEND_API zend_string *zend_long_to_str(zend_long num) /* {{{ */
{
- char buf[MAX_LENGTH_OF_ZEND_INT + 1];
- char *res;
- _zend_print_signed_to_buf(buf + sizeof(buf) - 1, num, zend_uint_t, res);
- return STR_INIT(res, buf + sizeof(buf) - 1 - res, 0);
+ char buf[MAX_LENGTH_OF_LONG + 1];
+ char *res = zend_print_long_to_buf(buf + sizeof(buf) - 1, num);
+ return zend_string_init(res, buf + sizeof(buf) - 1 - res, 0);
}
/* }}} */
-ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_int_t *lval, double *dval) {
+ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) {
return is_numeric_string_ex(str->val, str->len, lval, dval, -1, NULL);
}
+ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info)
+{
+ const char *ptr;
+ int base = 10, digits = 0, dp_or_e = 0;
+ double local_dval = 0.0;
+ zend_uchar type;
+
+ if (!length) {
+ return 0;
+ }
+
+ if (oflow_info != NULL) {
+ *oflow_info = 0;
+ }
+
+ /* Skip any whitespace
+ * This is much faster than the isspace() function */
+ while (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r' || *str == '\v' || *str == '\f') {
+ str++;
+ length--;
+ }
+ ptr = str;
+
+ if (*ptr == '-' || *ptr == '+') {
+ ptr++;
+ }
+
+ if (ZEND_IS_DIGIT(*ptr)) {
+ /* Handle hex numbers
+ * str is used instead of ptr to disallow signs and keep old behavior */
+ if (length > 2 && *str == '0' && (str[1] == 'x' || str[1] == 'X')) {
+ base = 16;
+ ptr += 2;
+ }
+
+ /* Skip any leading 0s */
+ while (*ptr == '0') {
+ ptr++;
+ }
+
+ /* Count the number of digits. If a decimal point/exponent is found,
+ * it's a double. Otherwise, if there's a dval or no need to check for
+ * a full match, stop when there are too many digits for a long */
+ for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) {
+check_digits:
+ if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) {
+ continue;
+ } else if (base == 10) {
+ if (*ptr == '.' && dp_or_e < 1) {
+ goto process_double;
+ } else if ((*ptr == 'e' || *ptr == 'E') && dp_or_e < 2) {
+ const char *e = ptr + 1;
+
+ if (*e == '-' || *e == '+') {
+ ptr = e++;
+ }
+ if (ZEND_IS_DIGIT(*e)) {
+ goto process_double;
+ }
+ }
+ }
+
+ break;
+ }
+
+ if (base == 10) {
+ if (digits >= MAX_LENGTH_OF_LONG) {
+ if (oflow_info != NULL) {
+ *oflow_info = *str == '-' ? -1 : 1;
+ }
+ dp_or_e = -1;
+ goto process_double;
+ }
+ } else if (!(digits < SIZEOF_ZEND_LONG * 2 || (digits == SIZEOF_ZEND_LONG * 2 && ptr[-digits] <= '7'))) {
+ if (dval) {
+ local_dval = zend_hex_strtod(str, &ptr);
+ }
+ if (oflow_info != NULL) {
+ *oflow_info = 1;
+ }
+ type = IS_DOUBLE;
+ }
+ } else if (*ptr == '.' && ZEND_IS_DIGIT(ptr[1])) {
+process_double:
+ type = IS_DOUBLE;
+
+ /* If there's a dval, do the conversion; else continue checking
+ * the digits if we need to check for a full match */
+ if (dval) {
+ local_dval = zend_strtod(str, &ptr);
+ } else if (allow_errors != 1 && dp_or_e != -1) {
+ dp_or_e = (*ptr++ == '.') ? 1 : 2;
+ goto check_digits;
+ }
+ } else {
+ return 0;
+ }
+
+ if (ptr != str + length) {
+ if (!allow_errors) {
+ return 0;
+ }
+ if (allow_errors == -1) {
+ zend_error(E_NOTICE, "A non well formed numeric value encountered");
+ }
+ }
+
+ if (type == IS_LONG) {
+ if (digits == MAX_LENGTH_OF_LONG - 1) {
+ int cmp = strcmp(&ptr[-digits], long_min_digits);
+
+ if (!(cmp < 0 || (cmp == 0 && *str == '-'))) {
+ if (dval) {
+ *dval = zend_strtod(str, NULL);
+ }
+ if (oflow_info != NULL) {
+ *oflow_info = *str == '-' ? -1 : 1;
+ }
+
+ return IS_DOUBLE;
+ }
+ }
+
+ if (lval) {
+ *lval = ZEND_STRTOL(str, NULL, base);
+ }
+
+ return IS_LONG;
+ } else {
+ if (dval) {
+ *dval = local_dval;
+ }
+
+ return IS_DOUBLE;
+ }
+}
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 3ed9b9fb4d..8075edf939 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -41,7 +41,7 @@
#include "ext/bcmath/libbcmath/src/bcmath.h"
#endif
-#define LONG_SIGN_MASK (((zend_int_t)1) << (8*sizeof(zend_int_t)-1))
+#define LONG_SIGN_MASK (((zend_long)1) << (8*sizeof(zend_long)-1))
BEGIN_EXTERN_C()
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
@@ -69,14 +69,41 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR
ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC);
ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC);
+
+/**
+ * Checks whether the string "str" with length "length" is numeric. The value
+ * of allow_errors determines whether it's required to be entirely numeric, or
+ * just its prefix. Leading whitespace is allowed.
+ *
+ * The function returns 0 if the string did not contain a valid number; IS_LONG
+ * if it contained a number that fits within the range of a long; or IS_DOUBLE
+ * if the number was out of long range or contained a decimal point/exponent.
+ * The number's value is returned into the respective pointer, *lval or *dval,
+ * if that pointer is not NULL.
+ *
+ * This variant also gives information if a string that represents an integer
+ * could not be represented as such due to overflow. It writes 1 to oflow_info
+ * if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN.
+ */
+ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info);
+
END_EXTERN_C()
-#if ZEND_DVAL_TO_IVAL_CAST_OK
-# define zend_dval_to_ival(d) ((zend_int_t) (d))
-#elif SIZEOF_ZEND_INT == 4
-static zend_always_inline zend_int_t zend_dval_to_ival(double d)
+#if ZEND_DVAL_TO_LVAL_CAST_OK
+static zend_always_inline zend_long zend_dval_to_lval(double d)
+{
+ if (EXPECTED(zend_finite(d)) && EXPECTED(!zend_isnan(d))) {
+ return (zend_long)d;
+ } else {
+ return 0;
+ }
+}
+#elif SIZEOF_ZEND_LONG == 4
+static zend_always_inline zend_long zend_dval_to_lval(double d)
{
- if (d > ZEND_INT_MAX || d < ZEND_INT_MIN) {
+ if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
+ return 0;
+ } else if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) {
double two_pow_32 = pow(2., 32.),
dmod;
@@ -86,15 +113,17 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d)
* to simulate rounding towards 0 of the negative number */
dmod = ceil(dmod) + two_pow_32;
}
- return (zend_int_t)(zend_uint_t)dmod;
+ return (zend_long)(zend_ulong)dmod;
}
- return (zend_int_t)d;
+ return (zend_long)d;
}
#else
-static zend_always_inline zend_int_t zend_dval_to_ival(double d)
+static zend_always_inline zend_long zend_dval_to_lval(double d)
{
- /* >= as (double)ZEND_INT_MAX is outside signed range */
- if (d >= ZEND_INT_MAX || d < ZEND_INT_MIN) {
+ if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
+ return 0;
+ /* >= as (double)ZEND_LONG_MAX is outside signed range */
+ } else if (d >= ZEND_LONG_MAX || d < ZEND_LONG_MIN) {
double two_pow_64 = pow(2., 64.),
dmod;
@@ -104,9 +133,9 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d)
* fractional part, hence dmod does not have one either */
dmod += two_pow_64;
}
- return (zend_int_t)(zend_uint_t)dmod;
+ return (zend_long)(zend_ulong)dmod;
}
- return (zend_int_t)d;
+ return (zend_long)d;
}
#endif
/* }}} */
@@ -114,178 +143,34 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d)
#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
#define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
-/**
- * Checks whether the string "str" with length "length" is numeric. The value
- * of allow_errors determines whether it's required to be entirely numeric, or
- * just its prefix. Leading whitespace is allowed.
- *
- * The function returns 0 if the string did not contain a valid number; IS_INT
- * if it contained a number that fits within the range of a long; or IS_DOUBLE
- * if the number was out of long range or contained a decimal point/exponent.
- * The number's value is returned into the respective pointer, *lval or *dval,
- * if that pointer is not NULL.
- *
- * This variant also gives information if a string that represents an integer
- * could not be represented as such due to overflow. It writes 1 to oflow_info
- * if the integer is larger than ZEND_INT_MAX and -1 if it's smaller than ZEND_INT_MIN.
- */
-static inline zend_uchar is_numeric_string_ex(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors, int *oflow_info)
+static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info)
{
- const char *ptr;
- int base = 10, digits = 0, dp_or_e = 0;
- double local_dval = 0.0;
- zend_uchar type;
-
- if (!length) {
- return 0;
- }
-
- if (oflow_info != NULL) {
- *oflow_info = 0;
- }
-
- /* Skip any whitespace
- * This is much faster than the isspace() function */
- while (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r' || *str == '\v' || *str == '\f') {
- str++;
- length--;
- }
- ptr = str;
-
- if (*ptr == '-' || *ptr == '+') {
- ptr++;
- }
-
- if (ZEND_IS_DIGIT(*ptr)) {
- /* Handle hex numbers
- * str is used instead of ptr to disallow signs and keep old behavior */
- if (length > 2 && *str == '0' && (str[1] == 'x' || str[1] == 'X')) {
- base = 16;
- ptr += 2;
- }
-
- /* Skip any leading 0s */
- while (*ptr == '0') {
- ptr++;
- }
-
- /* Count the number of digits. If a decimal point/exponent is found,
- * it's a double. Otherwise, if there's a dval or no need to check for
- * a full match, stop when there are too many digits for a long */
- for (type = IS_INT; !(digits >= MAX_LENGTH_OF_ZEND_INT && (dval || allow_errors == 1)); digits++, ptr++) {
-check_digits:
- if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) {
- continue;
- } else if (base == 10) {
- if (*ptr == '.' && dp_or_e < 1) {
- goto process_double;
- } else if ((*ptr == 'e' || *ptr == 'E') && dp_or_e < 2) {
- const char *e = ptr + 1;
-
- if (*e == '-' || *e == '+') {
- ptr = e++;
- }
- if (ZEND_IS_DIGIT(*e)) {
- goto process_double;
- }
- }
- }
-
- break;
- }
-
- if (base == 10) {
- if (digits >= MAX_LENGTH_OF_ZEND_INT) {
- if (oflow_info != NULL) {
- *oflow_info = *str == '-' ? -1 : 1;
- }
- dp_or_e = -1;
- goto process_double;
- }
- } else if (!(digits < SIZEOF_ZEND_INT * 2 || (digits == SIZEOF_ZEND_INT * 2 && ptr[-digits] <= '7'))) {
- if (dval) {
- local_dval = zend_hex_strtod(str, &ptr);
- }
- if (oflow_info != NULL) {
- *oflow_info = 1;
- }
- type = IS_DOUBLE;
- }
- } else if (*ptr == '.' && ZEND_IS_DIGIT(ptr[1])) {
-process_double:
- type = IS_DOUBLE;
-
- /* If there's a dval, do the conversion; else continue checking
- * the digits if we need to check for a full match */
- if (dval) {
- local_dval = zend_strtod(str, &ptr);
- } else if (allow_errors != 1 && dp_or_e != -1) {
- dp_or_e = (*ptr++ == '.') ? 1 : 2;
- goto check_digits;
- }
- } else {
+ if (*str > '9') {
return 0;
}
-
- if (ptr != str + length) {
- if (!allow_errors) {
- return 0;
- }
- if (allow_errors == -1) {
- zend_error(E_NOTICE, "A non well formed numeric value encountered");
- }
- }
-
- if (type == IS_INT) {
- if (digits == MAX_LENGTH_OF_ZEND_INT - 1) {
- int cmp = strcmp(&ptr[-digits], int_min_digits);
-
- if (!(cmp < 0 || (cmp == 0 && *str == '-'))) {
- if (dval) {
- *dval = zend_strtod(str, NULL);
- }
- if (oflow_info != NULL) {
- *oflow_info = *str == '-' ? -1 : 1;
- }
-
- return IS_DOUBLE;
- }
- }
-
- if (lval) {
- *lval = ZEND_STRTOI(str, NULL, base);
- }
-
- return IS_INT;
- } else {
- if (dval) {
- *dval = local_dval;
- }
-
- return IS_DOUBLE;
- }
+ return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info);
}
-static inline zend_uchar is_numeric_string(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors) {
+static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors) {
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
}
-ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_int_t *lval, double *dval);
+ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval);
-static inline const char *
-zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, char *end)
+static zend_always_inline const char *
+zend_memnstr(const char *haystack, const char *needle, size_t needle_len, char *end)
{
const char *p = haystack;
const char ne = needle[needle_len-1];
ptrdiff_t off_p;
- zend_size_t off_s;
+ size_t off_s;
if (needle_len == 1) {
return (char *)memchr(p, *needle, (end-p));
}
off_p = end - haystack;
- off_s = (off_p > 0) ? (zend_size_t)off_p : 0;
+ off_s = (off_p > 0) ? (size_t)off_p : 0;
if (needle_len > off_s) {
return NULL;
}
@@ -309,7 +194,7 @@ zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, c
return NULL;
}
-static inline const void *zend_memrchr(const void *s, int c, zend_size_t n)
+static zend_always_inline const void *zend_memrchr(const void *s, int c, size_t n)
{
register const unsigned char *e;
@@ -333,32 +218,32 @@ ZEND_API int decrement_function(zval *op2);
ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC);
ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
-ZEND_API void convert_to_int(zval *op);
+ZEND_API void convert_to_long(zval *op);
ZEND_API void convert_to_double(zval *op);
-ZEND_API void convert_to_int_base(zval *op, int base);
+ZEND_API void convert_to_long_base(zval *op, int base);
ZEND_API void convert_to_null(zval *op);
ZEND_API void convert_to_boolean(zval *op);
ZEND_API void convert_to_array(zval *op);
ZEND_API void convert_to_object(zval *op);
-ZEND_API void multi_convert_to_int_ex(int argc, ...);
+ZEND_API void multi_convert_to_long_ex(int argc, ...);
ZEND_API void multi_convert_to_double_ex(int argc, ...);
ZEND_API void multi_convert_to_string_ex(int argc, ...);
-ZEND_API zend_int_t _zval_get_int_func(zval *op TSRMLS_DC);
+ZEND_API zend_long _zval_get_long_func(zval *op TSRMLS_DC);
ZEND_API double _zval_get_double_func(zval *op TSRMLS_DC);
ZEND_API zend_string *_zval_get_string_func(zval *op TSRMLS_DC);
-static zend_always_inline zend_int_t _zval_get_int(zval *op TSRMLS_DC) {
- return Z_TYPE_P(op) == IS_INT ? Z_IVAL_P(op) : _zval_get_int_func(op TSRMLS_CC);
+static zend_always_inline zend_long _zval_get_long(zval *op TSRMLS_DC) {
+ return Z_TYPE_P(op) == IS_LONG ? Z_LVAL_P(op) : _zval_get_long_func(op TSRMLS_CC);
}
static zend_always_inline double _zval_get_double(zval *op TSRMLS_DC) {
return Z_TYPE_P(op) == IS_DOUBLE ? Z_DVAL_P(op) : _zval_get_double_func(op TSRMLS_CC);
}
static zend_always_inline zend_string *_zval_get_string(zval *op TSRMLS_DC) {
- return Z_TYPE_P(op) == IS_STRING ? STR_COPY(Z_STR_P(op)) : _zval_get_string_func(op TSRMLS_CC);
+ return Z_TYPE_P(op) == IS_STRING ? zend_string_copy(Z_STR_P(op)) : _zval_get_string_func(op TSRMLS_CC);
}
-#define zval_get_int(op) _zval_get_int((op) TSRMLS_CC)
+#define zval_get_long(op) _zval_get_long((op) TSRMLS_CC)
#define zval_get_double(op) _zval_get_double((op) TSRMLS_CC)
#define zval_get_string(op) _zval_get_string((op) TSRMLS_CC)
@@ -367,8 +252,6 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2
#define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); }
#define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); }
-ZEND_API double zend_string_to_double(const char *number, zend_uint length);
-
ZEND_API int zval_is_true(zval *op);
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
@@ -379,20 +262,20 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
#endif
-ZEND_API void zend_str_tolower(char *str, zend_size_t length);
-ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t length);
-ZEND_API char *zend_str_tolower_dup(const char *source, zend_size_t length);
+ZEND_API void zend_str_tolower(char *str, size_t length);
+ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, size_t length);
+ZEND_API char *zend_str_tolower_dup(const char *source, size_t length);
ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);
ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3);
-ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2);
-ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
-ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2);
-ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
-ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2);
-ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length);
+ZEND_API int zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2);
+ZEND_API int zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
+ZEND_API int zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2);
+ZEND_API int zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
+ZEND_API int zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2);
+ZEND_API int zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
@@ -400,10 +283,9 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
ZEND_API int zend_atoi(const char *str, int str_len);
-ZEND_API zend_int_t zend_atol(const char *str, int str_len);
+ZEND_API zend_long zend_atol(const char *str, int str_len);
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
-END_EXTERN_C()
#define convert_to_ex_master(pzv, lower_type, upper_type) \
if (Z_TYPE_P(pzv)!=upper_type) { \
@@ -417,8 +299,8 @@ END_EXTERN_C()
case IS_NULL: \
convert_to_null(pzv); \
break; \
- case IS_INT: \
- convert_to_int(pzv); \
+ case IS_LONG: \
+ convert_to_long(pzv); \
break; \
case IS_DOUBLE: \
convert_to_double(pzv); \
@@ -448,7 +330,7 @@ END_EXTERN_C()
}
#define convert_to_boolean_ex(pzv) convert_to_ex_master(pzv, boolean, _IS_BOOL)
-#define convert_to_int_ex(pzv) convert_to_ex_master(pzv, int, IS_INT)
+#define convert_to_long_ex(pzv) convert_to_ex_master(pzv, long, IS_LONG)
#define convert_to_double_ex(pzv) convert_to_ex_master(pzv, double, IS_DOUBLE)
#define convert_to_string_ex(pzv) convert_to_ex_master(pzv, string, IS_STRING)
#define convert_to_array_ex(pzv) convert_to_ex_master(pzv, array, IS_ARRAY)
@@ -456,7 +338,7 @@ END_EXTERN_C()
#define convert_to_null_ex(pzv) convert_to_ex_master(pzv, null, IS_NULL)
#define convert_scalar_to_number_ex(pzv) \
- if (Z_TYPE_P(pzv)!=IS_INT && Z_TYPE_P(pzv)!=IS_DOUBLE) { \
+ if (Z_TYPE_P(pzv)!=IS_LONG && Z_TYPE_P(pzv)!=IS_DOUBLE) { \
SEPARATE_ZVAL_IF_NOT_REF(pzv); \
convert_scalar_to_number(pzv TSRMLS_CC); \
}
@@ -480,7 +362,7 @@ ZEND_API void zend_update_current_locale(void);
static zend_always_inline int fast_increment_function(zval *op1)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
__asm__(
"incl (%0)\n\t"
@@ -508,11 +390,11 @@ static zend_always_inline int fast_increment_function(zval *op1)
"n"(ZVAL_OFFSETOF_TYPE)
: "cc");
#else
- if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MAX)) {
+ if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MAX)) {
/* switch to double */
- ZVAL_DOUBLE(op1, (double)ZEND_INT_MAX + 1.0);
+ ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
} else {
- Z_IVAL_P(op1)++;
+ Z_LVAL_P(op1)++;
}
#endif
return SUCCESS;
@@ -522,7 +404,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
static zend_always_inline int fast_decrement_function(zval *op1)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
__asm__(
"decl (%0)\n\t"
@@ -550,11 +432,11 @@ static zend_always_inline int fast_decrement_function(zval *op1)
"n"(ZVAL_OFFSETOF_TYPE)
: "cc");
#else
- if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MIN)) {
+ if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MIN)) {
/* switch to double */
- ZVAL_DOUBLE(op1, (double)ZEND_INT_MIN - 1.0);
+ ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
} else {
- Z_IVAL_P(op1)--;
+ Z_LVAL_P(op1)--;
}
#endif
return SUCCESS;
@@ -564,8 +446,8 @@ static zend_always_inline int fast_decrement_function(zval *op1)
static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
__asm__(
"movl (%1), %%eax\n\t"
@@ -585,7 +467,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
: "r"(&result->value),
"r"(&op1->value),
"r"(&op2->value),
- "n"(IS_INT),
+ "n"(IS_LONG),
"n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE)
: "eax","cc");
@@ -608,7 +490,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
: "r"(&result->value),
"r"(&op1->value),
"r"(&op2->value),
- "n"(IS_INT),
+ "n"(IS_LONG),
"n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE)
: "rax","cc");
@@ -619,24 +501,24 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
* have read the values of op1 and op2.
*/
- if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK)
- && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != ((Z_IVAL_P(op1) + Z_IVAL_P(op2)) & LONG_SIGN_MASK))) {
- ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) + (double) Z_IVAL_P(op2));
+ if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
+ && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) {
+ ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
} else {
- ZVAL_INT(result, Z_IVAL_P(op1) + Z_IVAL_P(op2));
+ ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2));
}
#endif
return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) + Z_DVAL_P(op2));
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2));
return SUCCESS;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
return SUCCESS;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)));
return SUCCESS;
}
}
@@ -645,8 +527,8 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
__asm__(
"movl (%1), %%eax\n\t"
@@ -670,7 +552,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
: "r"(&result->value),
"r"(&op1->value),
"r"(&op2->value),
- "n"(IS_INT),
+ "n"(IS_LONG),
"n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE)
: "eax","cc");
@@ -697,29 +579,29 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
: "r"(&result->value),
"r"(&op1->value),
"r"(&op2->value),
- "n"(IS_INT),
+ "n"(IS_LONG),
"n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE)
: "rax","cc");
#else
- ZVAL_INT(result, Z_IVAL_P(op1) - Z_IVAL_P(op2));
+ ZVAL_LONG(result, Z_LVAL_P(op1) - Z_LVAL_P(op2));
- if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(op2) & LONG_SIGN_MASK)
- && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(result) & LONG_SIGN_MASK))) {
- ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) - (double) Z_IVAL_P(op2));
+ if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
+ && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
+ ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
}
#endif
return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) - Z_DVAL_P(op2));
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2));
return SUCCESS;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2));
return SUCCESS;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)));
return SUCCESS;
}
}
@@ -728,23 +610,23 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- zend_int_t overflow;
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ zend_long overflow;
- ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1), Z_IVAL_P(op2), Z_IVAL_P(result), Z_DVAL_P(result), overflow);
- Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_INT;
+ ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
+ Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) * Z_DVAL_P(op2));
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2));
return SUCCESS;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2));
return SUCCESS;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)));
return SUCCESS;
}
}
@@ -754,20 +636,20 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
#if 0
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT) && 0) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE;
- } else if (UNEXPECTED(Z_IVAL_P(op2) == -1 && Z_IVAL_P(op1) == ZEND_INT_MIN)) {
+ } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN)) {
/* Prevent overflow error/crash */
- ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1);
- } else if (EXPECTED(Z_IVAL_P(op1) % Z_IVAL_P(op2) == 0)) {
+ ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1);
+ } else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) {
/* integer */
- ZVAL_INT(result, Z_IVAL_P(op1) / Z_IVAL_P(op2));
+ ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
} else {
- ZVAL_DOUBLE(result, ((double) Z_IVAL_P(op1)) / ((double)Z_IVAL_P(op2)));
+ ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2)));
}
return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
@@ -776,7 +658,7 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
ZVAL_BOOL(result, 0);
return FAILURE;
}
- ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) / Z_DVAL_P(op2));
+ ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2));
return SUCCESS;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) {
@@ -788,13 +670,13 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
}
ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2));
return SUCCESS;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE;
}
- ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_IVAL_P(op2)));
+ ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2)));
return SUCCESS;
}
}
@@ -804,18 +686,18 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- if (UNEXPECTED(Z_IVAL_P(op2) == 0)) {
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0);
return FAILURE;
- } else if (UNEXPECTED(Z_IVAL_P(op2) == -1)) {
- /* Prevent overflow error/crash if op1==ZEND_INT_MIN */
- ZVAL_INT(result, 0);
+ } else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
+ /* Prevent overflow error/crash if op1==ZEND_LONG_MIN */
+ ZVAL_LONG(result, 0);
return SUCCESS;
}
- ZVAL_INT(result, Z_IVAL_P(op1) % Z_IVAL_P(op2));
+ ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2));
return SUCCESS;
}
}
@@ -824,54 +706,54 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o
static zend_always_inline int fast_equal_check_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- return Z_IVAL_P(op1) == Z_IVAL_P(op2);
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ return Z_LVAL_P(op1) == Z_LVAL_P(op2);
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- return ((double)Z_IVAL_P(op1)) == Z_DVAL_P(op2);
+ return ((double)Z_LVAL_P(op1)) == Z_DVAL_P(op2);
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
return Z_DVAL_P(op1) == Z_DVAL_P(op2);
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- return Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2));
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) {
return 1;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
- if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
return 0;
} else {
- return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) == 0;
+ return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0;
}
} else {
zendi_smart_strcmp(result, op1, op2);
- return Z_IVAL_P(result) == 0;
+ return Z_LVAL_P(result) == 0;
}
}
}
compare_function(result, op1, op2 TSRMLS_CC);
- return Z_IVAL_P(result) == 0;
+ return Z_LVAL_P(result) == 0;
}
static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_IVAL_P(op1) == Z_IVAL_P(op2));
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_BOOL(result, (double)Z_IVAL_P(op1) == Z_DVAL_P(op2));
+ ZVAL_BOOL(result, (double)Z_LVAL_P(op1) == Z_DVAL_P(op2));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
return;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
@@ -880,40 +762,40 @@ static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval
ZVAL_TRUE(result);
return;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
- if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
ZVAL_FALSE(result);
return;
} else {
- ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) == 0);
+ ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
return;
}
} else {
zendi_smart_strcmp(result, op1, op2);
- ZVAL_BOOL(result, Z_IVAL_P(result) == 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
return;
}
}
}
compare_function(result, op1, op2 TSRMLS_CC);
- ZVAL_BOOL(result, Z_IVAL_P(result) == 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
}
static zend_always_inline void fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_IVAL_P(op1) != Z_IVAL_P(op2));
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_LVAL_P(op1) != Z_LVAL_P(op2));
return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_BOOL(result, (double)Z_IVAL_P(op1) != Z_DVAL_P(op2));
+ ZVAL_BOOL(result, (double)Z_LVAL_P(op1) != Z_DVAL_P(op2));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2));
return;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2)));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
@@ -922,68 +804,68 @@ static zend_always_inline void fast_not_equal_function(zval *result, zval *op1,
ZVAL_FALSE(result);
return;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
- if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) {
+ if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
ZVAL_TRUE(result);
return;
} else {
- ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) != 0);
+ ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
return;
}
} else {
zendi_smart_strcmp(result, op1, op2);
- ZVAL_BOOL(result, Z_IVAL_P(result) != 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
return;
}
}
}
compare_function(result, op1, op2 TSRMLS_CC);
- ZVAL_BOOL(result, Z_IVAL_P(result) != 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
}
static zend_always_inline void fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_IVAL_P(op1) < Z_IVAL_P(op2));
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_LVAL_P(op1) < Z_LVAL_P(op2));
return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_BOOL(result, (double)Z_IVAL_P(op1) < Z_DVAL_P(op2));
+ ZVAL_BOOL(result, (double)Z_LVAL_P(op1) < Z_DVAL_P(op2));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2));
return;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2)));
return;
}
}
compare_function(result, op1, op2 TSRMLS_CC);
- ZVAL_BOOL(result, Z_IVAL_P(result) < 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) < 0);
}
static zend_always_inline void fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
- if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) {
- if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_IVAL_P(op1) <= Z_IVAL_P(op2));
+ if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
+ if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_LVAL_P(op1) <= Z_LVAL_P(op2));
return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
- ZVAL_BOOL(result, (double)Z_IVAL_P(op1) <= Z_DVAL_P(op2));
+ ZVAL_BOOL(result, (double)Z_LVAL_P(op1) <= Z_DVAL_P(op2));
return;
}
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2));
return;
- } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) {
- ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_IVAL_P(op2)));
+ } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
+ ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2)));
return;
}
}
compare_function(result, op1, op2 TSRMLS_CC);
- ZVAL_BOOL(result, Z_IVAL_P(result) <= 0);
+ ZVAL_BOOL(result, Z_LVAL_P(result) <= 0);
}
static zend_always_inline void fast_is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
@@ -1023,29 +905,30 @@ static zend_always_inline void fast_is_not_identical_function(zval *result, zval
return SUCCESS; \
}
-/* input: buf points to the END of the buffer */
-#define _zend_print_unsigned_to_buf(buf, num, vartype, result) do { \
- char *__p = (buf); \
- vartype __num = (num); \
- *__p = '\0'; \
- do { \
- *--__p = (char) (__num % 10) + '0'; \
- __num /= 10; \
- } while (__num > 0); \
- result = __p; \
-} while (0)
+/* buf points to the END of the buffer */
+static zend_always_inline char *zend_print_ulong_to_buf(char *buf, zend_ulong num) {
+ *buf = '\0';
+ do {
+ *--buf = (char) (num % 10) + '0';
+ num /= 10;
+ } while (num > 0);
+ return buf;
+}
/* buf points to the END of the buffer */
-#define _zend_print_signed_to_buf(buf, num, vartype, result) do { \
- if (num < 0) { \
- _zend_print_unsigned_to_buf((buf), -(vartype)(num), vartype, (result)); \
- *--(result) = '-'; \
- } else { \
- _zend_print_unsigned_to_buf((buf), (num), vartype, (result)); \
- } \
-} while (0)
-
-ZEND_API zend_string *zend_int_to_str(zend_int_t num);
+static zend_always_inline char *zend_print_long_to_buf(char *buf, zend_long num) {
+ if (num < 0) {
+ char *result = zend_print_ulong_to_buf(buf, ~((zend_ulong) num) + 1);
+ *--result = '-';
+ return result;
+ } else {
+ return zend_print_ulong_to_buf(buf, num);
+ }
+}
+
+ZEND_API zend_string *zend_long_to_str(zend_long num);
+
+END_EXTERN_C()
#endif
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
new file mode 100644
index 0000000000..1705965c6b
--- /dev/null
+++ b/Zend/zend_portability.h
@@ -0,0 +1,399 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andi Gutmans <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Dmitry Stogov <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef ZEND_PORTABILITY_H
+#define ZEND_PORTABILITY_H
+
+#ifdef __cplusplus
+#define BEGIN_EXTERN_C() extern "C" {
+#define END_EXTERN_C() }
+#else
+#define BEGIN_EXTERN_C()
+#define END_EXTERN_C()
+#endif
+
+/*
+ * general definitions
+ */
+
+#ifdef ZEND_WIN32
+# include "zend_config.w32.h"
+# define ZEND_PATHS_SEPARATOR ';'
+#elif defined(NETWARE)
+# include <zend_config.h>
+# define ZEND_PATHS_SEPARATOR ';'
+#elif defined(__riscos__)
+# include <zend_config.h>
+# define ZEND_PATHS_SEPARATOR ';'
+#else
+# include <zend_config.h>
+# define ZEND_PATHS_SEPARATOR ':'
+#endif
+
+#include "../TSRM/TSRM.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef HAVE_UNIX_H
+# include <unix.h>
+#endif
+
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
+#endif
+
+#ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
+# include <alloca.h>
+#endif
+
+/* Only use this macro if you know for sure that all of the switches values
+ are covered by its case statements */
+#if ZEND_DEBUG
+# define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSERT(0); break;
+#elif defined(ZEND_WIN32)
+# define EMPTY_SWITCH_DEFAULT_CASE() default: __assume(0); break;
+#else
+# define EMPTY_SWITCH_DEFAULT_CASE()
+#endif
+
+/* all HAVE_XXX test have to be after the include of zend_config above */
+
+#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
+
+# ifndef RTLD_LAZY
+# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
+# endif
+
+# ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
+# endif
+
+# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
+# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
+# elif defined(RTLD_DEEPBIND)
+# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
+# else
+# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
+# endif
+# define DL_UNLOAD dlclose
+# if defined(DLSYM_NEEDS_UNDERSCORE)
+# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
+# else
+# define DL_FETCH_SYMBOL dlsym
+# endif
+# define DL_ERROR dlerror
+# define DL_HANDLE void *
+# define ZEND_EXTENSIONS_SUPPORT 1
+#elif defined(ZEND_WIN32)
+# define DL_LOAD(libname) LoadLibrary(libname)
+# define DL_FETCH_SYMBOL GetProcAddress
+# define DL_UNLOAD FreeLibrary
+# define DL_HANDLE HMODULE
+# define ZEND_EXTENSIONS_SUPPORT 1
+#else
+# define DL_HANDLE void *
+# define ZEND_EXTENSIONS_SUPPORT 0
+#endif
+
+/* AIX requires this to be the first thing in the file. */
+#ifndef __GNUC__
+# ifndef HAVE_ALLOCA_H
+# ifdef _AIX
+# pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca();
+# endif
+# endif
+# endif
+#endif
+
+/* Compatibility with non-clang compilers */
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
+/* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
+#ifdef __GNUC__
+# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#else
+# define ZEND_GCC_VERSION 0
+#endif
+
+#if ZEND_GCC_VERSION >= 2096
+# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+#else
+# define ZEND_ATTRIBUTE_MALLOC
+#endif
+
+#if ZEND_GCC_VERSION >= 4003 || __has_attribute(alloc_size)
+# define ZEND_ATTRIBUTE_ALLOC_SIZE(X) __attribute__ ((alloc_size(X)))
+# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y) __attribute__ ((alloc_size(X,Y)))
+#else
+# define ZEND_ATTRIBUTE_ALLOC_SIZE(X)
+# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y)
+#endif
+
+/* Format string checks are disabled by default, because we use custom format modifiers (like %p),
+ * which cause a large amount of false positives. You can enable format checks by adding
+ * -DZEND_CHECK_FORMAT_STRINGS to CFLAGS. */
+
+#if defined(ZEND_CHECK_FORMAT_STRINGS) && (ZEND_GCC_VERSION >= 2007 || __has_attribute(format))
+# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
+#else
+# define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
+#endif
+
+#if defined(ZEND_CHECK_FORMAT_STRINGS) && ((ZEND_GCC_VERSION >= 3001 && !defined(__INTEL_COMPILER)) || __has_attribute(format))
+# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
+#else
+# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
+#endif
+
+#if ZEND_GCC_VERSION >= 3001 || __has_attribute(deprecated)
+# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
+#elif defined(ZEND_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1300
+# define ZEND_ATTRIBUTE_DEPRECATED __declspec(deprecated)
+#else
+# define ZEND_ATTRIBUTE_DEPRECATED
+#endif
+
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
+# define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
+# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused));
+#else
+# define ZEND_ATTRIBUTE_UNUSED
+# define ZEND_ATTRIBUTE_UNUSED_LABEL
+#endif
+
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
+# define ZEND_FASTCALL __attribute__((fastcall))
+#elif defined(_MSC_VER) && defined(_M_IX86)
+# define ZEND_FASTCALL __fastcall
+#else
+# define ZEND_FASTCALL
+#endif
+
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004
+#else
+# define __restrict__
+#endif
+#define restrict __restrict__
+
+#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn)
+# define HAVE_NORETURN
+# define ZEND_NORETURN __attribute__((noreturn))
+#elif defined(ZEND_WIN32)
+# define HAVE_NORETURN
+# define ZEND_NORETURN __declspec(noreturn)
+#else
+# define ZEND_NORETURN
+#endif
+
+#if ZEND_DEBUG
+# define zend_always_inline inline
+# define zend_never_inline
+#else
+# if defined(__GNUC__)
+# if __GNUC__ >= 3
+# define zend_always_inline inline __attribute__((always_inline))
+# define zend_never_inline __attribute__((noinline))
+# else
+# define zend_always_inline inline
+# define zend_never_inline
+# endif
+# elif defined(_MSC_VER)
+# define zend_always_inline __forceinline
+# define zend_never_inline
+# else
+# if __has_attribute(always_inline)
+# define zend_always_inline inline __attribute__((always_inline))
+# else
+# define zend_always_inline inline
+# endif
+# if __has_attribute(noinline)
+# define zend_never_inline __attribute__((noinline))
+# else
+# define zend_never_inline
+# endif
+# endif
+#endif /* ZEND_DEBUG */
+
+#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
+# define EXPECTED(condition) __builtin_expect(!(!(condition)), 1)
+# define UNEXPECTED(condition) __builtin_expect(!(!(condition)), 0)
+#else
+# define EXPECTED(condition) (condition)
+# define UNEXPECTED(condition) (condition)
+#endif
+
+#ifndef XtOffsetOf
+# if defined(CRAY) || (defined(__ARMCC_VERSION) && !defined(LINUX))
+# ifdef __STDC__
+# define XtOffset(p_type, field) _Offsetof(p_type, field)
+# else
+# ifdef CRAY2
+# define XtOffset(p_type, field) \
+ (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
+
+# else /* !CRAY2 */
+
+# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
+
+# endif /* !CRAY2 */
+# endif /* __STDC__ */
+# else /* ! (CRAY || __arm) */
+
+# define XtOffset(p_type, field) \
+ ((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+
+# endif /* !CRAY */
+
+# ifdef offsetof
+# define XtOffsetOf(s_type, field) offsetof(s_type, field)
+# else
+# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
+# endif
+
+#endif
+
+#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
+# define ZEND_ALLOCA_MAX_SIZE (32 * 1024)
+# define ALLOCA_FLAG(name) \
+ zend_bool name;
+# define SET_ALLOCA_FLAG(name) \
+ name = 1
+# define do_alloca_ex(size, limit, use_heap) \
+ ((use_heap = (UNEXPECTED((size) > (limit)))) ? emalloc(size) : alloca(size))
+# define do_alloca(size, use_heap) \
+ do_alloca_ex(size, ZEND_ALLOCA_MAX_SIZE, use_heap)
+# define free_alloca(p, use_heap) \
+ do { if (UNEXPECTED(use_heap)) efree(p); } while (0)
+#else
+# define ALLOCA_FLAG(name)
+# define SET_ALLOCA_FLAG(name)
+# define do_alloca(p, use_heap) emalloc(p)
+# define free_alloca(p, use_heap) efree(p)
+#endif
+
+#ifdef HAVE_SIGSETJMP
+# define SETJMP(a) sigsetjmp(a, 0)
+# define LONGJMP(a,b) siglongjmp(a, b)
+# define JMP_BUF sigjmp_buf
+#else
+# define SETJMP(a) setjmp(a)
+# define LONGJMP(a,b) longjmp(a, b)
+# define JMP_BUF jmp_buf
+#endif
+
+#if ZEND_DEBUG
+# define ZEND_FILE_LINE_D const char *__zend_filename, const uint __zend_lineno
+# define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
+# define ZEND_FILE_LINE_ORIG_D const char *__zend_orig_filename, const uint __zend_orig_lineno
+# define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
+# define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
+# define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
+# define ZEND_FILE_LINE_C __FILE__, __LINE__
+# define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
+# define ZEND_FILE_LINE_EMPTY_C NULL, 0
+# define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
+# define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
+# define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
+# define ZEND_ASSERT(c) assert(c)
+#else
+# define ZEND_FILE_LINE_D
+# define ZEND_FILE_LINE_DC
+# define ZEND_FILE_LINE_ORIG_D
+# define ZEND_FILE_LINE_ORIG_DC
+# define ZEND_FILE_LINE_RELAY_C
+# define ZEND_FILE_LINE_RELAY_CC
+# define ZEND_FILE_LINE_C
+# define ZEND_FILE_LINE_CC
+# define ZEND_FILE_LINE_EMPTY_C
+# define ZEND_FILE_LINE_EMPTY_CC
+# define ZEND_FILE_LINE_ORIG_RELAY_C
+# define ZEND_FILE_LINE_ORIG_RELAY_CC
+# define ZEND_ASSERT(c)
+#endif /* ZEND_DEBUG */
+
+#if ZEND_DEBUG
+# define Z_DBG(expr) (expr)
+#else
+# define Z_DBG(expr)
+#endif
+
+#ifdef ZTS
+# define ZTS_V 1
+#else
+# define ZTS_V 0
+#endif
+
+#ifndef LONG_MAX
+# define LONG_MAX 2147483647L
+#endif
+
+#ifndef LONG_MIN
+# define LONG_MIN (- LONG_MAX - 1)
+#endif
+
+#define MAX_LENGTH_OF_DOUBLE 32
+
+#undef MIN
+#undef MAX
+#define MAX(a, b) (((a)>(b))?(a):(b))
+#define MIN(a, b) (((a)<(b))?(a):(b))
+#define ZEND_STRL(str) (str), (sizeof(str)-1)
+#define ZEND_STRS(str) (str), (sizeof(str))
+#define ZEND_NORMALIZE_BOOL(n) \
+ ((n) ? (((n)>0) ? 1 : -1) : 0)
+#define ZEND_TRUTH(x) ((x) ? 1 : 0)
+#define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
+
+#define ZEND_MAX_RESERVED_RESOURCES 4
+
+/* excpt.h on Digital Unix 4.0 defines function_table */
+#undef function_table
+
+#ifdef ZEND_WIN32
+#define ZEND_SECURE_ZERO(var, size) RtlSecureZeroMemory((var), (size))
+#else
+#define ZEND_SECURE_ZERO(var, size) memset((var), 0, (size))
+#endif
+
+#endif /* ZEND_PORTABILITY_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h
index ecd7b7042a..8a3dede91e 100644
--- a/Zend/zend_ptr_stack.h
+++ b/Zend/zend_ptr_stack.h
@@ -111,7 +111,7 @@ static zend_always_inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
return *(--stack->top_element);
}
-static inline void *zend_ptr_stack_top(zend_ptr_stack *stack)
+static zend_always_inline void *zend_ptr_stack_top(zend_ptr_stack *stack)
{
return stack->elements[stack->top - 1];
}
diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c
index 16d513e93c..a27a3c281f 100644
--- a/Zend/zend_qsort.c
+++ b/Zend/zend_qsort.c
@@ -74,7 +74,7 @@ ZEND_API void zend_qsort_r(void *base, size_t nmemb, size_t siz, compare_r_func_
end = end_stack[loop];
while (begin < end) {
- offset = (end - begin) >> Z_I(1);
+ offset = (end - begin) >> Z_L(1);
_zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz);
seg1 = begin + siz;
diff --git a/Zend/zend_smart_str.h b/Zend/zend_smart_str.h
new file mode 100644
index 0000000000..2724ac7323
--- /dev/null
+++ b/Zend/zend_smart_str.h
@@ -0,0 +1,125 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 7 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2014 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Sascha Schumann <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+ */
+
+#ifndef ZEND_SMART_STR_H
+#define ZEND_SMART_STR_H
+
+#include <zend.h>
+#include "zend_smart_str_public.h"
+
+#ifndef SMART_STR_PREALLOC
+#define SMART_STR_PREALLOC 128
+#endif
+
+#ifndef SMART_STR_START_SIZE
+#define SMART_STR_START_SIZE 78
+#endif
+
+#define smart_str_appends_ex(dest, src, what) \
+ smart_str_appendl_ex((dest), (src), strlen(src), (what))
+#define smart_str_appends(dest, src) \
+ smart_str_appendl((dest), (src), strlen(src))
+#define smart_str_appendc(dest, c) \
+ smart_str_appendc_ex((dest), (c), 0)
+#define smart_str_appendl(dest, src, len) \
+ smart_str_appendl_ex((dest), (src), (len), 0)
+#define smart_str_append(dest, src) \
+ smart_str_append_ex((dest), (src), 0)
+#define smart_str_append_smart_str(dest, src) \
+ smart_str_append_smart_str_ex((dest), (src), 0)
+#define smart_str_sets(dest, src) \
+ smart_str_setl((dest), (src), strlen(src));
+#define smart_str_append_long(dest, val) \
+ smart_str_append_long_ex((dest), (val), 0)
+#define smart_str_append_unsigned(dest, val) \
+ smart_str_append_unsigned_ex((dest), (val), 0)
+
+static zend_always_inline size_t smart_str_alloc(smart_str *str, size_t len, zend_bool persistent) {
+ size_t newlen;
+ if (!str->s) {
+ newlen = len;
+ str->a = newlen < SMART_STR_START_SIZE
+ ? SMART_STR_START_SIZE
+ : newlen + SMART_STR_PREALLOC;
+ str->s = zend_string_alloc(str->a, persistent);
+ str->s->len = 0;
+ } else {
+ newlen = str->s->len + len;
+ if (newlen >= str->a) {
+ str->a = newlen + SMART_STR_PREALLOC;
+ str->s = (zend_string *) perealloc(str->s, _STR_HEADER_SIZE + str->a + 1, persistent);
+ }
+ }
+ return newlen;
+}
+
+static zend_always_inline void smart_str_free(smart_str *str) {
+ if (str->s) {
+ zend_string_release(str->s);
+ str->s = NULL;
+ }
+ str->a = 0;
+}
+
+static zend_always_inline void smart_str_0(smart_str *str) {
+ if (str->s) {
+ str->s->val[str->s->len] = '\0';
+ }
+}
+
+static zend_always_inline void smart_str_appendc_ex(smart_str *dest, char ch, zend_bool persistent) {
+ size_t new_len = smart_str_alloc(dest, 1, persistent);
+ dest->s->val[new_len - 1] = ch;
+ dest->s->len = new_len;
+}
+
+static zend_always_inline void smart_str_appendl_ex(smart_str *dest, const char *str, size_t len, zend_bool persistent) {
+ size_t new_len = smart_str_alloc(dest, len, persistent);
+ memcpy(dest->s->val + dest->s->len, str, len);
+ dest->s->len = new_len;
+}
+
+static zend_always_inline void smart_str_append_ex(smart_str *dest, const zend_string *src, zend_bool persistent) {
+ smart_str_appendl_ex(dest, src->val, src->len, persistent);
+}
+
+static zend_always_inline void smart_str_append_smart_str_ex(smart_str *dest, const smart_str *src, zend_bool persistent) {
+ if (src->s && src->s->len) {
+ smart_str_append_ex(dest, src->s, persistent);
+ }
+}
+
+static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_long num, zend_bool persistent) {
+ char buf[32];
+ char *result = zend_print_long_to_buf(buf + sizeof(buf) - 1, num);
+ smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
+}
+
+static zend_always_inline void smart_str_append_unsigned_ex(smart_str *dest, zend_ulong num, zend_bool persistent) {
+ char buf[32];
+ char *result = zend_print_ulong_to_buf(buf + sizeof(buf) - 1, num);
+ smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
+}
+
+static zend_always_inline void smart_str_setl(smart_str *dest, const char *src, size_t len) {
+ smart_str_free(dest);
+ smart_str_appendl(dest, src, len);
+}
+
+#endif
+
diff --git a/ext/standard/php_smart_str_public.h b/Zend/zend_smart_str_public.h
index 7ce299e442..23abe8e064 100644
--- a/ext/standard/php_smart_str_public.h
+++ b/Zend/zend_smart_str_public.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -16,12 +16,8 @@
+----------------------------------------------------------------------+
*/
-/* $Id$ */
-
-#ifndef PHP_SMART_STR_PUBLIC_H
-#define PHP_SMART_STR_PUBLIC_H
-
-#include <sys/types.h>
+#ifndef ZEND_SMART_STR_PUBLIC_H
+#define ZEND_SMART_STR_PUBLIC_H
typedef struct {
zend_string *s;
diff --git a/Zend/zend_static_allocator.c b/Zend/zend_static_allocator.c
deleted file mode 100644
index 71338d211e..0000000000
--- a/Zend/zend_static_allocator.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "zend_static_allocator.h"
-
-/* Not checking emalloc() and erealloc() return values as they are supposed to bailout */
-
-inline static void block_init(Block *block, zend_uint block_size)
-{
- block->pos = block->bp = (char *) emalloc(block_size);
- block->end = block->bp + block_size;
-}
-
-inline static char *block_allocate(Block *block, zend_uint size)
-{
- char *retval = block->pos;
- if ((block->pos += size) >= block->end) {
- return (char *)NULL;
- }
- return retval;
-}
-
-inline static void block_destroy(Block *block)
-{
- efree(block->bp);
-}
-
-void static_allocator_init(StaticAllocator *sa)
-{
- sa->Blocks = (Block *) emalloc(sizeof(Block));
- block_init(sa->Blocks, ALLOCATOR_BLOCK_SIZE);
- sa->num_blocks = 1;
- sa->current_block = 0;
-}
-
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size)
-{
- char *retval;
-
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- if (retval) {
- return retval;
- }
- sa->Blocks = (Block *) erealloc(sa->Blocks, ++sa->num_blocks);
- sa->current_block++;
- block_init(&sa->Blocks[sa->current_block], (size > ALLOCATOR_BLOCK_SIZE) ? size : ALLOCATOR_BLOCK_SIZE);
- retval = block_allocate(&sa->Blocks[sa->current_block], size);
- return retval;
-}
-
-void static_allocator_destroy(StaticAllocator *sa)
-{
- zend_uint i;
-
- for (i=0; i<sa->num_blocks; i++) {
- block_free(&sa->Blocks[i]);
- }
- efree(sa->Blocks);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_static_allocator.h b/Zend/zend_static_allocator.h
deleted file mode 100644
index 7516065707..0000000000
--- a/Zend/zend_static_allocator.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef ZEND_STATIC_ALLOCATOR_H
-#define ZEND_STATIC_ALLOCATOR_H
-
-#define ALLOCATOR_BLOCK_SIZE 400000
-
-/* Temporary */
-typedef unsigned int zend_uint;
-#define emalloc(s) malloc(s)
-#define efree(p) free(p)
-
-typedef struct _Block {
- char *bp;
- char *pos;
- char *end;
-} Block;
-
-typedef struct _StaticAllocator {
- Block *Blocks;
- zend_uint num_blocks;
- zend_uint current_block;
-} StaticAllocator;
-
-void static_allocator_init(StaticAllocator *sa);
-char *static_allocator_allocate(StaticAllocator *sa, zend_uint size);
-void static_allocator_destroy(StaticAllocator *sa);
-
-#endif /* ZEND_STATIC_ALLOCATOR_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c
index b144432db9..f67f59af4a 100644
--- a/Zend/zend_stream.c
+++ b/Zend/zend_stream.c
@@ -105,7 +105,7 @@ static inline int zend_stream_is_mmap(zend_file_handle *file_handle) { /* {{{ */
static size_t zend_stream_fsize(zend_file_handle *file_handle TSRMLS_DC) /* {{{ */
{
- struct stat buf;
+ zend_stat_t buf;
if (zend_stream_is_mmap(file_handle)) {
return file_handle->handle.stream.mmap.len;
@@ -113,7 +113,7 @@ static size_t zend_stream_fsize(zend_file_handle *file_handle TSRMLS_DC) /* {{{
if (file_handle->type == ZEND_HANDLE_STREAM || file_handle->type == ZEND_HANDLE_MAPPED) {
return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle TSRMLS_CC);
}
- if (file_handle->handle.fp && fstat(fileno(file_handle->handle.fp), &buf) == 0) {
+ if (file_handle->handle.fp && zend_fstat(fileno(file_handle->handle.fp), &buf) == 0) {
#ifdef S_ISREG
if (!S_ISREG(buf.st_mode)) {
return 0;
@@ -236,7 +236,7 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t
/* *buf[size] is zeroed automatically by the kernel */
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
if (*buf != MAP_FAILED) {
- zend_int_t offset = ftell(file_handle->handle.fp);
+ zend_long offset = ftell(file_handle->handle.fp);
file_handle->handle.stream.mmap.map = *buf;
if (offset != -1) {
diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h
index 10fa8d8a60..84dc2e00b8 100644
--- a/Zend/zend_stream.h
+++ b/Zend/zend_stream.h
@@ -63,14 +63,14 @@ typedef struct _zend_stream {
} zend_stream;
typedef struct _zend_file_handle {
- zend_stream_type type;
- const char *filename;
- char *opened_path;
union {
int fd;
FILE *fp;
zend_stream stream;
} handle;
+ const char *filename;
+ char *opened_path;
+ zend_stream_type type;
zend_bool free_filename;
} zend_file_handle;
diff --git a/Zend/zend_string.c b/Zend/zend_string.c
index 5a4f4e1fc5..1833bbd241 100644
--- a/Zend/zend_string.c
+++ b/Zend/zend_string.c
@@ -29,40 +29,36 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC);
static void zend_interned_strings_snapshot_int(TSRMLS_D);
static void zend_interned_strings_restore_int(TSRMLS_D);
-ZEND_API zend_uint_t zend_hash_func(const char *str, zend_size_t len)
+ZEND_API zend_ulong zend_hash_func(const char *str, size_t len)
{
return zend_inline_hash_func(str, len);
}
+#ifndef ZTS
static void _str_dtor(zval *zv)
{
zend_string *str = Z_STR_P(zv);
GC_FLAGS(str) &= ~IS_STR_INTERNED;
GC_REFCOUNT(str) = 1;
}
+#endif
void zend_interned_strings_init(TSRMLS_D)
{
+#ifndef ZTS
zend_string *str;
-#ifndef ZTS
zend_hash_init(&CG(interned_strings), 1024, NULL, _str_dtor, 1);
CG(interned_strings).nTableMask = CG(interned_strings).nTableSize - 1;
CG(interned_strings).arData = (Bucket*) pecalloc(CG(interned_strings).nTableSize, sizeof(Bucket), 1);
- CG(interned_strings).arHash = (zend_uint*) pecalloc(CG(interned_strings).nTableSize, sizeof(zend_uint), 1);
- memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(zend_uint));
+ CG(interned_strings).arHash = (uint32_t*) pecalloc(CG(interned_strings).nTableSize, sizeof(uint32_t), 1);
+ memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(uint32_t));
/* interned empty string */
- str = STR_ALLOC(sizeof("")-1, 1);
+ str = zend_string_alloc(sizeof("")-1, 1);
str->val[0] = '\000';
CG(empty_string) = zend_new_interned_string_int(str TSRMLS_CC);
-#else
- str = STR_ALLOC(sizeof("")-1, 1);
- str->val[0] = '\000';
- STR_HASH_VAL(str);
- str->gc.u.v.flags |= IS_STR_INTERNED;
- CG(empty_string) = str;
#endif
/* one char strings (the actual interned strings are going to be created by ext/opcache) */
@@ -77,15 +73,13 @@ void zend_interned_strings_dtor(TSRMLS_D)
{
#ifndef ZTS
zend_hash_destroy(&CG(interned_strings));
-#else
- free(CG(empty_string));
#endif
}
static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
{
#ifndef ZTS
- zend_uint_t h;
+ zend_ulong h;
uint nIndex;
uint idx;
Bucket *p;
@@ -94,14 +88,14 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
return str;
}
- h = STR_HASH_VAL(str);
+ h = zend_string_hash_val(str);
nIndex = h & CG(interned_strings).nTableMask;
idx = CG(interned_strings).arHash[nIndex];
while (idx != INVALID_IDX) {
p = CG(interned_strings).arData + idx;
if ((p->h == h) && (p->key->len == str->len)) {
if (!memcmp(p->key->val, str->val, str->len)) {
- STR_RELEASE(str);
+ zend_string_release(str);
return p->key;
}
}
@@ -114,7 +108,7 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
if (CG(interned_strings).nNumUsed >= CG(interned_strings).nTableSize) {
if ((CG(interned_strings).nTableSize << 1) > 0) { /* Let's double the table size */
Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), 1);
- zend_uint *h = (zend_uint *) perealloc_recoverable(CG(interned_strings).arHash, (CG(interned_strings).nTableSize << 1) * sizeof(zend_uint), 1);
+ uint32_t *h = (uint32_t *) perealloc_recoverable(CG(interned_strings).arHash, (CG(interned_strings).nTableSize << 1) * sizeof(uint32_t), 1);
if (d && h) {
HANDLE_BLOCK_INTERRUPTIONS();
@@ -182,7 +176,7 @@ static void zend_interned_strings_restore_int(TSRMLS_D)
GC_FLAGS(p->key) &= ~IS_STR_INTERNED;
GC_REFCOUNT(p->key) = 1;
- STR_FREE(p->key);
+ zend_string_free(p->key);
nIndex = p->h & CG(interned_strings).nTableMask;
if (CG(interned_strings).arHash[nIndex] == idx) {
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index f30ae29941..1da3b511c0 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -29,7 +29,7 @@ ZEND_API extern zend_string *(*zend_new_interned_string)(zend_string *str TSRMLS
ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D);
ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D);
-ZEND_API zend_uint_t zend_hash_func(const char *str, zend_size_t len);
+ZEND_API zend_ulong zend_hash_func(const char *str, size_t len);
void zend_interned_strings_init(TSRMLS_D);
void zend_interned_strings_dtor(TSRMLS_D);
@@ -37,21 +37,6 @@ END_EXTERN_C()
#define IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED)
-#define STR_HASH_VAL(s) zend_str_hash_val(s)
-#define STR_FORGET_HASH_VAL(s) zend_str_forget_hash_val(s)
-
-#define STR_REFCOUNT(s) zend_str_refcount(s)
-#define STR_ADDREF(s) zend_str_addref(s)
-#define STR_DELREF(s) zend_str_delref(s)
-#define STR_ALLOC(len, persistent) zend_str_alloc(len, persistent)
-#define STR_SAFE_ALLOC(n, m, l, p) zend_str_safe_alloc(n, m, l, p)
-#define STR_INIT(str, len, persistent) zend_str_init(str, len, persistent)
-#define STR_COPY(s) zend_str_copy(s)
-#define STR_DUP(s, persistent) zend_str_dup(s, persistent)
-#define STR_REALLOC(s, len, persistent) zend_str_realloc(s, len, persistent)
-#define STR_SAFE_REALLOC(s, n, m, l, p) zend_str_safe_realloc(s, n, m, l, p)
-#define STR_FREE(s) zend_str_free(s)
-#define STR_RELEASE(s) zend_str_release(s)
#define STR_EMPTY_ALLOC() CG(empty_string)
#define _STR_HEADER_SIZE XtOffsetOf(zend_string, val)
@@ -70,7 +55,7 @@ END_EXTERN_C()
#define STR_ALLOCA_FREE(str, use_heap) free_alloca(str, use_heap)
-static zend_always_inline zend_uint_t zend_str_hash_val(zend_string *s)
+static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
{
if (!s->h) {
s->h = zend_hash_func(s->val, s->len);
@@ -78,12 +63,12 @@ static zend_always_inline zend_uint_t zend_str_hash_val(zend_string *s)
return s->h;
}
-static zend_always_inline void zend_str_forget_hash_val(zend_string *s)
+static zend_always_inline void zend_string_forget_hash_val(zend_string *s)
{
s->h = 0;
}
-static zend_always_inline zend_uint zend_str_refcount(zend_string *s)
+static zend_always_inline uint32_t zend_string_refcount(zend_string *s)
{
if (!IS_INTERNED(s)) {
return GC_REFCOUNT(s);
@@ -91,7 +76,7 @@ static zend_always_inline zend_uint zend_str_refcount(zend_string *s)
return 1;
}
-static zend_always_inline zend_uint zend_str_addref(zend_string *s)
+static zend_always_inline uint32_t zend_string_addref(zend_string *s)
{
if (!IS_INTERNED(s)) {
return ++GC_REFCOUNT(s);
@@ -99,7 +84,7 @@ static zend_always_inline zend_uint zend_str_addref(zend_string *s)
return 1;
}
-static zend_always_inline zend_uint zend_str_delref(zend_string *s)
+static zend_always_inline uint32_t zend_string_delref(zend_string *s)
{
if (!IS_INTERNED(s)) {
return --GC_REFCOUNT(s);
@@ -107,7 +92,7 @@ static zend_always_inline zend_uint zend_str_delref(zend_string *s)
return 1;
}
-static zend_always_inline zend_string *zend_str_alloc(zend_size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent)
{
zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent);
@@ -125,7 +110,7 @@ static zend_always_inline zend_string *zend_str_alloc(zend_size_t len, int persi
return ret;
}
-static zend_always_inline zend_string *zend_str_safe_alloc(size_t n, size_t m, size_t l, int persistent)
+static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent)
{
zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + l + 1), persistent);
@@ -143,87 +128,98 @@ static zend_always_inline zend_string *zend_str_safe_alloc(size_t n, size_t m, s
return ret;
}
-static zend_always_inline zend_string *zend_str_init(const char *str, zend_size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent)
{
- zend_string *ret = STR_ALLOC(len, persistent);
+ zend_string *ret = zend_string_alloc(len, persistent);
memcpy(ret->val, str, len);
ret->val[len] = '\0';
return ret;
}
-static zend_always_inline zend_string *zend_str_copy(zend_string *s)
+static zend_always_inline zend_string *zend_string_copy(zend_string *s)
{
if (!IS_INTERNED(s)) {
- STR_ADDREF(s);
+ GC_REFCOUNT(s)++;
}
return s;
}
-static zend_always_inline zend_string *zend_str_dup(zend_string *s, int persistent)
+static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent)
{
if (IS_INTERNED(s)) {
return s;
} else {
- return STR_INIT(s->val, s->len, persistent);
+ return zend_string_init(s->val, s->len, persistent);
}
}
-static zend_always_inline zend_string *zend_str_realloc(zend_string *s, zend_size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent)
{
zend_string *ret;
if (IS_INTERNED(s)) {
- ret = STR_ALLOC(len, persistent);
+ ret = zend_string_alloc(len, persistent);
memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
- } else if (EXPECTED(STR_REFCOUNT(s) == 1)) {
+ } else if (EXPECTED(GC_REFCOUNT(s) == 1)) {
ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent);
ret->len = len;
- STR_FORGET_HASH_VAL(ret);
+ zend_string_forget_hash_val(ret);
} else {
- ret = STR_ALLOC(len, persistent);
+ ret = zend_string_alloc(len, persistent);
memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
- STR_DELREF(s);
+ GC_REFCOUNT(s)--;
}
return ret;
}
-static zend_always_inline zend_string *zend_str_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent)
+static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent)
{
zend_string *ret;
if (IS_INTERNED(s)) {
- ret = STR_SAFE_ALLOC(n, m, l, persistent);
+ ret = zend_string_safe_alloc(n, m, l, persistent);
memcpy(ret->val, s->val, ((n * m) + l > (size_t)s->len ? (size_t)s->len : ((n * m) + l)) + 1);
- } else if (STR_REFCOUNT(s) == 1) {
+ } else if (GC_REFCOUNT(s) == 1) {
ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + l + 1), persistent);
ret->len = (n * m) + l;
- STR_FORGET_HASH_VAL(ret);
+ zend_string_forget_hash_val(ret);
} else {
- ret = STR_SAFE_ALLOC(n, m, l, persistent);
+ ret = zend_string_safe_alloc(n, m, l, persistent);
memcpy(ret->val, s->val, ((n * m) + l > (size_t)s->len ? (size_t)s->len : ((n * m) + l)) + 1);
- STR_DELREF(s);
+ GC_REFCOUNT(s)--;
}
return ret;
}
-static zend_always_inline void zend_str_free(zend_string *s)
+static zend_always_inline void zend_string_free(zend_string *s)
{
if (!IS_INTERNED(s)) {
- ZEND_ASSERT(STR_REFCOUNT(s) <= 1);
+ ZEND_ASSERT(GC_REFCOUNT(s) <= 1);
pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
}
}
-static zend_always_inline void zend_str_release(zend_string *s)
+static zend_always_inline void zend_string_release(zend_string *s)
{
if (!IS_INTERNED(s)) {
- if (STR_DELREF(s) == 0) {
+ if (--GC_REFCOUNT(s) == 0) {
pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
}
}
}
+static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_string *s2)
+{
+ return s1 == s2 || (s1->len == s2->len && !memcmp(s1->val, s2->val, s1->len));
+}
+
+#define zend_string_equals_literal_ci(str, c) \
+ ((str)->len == sizeof(c) - 1 && !zend_binary_strcasecmp((str)->val, (str)->len, (c), sizeof(c) - 1))
+
+#define zend_string_equals_literal(str, literal) \
+ ((str)->len == sizeof(literal)-1 && !memcmp((str)->val, literal, sizeof(literal) - 1))
+
/*
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
*
@@ -257,9 +253,9 @@ static zend_always_inline void zend_str_release(zend_string *s)
* -- Ralf S. Engelschall <rse@engelschall.com>
*/
-static inline zend_uint_t zend_inline_hash_func(const char *str, zend_size_t len)
+static zend_always_inline zend_ulong zend_inline_hash_func(const char *str, size_t len)
{
- register zend_uint_t hash = Z_UI(5381);
+ register zend_ulong hash = Z_UL(5381);
/* variant with the hash unrolled eight times */
for (; len >= 8; len -= 8) {
@@ -286,6 +282,30 @@ EMPTY_SWITCH_DEFAULT_CASE()
return hash;
}
+static zend_always_inline void zend_interned_empty_string_init(zend_string **s TSRMLS_DC)
+{
+ zend_string *str;
+
+ str = zend_string_alloc(sizeof("")-1, 1);
+ str->val[0] = '\000';
+
+#ifndef ZTS
+ *s = zend_new_interned_string(str TSRMLS_CC);
+#else
+ zend_string_hash_val(str);
+ str->gc.u.v.flags |= IS_STR_INTERNED;
+ *s = str;
+#endif
+}
+
+static zend_always_inline void zend_interned_empty_string_free(zend_string **s TSRMLS_DC)
+{
+ if (NULL != *s) {
+ free(*s);
+ *s = NULL;
+ }
+}
+
#endif /* ZEND_STRING_H */
/*
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
index 9d55933e0a..43f02b48f8 100644
--- a/Zend/zend_ts_hash.c
+++ b/Zend/zend_ts_hash.c
@@ -110,12 +110,12 @@ ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zv
return retval;
}
-ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_ts_hash_index_add_or_update(TsHashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC)
{
zval *retval;
begin_write(ht);
- retval = _zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, flag ZEND_FILE_LINE_RELAY_CC);
+ retval = _zend_hash_index_add_or_update(TS_HASH(ht), h, pData, flag ZEND_FILE_LINE_RELAY_CC);
end_write(ht);
return retval;
@@ -187,7 +187,7 @@ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key)
return retval;
}
-ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_uint_t h)
+ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h)
{
int retval;
@@ -209,7 +209,7 @@ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key)
return retval;
}
-ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t h)
+ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong h)
{
zval *retval;
@@ -231,7 +231,7 @@ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key)
return retval;
}
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h)
+ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h)
{
int retval;
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
index ceb7cbf1fe..6cb36410b8 100644
--- a/Zend/zend_ts_hash.h
+++ b/Zend/zend_ts_hash.h
@@ -25,7 +25,7 @@
typedef struct _zend_ts_hashtable {
HashTable hash;
- zend_uint reader;
+ uint32_t reader;
#ifdef ZTS
MUTEX_T mx_reader;
MUTEX_T mx_writer;
@@ -55,11 +55,11 @@ ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zv
#define zend_ts_hash_add(ht, key, pData) \
_zend_ts_hash_add_or_update(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC)
-ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC);
+ZEND_API zval *_zend_ts_hash_index_add_or_update(TsHashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC);
#define zend_ts_hash_index_update(ht, h, pData) \
- _zend_ts_hash_index_update_or_next_insert(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+ _zend_ts_hash_index_add_or_update(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
#define zend_ts_hash_next_index_insert(ht, pData) \
- _zend_ts_hash_index_update_or_next_insert(ht, 0, pData, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
+ _zend_ts_hash_index_add_or_update(ht, ht->nNextFreeElement, pData, HASH_ADD ZEND_FILE_LINE_CC)
ZEND_API zval* zend_ts_hash_add_empty_element(TsHashTable *ht, zend_string *key);
@@ -73,15 +73,15 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun
/* Deletes */
ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key);
-ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_uint_t h);
+ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h);
/* Data retreival */
ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key);
-ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t);
+ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong);
/* Misc */
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key);
-ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h);
+ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h);
/* Copying, merging and sorting */
ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);
@@ -111,7 +111,7 @@ ZEND_API zval *_zend_ts_hash_str_add(TsHashTable *ht, const char *key, int len,
#define zend_ts_hash_str_add(ht, key, len, pData) \
_zend_ts_hash_str_add(ht, key, len, pData ZEND_FILE_LINE_CC)
-static inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const char *str, int len)
+static zend_always_inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const char *str, int len)
{
zval *zv;
@@ -119,7 +119,7 @@ static inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const char *str,
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, const char *str, int len, void *pData)
+static zend_always_inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, const char *str, int len, void *pData)
{
zval tmp, *zv;
@@ -128,7 +128,7 @@ static inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, const char *str
return zv ? Z_PTR_P(zv) : NULL;
}
-static inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const char *str, int len, void *pData)
+static zend_always_inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const char *str, int len, void *pData)
{
zval tmp, *zv;
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index f5d7a6ea7d..383f77caa4 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -14,6 +14,7 @@
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+ | Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -22,7 +23,8 @@
#ifndef ZEND_TYPES_H
#define ZEND_TYPES_H
-#include "zend_int.h"
+#include "zend_portability.h"
+#include "zend_long.h"
#ifdef WORDS_BIGENDIAN
# define ZEND_ENDIAN_LOHI(lo, hi) hi; lo;
@@ -42,11 +44,13 @@
typedef unsigned char zend_bool;
typedef unsigned char zend_uchar;
-typedef unsigned int zend_uint;
-typedef unsigned long zend_ulong;
-typedef unsigned short zend_ushort;
-#ifdef ZEND_ENABLE_INT64
+typedef enum {
+ SUCCESS = 0,
+ FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */
+} ZEND_RESULT_CODE;
+
+#ifdef ZEND_ENABLE_ZVAL_LONG64
# ifdef ZEND_WIN32
# define ZEND_SIZE_MAX _UI64_MAX
# else
@@ -59,33 +63,14 @@ typedef unsigned short zend_ushort;
# define ZEND_SIZE_MAX SIZE_MAX
# endif
#endif
-typedef size_t zend_size_t;
-
-#define HAVE_ZEND_LONG64
-#ifdef ZEND_WIN32
-typedef __int64 zend_long64;
-typedef unsigned __int64 zend_ulong64;
-#elif SIZEOF_LONG_LONG_INT == 8
-typedef long long int zend_long64;
-typedef unsigned long long int zend_ulong64;
-#elif SIZEOF_LONG_LONG == 8
-typedef long long zend_long64;
-typedef unsigned long long zend_ulong64;
-#else
-# undef HAVE_ZEND_LONG64
-#endif
-#ifdef _WIN64
-typedef __int64 zend_intptr_t;
-typedef unsigned __int64 zend_uintptr_t;
-#else
-typedef long zend_intptr_t;
-typedef unsigned long zend_uintptr_t;
-#endif
+typedef intptr_t zend_intptr_t;
+typedef uintptr_t zend_uintptr_t;
typedef struct _zend_object_handlers zend_object_handlers;
typedef struct _zend_class_entry zend_class_entry;
typedef union _zend_function zend_function;
+typedef struct _zend_execute_data zend_execute_data;
typedef struct _zval_struct zval;
@@ -104,7 +89,7 @@ typedef void (*dtor_func_t)(zval *pDest);
typedef void (*copy_ctor_func_t)(zval *pElement);
typedef union _zend_value {
- zend_int_t lval; /* long value */
+ zend_long lval; /* long value */
double dval; /* double value */
zend_refcounted *counted;
zend_string *str;
@@ -129,60 +114,60 @@ struct _zval_struct {
zend_uchar const_flags,
zend_uchar reserved) /* various IS_VAR flags */
} v;
- zend_uint type_info;
+ uint32_t type_info;
} u1;
union {
- zend_uint var_flags;
- zend_uint next; /* hash collision chain */
- zend_uint str_offset; /* string offset */
- zend_uint cache_slot; /* literal cache slot */
+ uint32_t var_flags;
+ uint32_t next; /* hash collision chain */
+ uint32_t cache_slot; /* literal cache slot */
+ uint32_t lineno; /* line number (for ast nodes) */
} u2;
};
struct _zend_refcounted {
- zend_uint refcount; /* reference counter 32-bit */
+ uint32_t refcount; /* reference counter 32-bit */
union {
struct {
ZEND_ENDIAN_LOHI_3(
zend_uchar type,
zend_uchar flags, /* used for strings & objects */
- zend_ushort gc_info) /* keeps GC root number (or 0) and color */
+ uint16_t gc_info) /* keeps GC root number (or 0) and color */
} v;
- zend_uint type_info;
+ uint32_t type_info;
} u;
};
struct _zend_string {
zend_refcounted gc;
- zend_uint_t h; /* hash value */
- zend_size_t len;
+ zend_ulong h; /* hash value */
+ size_t len;
char val[1];
};
typedef struct _Bucket {
- zend_uint_t h; /* hash value (or numeric index) */
+ zend_ulong h; /* hash value (or numeric index) */
zend_string *key; /* string key or NULL for numerics */
zval val;
} Bucket;
typedef struct _HashTable {
- zend_uint nTableSize;
- zend_uint nTableMask;
- zend_uint nNumUsed;
- zend_uint nNumOfElements;
- zend_int_t nNextFreeElement;
+ uint32_t nTableSize;
+ uint32_t nTableMask;
+ uint32_t nNumUsed;
+ uint32_t nNumOfElements;
+ zend_long nNextFreeElement;
Bucket *arData;
- zend_uint *arHash;
+ uint32_t *arHash;
dtor_func_t pDestructor;
- zend_uint nInternalPointer;
+ uint32_t nInternalPointer;
union {
struct {
ZEND_ENDIAN_LOHI_3(
zend_uchar flags,
zend_uchar nApplyCount,
- zend_ushort reserve)
+ uint16_t reserve)
} v;
- zend_uint flags;
+ uint32_t flags;
} u;
} HashTable;
@@ -193,7 +178,7 @@ struct _zend_array {
struct _zend_object {
zend_refcounted gc;
- zend_uint handle; // TODO: may be removed ???
+ uint32_t handle; // TODO: may be removed ???
zend_class_entry *ce;
const zend_object_handlers *handlers;
HashTable *properties;
@@ -203,7 +188,7 @@ struct _zend_object {
struct _zend_resource {
zend_refcounted gc;
- zend_int_t handle; // TODO: may be removed ???
+ zend_long handle; // TODO: may be removed ???
int type;
void *ptr;
};
@@ -223,7 +208,7 @@ struct _zend_ast_ref {
#define IS_NULL 1
#define IS_FALSE 2
#define IS_TRUE 3
-#define IS_INT 4
+#define IS_LONG 4
#define IS_DOUBLE 5
#define IS_STRING 6
#define IS_ARRAY 7
@@ -241,10 +226,9 @@ struct _zend_ast_ref {
/* internal types */
#define IS_INDIRECT 15
-#define IS_STR_OFFSET 16
#define IS_PTR 17
-static inline zend_uchar zval_get_type(const zval* pz) {
+static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;
}
@@ -398,8 +382,8 @@ static inline zend_uchar zval_get_type(const zval* pz) {
#define Z_ISNULL(zval) (Z_TYPE(zval) == IS_NULL)
#define Z_ISNULL_P(zval_p) Z_ISNULL(*(zval_p))
-#define Z_IVAL(zval) (zval).value.lval
-#define Z_IVAL_P(zval_p) Z_IVAL(*(zval_p))
+#define Z_LVAL(zval) (zval).value.lval
+#define Z_LVAL_P(zval_p) Z_LVAL(*(zval_p))
#define Z_DVAL(zval) (zval).value.dval
#define Z_DVAL_P(zval_p) Z_DVAL(*(zval_p))
@@ -410,8 +394,8 @@ static inline zend_uchar zval_get_type(const zval* pz) {
#define Z_STRVAL(zval) Z_STR(zval)->val
#define Z_STRVAL_P(zval_p) Z_STRVAL(*(zval_p))
-#define Z_STRSIZE(zval) Z_STR(zval)->len
-#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*(zval_p))
+#define Z_STRLEN(zval) Z_STR(zval)->len
+#define Z_STRLEN_P(zval_p) Z_STRLEN(*(zval_p))
#define Z_STRHASH(zval) Z_STR(zval)->h
#define Z_STRHASH_P(zval_p) Z_STRHASH(*(zval_p))
@@ -434,7 +418,7 @@ static inline zend_uchar zval_get_type(const zval* pz) {
#define Z_OBJ_HANDLE(zval) (Z_OBJ((zval)))->handle
#define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*(zval_p))
-#define Z_OBJCE(zval) zend_get_class_entry(Z_OBJ(zval) TSRMLS_CC)
+#define Z_OBJCE(zval) (Z_OBJ(zval)->ce)
#define Z_OBJCE_P(zval_p) Z_OBJCE(*(zval_p))
#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
@@ -500,10 +484,10 @@ static inline zend_uchar zval_get_type(const zval* pz) {
(b) ? IS_TRUE : IS_FALSE; \
} while (0)
-#define ZVAL_INT(z, l) { \
+#define ZVAL_LONG(z, l) { \
zval *__z = (z); \
- Z_IVAL_P(__z) = l; \
- Z_TYPE_INFO_P(__z) = IS_INT; \
+ Z_LVAL_P(__z) = l; \
+ Z_TYPE_INFO_P(__z) = IS_LONG; \
}
#define ZVAL_DOUBLE(z, d) { \
@@ -522,10 +506,10 @@ static inline zend_uchar zval_get_type(const zval* pz) {
IS_STRING_EX; \
} while (0)
-#define ZVAL_INT_STR(z, s) do { \
- zval *__z = (z); \
- zend_string *__s = (s); \
- Z_STR_P(__z) = __s; \
+#define ZVAL_INTERNED_STR(z, s) do { \
+ zval *__z = (z); \
+ zend_string *__s = (s); \
+ Z_STR_P(__z) = __s; \
Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX; \
} while (0)
@@ -533,10 +517,22 @@ static inline zend_uchar zval_get_type(const zval* pz) {
zval *__z = (z); \
zend_string *__s = (s); \
Z_STR_P(__z) = __s; \
- /* interned strings support */ \
Z_TYPE_INFO_P(__z) = IS_STRING_EX; \
} while (0)
+#define ZVAL_STR_COPY(z, s) do { \
+ zval *__z = (z); \
+ zend_string *__s = (s); \
+ Z_STR_P(__z) = __s; \
+ /* interned strings support */ \
+ if (IS_INTERNED(__s)) { \
+ Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX; \
+ } else { \
+ GC_REFCOUNT(__s)++; \
+ Z_TYPE_INFO_P(__z) = IS_STRING_EX; \
+ } \
+ } while (0)
+
#define ZVAL_ARR(z, a) do { \
zval *__z = (z); \
Z_ARR_P(__z) = (a); \
@@ -575,26 +571,26 @@ static inline zend_uchar zval_get_type(const zval* pz) {
#define ZVAL_NEW_RES(z, h, p, t) do { \
zend_resource *_res = emalloc(sizeof(zend_resource)); \
- zval *__z; \
+ zval *__z; \
GC_REFCOUNT(_res) = 1; \
GC_TYPE_INFO(_res) = IS_RESOURCE; \
_res->handle = (h); \
_res->type = (t); \
_res->ptr = (p); \
- __z = (z); \
+ __z = (z); \
Z_RES_P(__z) = _res; \
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
} while (0)
#define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \
zend_resource *_res = malloc(sizeof(zend_resource)); \
- zval *__z; \
+ zval *__z; \
GC_REFCOUNT(_res) = 1; \
GC_TYPE_INFO(_res) = IS_RESOURCE; \
_res->handle = (h); \
_res->type = (t); \
_res->ptr = (p); \
- __z = (z); \
+ __z = (z); \
Z_RES_P(__z) = _res; \
Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \
} while (0)
@@ -653,17 +649,169 @@ static inline zend_uchar zval_get_type(const zval* pz) {
Z_TYPE_INFO_P(z) = IS_PTR; \
} while (0)
+#define Z_REFCOUNT_P(pz) zval_refcount_p(pz)
+#define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc)
+#define Z_ADDREF_P(pz) zval_addref_p(pz)
+#define Z_DELREF_P(pz) zval_delref_p(pz)
+
+#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z))
+#define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc)
+#define Z_ADDREF(z) Z_ADDREF_P(&(z))
+#define Z_DELREF(z) Z_DELREF_P(&(z))
+
+#define Z_TRY_ADDREF_P(pz) do { \
+ if (Z_REFCOUNTED_P((pz))) { \
+ Z_ADDREF_P((pz)); \
+ } \
+} while (0)
+
+#define Z_TRY_DELREF_P(pz) do { \
+ if (Z_REFCOUNTED_P((pz))) { \
+ Z_DELREF_P((pz)); \
+ } \
+} while (0)
+
+#define Z_TRY_ADDREF(z) Z_TRY_ADDREF_P(&(z))
+#define Z_TRY_DELREF(z) Z_TRY_DELREF_P(&(z))
+
+static zend_always_inline uint32_t zval_refcount_p(zval* pz) {
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz) || Z_IMMUTABLE_P(pz));
+ return GC_REFCOUNT(Z_COUNTED_P(pz));
+}
+
+static zend_always_inline uint32_t zval_set_refcount_p(zval* pz, uint32_t rc) {
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return GC_REFCOUNT(Z_COUNTED_P(pz)) = rc;
+}
+
+static zend_always_inline uint32_t zval_addref_p(zval* pz) {
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return ++GC_REFCOUNT(Z_COUNTED_P(pz));
+}
+
+static zend_always_inline uint32_t zval_delref_p(zval* pz) {
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return --GC_REFCOUNT(Z_COUNTED_P(pz));
+}
+
+#define ZVAL_COPY_VALUE(z, v) \
+ do { \
+ zval *_z1 = (z); \
+ zval *_z2 = (v); \
+ (_z1)->value = (_z2)->value; \
+ Z_TYPE_INFO_P(_z1) = Z_TYPE_INFO_P(_z2); \
+ } while (0)
+
+#define ZVAL_COPY(z, v) \
+ do { \
+ zval *__z1 = (z); \
+ zval *__z2 = (v); \
+ ZVAL_COPY_VALUE(__z1, __z2); \
+ if (Z_OPT_REFCOUNTED_P(__z1)) { \
+ Z_ADDREF_P(__z1); \
+ } \
+ } while (0)
+
+#define ZVAL_DUP(z, v) \
+ do { \
+ zval *__z1 = (z); \
+ zval *__z2 = (v); \
+ ZVAL_COPY_VALUE(__z1, __z2); \
+ zval_opt_copy_ctor(__z1); \
+ } while (0)
+
+#define ZVAL_DEREF(z) do { \
+ if (UNEXPECTED(Z_ISREF_P(z))) { \
+ (z) = Z_REFVAL_P(z); \
+ } \
+ } while (0)
-#define Z_STR_OFFSET_STR(zval) Z_INDIRECT(zval)
-#define Z_STR_OFFSET_STR_P(zval_p) Z_STR_OFFSET_STR(*(zval_p))
+#define ZVAL_MAKE_REF(zv) do { \
+ zval *__zv = (zv); \
+ if (!Z_ISREF_P(__zv)) { \
+ ZVAL_NEW_REF(__zv, __zv); \
+ } \
+ } while (0)
+
+#define ZVAL_UNREF(z) do { \
+ zval *_z = (z); \
+ zend_reference *ref; \
+ ZEND_ASSERT(Z_ISREF_P(_z)); \
+ ref = Z_REF_P(_z); \
+ ZVAL_COPY_VALUE(_z, &ref->val); \
+ efree_size(ref, sizeof(zend_reference)); \
+ } while (0)
-#define Z_STR_OFFSET_IDX(zval) (zval).u2.str_offset
-#define Z_STR_OFFSET_IDX_P(zval_p) Z_STR_OFFSET_IDX(*(zval_p))
+#define SEPARATE_STRING(zv) do { \
+ zval *_zv = (zv); \
+ if (Z_REFCOUNTED_P(_zv) && \
+ Z_REFCOUNT_P(_zv) > 1) { \
+ Z_DELREF_P(_zv); \
+ zval_copy_ctor_func(_zv); \
+ } \
+ } while (0)
+
+#define SEPARATE_ARRAY(zv) do { \
+ zval *_zv = (zv); \
+ if (Z_REFCOUNT_P(_zv) > 1) { \
+ if (!Z_IMMUTABLE_P(_zv)) { \
+ Z_DELREF_P(_zv); \
+ } \
+ zval_copy_ctor_func(_zv); \
+ } \
+ } while (0)
+
+#define SEPARATE_ZVAL_NOREF(zv) do { \
+ zval *_zv = (zv); \
+ ZEND_ASSERT(Z_TYPE_P(_zv) != IS_REFERENCE); \
+ if (Z_COPYABLE_P(_zv) || \
+ Z_IMMUTABLE_P(_zv)) { \
+ if (Z_REFCOUNT_P(_zv) > 1) { \
+ if (!Z_IMMUTABLE_P(_zv)) { \
+ Z_DELREF_P(_zv); \
+ } \
+ zval_copy_ctor_func(_zv); \
+ } \
+ } \
+ } while (0)
+
+#define SEPARATE_ZVAL(zv) do { \
+ zval *_zv = (zv); \
+ if (Z_REFCOUNTED_P(_zv) || \
+ Z_IMMUTABLE_P(_zv)) { \
+ if (Z_REFCOUNT_P(_zv) > 1) { \
+ if (Z_COPYABLE_P(_zv) || \
+ Z_IMMUTABLE_P(_zv)) { \
+ if (!Z_IMMUTABLE_P(_zv)) { \
+ Z_DELREF_P(_zv); \
+ } \
+ zval_copy_ctor_func(_zv); \
+ } else if (Z_ISREF_P(_zv)) { \
+ Z_DELREF_P(_zv); \
+ ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \
+ } \
+ } \
+ } \
+ } while (0)
+
+#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
+ zval *_zv = (zv); \
+ if (Z_COPYABLE_P(_zv) || \
+ Z_IMMUTABLE_P(_zv)) { \
+ if (Z_REFCOUNT_P(_zv) > 1) { \
+ if (!Z_IMMUTABLE_P(_zv)) { \
+ Z_DELREF_P(_zv); \
+ } \
+ zval_copy_ctor_func(_zv); \
+ } \
+ } \
+ } while (0)
-#define ZVAL_STR_OFFSET(z, s, i) do { \
- Z_STR_OFFSET_STR_P(z) = (s); \
- Z_STR_OFFSET_IDX_P(z) = (i); \
- Z_TYPE_INFO_P(z) = IS_STR_OFFSET; \
+#define SEPARATE_ARG_IF_REF(varptr) do { \
+ ZVAL_DEREF(varptr); \
+ if (Z_REFCOUNTED_P(varptr)) { \
+ Z_ADDREF_P(varptr); \
+ } \
} while (0)
#endif /* ZEND_TYPES_H */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 1c10a1451f..3e68a38487 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -34,7 +34,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
CHECK_ZVAL_STRING_REL(str);
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
case IS_ARRAY: {
@@ -46,15 +46,15 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
GC_TYPE(arr) = IS_NULL;
GC_REMOVE_FROM_BUFFER(arr);
zend_hash_destroy(&arr->ht);
- efree(arr);
+ efree_size(arr, sizeof(zend_array));
}
break;
}
case IS_CONSTANT_AST: {
zend_ast_ref *ast = (zend_ast_ref*)p;
- zend_ast_destroy(ast->ast);
- efree(ast);
+ zend_ast_destroy_and_free(ast->ast);
+ efree_size(ast, sizeof(zend_ast_ref));
break;
}
case IS_OBJECT: {
@@ -78,7 +78,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
zend_reference *ref = (zend_reference*)p;
if (--GC_REFCOUNT(ref) == 0) {
zval_ptr_dtor(&ref->val);
- efree(ref);
+ efree_size(ref, sizeof(zend_reference));
}
break;
}
@@ -94,7 +94,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
CHECK_ZVAL_STRING_REL(str);
- STR_FREE(str);
+ zend_string_free(str);
break;
}
case IS_ARRAY: {
@@ -106,15 +106,15 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
GC_TYPE(arr) = IS_NULL;
GC_REMOVE_FROM_BUFFER(arr);
zend_hash_destroy(&arr->ht);
- efree(arr);
+ efree_size(arr, sizeof(zend_array));
}
break;
}
case IS_CONSTANT_AST: {
zend_ast_ref *ast = (zend_ast_ref*)p;
- zend_ast_destroy(ast->ast);
- efree(ast);
+ zend_ast_destroy_and_free(ast->ast);
+ efree_size(ast, sizeof(zend_ast_ref));
break;
}
case IS_OBJECT: {
@@ -136,7 +136,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
zend_reference *ref = (zend_reference*)p;
zval_ptr_dtor(&ref->val);
- efree(ref);
+ efree_size(ref, sizeof(zend_reference));
break;
}
default:
@@ -150,7 +150,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
- STR_RELEASE(Z_STR_P(zvalue));
+ zend_string_release(Z_STR_P(zvalue));
break;
case IS_ARRAY:
case IS_CONSTANT_AST:
@@ -165,7 +165,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
free(ref);
break;
}
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
@@ -181,7 +181,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
- STR_FREE(Z_STR_P(zvalue));
+ zend_string_free(Z_STR_P(zvalue));
break;
case IS_ARRAY:
case IS_CONSTANT_AST:
@@ -196,7 +196,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
free(ref);
break;
}
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
@@ -234,7 +234,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
case IS_CONSTANT:
case IS_STRING:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
- Z_STR_P(zvalue) = STR_DUP(Z_STR_P(zvalue), 0);
+ Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0);
break;
case IS_ARRAY: {
HashTable *ht;
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
index c55ce233a5..94ae438e9d 100644
--- a/Zend/zend_variables.h
+++ b/Zend/zend_variables.h
@@ -36,6 +36,13 @@ static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
_zval_dtor_func(Z_COUNTED_P(zvalue) ZEND_FILE_LINE_RELAY_CC);
}
+static zend_always_inline void _zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE_DC)
+{
+ if (Z_REFCOUNTED_P(zval_ptr) && !Z_DELREF_P(zval_ptr)) {
+ _zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
+ }
+}
+
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
#define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)
@@ -98,6 +105,7 @@ ZEND_API void _zval_dtor_wrapper(zval *zvalue);
#define zval_opt_copy_ctor_no_imm(zvalue) _zval_opt_copy_ctor_no_imm((zvalue) ZEND_FILE_LINE_CC)
#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
+#define zval_ptr_dtor_nogc(zval_ptr) _zval_ptr_dtor_nogc((zval_ptr) ZEND_FILE_LINE_CC)
#define zval_internal_dtor(zvalue) _zval_internal_dtor((zvalue) ZEND_FILE_LINE_CC)
#define zval_internal_ptr_dtor(zvalue) _zval_internal_ptr_dtor((zvalue) ZEND_FILE_LINE_CC)
#define zval_dtor_wrapper _zval_dtor_wrapper
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 1d56cb95f5..01a91cad80 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -178,7 +178,7 @@ static int php_check_dots(const char *element, int n)
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
typedef struct {
- zend_uint_t ReparseTag;
+ unsigned long ReparseTag;
unsigned short ReparseDataLength;
unsigned short Reserved;
union {
@@ -187,7 +187,7 @@ typedef struct {
unsigned short SubstituteNameLength;
unsigned short PrintNameOffset;
unsigned short PrintNameLength;
- zend_uint_t Flags;
+ unsigned long Flags;
wchar_t ReparseTarget[1];
} SymbolicLinkReparseBuffer;
struct {
@@ -201,19 +201,19 @@ typedef struct {
unsigned char ReparseTarget[1];
} GenericReparseBuffer;
};
-} REPARSE_DATA_BUFFER;
+} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#define SECS_BETWEEN_EPOCHS (__int64)11644473600
#define SECS_TO_100NS (__int64)10000000
-static inline time_t FileTimeToUnixTime(const FILETIME FileTime)
+static inline time_t FileTimeToUnixTime(const FILETIME *FileTime)
{
__int64 UnixTime;
long *nsec = NULL;
SYSTEMTIME SystemTime;
- FileTimeToSystemTime(&FileTime, &SystemTime);
+ FileTimeToSystemTime(FileTime, &SystemTime);
- UnixTime = ((__int64)FileTime.dwHighDateTime << 32) +
- FileTime.dwLowDateTime;
+ UnixTime = ((__int64)FileTime->dwHighDateTime << 32) +
+ FileTime->dwLowDateTime;
UnixTime -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS);
@@ -294,7 +294,7 @@ CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){
CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{{ */
{
WIN32_FILE_ATTRIBUTE_DATA data;
- __int64 t;
+ LARGE_INTEGER t;
const size_t path_len = strlen(path);
ALLOCA_FLAG(use_heap_large);
@@ -393,13 +393,14 @@ CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{
}
buf->st_nlink = 1;
- t = data.nFileSizeHigh;
- t = t << 32;
- t |= data.nFileSizeLow;
- buf->st_size = t;
- buf->st_atime = FileTimeToUnixTime(data.ftLastAccessTime);
- buf->st_ctime = FileTimeToUnixTime(data.ftCreationTime);
- buf->st_mtime = FileTimeToUnixTime(data.ftLastWriteTime);
+ t.HighPart = data.nFileSizeHigh;
+ t.LowPart = data.nFileSizeLow;
+ /* It's an overflow on 32 bit, however it won't fix as long
+ as zend_long is 32 bit. */
+ buf->st_size = (zend_long)t.QuadPart;
+ buf->st_atime = FileTimeToUnixTime(&data.ftLastAccessTime);
+ buf->st_ctime = FileTimeToUnixTime(&data.ftCreationTime);
+ buf->st_mtime = FileTimeToUnixTime(&data.ftLastWriteTime);
return 0;
}
/* }}} */
@@ -582,9 +583,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */
/* }}} */
#ifdef PHP_WIN32
-static inline zend_uint_t realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */
+static inline zend_ulong realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */
{
- register zend_uint_t h;
+ register zend_ulong h;
char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC);
char *bucket_key = (char *)bucket_key_start;
const char *e = bucket_key + strlen(bucket_key);
@@ -593,8 +594,8 @@ static inline zend_uint_t realpath_cache_key(const char *path, int path_len TSRM
return 0;
}
- for (h = Z_UI(2166136261); bucket_key < e;) {
- h *= Z_UI(16777619);
+ for (h = Z_UL(2166136261); bucket_key < e;) {
+ h *= Z_UL(16777619);
h ^= *bucket_key++;
}
HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start);
@@ -602,13 +603,13 @@ static inline zend_uint_t realpath_cache_key(const char *path, int path_len TSRM
}
/* }}} */
#else
-static inline zend_uint_t realpath_cache_key(const char *path, int path_len) /* {{{ */
+static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {{{ */
{
- register zend_uint_t h;
+ register zend_ulong h;
const char *e = path + path_len;
- for (h = Z_UI(2166136261); path < e;) {
- h *= Z_UI(16777619);
+ for (h = Z_UL(2166136261); path < e;) {
+ h *= Z_UL(16777619);
h ^= *path++;
}
@@ -637,11 +638,11 @@ CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */
{
#ifdef PHP_WIN32
- zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC);
+ zend_ulong key = realpath_cache_key(path, path_len TSRMLS_CC);
#else
- zend_uint_t key = realpath_cache_key(path, path_len);
+ zend_ulong key = realpath_cache_key(path, path_len);
#endif
- zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
+ zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
while (*bucket != NULL) {
@@ -668,7 +669,7 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */
{
- zend_int_t size = sizeof(realpath_cache_bucket) + path_len + 1;
+ zend_long size = sizeof(realpath_cache_bucket) + path_len + 1;
int same = 1;
if (realpath_len != path_len ||
@@ -679,7 +680,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) {
realpath_cache_bucket *bucket = malloc(size);
- zend_uint_t n;
+ zend_ulong n;
if (bucket == NULL) {
return;
@@ -719,12 +720,12 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */
{
#ifdef PHP_WIN32
- zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC);
+ zend_ulong key = realpath_cache_key(path, path_len TSRMLS_CC);
#else
- zend_uint_t key = realpath_cache_key(path, path_len);
+ zend_ulong key = realpath_cache_key(path, path_len);
#endif
- zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
+ zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
while (*bucket != NULL) {
@@ -756,12 +757,12 @@ CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_
}
/* }}} */
-CWD_API zend_int_t realpath_cache_size(TSRMLS_D)
+CWD_API zend_long realpath_cache_size(TSRMLS_D)
{
return CWDG(realpath_cache_size);
}
-CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D)
+CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D)
{
return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
}
@@ -983,6 +984,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
memcpy(substitutename, path, len + 1);
substitutename_len = len;
} else {
+ /* XXX this might be not the end, restart handling with REPARSE_GUID_DATA_BUFFER should be implemented. */
free_alloca(pbuffer, use_heap_large);
return -1;
}
diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h
index 7c56686f2a..96ac6faa30 100644
--- a/Zend/zend_virtual_cwd.h
+++ b/Zend/zend_virtual_cwd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -70,7 +70,7 @@ typedef unsigned short mode_t;
#define IS_UNC_PATH(path, len) \
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
#define IS_ABSOLUTE_PATH(path, len) \
- (len >= 2 && ((isalpha(path[0]) && path[1] == ':') || IS_UNC_PATH(path, len)))
+ (len >= 2 && (/* is local */isalpha(path[0]) && path[1] == ':' || /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))
#elif defined(NETWARE)
#ifdef HAVE_DIRENT_H
@@ -211,27 +211,27 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
typedef struct _realpath_cache_bucket {
- zend_uint_t key;
+ zend_ulong key;
char *path;
- int path_len;
char *realpath;
+ struct _realpath_cache_bucket *next;
+ time_t expires;
+ int path_len;
int realpath_len;
int is_dir;
- time_t expires;
#ifdef PHP_WIN32
unsigned char is_rvalid;
unsigned char is_readable;
unsigned char is_wvalid;
unsigned char is_writable;
#endif
- struct _realpath_cache_bucket *next;
} realpath_cache_bucket;
typedef struct _virtual_cwd_globals {
cwd_state cwd;
- zend_int_t realpath_cache_size;
- zend_int_t realpath_cache_size_limit;
- zend_int_t realpath_cache_ttl;
+ zend_long realpath_cache_size;
+ zend_long realpath_cache_size_limit;
+ zend_long realpath_cache_ttl;
realpath_cache_bucket *realpath_cache[1024];
} virtual_cwd_globals;
@@ -246,8 +246,8 @@ extern virtual_cwd_globals cwd_globals;
CWD_API void realpath_cache_clean(TSRMLS_D);
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC);
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC);
-CWD_API zend_int_t realpath_cache_size(TSRMLS_D);
-CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D);
+CWD_API zend_long realpath_cache_size(TSRMLS_D);
+CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D);
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
/* The actual macros to be used in programs using TSRM
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 6b61c58ef9..fad4d5b99c 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -335,15 +335,17 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *value;
int have_get_ptr = 0;
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (OP1_TYPE != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP2();
FREE_OP(free_op_data1);
@@ -357,7 +359,8 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -430,9 +433,9 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_dim_helper, VAR|UNUSED|CV, CONST|TMP|VAR
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (OP1_TYPE == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (OP1_TYPE == IS_VAR && !OP1_FREE) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -441,11 +444,11 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_dim_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *dim = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, OP2_TYPE TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -494,10 +497,10 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
zval *value;
SAVE_OPLINE();
- value = GET_OP2_ZVAL_PTR(BP_VAR_R);
+ value = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -692,13 +695,15 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
retval = EX_VAR(opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (OP1_TYPE != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
FREE_OP2();
if (RETURN_VALUE_USED(opline)) {
@@ -714,7 +719,8 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -784,13 +790,15 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
retval = EX_VAR(opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (OP1_TYPE != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
FREE_OP2();
ZVAL_NULL(retval);
@@ -805,12 +813,11 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -867,7 +874,11 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -875,14 +886,10 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
- FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -890,19 +897,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -922,7 +917,11 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -930,14 +929,10 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
- FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -945,19 +940,7 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -972,50 +955,36 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_increment_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
- FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -1026,50 +995,36 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_decrement_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
- FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -1096,7 +1051,7 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO);
}
@@ -1116,7 +1071,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -1131,7 +1086,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (OP1_TYPE != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
FREE_OP1();
CHECK_EXCEPTION();
@@ -1154,8 +1109,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -1175,8 +1129,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -1198,7 +1151,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
}
if (OP1_TYPE != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -1263,9 +1216,7 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- FREE_OP1();
- }
+ FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1279,7 +1230,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -1288,7 +1239,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
}
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1305,12 +1256,12 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1318,7 +1269,7 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
@@ -1333,7 +1284,7 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
+ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
USE_OPLINE
zval *container;
@@ -1342,12 +1293,15 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP2();
@@ -1374,12 +1328,12 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1387,7 +1341,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1;
@@ -1399,7 +1353,7 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_R);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -1420,11 +1374,6 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
-{
- ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_property_address_read_helper);
-}
-
ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
@@ -1436,13 +1385,13 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1461,12 +1410,12 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1474,7 +1423,7 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1;
@@ -1486,7 +1435,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -1506,7 +1455,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zval *container;
@@ -1520,19 +1469,22 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_property_address_read_helper);
+ ZEND_VM_DISPATCH_TO_HANDLER(ZEND_FETCH_OBJ_R);
}
}
@@ -1546,12 +1498,12 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+ if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
@@ -1559,23 +1511,34 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST)
+ZEND_VM_HANDLER(98, ZEND_FETCH_LIST, CONST|TMP|VAR|CV, CONST)
{
USE_OPLINE
zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ container = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
+ if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
zend_free_op free_op2;
zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
ZVAL_COPY(EX_VAR(opline->result.var), value);
- FREE_OP2();
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
+ EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
+ zval *result = EX_VAR(opline->result.var);
+ zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), BP_VAR_R, result TSRMLS_CC);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+ } else {
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1592,10 +1555,10 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
object = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, OP1_TYPE, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
/* assign_obj has two opcodes! */
@@ -1613,7 +1576,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
SAVE_OPLINE();
object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -1623,7 +1586,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zend_free_op free_op2;
zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, OP1_TYPE, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
FREE_OP2();
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -1631,35 +1594,30 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zval *dim = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, OP2_TYPE TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, OP2_TYPE TSRMLS_CC);
FREE_OP2();
-
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
FREE_OP1_VAR_PTR();
/* assign_dim has two opcodes! */
@@ -1676,26 +1634,18 @@ ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV)
zval *variable_ptr;
SAVE_OPLINE();
- value = GET_OP2_ZVAL_PTR(BP_VAR_R);
+ value = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, OP2_TYPE, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_OP2_TMP_FREE()) {
- zval_dtor(value);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (OP2_TYPE == IS_TMP_VAR) {
+ FREE_OP2();
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (OP2_TYPE == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (OP2_TYPE == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, OP2_TYPE TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -1744,8 +1694,8 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
}
- if ((OP2_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
- (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
+ if ((OP2_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) ||
+ (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == NULL))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
if ((OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) ||
@@ -1774,9 +1724,11 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
{
- vm_frame_kind frame_kind = EX(frame_kind);
+ vm_frame_kind frame_kind = VM_FRAME_KIND(EX(frame_info));
if (frame_kind == VM_FRAME_NESTED_FUNCTION) {
+ zend_object *object;
+
i_free_compiled_variables(execute_data TSRMLS_CC);
if (UNEXPECTED(EX(symbol_table) != NULL)) {
zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
@@ -1786,30 +1738,26 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_CLOSURE) != 0) && EX(func)->op_array.prototype) {
OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
}
+ object = Z_OBJ(EX(This));
zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
execute_data = EG(current_execute_data);
- if (Z_OBJ(EG(This))) {
+ if (object) {
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
if (!(EX(opline)->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- Z_DELREF(EG(This));
+ GC_REFCOUNT(object)--;
}
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ if (GC_REFCOUNT(object) == 1) {
+ zend_object_store_ctor_failed(object TSRMLS_CC);
}
}
- if (!Z_DELREF(EG(This))) {
- _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
- } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
- gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
- }
+ OBJ_RELEASE(object);
}
- Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
if (UNEXPECTED(EG(exception) != NULL)) {
- zend_op *opline = EX(opline);
+ const zend_op *opline = EX(opline);
zend_throw_exception_internal(NULL TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(EX_VAR(opline->result.var));
@@ -1823,7 +1771,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
} else if (frame_kind == VM_FRAME_NESTED_CODE) {
zend_detach_symbol_table(execute_data);
destroy_op_array(&EX(func)->op_array TSRMLS_CC);
- efree(EX(func));
+ efree_size(EX(func), sizeof(zend_op_array));
EG(current_execute_data) = EX(prev_execute_data);
zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
@@ -2046,26 +1994,11 @@ ZEND_VM_HANDLER(70, ZEND_FREE, TMP|VAR, ANY)
USE_OPLINE
SAVE_OPLINE();
- if (OP1_TYPE == IS_TMP_VAR) {
- zval_dtor(EX_VAR(opline->op1.var));
- } else {
- zval_ptr_dtor(EX_VAR(opline->op1.var));
- }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY)
-{
- USE_OPLINE
- zval *tmp = EX_VAR(opline->result.var);
-
- SAVE_OPLINE();
- ZVAL_EMPTY_STRING(tmp);
- /*CHECK_EXCEPTION();*/
- ZEND_VM_NEXT_OPCODE();
-}
-
ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
{
USE_OPLINE
@@ -2212,19 +2145,56 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
object = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
FREE_OP2();
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ FREE_OP2();
+ FREE_OP1_IF_VAR();
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (OP2_TYPE != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -2234,7 +2204,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (OP2_TYPE == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -2244,14 +2214,14 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
FREE_OP2();
FREE_OP1_IF_VAR();
@@ -2333,7 +2303,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -2341,19 +2311,27 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -2365,8 +2343,8 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (OP2_TYPE == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -2382,7 +2360,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
zend_function *fbc;
zval *function_name, *func;
- if (OP2_TYPE == IS_CONST) {
+ if (OP2_TYPE == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
function_name = (zval*)(opline->op2.zv+1);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
@@ -2394,8 +2372,8 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
@@ -2412,21 +2390,22 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1);
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
FREE_OP2();
+
fbc = Z_FUNC_P(func);
called_scope = NULL;
object = NULL;
- } else if (OP2_TYPE != IS_CONST && OP2_TYPE != IS_TMP_VAR &&
+ } else if (OP2_TYPE != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
@@ -2437,11 +2416,10 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
- } else {
+ } else if (OP2_TYPE == IS_CV) {
FREE_OP2();
}
- } else if (OP2_TYPE != IS_CONST &&
- EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
+ } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
zval *method;
@@ -2479,13 +2457,25 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
if (UNEXPECTED(fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
}
+ if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ }
+ }
} else {
called_scope = Z_OBJCE_P(obj);
object = Z_OBJ_P(obj);
fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method));
}
if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
@@ -2502,8 +2492,8 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Function name must be a string");
ZEND_VM_CONTINUE(); /* Never reached */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -2535,6 +2525,18 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMP|VAR|CV)
object = fcc.object;
if (object) {
GC_REFCOUNT(object)++; /* For $this pointer */
+ } else if (func->common.scope &&
+ !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ }
}
} else {
zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
@@ -2544,8 +2546,8 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMP|VAR|CV)
object = NULL;
}
- EX(call) = zend_vm_stack_push_call_frame(
- func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ func, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
FREE_OP2();
CHECK_EXCEPTION();
@@ -2576,8 +2578,8 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
@@ -2600,8 +2602,8 @@ ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST)
CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
FREE_OP2();
@@ -2613,9 +2615,10 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
USE_OPLINE
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
+ zend_object *object = Z_OBJ(call->This);
SAVE_OPLINE();
- EX(call) = call->prev_nested_call;
+ EX(call) = call->prev_execute_data;
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name->val, fbc->common.function_name->val);
@@ -2630,22 +2633,6 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
}
}
}
- if (fbc->common.scope &&
- !(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
- !call->object) {
-
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- /* FIXME: output identifiers properly */
- zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- } else {
- /* FIXME: output identifiers properly */
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
- }
LOAD_OPLINE();
@@ -2655,23 +2642,23 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
if (fbc->common.scope) {
should_change_scope = 1;
- Z_OBJ(EG(This)) = call->object;
/* TODO: we don't set scope if we call an object method ??? */
/* See: ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt */
#if 1
- EG(scope) = (call->object) ? NULL : fbc->common.scope;
+ EG(scope) = object ? NULL : fbc->common.scope;
#else
EG(scope) = fbc->common.scope;
#endif
- } else {
+ } else {
call->called_scope = EX(called_scope);
+ Z_OBJ(call->This) = Z_OBJ(EX(This));
}
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
- zend_uint i;
+ uint32_t i;
zval *p = ZEND_CALL_ARG(call, 1);
for (i = 0; i < call->num_args; ++i) {
@@ -2699,7 +2686,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
- fbc->internal_function.handler(call->num_args, ret TSRMLS_CC);
+ fbc->internal_function.handler(call, ret TSRMLS_CC);
} else {
zend_execute_internal(call, ret TSRMLS_CC);
}
@@ -2717,18 +2704,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
ZEND_VM_C_GOTO(fcall_end);
}
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
- zval *return_value = NULL;
-
- Z_OBJ(EG(This)) = call->object;
- EG(scope) = fbc->common.scope;
- call->symbol_table = NULL;
- if (RETURN_VALUE_USED(opline)) {
- return_value = EX_VAR(opline->result.var);
-
- ZVAL_NULL(return_value);
- Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
- }
-
+ call->scope = EG(scope) = fbc->common.scope;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
@@ -2738,26 +2714,38 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
zend_vm_stack_free_call_frame(call TSRMLS_CC);
} else {
+ zval *return_value = NULL;
+
+ call->symbol_table = NULL;
+ if (RETURN_VALUE_USED(opline)) {
+ return_value = EX_VAR(opline->result.var);
+
+ ZVAL_NULL(return_value);
+ Z_VAR_FLAGS_P(return_value) = 0;
+ }
+
call->prev_execute_data = execute_data;
- i_init_func_execute_data(call, &fbc->op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_FUNCTION : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
+ i_init_func_execute_data(call, &fbc->op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_INFO(
+ VM_FRAME_TOP_FUNCTION,
+ VM_FRAME_FLAGS(call->frame_info));
zend_execute_ex(call TSRMLS_CC);
}
}
} else { /* ZEND_OVERLOADED_FUNCTION */
- Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
ZVAL_NULL(EX_VAR(opline->result.var));
/* Not sure what should be done here if it's a static method */
- if (EXPECTED(call->object != NULL)) {
+ if (EXPECTED(object != NULL)) {
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- call->object->handlers->call_method(fbc->common.function_name, call->object, call->num_args, EX_VAR(opline->result.var) TSRMLS_CC);
+ object->handlers->call_method(fbc->common.function_name, object, call, EX_VAR(opline->result.var) TSRMLS_CC);
EG(current_execute_data) = call->prev_execute_data;
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
@@ -2768,7 +2756,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
zend_vm_stack_free_call_frame(call TSRMLS_CC);
if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- STR_RELEASE(fbc->common.function_name);
+ zend_string_release(fbc->common.function_name);
}
efree(fbc);
@@ -2782,22 +2770,17 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
}
ZEND_VM_C_LABEL(fcall_end_change_scope):
- if (Z_OBJ(EG(This))) {
+ if (object) {
if (UNEXPECTED(EG(exception) != NULL) && (opline->op1.num & ZEND_CALL_CTOR)) {
if (!(opline->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- Z_DELREF(EG(This));
+ GC_REFCOUNT(object)--;
}
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ if (GC_REFCOUNT(object) == 1) {
+ zend_object_store_ctor_failed(object TSRMLS_CC);
}
}
- if (!Z_DELREF(EG(This))) {
- _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
- } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
- gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
- }
+ OBJ_RELEASE(object);
}
- Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
ZEND_VM_C_LABEL(fcall_end):
@@ -2831,7 +2814,7 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
zval_copy_ctor_func(EX(return_value));
}
}
- } else if (Z_ISREF_P(retval_ptr)) {
+ } else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && Z_ISREF_P(retval_ptr)) {
ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
FREE_OP1_IF_VAR();
} else {
@@ -2865,6 +2848,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
if (OP1_TYPE != IS_TMP_VAR) {
zval_opt_copy_ctor_no_imm(EX(return_value));
}
@@ -2874,7 +2858,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
retval_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
@@ -2884,9 +2868,9 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
} else {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EX(return_value)) {
- zval tmp;
- ZVAL_DUP(&tmp, retval_ptr);
- ZVAL_NEW_REF(EX(return_value), &tmp);
+ ZVAL_NEW_REF(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
+ if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -2896,6 +2880,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
ZVAL_MAKE_REF(retval_ptr);
Z_ADDREF_P(retval_ptr);
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
}
} while (0);
@@ -2962,7 +2947,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), catch_ce);
}
- ce = zend_get_class_entry(EG(exception) TSRMLS_CC);
+ ce = EG(exception)->ce;
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
@@ -3045,7 +3030,7 @@ ZEND_VM_HANDLER(117, ZEND_SEND_VAR, VAR|CV, ANY)
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
FREE_OP1();
} else {
@@ -3110,7 +3095,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
SAVE_OPLINE();
varptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr == NULL)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
@@ -3150,7 +3135,7 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, ANY)
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
FREE_OP1();
} else {
@@ -3183,7 +3168,7 @@ ZEND_VM_C_LABEL(send_again):
zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, zend_hash_num_elements(ht) TSRMLS_CC);
if (OP1_TYPE != IS_CONST && OP1_TYPE != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
- int i;
+ uint32_t i;
int separate = 0;
/* check if any of arguments are going to be passed by reference */
@@ -3342,14 +3327,14 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY)
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
} else {
- zend_uint arg_num = 1;
+ uint32_t arg_num = 1;
HashTable *ht = Z_ARRVAL_P(args);
zval *arg, *param, tmp;
@@ -3357,7 +3342,7 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY)
zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht) TSRMLS_CC);
if (OP1_TYPE != IS_CONST && OP1_TYPE != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
- zend_uint i;
+ uint32_t i;
int separate = 0;
/* check if any of arguments are going to be passed by reference */
@@ -3405,12 +3390,12 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY)
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
break;
}
@@ -3484,12 +3469,12 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY)
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
FREE_OP1();
CHECK_EXCEPTION();
@@ -3527,7 +3512,7 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY)
ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
+ uint32_t arg_num = opline->op1.num;
SAVE_OPLINE();
if (UNEXPECTED(arg_num > EX(num_args))) {
@@ -3546,7 +3531,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
+ uint32_t arg_num = opline->op1.num;
zval *param;
SAVE_OPLINE();
@@ -3574,8 +3559,8 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
- zend_uint arg_count = EX(num_args);
+ uint32_t arg_num = opline->op1.num;
+ uint32_t arg_count = EX(num_args);
zval *params;
SAVE_OPLINE();
@@ -3630,7 +3615,7 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
&EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk);
}
@@ -3641,7 +3626,7 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
&EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont);
}
@@ -3653,18 +3638,14 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->extended_value,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value,
&EX(func)->op_array, execute_data TSRMLS_CC);
brk_opline = EX(func)->op_array.opcodes + el->brk;
- if (brk_opline->opcode == ZEND_SWITCH_FREE) {
- if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
- }
- } else if (brk_opline->opcode == ZEND_FREE) {
+ if (brk_opline->opcode == ZEND_FREE) {
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_dtor(EX_VAR(brk_opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
}
}
ZEND_VM_JMP(opline->op1.jmp_addr);
@@ -3686,16 +3667,6 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY)
-{
- USE_OPLINE
-
- SAVE_OPLINE();
- zval_ptr_dtor(EX_VAR(opline->op1.var));
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
-}
-
ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
{
USE_OPLINE
@@ -3725,9 +3696,12 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
} else {
/* We are not handling overloaded classes right now */
EX(call) = zend_vm_stack_push_call_frame(
- constructor, opline->extended_value,
- RETURN_VALUE_USED(opline) ?
- ZEND_CALL_CTOR : (ZEND_CALL_CTOR | ZEND_CALL_CTOR_RESULT_UNUSED),
+ VM_FRAME_INFO(
+ VM_FRAME_NESTED_FUNCTION,
+ RETURN_VALUE_USED(opline) ?
+ ZEND_CALL_CTOR : (ZEND_CALL_CTOR | ZEND_CALL_CTOR_RESULT_UNUSED)),
+ constructor,
+ opline->extended_value,
Z_CE_P(EX_VAR(opline->op1.var)),
Z_OBJ(object_zval),
EX(call) TSRMLS_CC);
@@ -3757,7 +3731,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
obj = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_R);
if (OP1_TYPE == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -3815,7 +3789,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv));
+ char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
actual = Z_STRVAL_P(opline->op2.zv);
} else {
@@ -3823,7 +3797,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -3886,10 +3860,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
- } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
+ } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- STR_ADDREF(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -3909,7 +3882,7 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -3917,7 +3890,7 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
FREE_OP1_VAR_PTR();
} else {
expr_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (IS_OP1_TMP_FREE()) { /* temporary variable */
+ if (OP1_TYPE == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (OP1_TYPE == IS_CONST) {
@@ -3925,9 +3898,9 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
FREE_OP1_IF_VAR();
} else if (OP1_TYPE == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -3938,15 +3911,15 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
ZEND_VM_C_LABEL(add_again):
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
ZEND_VM_C_GOTO(num_index);
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index):
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -3990,7 +3963,7 @@ ZEND_VM_C_LABEL(str_index):
ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -4049,8 +4022,8 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break;
- case IS_INT:
- ZVAL_INT(result, zval_get_int(expr));
+ case IS_LONG:
+ ZVAL_LONG(result, zval_get_long(expr));
break;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr));
@@ -4070,7 +4043,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- FREE_OP1();
+ FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4085,15 +4058,13 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (OP1_TYPE != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!IS_OP1_TMP_FREE()) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -4105,23 +4076,18 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (OP1_TYPE != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!IS_OP1_TMP_FREE()) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- FREE_OP1_IF_VAR();
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
+
FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4141,12 +4107,11 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
ZVAL_UNDEF(&tmp_inc_filename);
if (Z_TYPE_P(inc_filename) != IS_STRING) {
- ZVAL_DUP(&tmp_inc_filename, inc_filename);
- convert_to_string(&tmp_inc_filename);
+ ZVAL_STR(&tmp_inc_filename, zval_get_string(inc_filename));
inc_filename = &tmp_inc_filename;
}
- if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
+ if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else {
@@ -4159,9 +4124,9 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_file_handle file_handle;
char *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
+ resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
+ failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, (int)strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -4174,7 +4139,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
+ if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, (int)strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
@@ -4221,8 +4186,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
return_value = EX_VAR(opline->result.var);
}
- call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
+ (zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
if (EX(symbol_table)) {
call->symbol_table = EX(symbol_table);
@@ -4231,15 +4196,16 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
}
call->prev_execute_data = execute_data;
- i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_code_execute_data(call, new_op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_TOP_CODE;
zend_execute_ex(call TSRMLS_CC);
}
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
HANDLE_EXCEPTION();
@@ -4257,28 +4223,35 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (OP1_TYPE == IS_CV &&
OP2_TYPE == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ ZVAL_UNDEF(&tmp);
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -4291,10 +4264,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (OP1_TYPE != IS_CONST && tmp_is_dup) {
+ if (OP1_TYPE != IS_CONST) {
zval_dtor(&tmp);
- } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- zval_ptr_dtor(&tmp);
}
FREE_OP1();
HANDLE_EXCEPTION();
@@ -4313,10 +4284,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (OP1_TYPE != IS_CONST && tmp_is_dup) {
+ if (OP1_TYPE != IS_CONST) {
zval_dtor(&tmp);
- } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- zval_ptr_dtor(&tmp);
}
FREE_OP1();
CHECK_EXCEPTION();
@@ -4329,94 +4298,79 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (OP1_TYPE != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (OP1_TYPE != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
ZEND_VM_C_LABEL(offset_again):
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_dim):
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (OP2_TYPE != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- ZEND_VM_C_GOTO(numeric_index_dim);
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-ZEND_VM_C_LABEL(numeric_index_dim):
- zend_hash_index_del(ht, hval);
- if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (OP2_TYPE != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ ZEND_VM_C_GOTO(num_index_dim);
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- ZEND_VM_C_GOTO(num_index_dim);
- case IS_TRUE:
- hval = 1;
- ZEND_VM_C_GOTO(num_index_dim);
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- ZEND_VM_C_GOTO(num_index_dim);
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- ZEND_VM_C_GOTO(offset_again);
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- FREE_OP2();
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ ZEND_VM_C_GOTO(num_index_dim);
+ case IS_TRUE:
+ hval = 1;
+ ZEND_VM_C_GOTO(num_index_dim);
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ ZEND_VM_C_GOTO(num_index_dim);
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ ZEND_VM_C_GOTO(offset_again);
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (OP2_TYPE == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- FREE_OP2();
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- FREE_OP2();
- break;
+ FREE_OP2();
+ } else if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (OP2_TYPE == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ FREE_OP2();
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ FREE_OP2();
}
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -4432,13 +4386,13 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
- if (OP1_TYPE == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (OP1_TYPE == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -4464,35 +4418,19 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
- (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ (opline->extended_value & ZEND_FE_FETCH_BYREF)) {
array_ptr = array_ref = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
ZVAL_DEREF(array_ptr);
if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ARRAY(array_ptr);
if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- } else if (Z_IMMUTABLE_P(array_ptr)) {
- zval_copy_ctor(array_ptr);
- } else {
- SEPARATE_ZVAL_NOREF(array_ptr);
+ ZVAL_NEW_REF(array_ref, array_ref);
+ array_ptr = Z_REFVAL_P(array_ref);
}
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
- zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
-
ce = Z_OBJCE_P(array_ptr);
- if (!ce || ce->get_iterator == NULL) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- }
+ if (ce->get_iterator == NULL) {
Z_ADDREF_P(array_ptr);
}
array_ref = array_ptr;
@@ -4502,9 +4440,12 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
} else {
array_ptr = array_ref = GET_OP1_ZVAL_PTR(BP_VAR_R);
ZVAL_DEREF(array_ptr);
- if (IS_OP1_TMP_FREE()) { /* IS_TMP_VAR */
+ if (OP1_TYPE == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, array_ptr);
- array_ptr = &tmp;
+ if (Z_OPT_IMMUTABLE_P(&tmp)) {
+ zval_copy_ctor_func(&tmp);
+ }
+ array_ref = array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -4513,17 +4454,18 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
- if (!ce || !ce->get_iterator) {
+ if (!ce->get_iterator) {
if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(array_ref);
}
}
} else if (Z_IMMUTABLE_P(array_ref)) {
if (OP1_TYPE == IS_CV) {
- zval_copy_ctor(array_ref);
+ zval_copy_ctor_func(array_ref);
Z_ADDREF_P(array_ref);
} else {
- ZVAL_DUP(&tmp, array_ref);
+ ZVAL_COPY_VALUE(&tmp, array_ref);
+ zval_copy_ctor_func(&tmp);
array_ptr = array_ref = &tmp;
}
} else if (Z_REFCOUNTED_P(array_ref)) {
@@ -4544,14 +4486,13 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
ZVAL_UNREF(array_ref);
array_ptr = array_ref;
}
- if (Z_IMMUTABLE_P(array_ptr) ||
- (Z_ISREF_P(array_ref) &&
- Z_REFCOUNTED_P(array_ptr) &&
- Z_REFCOUNT_P(array_ptr) > 1)) {
- if (!Z_IMMUTABLE_P(array_ptr)) {
- Z_DELREF_P(array_ptr);
- }
- zval_copy_ctor(array_ptr);
+ if (Z_IMMUTABLE_P(array_ptr)) {
+ zval_copy_ctor_func(array_ptr);
+ } else if (Z_ISREF_P(array_ref) &&
+ Z_COPYABLE_P(array_ptr) &&
+ Z_REFCOUNT_P(array_ptr) > 1) {
+ Z_DELREF_P(array_ptr);
+ zval_copy_ctor_func(array_ptr);
}
if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(array_ref);
@@ -4561,16 +4502,16 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
if (ce && ce->get_iterator) {
- iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
+ iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_FETCH_BYREF TSRMLS_CC);
- if (OP1_TYPE == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ if (OP1_TYPE == IS_VAR && !(opline->extended_value & ZEND_FE_FETCH_BYREF)) {
FREE_OP1_IF_VAR();
}
if (iter && EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(&iterator, &iter->std);
array_ptr = array_ref = &iterator;
} else {
- if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
FREE_OP1_VAR_PTR();
}
if (!EG(exception)) {
@@ -4589,7 +4530,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
FREE_OP1_VAR_PTR();
}
HANDLE_EXCEPTION();
@@ -4598,38 +4539,51 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
FREE_OP1_VAR_PTR();
}
HANDLE_EXCEPTION();
}
iter->index = -1; /* will be set to 0 before using next handler */
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- zend_hash_internal_pointer_reset(fe_ht);
- if (ce) {
- zend_object *zobj = Z_OBJ_P(array_ptr);
- while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- zend_string *str_key;
- zend_uint_t int_key;
- zend_uchar key_type;
-
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
- if (key_type != HASH_KEY_NON_EXISTENT &&
- (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
- break;
+ HashPointer *ptr = (HashPointer*)EX_VAR((opline+2)->op1.var);
+ HashPosition pos = 0;
+ Bucket *p;
+
+ while (1) {
+ if (pos >= fe_ht->nNumUsed) {
+ is_empty = 1;
+ if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ FREE_OP1_VAR_PTR();
}
- zend_hash_move_forward(fe_ht);
+ ZEND_VM_JMP(opline->op2.jmp_addr);
}
- }
- is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
+ p = fe_ht->arData + pos;
+ if (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ if (!ce ||
+ !p->key ||
+ zend_check_property_access(Z_OBJ_P(array_ptr), p->key TSRMLS_CC) == SUCCESS) {
+ break;
+ }
+ pos++;
+ }
+ fe_ht->nInternalPointer = pos;
+ ptr->pos = pos;
+ ptr->ht = fe_ht;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ is_empty = 0;
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
- if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
FREE_OP1_VAR_PTR();
}
if (is_empty) {
@@ -4647,92 +4601,194 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zval *array, *array_ref;
zval *value;
HashTable *fe_ht;
- zend_object_iterator *iter = NULL;
- zval *key = NULL;
+ HashPointer *ptr;
+ HashPosition pos;
+ Bucket *p;
array = array_ref = EX_VAR(opline->op1.var);
if (Z_ISREF_P(array)) {
array = Z_REFVAL_P(array);
// TODO: referenced value might be changed to different array ???
if (Z_IMMUTABLE_P(array)) {
- zval_copy_ctor(array);
+ zval_copy_ctor_func(array);
}
}
- if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
- key = EX_VAR((opline+1)->result.var);
- }
SAVE_OPLINE();
- switch (zend_iterator_unwrap(array, &iter TSRMLS_CC)) {
- default:
- case ZEND_ITER_INVALID:
- zend_error(E_WARNING, "Invalid argument supplied for foreach()");
+ if (EXPECTED(Z_TYPE_P(array) == IS_ARRAY)) {
+ fe_ht = Z_ARRVAL_P(array);
+ ptr = (HashPointer*)EX_VAR((opline+1)->op1.var);
+ pos = ptr->pos;
+ if (UNEXPECTED(pos == INVALID_IDX)) {
+ /* reached end of iteration */
ZEND_VM_JMP(opline->op2.jmp_addr);
-
- case ZEND_ITER_PLAIN_OBJECT: {
- zend_object *zobj = Z_OBJ_P(array);
- int key_type;
- zend_string *str_key;
- zend_uint_t int_key;
-
- fe_ht = Z_OBJPROP_P(array);
- zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
+ } else if (UNEXPECTED(ptr->ht != fe_ht)) {
+ ptr->ht = fe_ht;
+ pos = 0;
+ } else if (UNEXPECTED(fe_ht->nInternalPointer != ptr->pos)) {
+ if (fe_ht->u.flags & HASH_FLAG_PACKED) {
+ pos = ptr->h;
+ } else {
+ pos = fe_ht->arHash[ptr->h & fe_ht->nTableMask];
+ while (1) {
+ if (pos == INVALID_IDX) {
+ pos = fe_ht->nInternalPointer;
+ break;
+ } else if (fe_ht->arData[pos].h == ptr->h && fe_ht->arData[pos].key == ptr->key) {
+ break;
+ }
+ pos = Z_NEXT(fe_ht->arData[pos].val);
+ }
+ }
+ }
+ while (1) {
+ if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
+ /* reached end of iteration */
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ }
+ p = fe_ht->arData + pos;
+ value = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ } else if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ if (!p->key) {
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
+ } else {
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
+ }
+ }
+ break;
+ }
+ do {
+ pos++;
+ if (pos >= fe_ht->nNumUsed) {
+ fe_ht->nInternalPointer = ptr->pos = INVALID_IDX;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
+ p = fe_ht->arData + pos;
+ } while (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF));
+ fe_ht->nInternalPointer = ptr->pos = pos;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ } else if (EXPECTED(Z_TYPE_P(array) == IS_OBJECT)) {
+ zend_object_iterator *iter;
+
+ if ((iter = zend_iterator_unwrap(array TSRMLS_CC)) == NULL) {
+ /* plain object */
+ zend_object *zobj = Z_OBJ_P(array);
+
+ fe_ht = Z_OBJPROP_P(array);
+ ptr = (HashPointer*)EX_VAR((opline+1)->op1.var);
+ pos = ptr->pos;
+ if (pos == INVALID_IDX) {
+ /* reached end of iteration */
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ } else if (UNEXPECTED(ptr->ht != fe_ht)) {
+ ptr->ht = fe_ht;
+ pos = 0;
+ } else if (UNEXPECTED(fe_ht->nInternalPointer != ptr->pos)) {
+ if (fe_ht->u.flags & HASH_FLAG_PACKED) {
+ pos = ptr->h;
+ } else {
+ pos = fe_ht->arHash[ptr->h & fe_ht->nTableMask];
+ while (1) {
+ if (pos == INVALID_IDX) {
+ pos = fe_ht->nInternalPointer;
+ break;
+ } else if (fe_ht->arData[pos].h == ptr->h && fe_ht->arData[pos].key == ptr->key) {
+ break;
+ }
+ pos = Z_NEXT(fe_ht->arData[pos].val);
+ }
+ }
+ }
while (1) {
- if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
+ if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
/* reached end of iteration */
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- if (Z_TYPE_P(value) == IS_INDIRECT) {
+ p = fe_ht->arData + pos;
+ value = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ } else if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
value = Z_INDIRECT_P(value);
- if (Z_TYPE_P(value) == IS_UNDEF) {
- zend_hash_move_forward(fe_ht);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
continue;
}
}
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
-
- zend_hash_move_forward(fe_ht);
- if (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ if (UNEXPECTED(!p->key)) {
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
+ }
+ break;
+ } else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ if (p->key->val[0]) {
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
+ } else {
+ const char *class_name, *prop_name;
+ size_t prop_name_len;
+ zend_unmangle_property_name_ex(
+ p->key, &class_name, &prop_name, &prop_name_len);
+ ZVAL_STRINGL(EX_VAR((opline+1)->result.var), prop_name, prop_name_len);
+ }
+ }
break;
}
+ pos++;
}
-
- if (key) {
- if (key_type == HASH_KEY_IS_INT) {
- ZVAL_INT(key, int_key);
- } else {
- const char *class_name, *prop_name;
- int prop_name_len;
- zend_unmangle_property_name_ex(
- str_key->val, str_key->len, &class_name, &prop_name, &prop_name_len
- );
- ZVAL_STRINGL(key, prop_name, prop_name_len);
- }
- }
-
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- break;
- }
-
- case ZEND_ITER_PLAIN_ARRAY:
- fe_ht = Z_ARRVAL_P(array);
- zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
- /* reached end of iteration */
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
- if (key) {
- zend_hash_get_current_key_zval(fe_ht, key);
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zend_hash_move_forward(fe_ht);
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- break;
-
- case ZEND_ITER_OBJECT:
+ do {
+ pos++;
+ if (pos >= fe_ht->nNumUsed) {
+ fe_ht->nInternalPointer = ptr->pos = INVALID_IDX;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
+ p = fe_ht->arData + pos;
+ } while (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF) ||
+ (EXPECTED(p->key != NULL) &&
+ zend_check_property_access(zobj, p->key TSRMLS_CC) == FAILURE));
+ fe_ht->nInternalPointer = ptr->pos = pos;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
/* !iter happens from exception */
if (iter && ++iter->index > 0) {
/* This could cause an endless loop if index becomes zero again.
@@ -4761,57 +4817,59 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
/* failure in get_current_data */
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- if (key) {
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (iter->funcs->get_current_key) {
- iter->funcs->get_current_key(iter, key TSRMLS_CC);
+ iter->funcs->get_current_key(iter, EX_VAR((opline+1)->result.var) TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
HANDLE_EXCEPTION();
}
} else {
- ZVAL_INT(key, iter->index);
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), iter->index);
}
}
- break;
- }
-
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_MAKE_REF(value);
- Z_ADDREF_P(value);
- ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
} else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ zend_error(E_WARNING, "Invalid argument supplied for foreach()");
+ ZEND_VM_JMP(opline->op2.jmp_addr);
}
-
- CHECK_EXCEPTION();
- ZEND_VM_INC_OPCODE();
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (OP1_TYPE == IS_CV &&
OP2_TYPE == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS);
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -4833,55 +4891,44 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((OP1_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (OP1_TYPE != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
FREE_OP1();
- }
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
-ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (OP1_TYPE != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -4896,14 +4943,14 @@ ZEND_VM_C_LABEL(isset_again):
}
ZEND_VM_C_LABEL(str_index_prop):
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_prop):
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
ZEND_VM_C_GOTO(num_index_prop);
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -4934,8 +4981,8 @@ ZEND_VM_C_LABEL(num_index_prop):
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -4944,24 +4991,24 @@ ZEND_VM_C_LABEL(num_index_prop):
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -4977,12 +5024,12 @@ ZEND_VM_C_LABEL(num_index_prop):
FREE_OP2();
ZVAL_BOOL(EX_VAR(opline->result.var), result);
- FREE_OP1_IF_VAR();
+ FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
+ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
@@ -4994,8 +5041,8 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|C
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -5010,7 +5057,7 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|C
FREE_OP2();
ZVAL_BOOL(EX_VAR(opline->result.var), result);
- FREE_OP1_IF_VAR();
+ FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5025,8 +5072,8 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
zend_free_op free_op1;
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
@@ -5042,9 +5089,10 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
USE_OPLINE
SAVE_OPLINE();
- ZVAL_INT(EX_VAR(opline->result.var), EG(error_reporting));
- if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) {
- ZVAL_INT(&EX(old_error_reporting), EG(error_reporting));
+ ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
+ if (EX(silence_op_num) == -1) {
+ EX(silence_op_num) = opline->op2.num;
+ EX(old_error_reporting) = EG(error_reporting);
}
if (EG(error_reporting)) {
@@ -5065,51 +5113,27 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
}
if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
- EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
EG(error_reporting_ini_entry)->modified = 1;
}
- } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) {
- efree(EG(error_reporting_ini_entry)->value);
}
- EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1);
- EG(error_reporting_ini_entry)->value_length = sizeof("0")-1;
} while (0);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(142, ZEND_RAISE_ABSTRACT_ERROR, ANY, ANY)
-{
- SAVE_OPLINE();
- zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(scope)->name->val, EX(func)->op_array.function_name->val);
- ZEND_VM_NEXT_OPCODE(); /* Never reached */
-}
-
ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
{
USE_OPLINE
- char buf[MAX_LENGTH_OF_ZEND_INT + 1];
- char *res;
SAVE_OPLINE();
- if (!EG(error_reporting) && Z_IVAL_P(EX_VAR(opline->op1.var)) != 0) {
- EG(error_reporting) = Z_IVAL_P(EX_VAR(opline->op1.var));
- _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_uint_t, res);
- if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
- if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
- EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
- efree(EG(error_reporting_ini_entry)->value);
- }
- EG(error_reporting_ini_entry)->value_length = buf + sizeof(buf) - 1 - res;
- EG(error_reporting_ini_entry)->value = estrndup(res, EG(error_reporting_ini_entry)->value_length);
- }
+ if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
+ }
+ if (EX(silence_op_num) == opline->op2.num) {
+ EX(silence_op_num) = -1;
}
-//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
-//??? EX(old_error_reporting) = NULL;
-//??? }
- CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5118,10 +5142,15 @@ ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
if (i_zend_is_true(value TSRMLS_CC)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (OP1_TYPE == IS_CONST) {
@@ -5130,6 +5159,9 @@ ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
}
} else if (OP1_TYPE == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (OP1_TYPE == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ FREE_OP1();
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -5139,16 +5171,22 @@ ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(158, ZEND_JMP_SET_VAR, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
- value = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ value = GET_OP1_ZVAL_PTR(BP_VAR_IS);
- if (i_zend_is_true(value TSRMLS_CC)) {
+ if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
+
+ if (Z_TYPE_P(value) > IS_NULL) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (OP1_TYPE == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
@@ -5156,6 +5194,9 @@ ZEND_VM_HANDLER(158, ZEND_JMP_SET_VAR, CONST|TMP|VAR|CV, ANY)
}
} else if (OP1_TYPE == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (OP1_TYPE == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ FREE_OP1();
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -5174,33 +5215,18 @@ ZEND_VM_HANDLER(22, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (OP1_TYPE == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
- }
- } else if (OP1_TYPE == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- ZEND_VM_NEXT_OPCODE();
-}
-
-ZEND_VM_HANDLER(157, ZEND_QM_ASSIGN_VAR, CONST|TMP|VAR|CV, ANY)
-{
- USE_OPLINE
- zend_free_op free_op1;
- zval *value;
-
- SAVE_OPLINE();
- value = GET_OP1_ZVAL_PTR(BP_VAR_R);
-
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (OP1_TYPE == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
+ if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && Z_ISREF_P(value)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), Z_REFVAL_P(value));
+ FREE_OP1();
+ } else {
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
+ if (OP1_TYPE == IS_CONST) {
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+ zval_copy_ctor_func(EX_VAR(opline->result.var));
+ }
+ } else if (OP1_TYPE == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- } else if (OP1_TYPE == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -5305,7 +5331,7 @@ ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY)
SAVE_OPLINE();
expr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
+ if (Z_TYPE_P(expr) == IS_OBJECT) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
@@ -5395,9 +5421,9 @@ ZEND_VM_HANDLER(155, ZEND_BIND_TRAITS, ANY, ANY)
ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
{
- zend_uint op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
+ uint32_t op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
int i;
- zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
+ uint32_t catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
for (i = 0; i < EX(func)->op_array.last_try_catch; i++) {
if (EX(func)->op_array.try_catch_array[i].try_op > op_num) {
@@ -5423,18 +5449,18 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
* arguments pushed to the stack that have to be dtor'ed. */
zend_vm_stack_free_args(EX(call) TSRMLS_CC);
- if (call->object) {
- if (call->flags & ZEND_CALL_CTOR) {
- if (!(call->flags & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- GC_REFCOUNT(call->object)--;
+ if (Z_OBJ(call->This)) {
+ if (call->frame_info & ZEND_CALL_CTOR) {
+ if (!(call->frame_info & ZEND_CALL_CTOR_RESULT_UNUSED)) {
+ GC_REFCOUNT(Z_OBJ(call->This))--;
}
- if (GC_REFCOUNT(call->object) == 1) {
- zend_object_store_ctor_failed(call->object TSRMLS_CC);
+ if (GC_REFCOUNT(Z_OBJ(call->This)) == 1) {
+ zend_object_store_ctor_failed(Z_OBJ(call->This) TSRMLS_CC);
}
}
- OBJ_RELEASE(call->object);
+ OBJ_RELEASE(Z_OBJ(call->This));
}
- EX(call) = call->prev_nested_call;
+ EX(call) = call->prev_execute_data;
zend_vm_stack_free_call_frame(call TSRMLS_CC);
call = EX(call);
} while (call);
@@ -5451,13 +5477,9 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
catch_op_num >= EX(func)->op_array.brk_cont_array[i].brk) {
zend_op *brk_opline = &EX(func)->op_array.opcodes[EX(func)->op_array.brk_cont_array[i].brk];
- if (brk_opline->opcode == ZEND_SWITCH_FREE) {
+ if (brk_opline->opcode == ZEND_FREE) {
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
- }
- } else if (brk_opline->opcode == ZEND_FREE) {
- if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_dtor(EX_VAR(brk_opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
}
}
}
@@ -5465,18 +5487,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
/* restore previous error_reporting value */
- if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_IVAL(EX(old_error_reporting)) != 0) {
- zval restored_error_reporting;
- zend_string *key;
-
- ZVAL_INT(&restored_error_reporting, Z_IVAL(EX(old_error_reporting)));
- convert_to_string(&restored_error_reporting);
- key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
- zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
- STR_FREE(key);
- zval_dtor(&restored_error_reporting);
+ if (!EG(error_reporting) && EX(silence_op_num) != -1 && EX(old_error_reporting) != 0) {
+ EG(error_reporting) = EX(old_error_reporting);
}
- ZVAL_UNDEF(&EX(old_error_reporting));
+ EX(silence_op_num) = -1;
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
if (EX(delayed_exception)) {
@@ -5571,7 +5585,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
}
}
c.flags = CONST_CS; /* non persistent, case sensetive */
- c.name = STR_DUP(Z_STR_P(name), 0);
+ c.name = zend_string_dup(Z_STR_P(name), 0);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
@@ -5601,7 +5615,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
if (closure_is_static || closure_is_being_defined_inside_static_context) {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
}
CHECK_EXCEPTION();
@@ -5660,13 +5674,13 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(&generator->value);
+ if (OP1_TYPE != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -5691,14 +5705,14 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
ZVAL_DUP(&generator->value, value);
} else if (OP1_TYPE == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
FREE_OP1_IF_VAR();
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (OP1_TYPE == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -5716,25 +5730,25 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
ZVAL_DUP(&generator->key, key);
} else if (OP2_TYPE == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((OP2_TYPE == IS_VAR || OP2_TYPE == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
FREE_OP2_IF_VAR();
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (OP2_TYPE == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -5841,19 +5855,46 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
zval *varname;
zval *value;
zval *variable_ptr;
- zend_string *name;
+ Bucket *p;
+ uint32_t idx;
SAVE_OPLINE();
varname = GET_OP2_ZVAL_PTR(BP_VAR_R);
- name = Z_STR_P(varname);
- value = zend_hash_find(&EG(symbol_table).ht, name);
- if (value == NULL) {
- value = zend_hash_add_new(&EG(symbol_table).ht, name, &EG(uninitialized_zval));
+ idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname));
+ /* index 0 can't be cached (NULL is a mark of uninitialized cache slot) */
+ p = EG(symbol_table).ht.arData + idx;
+ if (EXPECTED(idx > 0) &&
+ EXPECTED(idx < EG(symbol_table).ht.nNumUsed) &&
+ EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+ (EXPECTED(p->key == Z_STR_P(varname)) ||
+ (EXPECTED(p->h == Z_STR_P(varname)->h) &&
+ EXPECTED(p->key != NULL) &&
+ EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
+ EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
+ value = &EG(symbol_table).ht.arData[idx].val;
/* GLOBAL variable may be an INDIRECT pointer to CV */
- } else if (Z_TYPE_P(value) == IS_INDIRECT) {
- value = Z_INDIRECT_P(value);
- if (Z_TYPE_P(value) == IS_UNDEF) {
- ZVAL_NULL(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
+ } else {
+ value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
+ if (UNEXPECTED(value == NULL)) {
+ value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
+ idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+ CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
+ } else {
+ idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+ CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
+ /* GLOBAL variable may be an INDIRECT pointer to CV */
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
}
}
@@ -5873,24 +5914,26 @@ ZEND_VM_HANDLER(121, ZEND_STRLEN, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
- ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value));
+ ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
} else {
if (Z_TYPE_P(value) < IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 0);
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
} else if (Z_TYPE_P(value) == IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
} else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value);
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str;
+ zval tmp;
- if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
+ ZVAL_COPY(&tmp, value);
+ if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
ZEND_VM_C_GOTO(strlen_error);
}
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zval_dtor(&tmp);
} else {
ZEND_VM_C_LABEL(strlen_error):
zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
@@ -5912,7 +5955,7 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
switch (opline->extended_value) {
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
@@ -5923,16 +5966,12 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
break;
case IS_OBJECT:
if (Z_TYPE_P(value) == opline->extended_value) {
- if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
- ZVAL_TRUE(EX_VAR(opline->result.var));
+ zend_class_entry *ce = Z_OBJCE_P(value);
+ if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
+ && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+ ZVAL_FALSE(EX_VAR(opline->result.var));
} else {
- zend_class_entry *ce = Z_OBJCE_P(value);
- if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
- && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
- ZVAL_FALSE(EX_VAR(opline->result.var));
- } else {
- ZVAL_TRUE(EX_VAR(opline->result.var));
- }
+ ZVAL_TRUE(EX_VAR(opline->result.var));
}
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -5945,8 +5984,8 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
}
+ break;
EMPTY_SWITCH_DEFAULT_CASE()
-
}
FREE_OP1();
CHECK_EXCEPTION();
@@ -5956,11 +5995,9 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
ZEND_VM_HANDLER(122, ZEND_DEFINED, CONST, ANY)
{
USE_OPLINE
- zval *name;
zend_constant *c;
SAVE_OPLINE();
- name = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if ((c = zend_quick_get_constant(opline->op1.zv, 0 TSRMLS_CC)) == NULL) {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 89b6c7e0d3..4b58d95618 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -306,7 +306,7 @@ static zend_uchar zend_user_opcodes[256] = {0,
241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);
+static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);
#undef OPLINE
@@ -316,7 +316,7 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o
#undef SAVE_OPLINE
#define OPLINE EX(opline)
#define DCL_OPLINE
-#define USE_OPLINE zend_op *opline = EX(opline);
+#define USE_OPLINE const zend_op *opline = EX(opline);
#define LOAD_OPLINE()
#define SAVE_OPLINE()
#undef CHECK_EXCEPTION
@@ -325,7 +325,6 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o
#define CHECK_EXCEPTION() LOAD_OPLINE()
#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()
#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()
-#define LOAD_REGS()
#define ZEND_VM_CONTINUE() return 0
#define ZEND_VM_RETURN() return -1
#define ZEND_VM_ENTER() return 1
@@ -340,7 +339,6 @@ ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
- LOAD_REGS();
LOAD_OPLINE();
while (1) {
@@ -371,23 +369,25 @@ ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC
return;
}
- execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ execute_data = zend_vm_stack_push_call_frame(VM_FRAME_TOP_CODE,
+ (zend_function*)op_array, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, EG(current_execute_data) ? Z_OBJ(EG(current_execute_data)->This) : NULL, NULL TSRMLS_CC);
if (EG(current_execute_data)) {
execute_data->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
} else {
execute_data->symbol_table = &EG(symbol_table);
}
EX(prev_execute_data) = EG(current_execute_data);
- i_init_execute_data(execute_data, op_array, return_value, VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_execute_data(execute_data, op_array, return_value TSRMLS_CC);
zend_execute_ex(execute_data TSRMLS_CC);
}
static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
{
- vm_frame_kind frame_kind = EX(frame_kind);
+ vm_frame_kind frame_kind = VM_FRAME_KIND(EX(frame_info));
if (frame_kind == VM_FRAME_NESTED_FUNCTION) {
+ zend_object *object;
+
i_free_compiled_variables(execute_data TSRMLS_CC);
if (UNEXPECTED(EX(symbol_table) != NULL)) {
zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
@@ -397,30 +397,26 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_CLOSURE) != 0) && EX(func)->op_array.prototype) {
OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
}
+ object = Z_OBJ(EX(This));
zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
execute_data = EG(current_execute_data);
- if (Z_OBJ(EG(This))) {
+ if (object) {
if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
if (!(EX(opline)->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- Z_DELREF(EG(This));
+ GC_REFCOUNT(object)--;
}
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ if (GC_REFCOUNT(object) == 1) {
+ zend_object_store_ctor_failed(object TSRMLS_CC);
}
}
- if (!Z_DELREF(EG(This))) {
- _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
- } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
- gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
- }
+ OBJ_RELEASE(object);
}
- Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
if (UNEXPECTED(EG(exception) != NULL)) {
- zend_op *opline = EX(opline);
+ const zend_op *opline = EX(opline);
zend_throw_exception_internal(NULL TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(EX_VAR(opline->result.var));
@@ -434,7 +430,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
} else if (frame_kind == VM_FRAME_NESTED_CODE) {
zend_detach_symbol_table(execute_data);
destroy_op_array(&EX(func)->op_array TSRMLS_CC);
- efree(EX(func));
+ efree_size(EX(func), sizeof(zend_op_array));
EG(current_execute_data) = EX(prev_execute_data);
zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
@@ -490,25 +486,15 @@ static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_CONTINUE();
}
-static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zval *tmp = EX_VAR(opline->result.var);
-
- SAVE_OPLINE();
- ZVAL_EMPTY_STRING(tmp);
- /*CHECK_EXCEPTION();*/
- ZEND_VM_NEXT_OPCODE();
-}
-
static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
+ zend_object *object = Z_OBJ(call->This);
SAVE_OPLINE();
- EX(call) = call->prev_nested_call;
+ EX(call) = call->prev_execute_data;
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name->val, fbc->common.function_name->val);
@@ -523,22 +509,6 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
}
}
- if (fbc->common.scope &&
- !(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
- !call->object) {
-
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- /* FIXME: output identifiers properly */
- zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- } else {
- /* FIXME: output identifiers properly */
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
- }
LOAD_OPLINE();
@@ -548,23 +518,23 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (fbc->common.scope) {
should_change_scope = 1;
- Z_OBJ(EG(This)) = call->object;
/* TODO: we don't set scope if we call an object method ??? */
/* See: ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt */
#if 1
- EG(scope) = (call->object) ? NULL : fbc->common.scope;
+ EG(scope) = object ? NULL : fbc->common.scope;
#else
EG(scope) = fbc->common.scope;
#endif
} else {
call->called_scope = EX(called_scope);
+ Z_OBJ(call->This) = Z_OBJ(EX(This));
}
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
- zend_uint i;
+ uint32_t i;
zval *p = ZEND_CALL_ARG(call, 1);
for (i = 0; i < call->num_args; ++i) {
@@ -592,7 +562,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
- fbc->internal_function.handler(call->num_args, ret TSRMLS_CC);
+ fbc->internal_function.handler(call, ret TSRMLS_CC);
} else {
zend_execute_internal(call, ret TSRMLS_CC);
}
@@ -610,18 +580,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
goto fcall_end;
}
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
- zval *return_value = NULL;
-
- Z_OBJ(EG(This)) = call->object;
- EG(scope) = fbc->common.scope;
- call->symbol_table = NULL;
- if (RETURN_VALUE_USED(opline)) {
- return_value = EX_VAR(opline->result.var);
-
- ZVAL_NULL(return_value);
- Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
- }
-
+ call->scope = EG(scope) = fbc->common.scope;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
@@ -631,26 +590,38 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_vm_stack_free_call_frame(call TSRMLS_CC);
} else {
+ zval *return_value = NULL;
+
+ call->symbol_table = NULL;
+ if (RETURN_VALUE_USED(opline)) {
+ return_value = EX_VAR(opline->result.var);
+
+ ZVAL_NULL(return_value);
+ Z_VAR_FLAGS_P(return_value) = 0;
+ }
+
call->prev_execute_data = execute_data;
- i_init_func_execute_data(call, &fbc->op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_FUNCTION : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
+ i_init_func_execute_data(call, &fbc->op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_INFO(
+ VM_FRAME_TOP_FUNCTION,
+ VM_FRAME_FLAGS(call->frame_info));
zend_execute_ex(call TSRMLS_CC);
}
}
} else { /* ZEND_OVERLOADED_FUNCTION */
- Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
ZVAL_NULL(EX_VAR(opline->result.var));
/* Not sure what should be done here if it's a static method */
- if (EXPECTED(call->object != NULL)) {
+ if (EXPECTED(object != NULL)) {
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- call->object->handlers->call_method(fbc->common.function_name, call->object, call->num_args, EX_VAR(opline->result.var) TSRMLS_CC);
+ object->handlers->call_method(fbc->common.function_name, object, call, EX_VAR(opline->result.var) TSRMLS_CC);
EG(current_execute_data) = call->prev_execute_data;
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
@@ -661,7 +632,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_vm_stack_free_call_frame(call TSRMLS_CC);
if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- STR_RELEASE(fbc->common.function_name);
+ zend_string_release(fbc->common.function_name);
}
efree(fbc);
@@ -675,22 +646,17 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
fcall_end_change_scope:
- if (Z_OBJ(EG(This))) {
+ if (object) {
if (UNEXPECTED(EG(exception) != NULL) && (opline->op1.num & ZEND_CALL_CTOR)) {
if (!(opline->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- Z_DELREF(EG(This));
+ GC_REFCOUNT(object)--;
}
- if (Z_REFCOUNT(EG(This)) == 1) {
- zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
+ if (GC_REFCOUNT(object) == 1) {
+ zend_object_store_ctor_failed(object TSRMLS_CC);
}
}
- if (!Z_DELREF(EG(This))) {
- _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
- } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
- gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
- }
+ OBJ_RELEASE(object);
}
- Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
fcall_end:
@@ -738,7 +704,7 @@ send_again:
zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, zend_hash_num_elements(ht) TSRMLS_CC);
if (opline->op1_type != IS_CONST && opline->op1_type != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
- int i;
+ uint32_t i;
int separate = 0;
/* check if any of arguments are going to be passed by reference */
@@ -897,14 +863,14 @@ static int ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
} else {
- zend_uint arg_num = 1;
+ uint32_t arg_num = 1;
HashTable *ht = Z_ARRVAL_P(args);
zval *arg, *param, tmp;
@@ -912,7 +878,7 @@ static int ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht) TSRMLS_CC);
if (opline->op1_type != IS_CONST && opline->op1_type != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
- zend_uint i;
+ uint32_t i;
int separate = 0;
/* check if any of arguments are going to be passed by reference */
@@ -960,12 +926,12 @@ static int ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
break;
}
@@ -1003,7 +969,7 @@ static int ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
+ uint32_t arg_num = opline->op1.num;
SAVE_OPLINE();
if (UNEXPECTED(arg_num > EX(num_args))) {
@@ -1022,8 +988,8 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
- zend_uint arg_count = EX(num_args);
+ uint32_t arg_num = opline->op1.num;
+ uint32_t arg_count = EX(num_args);
zval *params;
SAVE_OPLINE();
@@ -1086,9 +1052,12 @@ static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
/* We are not handling overloaded classes right now */
EX(call) = zend_vm_stack_push_call_frame(
- constructor, opline->extended_value,
- RETURN_VALUE_USED(opline) ?
- ZEND_CALL_CTOR : (ZEND_CALL_CTOR | ZEND_CALL_CTOR_RESULT_UNUSED),
+ VM_FRAME_INFO(
+ VM_FRAME_NESTED_FUNCTION,
+ RETURN_VALUE_USED(opline) ?
+ ZEND_CALL_CTOR : (ZEND_CALL_CTOR | ZEND_CALL_CTOR_RESULT_UNUSED)),
+ constructor,
+ opline->extended_value,
Z_CE_P(EX_VAR(opline->op1.var)),
Z_OBJ(object_zval),
EX(call) TSRMLS_CC);
@@ -1110,9 +1079,10 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
SAVE_OPLINE();
- ZVAL_INT(EX_VAR(opline->result.var), EG(error_reporting));
- if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) {
- ZVAL_INT(&EX(old_error_reporting), EG(error_reporting));
+ ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
+ if (EX(silence_op_num) == -1) {
+ EX(silence_op_num) = opline->op2.num;
+ EX(old_error_reporting) = EG(error_reporting);
}
if (EG(error_reporting)) {
@@ -1133,28 +1103,16 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
}
if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
- EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
EG(error_reporting_ini_entry)->modified = 1;
}
- } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) {
- efree(EG(error_reporting_ini_entry)->value);
}
- EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1);
- EG(error_reporting_ini_entry)->value_length = sizeof("0")-1;
} while (0);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- SAVE_OPLINE();
- zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(scope)->name->val, EX(func)->op_array.function_name->val);
- ZEND_VM_NEXT_OPCODE(); /* Never reached */
-}
-
static int ZEND_FASTCALL ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
SAVE_OPLINE();
@@ -1297,9 +1255,9 @@ static int ZEND_FASTCALL ZEND_BIND_TRAITS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
- zend_uint op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
+ uint32_t op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
int i;
- zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
+ uint32_t catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
for (i = 0; i < EX(func)->op_array.last_try_catch; i++) {
if (EX(func)->op_array.try_catch_array[i].try_op > op_num) {
@@ -1325,18 +1283,18 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
* arguments pushed to the stack that have to be dtor'ed. */
zend_vm_stack_free_args(EX(call) TSRMLS_CC);
- if (call->object) {
- if (call->flags & ZEND_CALL_CTOR) {
- if (!(call->flags & ZEND_CALL_CTOR_RESULT_UNUSED)) {
- GC_REFCOUNT(call->object)--;
+ if (Z_OBJ(call->This)) {
+ if (call->frame_info & ZEND_CALL_CTOR) {
+ if (!(call->frame_info & ZEND_CALL_CTOR_RESULT_UNUSED)) {
+ GC_REFCOUNT(Z_OBJ(call->This))--;
}
- if (GC_REFCOUNT(call->object) == 1) {
- zend_object_store_ctor_failed(call->object TSRMLS_CC);
+ if (GC_REFCOUNT(Z_OBJ(call->This)) == 1) {
+ zend_object_store_ctor_failed(Z_OBJ(call->This) TSRMLS_CC);
}
}
- OBJ_RELEASE(call->object);
+ OBJ_RELEASE(Z_OBJ(call->This));
}
- EX(call) = call->prev_nested_call;
+ EX(call) = call->prev_execute_data;
zend_vm_stack_free_call_frame(call TSRMLS_CC);
call = EX(call);
} while (call);
@@ -1353,13 +1311,9 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
catch_op_num >= EX(func)->op_array.brk_cont_array[i].brk) {
zend_op *brk_opline = &EX(func)->op_array.opcodes[EX(func)->op_array.brk_cont_array[i].brk];
- if (brk_opline->opcode == ZEND_SWITCH_FREE) {
- if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
- }
- } else if (brk_opline->opcode == ZEND_FREE) {
+ if (brk_opline->opcode == ZEND_FREE) {
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_dtor(EX_VAR(brk_opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
}
}
}
@@ -1367,18 +1321,10 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
}
/* restore previous error_reporting value */
- if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_IVAL(EX(old_error_reporting)) != 0) {
- zval restored_error_reporting;
- zend_string *key;
-
- ZVAL_INT(&restored_error_reporting, Z_IVAL(EX(old_error_reporting)));
- convert_to_string(&restored_error_reporting);
- key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
- zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
- STR_FREE(key);
- zval_dtor(&restored_error_reporting);
+ if (!EG(error_reporting) && EX(silence_op_num) != -1 && EX(old_error_reporting) != 0) {
+ EG(error_reporting) = EX(old_error_reporting);
}
- ZVAL_UNDEF(&EX(old_error_reporting));
+ EX(silence_op_num) = -1;
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
if (EX(delayed_exception)) {
@@ -1553,7 +1499,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
zend_function *fbc;
zval *function_name, *func;
- if (IS_CONST == IS_CONST) {
+ if (IS_CONST == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
function_name = (zval*)(opline->op2.zv+1);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
@@ -1565,8 +1511,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
@@ -1583,21 +1529,21 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1);
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
fbc = Z_FUNC_P(func);
called_scope = NULL;
object = NULL;
- } else if (IS_CONST != IS_CONST && IS_CONST != IS_TMP_VAR &&
+ } else if (IS_CONST != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
@@ -1608,11 +1554,10 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
- } else {
+ } else if (IS_CONST == IS_CV) {
}
- } else if (IS_CONST != IS_CONST &&
- EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
+ } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
zval *method;
@@ -1650,13 +1595,25 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
if (UNEXPECTED(fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
}
+ if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ }
+ }
} else {
called_scope = Z_OBJCE_P(obj);
object = Z_OBJ_P(obj);
fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method));
}
if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
@@ -1673,8 +1630,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Function name must be a string");
ZEND_VM_CONTINUE(); /* Never reached */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1705,8 +1662,8 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
@@ -1729,8 +1686,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
}
@@ -1738,7 +1695,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_uint arg_num = opline->op1.num;
+ uint32_t arg_num = opline->op1.num;
zval *param;
SAVE_OPLINE();
@@ -1769,7 +1726,7 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
&EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk);
}
@@ -1780,7 +1737,7 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
&EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont);
}
@@ -1792,18 +1749,14 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_brk_cont_element *el;
SAVE_OPLINE();
- el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->extended_value,
+ el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value,
&EX(func)->op_array, execute_data TSRMLS_CC);
brk_opline = EX(func)->op_array.opcodes + el->brk;
- if (brk_opline->opcode == ZEND_SWITCH_FREE) {
+ if (brk_opline->opcode == ZEND_FREE) {
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
- }
- } else if (brk_opline->opcode == ZEND_FREE) {
- if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_dtor(EX_VAR(brk_opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
}
}
ZEND_VM_JMP(opline->op1.jmp_addr);
@@ -1870,7 +1823,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1882,7 +1835,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
zend_function *fbc;
zval *function_name, *func;
- if (IS_TMP_VAR == IS_CONST) {
+ if (IS_TMP_VAR == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
function_name = (zval*)(opline->op2.zv+1);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
@@ -1894,8 +1847,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
@@ -1912,21 +1865,22 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1);
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- STR_FREE(lcname);
- zval_dtor(free_op2.var);
+ zend_string_free(lcname);
+ zval_ptr_dtor_nogc(free_op2.var);
+
fbc = Z_FUNC_P(func);
called_scope = NULL;
object = NULL;
- } else if (IS_TMP_VAR != IS_CONST && IS_TMP_VAR != IS_TMP_VAR &&
+ } else if (IS_TMP_VAR != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
@@ -1937,11 +1891,10 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
- } else {
- zval_dtor(free_op2.var);
+ } else if (IS_TMP_VAR == IS_CV) {
+ zval_ptr_dtor_nogc(free_op2.var);
}
- } else if (IS_TMP_VAR != IS_CONST &&
- EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
+ } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
zval *method;
@@ -1979,13 +1932,25 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
if (UNEXPECTED(fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
}
+ if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ }
+ }
} else {
called_scope = Z_OBJCE_P(obj);
object = Z_OBJ_P(obj);
fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method));
}
if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
@@ -1994,7 +1959,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
GC_REFCOUNT(object)++; /* For $this pointer */
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -2002,8 +1967,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Function name must be a string");
ZEND_VM_CONTINUE(); /* Never reached */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -2056,7 +2021,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
zend_function *fbc;
zval *function_name, *func;
- if (IS_VAR == IS_CONST) {
+ if (IS_VAR == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
function_name = (zval*)(opline->op2.zv+1);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
@@ -2068,8 +2033,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
@@ -2086,21 +2051,22 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1);
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
zval_ptr_dtor_nogc(free_op2.var);
+
fbc = Z_FUNC_P(func);
called_scope = NULL;
object = NULL;
- } else if (IS_VAR != IS_CONST && IS_VAR != IS_TMP_VAR &&
+ } else if (IS_VAR != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
@@ -2111,11 +2077,10 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
- } else {
+ } else if (IS_VAR == IS_CV) {
zval_ptr_dtor_nogc(free_op2.var);
}
- } else if (IS_VAR != IS_CONST &&
- EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
+ } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
zval *method;
@@ -2153,13 +2118,25 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
if (UNEXPECTED(fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
}
+ if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ }
+ }
} else {
called_scope = Z_OBJCE_P(obj);
object = Z_OBJ_P(obj);
fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method));
}
if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
@@ -2176,8 +2153,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Function name must be a string");
ZEND_VM_CONTINUE(); /* Never reached */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -2268,7 +2245,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
zend_function *fbc;
zval *function_name, *func;
- if (IS_CV == IS_CONST) {
+ if (IS_CV == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
function_name = (zval*)(opline->op2.zv+1);
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
@@ -2280,8 +2257,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, NULL, NULL, EX(call) TSRMLS_CC);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
@@ -2298,21 +2275,21 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1);
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- STR_FREE(lcname);
+ zend_string_free(lcname);
fbc = Z_FUNC_P(func);
called_scope = NULL;
object = NULL;
- } else if (IS_CV != IS_CONST && IS_CV != IS_TMP_VAR &&
+ } else if (IS_CV != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
@@ -2323,11 +2300,10 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
- } else {
+ } else if (IS_CV == IS_CV) {
}
- } else if (IS_CV != IS_CONST &&
- EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
+ } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
zval *method;
@@ -2365,13 +2341,25 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
if (UNEXPECTED(fbc == NULL)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
}
+ if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ fbc->common.scope->name->val, fbc->common.function_name->val);
+ }
+ }
} else {
called_scope = Z_OBJCE_P(obj);
object = Z_OBJ_P(obj);
fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method));
}
if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
@@ -2388,8 +2376,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
zend_error_noreturn(E_ERROR, "Function name must be a string");
ZEND_VM_CONTINUE(); /* Never reached */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -2441,7 +2429,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -2626,7 +2614,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zval_copy_ctor_func(EX(return_value));
}
}
- } else if (Z_ISREF_P(retval_ptr)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(retval_ptr)) {
ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
} else {
@@ -2660,6 +2648,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
if (IS_CONST != IS_TMP_VAR) {
zval_opt_copy_ctor_no_imm(EX(return_value));
}
@@ -2669,7 +2658,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
retval_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
@@ -2679,9 +2668,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
} else {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EX(return_value)) {
- zval tmp;
- ZVAL_DUP(&tmp, retval_ptr);
- ZVAL_NEW_REF(EX(return_value), &tmp);
+ ZVAL_NEW_REF(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
+ if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -2691,6 +2680,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
ZVAL_MAKE_REF(retval_ptr);
Z_ADDREF_P(retval_ptr);
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
}
} while (0);
@@ -2792,7 +2782,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
obj = opline->op1.zv;
if (IS_CONST == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -2868,8 +2858,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break;
- case IS_INT:
- ZVAL_INT(result, zval_get_int(expr));
+ case IS_LONG:
+ ZVAL_LONG(result, zval_get_long(expr));
break;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr));
@@ -2903,15 +2893,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CONST != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -2923,21 +2911,16 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CONST != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
CHECK_EXCEPTION();
@@ -2958,12 +2941,11 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
ZVAL_UNDEF(&tmp_inc_filename);
if (Z_TYPE_P(inc_filename) != IS_STRING) {
- ZVAL_DUP(&tmp_inc_filename, inc_filename);
- convert_to_string(&tmp_inc_filename);
+ ZVAL_STR(&tmp_inc_filename, zval_get_string(inc_filename));
inc_filename = &tmp_inc_filename;
}
- if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
+ if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else {
@@ -2976,9 +2958,9 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
zend_file_handle file_handle;
char *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
+ resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
+ failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, (int)strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -2991,7 +2973,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
+ if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, (int)strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
@@ -3038,8 +3020,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
return_value = EX_VAR(opline->result.var);
}
- call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
+ (zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
if (EX(symbol_table)) {
call->symbol_table = EX(symbol_table);
@@ -3048,15 +3030,16 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
}
call->prev_execute_data = execute_data;
- i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_code_execute_data(call, new_op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_TOP_CODE;
zend_execute_ex(call TSRMLS_CC);
}
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
HANDLE_EXCEPTION();
@@ -3081,35 +3064,19 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
- (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ (opline->extended_value & ZEND_FE_FETCH_BYREF)) {
array_ptr = array_ref = NULL;
ZVAL_DEREF(array_ptr);
if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ARRAY(array_ptr);
if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- } else if (Z_IMMUTABLE_P(array_ptr)) {
- zval_copy_ctor(array_ptr);
- } else {
- SEPARATE_ZVAL_NOREF(array_ptr);
+ ZVAL_NEW_REF(array_ref, array_ref);
+ array_ptr = Z_REFVAL_P(array_ref);
}
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
- zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
-
ce = Z_OBJCE_P(array_ptr);
- if (!ce || ce->get_iterator == NULL) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- }
+ if (ce->get_iterator == NULL) {
Z_ADDREF_P(array_ptr);
}
array_ref = array_ptr;
@@ -3119,9 +3086,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
} else {
array_ptr = array_ref = opline->op1.zv;
ZVAL_DEREF(array_ptr);
- if (0) { /* IS_TMP_VAR */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, array_ptr);
- array_ptr = &tmp;
+ if (Z_OPT_IMMUTABLE_P(&tmp)) {
+ zval_copy_ctor_func(&tmp);
+ }
+ array_ref = array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -3130,17 +3100,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
- if (!ce || !ce->get_iterator) {
+ if (!ce->get_iterator) {
if (IS_CONST == IS_CV) {
Z_ADDREF_P(array_ref);
}
}
} else if (Z_IMMUTABLE_P(array_ref)) {
if (IS_CONST == IS_CV) {
- zval_copy_ctor(array_ref);
+ zval_copy_ctor_func(array_ref);
Z_ADDREF_P(array_ref);
} else {
- ZVAL_DUP(&tmp, array_ref);
+ ZVAL_COPY_VALUE(&tmp, array_ref);
+ zval_copy_ctor_func(&tmp);
array_ptr = array_ref = &tmp;
}
} else if (Z_REFCOUNTED_P(array_ref)) {
@@ -3161,14 +3132,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_UNREF(array_ref);
array_ptr = array_ref;
}
- if (Z_IMMUTABLE_P(array_ptr) ||
- (Z_ISREF_P(array_ref) &&
- Z_REFCOUNTED_P(array_ptr) &&
- Z_REFCOUNT_P(array_ptr) > 1)) {
- if (!Z_IMMUTABLE_P(array_ptr)) {
- Z_DELREF_P(array_ptr);
- }
- zval_copy_ctor(array_ptr);
+ if (Z_IMMUTABLE_P(array_ptr)) {
+ zval_copy_ctor_func(array_ptr);
+ } else if (Z_ISREF_P(array_ref) &&
+ Z_COPYABLE_P(array_ptr) &&
+ Z_REFCOUNT_P(array_ptr) > 1) {
+ Z_DELREF_P(array_ptr);
+ zval_copy_ctor_func(array_ptr);
}
if (IS_CONST == IS_CV) {
Z_ADDREF_P(array_ref);
@@ -3178,16 +3148,16 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
if (ce && ce->get_iterator) {
- iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
+ iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_FETCH_BYREF TSRMLS_CC);
- if (IS_CONST == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ if (IS_CONST == IS_VAR && !(opline->extended_value & ZEND_FE_FETCH_BYREF)) {
}
if (iter && EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(&iterator, &iter->std);
array_ptr = array_ref = &iterator;
} else {
- if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (!EG(exception)) {
@@ -3206,7 +3176,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
@@ -3215,38 +3185,51 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
}
iter->index = -1; /* will be set to 0 before using next handler */
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- zend_hash_internal_pointer_reset(fe_ht);
- if (ce) {
- zend_object *zobj = Z_OBJ_P(array_ptr);
- while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- zend_string *str_key;
- zend_uint_t int_key;
- zend_uchar key_type;
-
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
- if (key_type != HASH_KEY_NON_EXISTENT &&
- (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
- break;
+ HashPointer *ptr = (HashPointer*)EX_VAR((opline+2)->op1.var);
+ HashPosition pos = 0;
+ Bucket *p;
+
+ while (1) {
+ if (pos >= fe_ht->nNumUsed) {
+ is_empty = 1;
+ if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
+
}
- zend_hash_move_forward(fe_ht);
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ }
+ p = fe_ht->arData + pos;
+ if (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ if (!ce ||
+ !p->key ||
+ zend_check_property_access(Z_OBJ_P(array_ptr), p->key TSRMLS_CC) == SUCCESS) {
+ break;
}
+ pos++;
}
- is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
+ fe_ht->nInternalPointer = pos;
+ ptr->pos = pos;
+ ptr->ht = fe_ht;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ is_empty = 0;
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
- if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (is_empty) {
@@ -3267,8 +3250,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *ptr = opline->op1.zv;
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
@@ -3284,10 +3267,15 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = opline->op1.zv;
+ if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
if (i_zend_is_true(value TSRMLS_CC)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_CONST == IS_CONST) {
@@ -3296,6 +3284,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
}
} else if (IS_CONST == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -3304,16 +3295,22 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_COALESCE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = opline->op1.zv;
- if (i_zend_is_true(value TSRMLS_CC)) {
+ if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
+
+ if (Z_TYPE_P(value) > IS_NULL) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
@@ -3321,6 +3318,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
}
} else if (IS_CONST == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -3338,33 +3338,18 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
value = opline->op1.zv;
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_CONST == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
- }
- } else if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- ZEND_VM_NEXT_OPCODE();
-}
-
-static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zval *value;
-
- SAVE_OPLINE();
- value = opline->op1.zv;
+ if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(value)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), Z_REFVAL_P(value));
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_CONST == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
+ } else {
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
+ if (IS_CONST == IS_CONST) {
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+ zval_copy_ctor_func(EX_VAR(opline->result.var));
+ }
+ } else if (IS_CONST == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -3378,24 +3363,26 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
value = opline->op1.zv;
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
- ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value));
+ ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
} else {
if (Z_TYPE_P(value) < IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 0);
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
} else if (Z_TYPE_P(value) == IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
} else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value);
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str;
+ zval tmp;
- if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
+ ZVAL_COPY(&tmp, value);
+ if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
goto strlen_error;
}
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zval_dtor(&tmp);
} else {
strlen_error:
zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
@@ -3417,7 +3404,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
value = opline->op1.zv;
switch (opline->extended_value) {
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
@@ -3428,16 +3415,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
break;
case IS_OBJECT:
if (Z_TYPE_P(value) == opline->extended_value) {
- if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
- ZVAL_TRUE(EX_VAR(opline->result.var));
+ zend_class_entry *ce = Z_OBJCE_P(value);
+ if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
+ && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+ ZVAL_FALSE(EX_VAR(opline->result.var));
} else {
- zend_class_entry *ce = Z_OBJCE_P(value);
- if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
- && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
- ZVAL_FALSE(EX_VAR(opline->result.var));
- } else {
- ZVAL_TRUE(EX_VAR(opline->result.var));
- }
+ ZVAL_TRUE(EX_VAR(opline->result.var));
}
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -3450,8 +3433,8 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
}
+ break;
EMPTY_SWITCH_DEFAULT_CASE()
-
}
CHECK_EXCEPTION();
@@ -3461,11 +3444,9 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL ZEND_DEFINED_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *name;
zend_constant *c;
SAVE_OPLINE();
- name = opline->op1.zv;
if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if ((c = zend_quick_get_constant(opline->op1.zv, 0 TSRMLS_CC)) == NULL) {
@@ -3769,7 +3750,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -3784,7 +3765,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -3807,8 +3788,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -3828,8 +3808,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -3851,7 +3830,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
}
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -3916,30 +3895,185 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_
container = opline->op1.zv;
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_CONST == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *container;
+ zval *offset;
+
SAVE_OPLINE();
container = opline->op1.zv;
+ offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = opline->op2.zv;
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = opline->op2.zv;
+ container = NULL;
+
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
ZVAL_COPY(EX_VAR(opline->result.var), value);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
+ EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
+ zval *result = EX_VAR(opline->result.var);
+ zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC);
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+ } else {
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4018,7 +4152,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -4026,19 +4160,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -4050,8 +4192,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_CONST == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -4086,6 +4228,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
object = fcc.object;
if (object) {
GC_REFCOUNT(object)++; /* For $this pointer */
+ } else if (func->common.scope &&
+ !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ }
}
} else {
zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
@@ -4095,8 +4249,8 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
object = NULL;
}
- EX(call) = zend_vm_stack_push_call_frame(
- func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ func, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4130,7 +4284,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv));
+ char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
actual = Z_STRVAL_P(opline->op2.zv);
} else {
@@ -4138,7 +4292,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -4201,10 +4355,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
- } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
+ } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- STR_ADDREF(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -4224,7 +4377,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -4232,7 +4385,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
} else {
expr_ptr = opline->op1.zv;
- if (0) { /* temporary variable */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CONST == IS_CONST) {
@@ -4240,9 +4393,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -4253,15 +4406,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
zval *offset = opline->op2.zv;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -4305,7 +4458,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -4339,28 +4492,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = opline->op1.zv;
+ ZVAL_UNDEF(&tmp);
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -4373,10 +4533,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -4395,10 +4553,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -4409,26 +4565,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -4450,37 +4608,170 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
}
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = opline->op2.zv;
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+ if (IS_CONST != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_CONST != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+ } else if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
}
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = opline->op2.zv;
+
+ if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4507,7 +4798,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
}
}
c.flags = CONST_CS; /* non persistent, case sensetive */
- c.name = STR_DUP(Z_STR_P(name), 0);
+ c.name = zend_string_dup(Z_STR_P(name), 0);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
@@ -4552,13 +4843,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CONST != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -4582,14 +4873,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_DUP(&generator->value, value);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -4607,25 +4898,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_DUP(&generator->key, key);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -4673,7 +4964,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4688,7 +4979,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4703,7 +4994,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4718,7 +5009,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4733,7 +5024,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4748,7 +5039,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4763,7 +5054,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4778,7 +5069,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4793,7 +5084,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_H
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4809,7 +5100,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCO
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4825,7 +5116,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4841,7 +5132,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_H
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4857,7 +5148,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4873,7 +5164,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_O
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4888,7 +5179,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4903,7 +5194,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4918,7 +5209,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4933,7 +5224,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4947,14 +5238,160 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = opline->op1.zv;
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1, free_op2;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ } else {
+ if (IS_TMP_VAR == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1, free_op2;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ container = NULL;
+
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -5022,13 +5459,13 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
}
}
if (IS_TMP_VAR != IS_CONST) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -5036,19 +5473,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -5060,8 +5505,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_TMP_VAR == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -5096,6 +5541,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE
object = fcc.object;
if (object) {
GC_REFCOUNT(object)++; /* For $this pointer */
+ } else if (func->common.scope &&
+ !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ }
}
} else {
zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
@@ -5105,10 +5562,10 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE
object = NULL;
}
- EX(call) = zend_vm_stack_push_call_frame(
- func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ func, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5124,7 +5581,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5139,7 +5596,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -5147,7 +5604,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
} else {
expr_ptr = opline->op1.zv;
- if (0) { /* temporary variable */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CONST == IS_CONST) {
@@ -5155,9 +5612,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -5168,15 +5625,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -5209,7 +5666,7 @@ str_index:
/* do nothing */
break;
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
@@ -5220,7 +5677,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -5248,6 +5705,153 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
}
}
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_CONST != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_TMP_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
+ } else {
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -5282,13 +5886,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CONST != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -5312,14 +5916,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -5337,25 +5941,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -5388,7 +5992,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5684,7 +6288,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -5699,7 +6303,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -5722,8 +6326,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -5743,8 +6346,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -5766,7 +6368,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
}
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -5831,13 +6433,159 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA
container = opline->op1.zv;
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1, free_op2;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ } else {
+ if (IS_VAR == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
}
+
+ zval_ptr_dtor_nogc(free_op2.var);
+
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1, free_op2;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ container = NULL;
+
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -5911,7 +6659,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -5919,19 +6667,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -5943,8 +6699,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_VAR == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -5979,6 +6735,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE
object = fcc.object;
if (object) {
GC_REFCOUNT(object)++; /* For $this pointer */
+ } else if (func->common.scope &&
+ !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ }
}
} else {
zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
@@ -5988,8 +6756,8 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE
object = NULL;
}
- EX(call) = zend_vm_stack_push_call_frame(
- func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ func, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
@@ -6022,7 +6790,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -6030,7 +6798,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
} else {
expr_ptr = opline->op1.zv;
- if (0) { /* temporary variable */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CONST == IS_CONST) {
@@ -6038,9 +6806,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -6051,15 +6819,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -6103,7 +6871,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -6137,28 +6905,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = opline->op1.zv;
+ ZVAL_UNDEF(&tmp);
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -6171,10 +6946,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -6193,10 +6966,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -6207,26 +6978,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -6248,37 +7021,172 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
}
+}
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_CONST != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
}
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
}
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op2;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -6317,13 +7225,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CONST != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -6347,14 +7255,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -6372,25 +7280,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
zval_ptr_dtor_nogc(free_op2.var);
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -6444,7 +7352,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -6459,7 +7367,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -6482,8 +7390,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -6503,8 +7410,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -6526,7 +7432,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
}
if (IS_CONST != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -6581,6 +7487,41 @@ static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HA
return zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_UNUSED == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
+
+
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -6654,7 +7595,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -6662,19 +7603,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -6686,8 +7635,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_UNUSED == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -6707,7 +7656,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -6715,7 +7664,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
} else {
expr_ptr = opline->op1.zv;
- if (0) { /* temporary variable */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CONST == IS_CONST) {
@@ -6723,9 +7672,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -6736,15 +7685,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
zval *offset = NULL;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -6788,7 +7737,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -6822,28 +7771,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = opline->op1.zv;
+ ZVAL_UNDEF(&tmp);
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -6856,10 +7812,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -6878,10 +7832,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CONST != IS_CONST && tmp_is_dup) {
+ if (IS_CONST != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -6892,26 +7844,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -6933,39 +7887,27 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -6986,7 +7928,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
if (closure_is_static || closure_is_being_defined_inside_static_context) {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
}
CHECK_EXCEPTION();
@@ -7027,13 +7969,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CONST != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -7057,14 +7999,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
ZVAL_DUP(&generator->value, value);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -7082,25 +8024,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
ZVAL_DUP(&generator->key, key);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_UNUSED == IS_VAR || IS_UNUSED == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -7408,13 +8350,157 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAN
container = opline->op1.zv;
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_CV == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = opline->op1.zv;
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+
+
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
}
+
+
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if ((IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ container = NULL;
+
+ if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+
+ if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -7488,7 +8574,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -7496,19 +8582,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -7520,8 +8614,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_CV == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -7556,6 +8650,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_
object = fcc.object;
if (object) {
GC_REFCOUNT(object)++; /* For $this pointer */
+ } else if (func->common.scope &&
+ !(func->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(E_STRICT,
+ "Non-static method %s::%s() should not be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ } else {
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically",
+ func->common.scope->name->val, func->common.function_name->val);
+ }
}
} else {
zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
@@ -7565,8 +8671,8 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_
object = NULL;
}
- EX(call) = zend_vm_stack_push_call_frame(
- func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ func, opline->extended_value, called_scope, object, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -7592,7 +8698,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), catch_ce);
}
- ce = zend_get_class_entry(EG(exception) TSRMLS_CC);
+ ce = EG(exception)->ce;
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
@@ -7650,7 +8756,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -7658,7 +8764,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
} else {
expr_ptr = opline->op1.zv;
- if (0) { /* temporary variable */
+ if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CONST == IS_CONST) {
@@ -7666,9 +8772,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -7679,15 +8785,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -7731,7 +8837,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -7759,6 +8865,151 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND
}
}
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if (IS_CONST != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_CV != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
+ } else {
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = opline->op1.zv;
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if (IS_CONST == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -7793,13 +9044,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CONST != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -7823,14 +9074,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_DUP(&generator->value, value);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -7848,25 +9099,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_DUP(&generator->key, key);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -7912,7 +9163,7 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
bitwise_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -7925,7 +9176,7 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
boolean_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -7941,7 +9192,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_print_variable(z TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -7950,7 +9201,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -7978,7 +9229,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
opline = opline->op2.jmp_addr;
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8009,7 +9260,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
opline++;
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8040,7 +9291,7 @@ static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
opline = opline->op2.jmp_addr;
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8075,7 +9326,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_FALSE(EX_VAR(opline->result.var));
opline = opline->op2.jmp_addr;
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8109,7 +9360,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_FALSE(EX_VAR(opline->result.var));
opline++;
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8121,11 +9372,7 @@ static int ZEND_FASTCALL ZEND_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
SAVE_OPLINE();
- if (IS_TMP_VAR == IS_TMP_VAR) {
- zval_dtor(EX_VAR(opline->op1.var));
- } else {
- zval_ptr_dtor(EX_VAR(opline->op1.var));
- }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8140,7 +9387,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
retval_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (!EX(return_value)) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
@@ -8149,7 +9396,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval_copy_ctor_func(EX(return_value));
}
}
- } else if (Z_ISREF_P(retval_ptr)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(retval_ptr)) {
ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
} else {
@@ -8179,10 +9426,11 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
retval_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (!EX(return_value)) {
if (IS_TMP_VAR == IS_TMP_VAR) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
if (IS_TMP_VAR != IS_TMP_VAR) {
zval_opt_copy_ctor_no_imm(EX(return_value));
}
@@ -8192,7 +9440,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
retval_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
@@ -8202,9 +9450,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
} else {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EX(return_value)) {
- zval tmp;
- ZVAL_DUP(&tmp, retval_ptr);
- ZVAL_NEW_REF(EX(return_value), &tmp);
+ ZVAL_NEW_REF(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
+ if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -8214,6 +9462,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_MAKE_REF(retval_ptr);
Z_ADDREF_P(retval_ptr);
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
}
} while (0);
@@ -8297,7 +9546,7 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
ZVAL_BOOL(retval, i_zend_is_true(_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC));
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -8316,7 +9565,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -8392,8 +9641,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break;
- case IS_INT:
- ZVAL_INT(result, zval_get_int(expr));
+ case IS_LONG:
+ ZVAL_LONG(result, zval_get_long(expr));
break;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr));
@@ -8413,7 +9662,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- zval_dtor(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8428,15 +9676,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!1) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -8448,23 +9694,19 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!1) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
- zval_dtor(free_op1.var);
+
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8483,12 +9725,11 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
ZVAL_UNDEF(&tmp_inc_filename);
if (Z_TYPE_P(inc_filename) != IS_STRING) {
- ZVAL_DUP(&tmp_inc_filename, inc_filename);
- convert_to_string(&tmp_inc_filename);
+ ZVAL_STR(&tmp_inc_filename, zval_get_string(inc_filename));
inc_filename = &tmp_inc_filename;
}
- if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
+ if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else {
@@ -8501,9 +9742,9 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
zend_file_handle file_handle;
char *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
+ resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
+ failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, (int)strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -8516,7 +9757,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
+ if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, (int)strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
@@ -8552,7 +9793,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
@@ -8563,8 +9804,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
return_value = EX_VAR(opline->result.var);
}
- call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
+ (zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
if (EX(symbol_table)) {
call->symbol_table = EX(symbol_table);
@@ -8573,15 +9814,16 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
}
call->prev_execute_data = execute_data;
- i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_code_execute_data(call, new_op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_TOP_CODE;
zend_execute_ex(call TSRMLS_CC);
}
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
HANDLE_EXCEPTION();
@@ -8606,35 +9848,19 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
- (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ (opline->extended_value & ZEND_FE_FETCH_BYREF)) {
array_ptr = array_ref = NULL;
ZVAL_DEREF(array_ptr);
if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ARRAY(array_ptr);
if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- } else if (Z_IMMUTABLE_P(array_ptr)) {
- zval_copy_ctor(array_ptr);
- } else {
- SEPARATE_ZVAL_NOREF(array_ptr);
+ ZVAL_NEW_REF(array_ref, array_ref);
+ array_ptr = Z_REFVAL_P(array_ref);
}
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
- zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
-
ce = Z_OBJCE_P(array_ptr);
- if (!ce || ce->get_iterator == NULL) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- }
+ if (ce->get_iterator == NULL) {
Z_ADDREF_P(array_ptr);
}
array_ref = array_ptr;
@@ -8644,9 +9870,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
} else {
array_ptr = array_ref = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
ZVAL_DEREF(array_ptr);
- if (1) { /* IS_TMP_VAR */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, array_ptr);
- array_ptr = &tmp;
+ if (Z_OPT_IMMUTABLE_P(&tmp)) {
+ zval_copy_ctor_func(&tmp);
+ }
+ array_ref = array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -8655,17 +9884,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
- if (!ce || !ce->get_iterator) {
+ if (!ce->get_iterator) {
if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(array_ref);
}
}
} else if (Z_IMMUTABLE_P(array_ref)) {
if (IS_TMP_VAR == IS_CV) {
- zval_copy_ctor(array_ref);
+ zval_copy_ctor_func(array_ref);
Z_ADDREF_P(array_ref);
} else {
- ZVAL_DUP(&tmp, array_ref);
+ ZVAL_COPY_VALUE(&tmp, array_ref);
+ zval_copy_ctor_func(&tmp);
array_ptr = array_ref = &tmp;
}
} else if (Z_REFCOUNTED_P(array_ref)) {
@@ -8686,14 +9916,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_UNREF(array_ref);
array_ptr = array_ref;
}
- if (Z_IMMUTABLE_P(array_ptr) ||
- (Z_ISREF_P(array_ref) &&
- Z_REFCOUNTED_P(array_ptr) &&
- Z_REFCOUNT_P(array_ptr) > 1)) {
- if (!Z_IMMUTABLE_P(array_ptr)) {
- Z_DELREF_P(array_ptr);
- }
- zval_copy_ctor(array_ptr);
+ if (Z_IMMUTABLE_P(array_ptr)) {
+ zval_copy_ctor_func(array_ptr);
+ } else if (Z_ISREF_P(array_ref) &&
+ Z_COPYABLE_P(array_ptr) &&
+ Z_REFCOUNT_P(array_ptr) > 1) {
+ Z_DELREF_P(array_ptr);
+ zval_copy_ctor_func(array_ptr);
}
if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(array_ref);
@@ -8703,16 +9932,16 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
if (ce && ce->get_iterator) {
- iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
+ iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_FETCH_BYREF TSRMLS_CC);
- if (IS_TMP_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ if (IS_TMP_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_FETCH_BYREF)) {
}
if (iter && EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(&iterator, &iter->std);
array_ptr = array_ref = &iterator;
} else {
- if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (!EG(exception)) {
@@ -8731,7 +9960,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
@@ -8740,38 +9969,51 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
}
iter->index = -1; /* will be set to 0 before using next handler */
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- zend_hash_internal_pointer_reset(fe_ht);
- if (ce) {
- zend_object *zobj = Z_OBJ_P(array_ptr);
- while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- zend_string *str_key;
- zend_uint_t int_key;
- zend_uchar key_type;
-
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
- if (key_type != HASH_KEY_NON_EXISTENT &&
- (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
- break;
+ HashPointer *ptr = (HashPointer*)EX_VAR((opline+2)->op1.var);
+ HashPosition pos = 0;
+ Bucket *p;
+
+ while (1) {
+ if (pos >= fe_ht->nNumUsed) {
+ is_empty = 1;
+ if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
+
}
- zend_hash_move_forward(fe_ht);
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ }
+ p = fe_ht->arData + pos;
+ if (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ if (!ce ||
+ !p->key ||
+ zend_check_property_access(Z_OBJ_P(array_ptr), p->key TSRMLS_CC) == SUCCESS) {
+ break;
}
+ pos++;
}
- is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
+ fe_ht->nInternalPointer = pos;
+ ptr->pos = pos;
+ ptr->ht = fe_ht;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ is_empty = 0;
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
- if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (is_empty) {
@@ -8792,12 +10034,12 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
zval *ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
#endif
zend_bailout();
@@ -8807,26 +10049,14 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- char buf[MAX_LENGTH_OF_ZEND_INT + 1];
- char *res;
SAVE_OPLINE();
- if (!EG(error_reporting) && Z_IVAL_P(EX_VAR(opline->op1.var)) != 0) {
- EG(error_reporting) = Z_IVAL_P(EX_VAR(opline->op1.var));
- _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_uint_t, res);
- if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
- if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
- EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
- efree(EG(error_reporting_ini_entry)->value);
- }
- EG(error_reporting_ini_entry)->value_length = buf + sizeof(buf) - 1 - res;
- EG(error_reporting_ini_entry)->value = estrndup(res, EG(error_reporting_ini_entry)->value_length);
- }
+ if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
+ }
+ if (EX(silence_op_num) == opline->op2.num) {
+ EX(silence_op_num) = -1;
}
-//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
-//??? EX(old_error_reporting) = NULL;
-//??? }
- CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8835,10 +10065,15 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
if (i_zend_is_true(value TSRMLS_CC)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_TMP_VAR == IS_CONST) {
@@ -8847,25 +10082,34 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
} else if (IS_TMP_VAR == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ zval_ptr_dtor_nogc(free_op1.var);
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_COALESCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (i_zend_is_true(value TSRMLS_CC)) {
+ if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
+
+ if (Z_TYPE_P(value) > IS_NULL) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
@@ -8873,11 +10117,14 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
}
} else if (IS_TMP_VAR == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ zval_ptr_dtor_nogc(free_op1.var);
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8891,33 +10138,18 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_TMP_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
- }
- } else if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- ZEND_VM_NEXT_OPCODE();
-}
-
-static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1;
- zval *value;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_TMP_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
+ if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(value)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), Z_REFVAL_P(value));
+ zval_ptr_dtor_nogc(free_op1.var);
+ } else {
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
+ if (IS_TMP_VAR == IS_CONST) {
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+ zval_copy_ctor_func(EX_VAR(opline->result.var));
+ }
+ } else if (IS_TMP_VAR == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -8932,13 +10164,13 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
+ if (Z_TYPE_P(expr) == IS_OBJECT) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
}
ZVAL_BOOL(EX_VAR(opline->result.var), result);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8952,31 +10184,33 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
- ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value));
+ ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
} else {
if (Z_TYPE_P(value) < IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 0);
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
} else if (Z_TYPE_P(value) == IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
} else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value);
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str;
+ zval tmp;
- if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
+ ZVAL_COPY(&tmp, value);
+ if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
goto strlen_error;
}
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zval_dtor(&tmp);
} else {
strlen_error:
zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
ZVAL_NULL(EX_VAR(opline->result.var));
}
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8991,7 +10225,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
switch (opline->extended_value) {
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
@@ -9002,16 +10236,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
break;
case IS_OBJECT:
if (Z_TYPE_P(value) == opline->extended_value) {
- if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
- ZVAL_TRUE(EX_VAR(opline->result.var));
+ zend_class_entry *ce = Z_OBJCE_P(value);
+ if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
+ && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+ ZVAL_FALSE(EX_VAR(opline->result.var));
} else {
- zend_class_entry *ce = Z_OBJCE_P(value);
- if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
- && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
- ZVAL_FALSE(EX_VAR(opline->result.var));
- } else {
- ZVAL_TRUE(EX_VAR(opline->result.var));
- }
+ ZVAL_TRUE(EX_VAR(opline->result.var));
}
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -9024,10 +10254,10 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
}
+ break;
EMPTY_SWITCH_DEFAULT_CASE()
-
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9041,7 +10271,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9056,7 +10286,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9071,7 +10301,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9086,7 +10316,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9101,7 +10331,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9116,7 +10346,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9131,7 +10361,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9146,7 +10376,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9161,7 +10391,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_H
fast_is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9177,7 +10407,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
fast_is_not_identical_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9193,7 +10423,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
fast_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9209,7 +10439,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_H
fast_not_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9225,7 +10455,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN
fast_is_smaller_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9241,7 +10471,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_O
fast_is_smaller_or_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9256,7 +10486,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9271,7 +10501,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9286,7 +10516,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9301,7 +10531,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9323,7 +10553,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -9338,9 +10568,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9350,7 +10580,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
retval = zend_std_get_static_property(ce, name, 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
retval = zend_hash_find(target_symbol_table, name);
@@ -9361,8 +10591,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -9382,8 +10611,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -9400,12 +10628,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
zval_update_constant(retval, 1 TSRMLS_CC);
}
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
}
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -9470,30 +10698,185 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HA
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_CONST == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
+
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
zval *container;
+ zval *offset;
+
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = opline->op2.zv;
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = opline->op2.zv;
+ container = NULL;
+
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
ZVAL_COPY(EX_VAR(opline->result.var), value);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
+ EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
+ zval *result = EX_VAR(opline->result.var);
+ zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC);
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+ } else {
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9561,19 +10944,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CONST != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -9583,7 +11002,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -9593,14 +11012,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -9632,7 +11051,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -9640,7 +11059,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
} else {
expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (1) { /* temporary variable */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CONST) {
@@ -9648,9 +11067,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -9661,15 +11080,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
zval *offset = opline->op2.zv;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -9713,7 +11132,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -9747,28 +11166,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -9781,12 +11207,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -9803,12 +11227,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9817,26 +11239,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -9858,37 +11282,171 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
}
+}
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = opline->op2.zv;
+
+ if (IS_TMP_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_CONST != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
}
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
}
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = opline->op2.zv;
+
+ if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9927,13 +11485,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!1) {
- zval_copy_ctor(&generator->value);
+ if (IS_TMP_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -9957,14 +11515,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -9982,25 +11540,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -10032,7 +11590,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
pow_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10047,8 +11605,8 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10062,8 +11620,8 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10077,8 +11635,8 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10092,8 +11650,8 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10107,8 +11665,8 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10122,8 +11680,8 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10137,8 +11695,8 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10152,8 +11710,8 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10167,8 +11725,8 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAN
fast_is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10183,8 +11741,8 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
fast_is_not_identical_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10199,8 +11757,8 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER
fast_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10215,8 +11773,8 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAN
fast_not_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10231,8 +11789,8 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
fast_is_smaller_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10247,8 +11805,8 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPC
fast_is_smaller_or_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10262,8 +11820,8 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10277,8 +11835,8 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10292,8 +11850,8 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10307,8 +11865,8 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER
boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10322,14 +11880,160 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1, free_op2;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ } else {
+ if (IS_TMP_VAR == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
}
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1, free_op2;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ container = NULL;
+
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -10368,7 +12072,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
* which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
* string offsets or overloaded objects
*/
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10398,19 +12102,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_TMP_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -10420,7 +12160,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -10430,16 +12170,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10456,7 +12196,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10471,7 +12211,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -10479,7 +12219,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
} else {
expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (1) { /* temporary variable */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CONST) {
@@ -10487,9 +12227,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -10500,15 +12240,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -10541,7 +12281,7 @@ str_index:
/* do nothing */
break;
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
@@ -10552,7 +12292,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -10580,6 +12320,153 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
}
}
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_TMP_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_TMP_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
+ } else {
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -10614,13 +12501,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!1) {
- zval_copy_ctor(&generator->value);
+ if (IS_TMP_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -10644,14 +12531,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->value, value);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -10669,25 +12556,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->key, key);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -10719,8 +12606,8 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
pow_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10734,7 +12621,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10749,7 +12636,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10764,7 +12651,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10779,7 +12666,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10794,7 +12681,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10809,7 +12696,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10824,7 +12711,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10839,7 +12726,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10854,7 +12741,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN
fast_is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10870,7 +12757,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
fast_is_not_identical_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10886,7 +12773,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER
fast_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10902,7 +12789,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN
fast_not_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10918,7 +12805,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL
fast_is_smaller_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10934,7 +12821,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPC
fast_is_smaller_or_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10949,7 +12836,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10964,7 +12851,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10979,7 +12866,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10994,7 +12881,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER
boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11016,7 +12903,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -11031,9 +12918,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11043,7 +12930,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
retval = zend_std_get_static_property(ce, name, 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
retval = zend_hash_find(target_symbol_table, name);
@@ -11054,8 +12941,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -11075,8 +12961,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -11093,12 +12978,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
zval_update_constant(retval, 1 TSRMLS_CC);
}
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
}
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -11163,13 +13048,159 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1, free_op2;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ } else {
+ if (IS_VAR == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
}
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ zend_free_op free_op2;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1, free_op2;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ container = NULL;
+
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -11238,19 +13269,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -11260,7 +13327,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -11270,14 +13337,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
@@ -11311,7 +13378,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -11319,7 +13386,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
} else {
expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (1) { /* temporary variable */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CONST) {
@@ -11327,9 +13394,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -11340,15 +13407,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -11392,7 +13459,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -11426,28 +13493,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -11460,12 +13534,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -11482,12 +13554,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11496,26 +13566,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -11537,37 +13609,173 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
}
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_TMP_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
+ } else if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
}
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
}
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1, free_op2;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+
+ if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ zval_ptr_dtor_nogc(free_op2.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11606,13 +13814,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!1) {
- zval_copy_ctor(&generator->value);
+ if (IS_TMP_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -11636,14 +13844,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->value, value);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -11661,25 +13869,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->key, key);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
zval_ptr_dtor_nogc(free_op2.var);
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -11711,7 +13919,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
pow_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11733,7 +13941,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -11748,9 +13956,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11760,7 +13968,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
retval = zend_std_get_static_property(ce, name, 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
retval = zend_hash_find(target_symbol_table, name);
@@ -11771,8 +13979,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -11792,8 +13999,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -11810,12 +14016,12 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
zval_update_constant(retval, 1 TSRMLS_CC);
}
} else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
}
if (IS_TMP_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -11870,6 +14076,41 @@ static int ZEND_FASTCALL ZEND_FETCH_IS_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAND
return zend_fetch_var_address_helper_SPEC_TMP_UNUSED(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_UNUSED == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -11880,7 +14121,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -11888,7 +14129,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
} else {
expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (1) { /* temporary variable */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CONST) {
@@ -11896,9 +14137,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -11909,15 +14150,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
zval *offset = NULL;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -11961,7 +14202,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -11995,28 +14236,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -12029,12 +14277,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -12051,12 +14297,10 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_TMP_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_TMP_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12065,26 +14309,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -12106,39 +14352,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_dtor(free_op1.var);
- }
+ zval_ptr_dtor_nogc(free_op1.var);
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12175,13 +14410,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!1) {
- zval_copy_ctor(&generator->value);
+ if (IS_TMP_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -12205,14 +14440,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->value, value);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -12230,25 +14465,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->key, key);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_UNUSED == IS_VAR || IS_UNUSED == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -12280,7 +14515,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12295,7 +14530,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12310,7 +14545,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12325,7 +14560,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12340,7 +14575,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12355,7 +14590,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12370,7 +14605,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12385,7 +14620,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12400,7 +14635,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HAND
fast_is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12416,7 +14651,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
fast_is_not_identical_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12432,7 +14667,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_
fast_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12448,7 +14683,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HAND
fast_not_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12464,7 +14699,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
fast_is_smaller_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12480,7 +14715,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCO
fast_is_smaller_or_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12495,7 +14730,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12510,7 +14745,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12525,7 +14760,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12540,7 +14775,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_
boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12556,13 +14791,157 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDL
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+ zend_free_op free_op1;
+
+ SAVE_OPLINE();
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ container = NULL;
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
+ }
+ zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+
+ } else {
+ if (IS_CV == IS_UNUSED) {
+ zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
+ }
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ zend_error(E_NOTICE, "Trying to get property of non-object");
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
}
+
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if ((IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
+ UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ } else {
+ zval *retval;
+
+ /* here we are sure we are dealing with an object */
+ retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
+
+ if (retval != EX_VAR(opline->result.var)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+ }
+ }
+
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *container;
+
+ if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ /* Behave like FETCH_OBJ_W */
+ zend_free_op free_op1;
+ zval *property;
+
+ SAVE_OPLINE();
+ property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ container = NULL;
+
+ if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+ }
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+
+ if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
+ EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
+ return ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
+}
+
static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -12630,19 +15009,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_TMP_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CV != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -12652,7 +15067,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -12662,14 +15077,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -12701,7 +15116,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -12709,7 +15124,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
} else {
expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (1) { /* temporary variable */
+ if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CONST) {
@@ -12717,9 +15132,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -12730,15 +15145,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -12782,7 +15197,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -12810,6 +15225,151 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
}
}
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ int result;
+ zend_ulong hval;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if (IS_TMP_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
+ zval *value;
+ zend_string *str;
+
+isset_again:
+ if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
+ str = Z_STR_P(offset);
+ if (IS_CV != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(str, hval)) {
+ goto num_index_prop;
+ }
+ }
+str_index_prop:
+ value = zend_hash_find_ind(ht, str);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
+num_index_prop:
+ value = zend_hash_index_find(ht, hval);
+ } else {
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ goto num_index_prop;
+ case IS_NULL:
+ str = STR_EMPTY_ALLOC();
+ goto str_index_prop;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_prop;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_prop;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_prop;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto isset_again;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ value = NULL;
+ break;
+ }
+ }
+
+ if (opline->extended_value & ZEND_ISSET) {
+ /* > IS_NULL means not IS_UNDEF and not IS_NULL */
+ result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
+ }
+ } else if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
+ result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check element of non-array");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zval tmp;
+
+ result = 0;
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
+ if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
+ ZVAL_DEREF(offset);
+ }
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ ZVAL_DUP(&tmp, offset);
+ convert_to_long(&tmp);
+ offset = &tmp;
+ }
+ }
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
+ if ((opline->extended_value & ZEND_ISSET) ||
+ Z_STRVAL_P(container)[offset->value.lval] != '0') {
+ result = 1;
+ }
+ }
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+ int result;
+ zval *offset;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+
+ if (IS_TMP_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
+ result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
+ } else {
+ zend_error(E_NOTICE, "Trying to check property of non-object");
+ result = 0;
+ }
+ if ((opline->extended_value & ZEND_ISSET) == 0) {
+ result = !result;
+ }
+ } else {
+ result = ((opline->extended_value & ZEND_ISSET) == 0);
+ }
+
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -12844,13 +15404,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!1) {
- zval_copy_ctor(&generator->value);
+ if (IS_TMP_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -12874,14 +15434,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->value, value);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -12899,25 +15459,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->key, key);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -12949,7 +15509,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
pow_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -12990,7 +15550,11 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -12998,14 +15562,10 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13013,19 +15573,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -13045,7 +15593,11 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -13053,14 +15605,10 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13068,19 +15616,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -13095,50 +15631,36 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_increment_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
- if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -13149,50 +15671,36 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_decrement_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
- if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -13219,7 +15727,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -13390,11 +15898,7 @@ static int ZEND_FASTCALL ZEND_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
SAVE_OPLINE();
- if (IS_VAR == IS_TMP_VAR) {
- zval_dtor(EX_VAR(opline->op1.var));
- } else {
- zval_ptr_dtor(EX_VAR(opline->op1.var));
- }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13418,7 +15922,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval_copy_ctor_func(EX(return_value));
}
}
- } else if (Z_ISREF_P(retval_ptr)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(retval_ptr)) {
ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
zval_ptr_dtor_nogc(free_op1.var);
} else {
@@ -13452,6 +15956,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
if (IS_VAR != IS_TMP_VAR) {
zval_opt_copy_ctor_no_imm(EX(return_value));
}
@@ -13461,7 +15966,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
@@ -13471,9 +15976,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
} else {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EX(return_value)) {
- zval tmp;
- ZVAL_DUP(&tmp, retval_ptr);
- ZVAL_NEW_REF(EX(return_value), &tmp);
+ ZVAL_NEW_REF(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
+ if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -13483,6 +15988,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
ZVAL_MAKE_REF(retval_ptr);
Z_ADDREF_P(retval_ptr);
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
}
} while (0);
@@ -13526,7 +16032,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
zval_ptr_dtor_nogc(free_op1.var);
} else {
@@ -13591,7 +16097,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
varptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(varptr == NULL)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
@@ -13631,7 +16137,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
zval_ptr_dtor_nogc(free_op1.var);
} else {
@@ -13682,12 +16188,12 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -13737,16 +16243,6 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_SWITCH_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- SAVE_OPLINE();
- zval_ptr_dtor(EX_VAR(opline->op1.var));
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
-}
-
static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -13760,7 +16256,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -13836,8 +16332,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break;
- case IS_INT:
- ZVAL_INT(result, zval_get_int(expr));
+ case IS_LONG:
+ ZVAL_LONG(result, zval_get_long(expr));
break;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr));
@@ -13872,15 +16368,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -13892,23 +16386,18 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- zval_ptr_dtor_nogc(free_op1.var);
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
+
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -13928,12 +16417,11 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
ZVAL_UNDEF(&tmp_inc_filename);
if (Z_TYPE_P(inc_filename) != IS_STRING) {
- ZVAL_DUP(&tmp_inc_filename, inc_filename);
- convert_to_string(&tmp_inc_filename);
+ ZVAL_STR(&tmp_inc_filename, zval_get_string(inc_filename));
inc_filename = &tmp_inc_filename;
}
- if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
+ if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else {
@@ -13946,9 +16434,9 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
zend_file_handle file_handle;
char *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
+ resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
+ failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, (int)strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -13961,7 +16449,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
+ if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, (int)strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
@@ -14008,8 +16496,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
return_value = EX_VAR(opline->result.var);
}
- call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
+ (zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
if (EX(symbol_table)) {
call->symbol_table = EX(symbol_table);
@@ -14018,15 +16506,16 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
}
call->prev_execute_data = execute_data;
- i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_code_execute_data(call, new_op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_TOP_CODE;
zend_execute_ex(call TSRMLS_CC);
}
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
HANDLE_EXCEPTION();
@@ -14051,35 +16540,19 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
- (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ (opline->extended_value & ZEND_FE_FETCH_BYREF)) {
array_ptr = array_ref = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
ZVAL_DEREF(array_ptr);
if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ARRAY(array_ptr);
if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- } else if (Z_IMMUTABLE_P(array_ptr)) {
- zval_copy_ctor(array_ptr);
- } else {
- SEPARATE_ZVAL_NOREF(array_ptr);
+ ZVAL_NEW_REF(array_ref, array_ref);
+ array_ptr = Z_REFVAL_P(array_ref);
}
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
- zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
-
ce = Z_OBJCE_P(array_ptr);
- if (!ce || ce->get_iterator == NULL) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- }
+ if (ce->get_iterator == NULL) {
Z_ADDREF_P(array_ptr);
}
array_ref = array_ptr;
@@ -14089,9 +16562,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
} else {
array_ptr = array_ref = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
ZVAL_DEREF(array_ptr);
- if (0) { /* IS_TMP_VAR */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, array_ptr);
- array_ptr = &tmp;
+ if (Z_OPT_IMMUTABLE_P(&tmp)) {
+ zval_copy_ctor_func(&tmp);
+ }
+ array_ref = array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -14100,17 +16576,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
- if (!ce || !ce->get_iterator) {
+ if (!ce->get_iterator) {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(array_ref);
}
}
} else if (Z_IMMUTABLE_P(array_ref)) {
if (IS_VAR == IS_CV) {
- zval_copy_ctor(array_ref);
+ zval_copy_ctor_func(array_ref);
Z_ADDREF_P(array_ref);
} else {
- ZVAL_DUP(&tmp, array_ref);
+ ZVAL_COPY_VALUE(&tmp, array_ref);
+ zval_copy_ctor_func(&tmp);
array_ptr = array_ref = &tmp;
}
} else if (Z_REFCOUNTED_P(array_ref)) {
@@ -14131,14 +16608,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_UNREF(array_ref);
array_ptr = array_ref;
}
- if (Z_IMMUTABLE_P(array_ptr) ||
- (Z_ISREF_P(array_ref) &&
- Z_REFCOUNTED_P(array_ptr) &&
- Z_REFCOUNT_P(array_ptr) > 1)) {
- if (!Z_IMMUTABLE_P(array_ptr)) {
- Z_DELREF_P(array_ptr);
- }
- zval_copy_ctor(array_ptr);
+ if (Z_IMMUTABLE_P(array_ptr)) {
+ zval_copy_ctor_func(array_ptr);
+ } else if (Z_ISREF_P(array_ref) &&
+ Z_COPYABLE_P(array_ptr) &&
+ Z_REFCOUNT_P(array_ptr) > 1) {
+ Z_DELREF_P(array_ptr);
+ zval_copy_ctor_func(array_ptr);
}
if (IS_VAR == IS_CV) {
Z_ADDREF_P(array_ref);
@@ -14148,16 +16624,16 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
if (ce && ce->get_iterator) {
- iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
+ iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_FETCH_BYREF TSRMLS_CC);
- if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_FETCH_BYREF)) {
zval_ptr_dtor_nogc(free_op1.var);
}
if (iter && EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(&iterator, &iter->std);
array_ptr = array_ref = &iterator;
} else {
- if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
if (!EG(exception)) {
@@ -14176,7 +16652,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
HANDLE_EXCEPTION();
@@ -14185,38 +16661,51 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
HANDLE_EXCEPTION();
}
iter->index = -1; /* will be set to 0 before using next handler */
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- zend_hash_internal_pointer_reset(fe_ht);
- if (ce) {
- zend_object *zobj = Z_OBJ_P(array_ptr);
- while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- zend_string *str_key;
- zend_uint_t int_key;
- zend_uchar key_type;
-
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
- if (key_type != HASH_KEY_NON_EXISTENT &&
- (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
- break;
+ HashPointer *ptr = (HashPointer*)EX_VAR((opline+2)->op1.var);
+ HashPosition pos = 0;
+ Bucket *p;
+
+ while (1) {
+ if (pos >= fe_ht->nNumUsed) {
+ is_empty = 1;
+ if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
- zend_hash_move_forward(fe_ht);
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ }
+ p = fe_ht->arData + pos;
+ if (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ if (!ce ||
+ !p->key ||
+ zend_check_property_access(Z_OBJ_P(array_ptr), p->key TSRMLS_CC) == SUCCESS) {
+ break;
}
+ pos++;
}
- is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
+ fe_ht->nInternalPointer = pos;
+ ptr->pos = pos;
+ ptr->ht = fe_ht;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ is_empty = 0;
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
- if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
if (is_empty) {
@@ -14234,92 +16723,194 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zval *array, *array_ref;
zval *value;
HashTable *fe_ht;
- zend_object_iterator *iter = NULL;
- zval *key = NULL;
+ HashPointer *ptr;
+ HashPosition pos;
+ Bucket *p;
array = array_ref = EX_VAR(opline->op1.var);
if (Z_ISREF_P(array)) {
array = Z_REFVAL_P(array);
// TODO: referenced value might be changed to different array ???
if (Z_IMMUTABLE_P(array)) {
- zval_copy_ctor(array);
+ zval_copy_ctor_func(array);
}
}
- if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
- key = EX_VAR((opline+1)->result.var);
- }
SAVE_OPLINE();
- switch (zend_iterator_unwrap(array, &iter TSRMLS_CC)) {
- default:
- case ZEND_ITER_INVALID:
- zend_error(E_WARNING, "Invalid argument supplied for foreach()");
+ if (EXPECTED(Z_TYPE_P(array) == IS_ARRAY)) {
+ fe_ht = Z_ARRVAL_P(array);
+ ptr = (HashPointer*)EX_VAR((opline+1)->op1.var);
+ pos = ptr->pos;
+ if (UNEXPECTED(pos == INVALID_IDX)) {
+ /* reached end of iteration */
ZEND_VM_JMP(opline->op2.jmp_addr);
+ } else if (UNEXPECTED(ptr->ht != fe_ht)) {
+ ptr->ht = fe_ht;
+ pos = 0;
+ } else if (UNEXPECTED(fe_ht->nInternalPointer != ptr->pos)) {
+ if (fe_ht->u.flags & HASH_FLAG_PACKED) {
+ pos = ptr->h;
+ } else {
+ pos = fe_ht->arHash[ptr->h & fe_ht->nTableMask];
+ while (1) {
+ if (pos == INVALID_IDX) {
+ pos = fe_ht->nInternalPointer;
+ break;
+ } else if (fe_ht->arData[pos].h == ptr->h && fe_ht->arData[pos].key == ptr->key) {
+ break;
+ }
+ pos = Z_NEXT(fe_ht->arData[pos].val);
+ }
+ }
+ }
+ while (1) {
+ if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
+ /* reached end of iteration */
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ }
+ p = fe_ht->arData + pos;
+ value = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ } else if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ if (!p->key) {
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
+ } else {
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
+ }
+ }
+ break;
+ }
+ do {
+ pos++;
+ if (pos >= fe_ht->nNumUsed) {
+ fe_ht->nInternalPointer = ptr->pos = INVALID_IDX;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
+ p = fe_ht->arData + pos;
+ } while (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF));
+ fe_ht->nInternalPointer = ptr->pos = pos;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ } else if (EXPECTED(Z_TYPE_P(array) == IS_OBJECT)) {
+ zend_object_iterator *iter;
- case ZEND_ITER_PLAIN_OBJECT: {
- zend_object *zobj = Z_OBJ_P(array);
- int key_type;
- zend_string *str_key;
- zend_uint_t int_key;
+ if ((iter = zend_iterator_unwrap(array TSRMLS_CC)) == NULL) {
+ /* plain object */
+ zend_object *zobj = Z_OBJ_P(array);
- fe_ht = Z_OBJPROP_P(array);
- zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
+ fe_ht = Z_OBJPROP_P(array);
+ ptr = (HashPointer*)EX_VAR((opline+1)->op1.var);
+ pos = ptr->pos;
+ if (pos == INVALID_IDX) {
+ /* reached end of iteration */
+ ZEND_VM_JMP(opline->op2.jmp_addr);
+ } else if (UNEXPECTED(ptr->ht != fe_ht)) {
+ ptr->ht = fe_ht;
+ pos = 0;
+ } else if (UNEXPECTED(fe_ht->nInternalPointer != ptr->pos)) {
+ if (fe_ht->u.flags & HASH_FLAG_PACKED) {
+ pos = ptr->h;
+ } else {
+ pos = fe_ht->arHash[ptr->h & fe_ht->nTableMask];
+ while (1) {
+ if (pos == INVALID_IDX) {
+ pos = fe_ht->nInternalPointer;
+ break;
+ } else if (fe_ht->arData[pos].h == ptr->h && fe_ht->arData[pos].key == ptr->key) {
+ break;
+ }
+ pos = Z_NEXT(fe_ht->arData[pos].val);
+ }
+ }
+ }
while (1) {
- if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
+ if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
/* reached end of iteration */
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- if (Z_TYPE_P(value) == IS_INDIRECT) {
+ p = fe_ht->arData + pos;
+ value = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
+ continue;
+ } else if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
value = Z_INDIRECT_P(value);
- if (Z_TYPE_P(value) == IS_UNDEF) {
- zend_hash_move_forward(fe_ht);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ pos++;
continue;
}
}
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
-
- zend_hash_move_forward(fe_ht);
- if (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
+ if (UNEXPECTED(!p->key)) {
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
+ }
+ break;
+ } else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
+ if (p->key->val[0]) {
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
+ } else {
+ const char *class_name, *prop_name;
+ size_t prop_name_len;
+ zend_unmangle_property_name_ex(
+ p->key, &class_name, &prop_name, &prop_name_len);
+ ZVAL_STRINGL(EX_VAR((opline+1)->result.var), prop_name, prop_name_len);
+ }
+ }
break;
}
+ pos++;
}
-
- if (key) {
- if (key_type == HASH_KEY_IS_INT) {
- ZVAL_INT(key, int_key);
- } else {
- const char *class_name, *prop_name;
- int prop_name_len;
- zend_unmangle_property_name_ex(
- str_key->val, str_key->len, &class_name, &prop_name, &prop_name_len
- );
- ZVAL_STRINGL(key, prop_name, prop_name_len);
- }
- }
-
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- break;
- }
-
- case ZEND_ITER_PLAIN_ARRAY:
- fe_ht = Z_ARRVAL_P(array);
- zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
- /* reached end of iteration */
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
- if (key) {
- zend_hash_get_current_key_zval(fe_ht, key);
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zend_hash_move_forward(fe_ht);
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var));
- break;
-
- case ZEND_ITER_OBJECT:
+ do {
+ pos++;
+ if (pos >= fe_ht->nNumUsed) {
+ fe_ht->nInternalPointer = ptr->pos = INVALID_IDX;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
+ p = fe_ht->arData + pos;
+ } while (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF) ||
+ (EXPECTED(p->key != NULL) &&
+ zend_check_property_access(zobj, p->key TSRMLS_CC) == FAILURE));
+ fe_ht->nInternalPointer = ptr->pos = pos;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ } else {
/* !iter happens from exception */
if (iter && ++iter->index > 0) {
/* This could cause an endless loop if index becomes zero again.
@@ -14348,31 +16939,31 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* failure in get_current_data */
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- if (key) {
+ if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
+ ZVAL_MAKE_REF(value);
+ Z_ADDREF_P(value);
+ ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ } else {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (iter->funcs->get_current_key) {
- iter->funcs->get_current_key(iter, key TSRMLS_CC);
+ iter->funcs->get_current_key(iter, EX_VAR((opline+1)->result.var) TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
HANDLE_EXCEPTION();
}
} else {
- ZVAL_INT(key, iter->index);
+ ZVAL_LONG(EX_VAR((opline+1)->result.var), iter->index);
}
}
- break;
- }
-
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_MAKE_REF(value);
- Z_ADDREF_P(value);
- ZVAL_REF(EX_VAR(opline->result.var), Z_REF_P(value));
+ ZEND_VM_INC_OPCODE();
+ ZEND_VM_NEXT_OPCODE();
+ }
} else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ zend_error(E_WARNING, "Invalid argument supplied for foreach()");
+ ZEND_VM_JMP(opline->op2.jmp_addr);
}
-
- CHECK_EXCEPTION();
- ZEND_VM_INC_OPCODE();
- ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -14385,8 +16976,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
zval *ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
@@ -14402,10 +16993,15 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
if (i_zend_is_true(value TSRMLS_CC)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_VAR == IS_CONST) {
@@ -14414,6 +17010,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
} else if (IS_VAR == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ zval_ptr_dtor_nogc(free_op1.var);
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -14423,16 +17022,22 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_COALESCE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (i_zend_is_true(value TSRMLS_CC)) {
+ if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
+
+ if (Z_TYPE_P(value) > IS_NULL) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
@@ -14440,6 +17045,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
}
} else if (IS_VAR == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ zval_ptr_dtor_nogc(free_op1.var);
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -14458,33 +17066,18 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
- }
- } else if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- ZEND_VM_NEXT_OPCODE();
-}
-
-static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1;
- zval *value;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
+ if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(value)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), Z_REFVAL_P(value));
+ zval_ptr_dtor_nogc(free_op1.var);
+ } else {
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
+ if (IS_VAR == IS_CONST) {
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+ zval_copy_ctor_func(EX_VAR(opline->result.var));
+ }
+ } else if (IS_VAR == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -14499,7 +17092,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
expr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
+ if (Z_TYPE_P(expr) == IS_OBJECT) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
@@ -14519,24 +17112,26 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
value = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
- ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value));
+ ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
} else {
if (Z_TYPE_P(value) < IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 0);
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
} else if (Z_TYPE_P(value) == IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
} else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value);
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str;
+ zval tmp;
- if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
+ ZVAL_COPY(&tmp, value);
+ if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
goto strlen_error;
}
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zval_dtor(&tmp);
} else {
strlen_error:
zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
@@ -14558,7 +17153,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
value = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
switch (opline->extended_value) {
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
@@ -14569,16 +17164,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
break;
case IS_OBJECT:
if (Z_TYPE_P(value) == opline->extended_value) {
- if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
- ZVAL_TRUE(EX_VAR(opline->result.var));
+ zend_class_entry *ce = Z_OBJCE_P(value);
+ if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
+ && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+ ZVAL_FALSE(EX_VAR(opline->result.var));
} else {
- zend_class_entry *ce = Z_OBJCE_P(value);
- if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
- && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
- ZVAL_FALSE(EX_VAR(opline->result.var));
- } else {
- ZVAL_TRUE(EX_VAR(opline->result.var));
- }
+ ZVAL_TRUE(EX_VAR(opline->result.var));
}
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -14591,8 +17182,8 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
}
+ break;
EMPTY_SWITCH_DEFAULT_CASE()
-
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -14883,15 +17474,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
zval *value;
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -14905,7 +17498,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -14977,9 +17571,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CONST(int (*b
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_VAR == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -14988,11 +17582,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CONST(int (*b
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -15044,7 +17638,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar
value = opline->op2.zv;
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -15239,13 +17833,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -15261,7 +17857,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -15330,13 +17927,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -15351,12 +17950,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -15419,7 +18017,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -15434,7 +18032,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -15457,8 +18055,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -15478,8 +18075,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -15501,7 +18097,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
}
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -15566,9 +18162,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(free_op1.var);
- }
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15582,7 +18176,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -15591,7 +18185,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15608,12 +18202,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15645,12 +18239,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -15677,12 +18274,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15690,7 +18287,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
@@ -15702,7 +18299,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -15722,11 +18319,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_VAR_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -15738,13 +18330,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
property = opline->op2.zv;
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15763,12 +18355,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
property = opline->op2.zv;
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15788,7 +18380,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -15821,19 +18413,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OP
property = opline->op2.zv;
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_VAR_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -15847,12 +18442,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = opline->op2.zv;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -15860,6 +18455,39 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_free_op free_op1;
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+
+ zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
+ EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
+ zval *result = EX_VAR(opline->result.var);
+ zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+ } else {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -15871,10 +18499,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = opline->op2.zv;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -15892,7 +18520,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -15902,7 +18530,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
zval *property_name = opline->op2.zv;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -15910,34 +18538,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
zval *dim = opline->op2.zv;
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
@@ -15957,23 +18581,15 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
value = opline->op2.zv;
variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_CONST, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_CONST == IS_TMP_VAR) {
+
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_CONST == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_CONST == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -16010,19 +18626,56 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CONST != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -16032,7 +18685,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -16042,14 +18695,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
@@ -16130,7 +18783,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -16138,19 +18791,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -16162,8 +18823,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_CONST == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -16201,7 +18862,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv));
+ char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
actual = Z_STRVAL_P(opline->op2.zv);
} else {
@@ -16209,7 +18870,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -16272,10 +18933,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
- } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
+ } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- STR_ADDREF(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -16295,7 +18955,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -16303,7 +18963,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_VAR == IS_CONST) {
@@ -16311,9 +18971,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -16324,15 +18984,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
zval *offset = opline->op2.zv;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -16376,7 +19036,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -16410,28 +19070,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -16444,10 +19111,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
@@ -16466,10 +19131,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -16482,94 +19145,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op1;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_VAR != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = opline->op2.zv;
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CONST != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CONST != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CONST == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CONST == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -16585,13 +19233,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = opline->op2.zv;
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_VAR == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -16608,26 +19256,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -16649,39 +19299,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
- }
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -16690,14 +19329,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND
zend_free_op free_op1;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -16712,14 +19351,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -16750,8 +19389,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -16760,24 +19399,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -16809,8 +19448,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -16863,13 +19502,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -16894,14 +19533,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
zval_ptr_dtor_nogc(free_op1.var);
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -16919,25 +19558,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -16990,7 +19629,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17005,7 +19644,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17020,7 +19659,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17035,7 +19674,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17050,7 +19689,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17065,7 +19704,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17080,7 +19719,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17095,7 +19734,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17110,7 +19749,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17126,7 +19765,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17142,7 +19781,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17158,7 +19797,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17174,7 +19813,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17190,7 +19829,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPC
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17205,7 +19844,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17220,7 +19859,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17235,7 +19874,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17250,7 +19889,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17264,17 +19903,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
zval *value;
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
@@ -17286,7 +19927,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -17339,7 +19981,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
}
@@ -17359,9 +20001,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_TMP(int (*bin
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_VAR == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -17370,11 +20012,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_TMP(int (*bin
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -17406,7 +20048,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_TMP(int (*bin
}
assign_op_dim_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -17426,7 +20068,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -17458,7 +20100,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
}
assign_op_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17621,15 +20263,17 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(retval);
}
@@ -17643,7 +20287,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -17683,7 +20328,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17713,15 +20358,17 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -17734,12 +20381,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -17771,7 +20417,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17796,10 +20442,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(free_op1.var);
- }
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17813,7 +20457,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -17821,8 +20465,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
} else {
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
}
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -17839,12 +20483,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -17861,7 +20505,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17876,15 +20520,18 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
if (IS_TMP_VAR == IS_UNUSED) {
@@ -17892,7 +20539,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
@@ -17908,12 +20555,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -17921,7 +20568,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
@@ -17933,7 +20580,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -17948,17 +20595,12 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -17970,13 +20612,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -17995,12 +20637,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -18020,7 +20662,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -18034,7 +20676,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18054,19 +20696,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCO
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -18080,12 +20725,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -18104,11 +20749,11 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
@@ -18125,7 +20770,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -18135,43 +20780,38 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
-
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
- } else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
+ } else {
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
@@ -18191,23 +20831,15 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_TMP_VAR, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (1) {
- zval_dtor(value);
+ if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_TMP_VAR == IS_TMP_VAR) {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_TMP_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_TMP_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -18244,19 +20876,56 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
+ HANDLE_EXCEPTION();
+ }
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (EG(exception) != NULL) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_TMP_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -18266,7 +20935,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -18276,16 +20945,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -18359,13 +21028,13 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
}
}
if (IS_TMP_VAR != IS_CONST) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -18373,19 +21042,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -18397,8 +21074,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_TMP_VAR == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -18419,7 +21096,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18434,7 +21111,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -18442,7 +21119,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_VAR == IS_CONST) {
@@ -18450,9 +21127,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -18463,15 +21140,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -18504,7 +21181,7 @@ str_index:
/* do nothing */
break;
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
@@ -18515,7 +21192,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -18549,94 +21226,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_VAR != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_TMP_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_dtor(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_TMP_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_dtor(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_dtor(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_TMP_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -18652,20 +21314,20 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_VAR == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18677,14 +21339,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_O
zend_free_op free_op1, free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -18699,14 +21361,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -18737,8 +21399,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -18747,24 +21409,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -18778,7 +21440,7 @@ num_index_prop:
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -18797,8 +21459,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -18811,7 +21473,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -18852,13 +21514,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -18883,14 +21545,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->value, value);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
zval_ptr_dtor_nogc(free_op1.var);
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -18908,25 +21570,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->key, key);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -18959,7 +21621,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19253,15 +21915,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
zval *value;
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
@@ -19275,7 +21939,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -19348,9 +22013,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_VAR(int (*bin
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_VAR == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -19359,11 +22024,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_VAR(int (*bin
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -19412,10 +22077,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -19610,13 +22275,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
@@ -19632,7 +22299,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -19702,13 +22370,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
@@ -19723,12 +22393,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -19792,7 +22461,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -19807,7 +22476,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -19830,8 +22499,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -19851,8 +22519,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -19874,7 +22541,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
}
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -19939,9 +22606,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(free_op1.var);
- }
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19955,7 +22620,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -19964,7 +22629,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
}
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -19981,12 +22646,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -20018,12 +22683,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
zval_ptr_dtor_nogc(free_op2.var);
@@ -20050,12 +22718,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -20063,7 +22731,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
@@ -20075,7 +22743,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -20096,11 +22764,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -20112,13 +22775,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -20137,12 +22800,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -20162,7 +22825,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -20196,19 +22859,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCO
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -20222,12 +22888,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -20246,10 +22912,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -20267,7 +22933,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -20277,7 +22943,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -20285,35 +22951,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
-
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
- } else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
+ } else {
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
@@ -20330,26 +22991,18 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_VAR, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_VAR == IS_TMP_VAR) {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -20398,8 +23051,8 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
}
- if ((IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
- (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
+ if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) ||
+ (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == NULL))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
if ((IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) ||
@@ -20450,19 +23103,56 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -20472,7 +23162,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -20482,14 +23172,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
zval_ptr_dtor_nogc(free_op1.var);
@@ -20571,7 +23261,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -20579,19 +23269,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -20603,8 +23301,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_VAR == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -20640,7 +23338,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -20648,7 +23346,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_VAR == IS_CONST) {
@@ -20656,9 +23354,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -20669,15 +23367,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -20721,7 +23419,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -20755,28 +23453,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -20789,10 +23494,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
@@ -20811,10 +23514,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -20827,94 +23528,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_VAR != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_ptr_dtor_nogc(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -20930,13 +23616,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_VAR == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -20953,26 +23639,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -20994,39 +23682,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
- }
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -21035,14 +23712,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_O
zend_free_op free_op1, free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -21057,14 +23734,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -21095,8 +23772,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -21105,24 +23782,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -21155,8 +23832,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -21210,13 +23887,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -21241,14 +23918,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->value, value);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
zval_ptr_dtor_nogc(free_op1.var);
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -21266,25 +23943,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
ZVAL_DUP(&generator->key, key);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
zval_ptr_dtor_nogc(free_op2.var);
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -21336,15 +24013,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
zval *value;
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -21358,7 +24037,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -21430,9 +24110,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_UNUSED(int (*
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_VAR == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -21441,11 +24121,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_UNUSED(int (*
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -21497,7 +24177,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina
value = NULL;
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -21694,7 +24374,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -21709,7 +24389,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -21732,8 +24412,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -21753,8 +24432,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -21776,7 +24454,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
}
if (IS_VAR != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -21840,7 +24518,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -21849,7 +24527,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_H
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -21866,12 +24544,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -21888,12 +24566,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_O
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -21920,7 +24601,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -21930,7 +24611,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
zval *property_name = NULL;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -21938,34 +24619,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
zval *dim = NULL;
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
@@ -22047,7 +24724,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -22055,19 +24732,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -22079,8 +24764,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_UNUSED == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -22100,7 +24785,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -22108,7 +24793,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_VAR == IS_CONST) {
@@ -22116,9 +24801,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -22129,15 +24814,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
zval *offset = NULL;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -22181,7 +24866,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -22215,28 +24900,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
zval tmp, *varname;
HashTable *target_symbol_table;
zend_free_op free_op1;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -22249,10 +24941,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
@@ -22271,10 +24961,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_VAR != IS_CONST && tmp_is_dup) {
+ if (IS_VAR != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
@@ -22285,26 +24973,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zend_free_op free_op1;
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -22326,39 +25016,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
zval_ptr_dtor_nogc(free_op1.var);
- }
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -22413,13 +25092,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -22444,14 +25123,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->value, value);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
zval_ptr_dtor_nogc(free_op1.var);
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -22469,25 +25148,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->key, key);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_UNUSED == IS_VAR || IS_UNUSED == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -22799,15 +25478,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
zval *value;
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -22821,7 +25502,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -22893,9 +25575,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CV(int (*bina
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_VAR == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -22904,11 +25586,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CV(int (*bina
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -22957,10 +25639,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -23155,13 +25837,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -23177,7 +25861,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -23246,13 +25931,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_VAR != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -23267,12 +25954,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -23329,9 +26015,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(free_op1.var);
- }
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23345,7 +26029,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -23354,7 +26038,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23371,12 +26055,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23408,12 +26092,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -23440,12 +26127,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23453,7 +26140,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
@@ -23465,7 +26152,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -23485,11 +26172,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -23501,13 +26183,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23526,12 +26208,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23551,7 +26233,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -23584,19 +26266,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCOD
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -23610,12 +26295,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
@@ -23634,10 +26319,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
object = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
@@ -23655,7 +26340,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -23665,7 +26350,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_VAR, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -23673,34 +26358,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
@@ -23717,26 +26398,18 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_CV, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_CV == IS_TMP_VAR) {
+
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_CV == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_CV == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -23784,8 +26457,8 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
}
- if ((IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
- (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
+ if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) ||
+ (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == NULL))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
if ((IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) ||
@@ -23835,19 +26508,56 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
object = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zval_ptr_dtor_nogc(free_op1.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CV != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -23857,7 +26567,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -23867,14 +26577,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op1.var);
@@ -23955,7 +26665,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
fbc = ce->constructor;
@@ -23963,19 +26673,27 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
object = NULL;
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- if (EX(object)) {
- object = EX(object);
+ if (Z_OBJ(EX(This))) {
+ object = Z_OBJ(EX(This));
GC_REFCOUNT(object)++;
- if (object->handlers->get_class_entry &&
- !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
- /* We are calling method of the other (incompatible) class,
- but passing $this. This is done for compatibility with php-4. */
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
- }
+ }
+ if (!object ||
+ !instanceof_function(object->ce, ce TSRMLS_CC)) {
+ /* We are calling method of the other (incompatible) class,
+ but passing $this. This is done for compatibility with php-4. */
+ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
+ zend_error(
+ object ? E_DEPRECATED : E_STRICT,
+ "Non-static method %s::%s() should not be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
+ } else {
+ /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
+ zend_error_noreturn(
+ E_ERROR,
+ "Non-static method %s::%s() cannot be called statically%s",
+ fbc->common.scope->name->val, fbc->common.function_name->val,
+ object ? ", assuming $this from incompatible context" : "");
}
}
}
@@ -23987,8 +26705,8 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
}
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, ce, object, EX(call) TSRMLS_CC);
if (IS_CV == IS_UNUSED) {
EX(call)->return_value = NULL;
@@ -24023,7 +26741,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -24031,7 +26749,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_VAR == IS_CONST) {
@@ -24039,9 +26757,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -24052,15 +26770,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -24104,7 +26822,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -24138,94 +26856,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_VAR != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CV != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CV != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CV == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CV == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
@@ -24241,13 +26944,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_VAR == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -24266,14 +26969,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OP
zend_free_op free_op1;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_VAR != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -24288,14 +26991,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -24326,8 +27029,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -24336,24 +27039,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -24385,8 +27088,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O
container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_VAR == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -24439,13 +27142,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_VAR != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -24470,14 +27173,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->value, value);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
zval_ptr_dtor_nogc(free_op1.var);
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -24495,25 +27198,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->key, key);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -24566,10 +27269,10 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_object_clone_obj_t clone_call;
SAVE_OPLINE();
- obj = _get_obj_zval_ptr_unused(TSRMLS_C);
+ obj = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
if (IS_UNUSED == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -24624,8 +27327,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zval *ptr = NULL;
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
@@ -24640,20 +27343,22 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
{
USE_OPLINE
zend_free_op free_op_data1;
- zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ zval *object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
zval *property = opline->op2.zv;
zval *value;
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -24667,7 +27372,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -24737,10 +27443,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CONST(int
zval *value, *container;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_UNUSED == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -24749,11 +27455,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CONST(int
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -24805,7 +27511,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
value = opline->op2.zv;
var_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -24996,17 +27702,19 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -25022,7 +27730,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -25087,17 +27796,19 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -25112,12 +27823,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -25164,7 +27874,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
return zend_post_incdec_property_helper_SPEC_UNUSED_CONST(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -25173,10 +27883,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -25196,11 +27906,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -25211,14 +27916,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -25235,14 +27940,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -25259,10 +27964,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -25293,21 +27998,24 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -25318,15 +28026,15 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OP
zval *container, *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = opline->op2.zv;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -25342,13 +28050,13 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
zval *property_name;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property_name = opline->op2.zv;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_UNUSED, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -25417,21 +28125,57 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CONST != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -25441,7 +28185,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -25451,14 +28195,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -25478,7 +28222,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv));
+ char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
if(!actual) {
actual = Z_STRVAL_P(opline->op2.zv);
} else {
@@ -25486,7 +28230,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -25549,10 +28293,9 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
}
ZVAL_DUP(EX_VAR(opline->result.var), value);
- } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
+ } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- STR_ADDREF(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -25565,7 +28308,7 @@ constant_fetch_end:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -25599,94 +28342,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_UNUSED != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = opline->op2.zv;
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CONST != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CONST != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CONST == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CONST == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
CHECK_EXCEPTION();
@@ -25701,14 +28429,14 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = opline->op2.zv;
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_UNUSED == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -25727,14 +28455,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CONST_HANDLER(Z
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -25749,14 +28477,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -25787,8 +28515,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -25797,24 +28525,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -25843,11 +28571,11 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -25900,13 +28628,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_UNUSED != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -25930,14 +28658,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
ZVAL_DUP(&generator->value, value);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -25955,25 +28683,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
ZVAL_DUP(&generator->key, key);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -26005,22 +28733,24 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ zval *object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value;
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
@@ -26032,7 +28762,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -26085,7 +28816,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
}
@@ -26103,10 +28834,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_TMP(int (*
zval *value, *container;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_UNUSED == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -26115,11 +28846,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_TMP(int (*
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -26151,7 +28882,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_TMP(int (*
}
assign_op_dim_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
@@ -26171,7 +28902,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -26203,7 +28934,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
}
assign_op_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26362,19 +29093,21 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(retval);
}
@@ -26388,7 +29121,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -26428,7 +29162,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26454,19 +29188,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
CHECK_EXCEPTION();
@@ -26479,12 +29215,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -26516,7 +29251,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26532,7 +29267,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
return zend_post_incdec_property_helper_SPEC_UNUSED_TMP(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -26541,10 +29276,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -26559,17 +29294,12 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -26580,14 +29310,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -26604,14 +29334,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -26628,10 +29358,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -26645,7 +29375,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26663,21 +29393,24 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_O
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -26688,15 +29421,15 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCO
zval *container, *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -26712,14 +29445,14 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA
zval *property_name;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_UNUSED, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
@@ -26765,7 +29498,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
* which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
* string offsets or overloaded objects
*/
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26793,21 +29526,57 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
+ HANDLE_EXCEPTION();
+ }
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_TMP_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -26817,7 +29586,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -26827,16 +29596,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26845,7 +29614,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -26879,94 +29648,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_UNUSED != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_TMP_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_dtor(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_TMP_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_dtor(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_dtor(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_TMP_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -26981,21 +29735,21 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_UNUSED == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -27007,14 +29761,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEN
zend_free_op free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -27029,14 +29783,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -27067,8 +29821,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -27077,24 +29831,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -27108,7 +29862,7 @@ num_index_prop:
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
CHECK_EXCEPTION();
@@ -27124,11 +29878,11 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZE
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -27141,7 +29895,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZE
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
CHECK_EXCEPTION();
@@ -27182,13 +29936,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_UNUSED != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -27212,14 +29966,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->value, value);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -27237,25 +29991,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->key, key);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -27287,20 +30041,22 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ zval *object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
zval *property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value;
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
@@ -27314,7 +30070,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -27385,10 +30142,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_VAR(int (*
zval *value, *container;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_UNUSED == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -27397,11 +30154,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_VAR(int (*
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -27450,10 +30207,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -27644,17 +30401,19 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
@@ -27670,7 +30429,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -27736,17 +30496,19 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
@@ -27761,12 +30523,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -27814,7 +30575,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
return zend_post_incdec_property_helper_SPEC_UNUSED_VAR(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -27823,10 +30584,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -27847,11 +30608,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -27862,14 +30618,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -27886,14 +30642,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -27910,10 +30666,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -27945,21 +30701,24 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_O
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -27970,15 +30729,15 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCO
zval *container, *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -27994,13 +30753,13 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA
zval *property_name;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_UNUSED, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
@@ -28075,21 +30834,57 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -28099,7 +30894,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -28109,14 +30904,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
@@ -28127,7 +30922,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -28161,94 +30956,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_UNUSED != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_ptr_dtor_nogc(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -28263,14 +31043,14 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_UNUSED == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -28289,14 +31069,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEN
zend_free_op free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -28311,14 +31091,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -28349,8 +31129,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -28359,24 +31139,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -28406,11 +31186,11 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZE
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -28464,13 +31244,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_UNUSED != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -28494,14 +31274,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->value, value);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -28519,25 +31299,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_DUP(&generator->key, key);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
zval_ptr_dtor_nogc(free_op2.var);
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -28569,20 +31349,22 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
{
USE_OPLINE
zend_free_op free_op_data1;
- zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ zval *object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
zval *property = NULL;
zval *value;
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -28596,7 +31378,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -28666,10 +31449,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_UNUSED(int
zval *value, *container;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_UNUSED == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -28678,11 +31461,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_UNUSED(int
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -28734,7 +31517,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
value = NULL;
var_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -28918,7 +31701,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_BW_XOR_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -28980,13 +31763,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_UNUSED != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -29010,14 +31793,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
ZVAL_DUP(&generator->value, value);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -29035,25 +31818,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
ZVAL_DUP(&generator->key, key);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_UNUSED == IS_VAR || IS_UNUSED == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -29085,20 +31868,22 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
{
USE_OPLINE
zend_free_op free_op_data1;
- zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ zval *object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
zval *property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *value;
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -29112,7 +31897,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -29182,10 +31968,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CV(int (*b
zval *value, *container;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_UNUSED == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -29194,11 +31980,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CV(int (*b
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -29247,10 +32033,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -29441,17 +32227,19 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -29467,7 +32255,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -29532,17 +32321,19 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
int have_get_ptr = 0;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_UNUSED != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -29557,12 +32348,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -29609,7 +32399,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
return zend_post_incdec_property_helper_SPEC_UNUSED_CV(decrement_function, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -29618,10 +32408,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -29641,11 +32431,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -29656,14 +32441,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -29680,14 +32465,14 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -29704,10 +32489,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -29738,21 +32523,24 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OP
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -29763,15 +32551,15 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCOD
zval *container, *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -29787,13 +32575,13 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN
zval *property_name;
SAVE_OPLINE();
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_UNUSED, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -29867,21 +32655,57 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+
+ if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CV != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -29891,7 +32715,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -29901,14 +32725,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -29918,7 +32742,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -29952,94 +32776,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_UNUSED != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CV != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CV != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CV == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CV == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
CHECK_EXCEPTION();
@@ -30054,14 +32863,14 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_UNUSED == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -30080,14 +32889,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_UNUSED != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -30102,14 +32911,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -30140,8 +32949,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -30150,24 +32959,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -30196,11 +33005,11 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEN
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(execute_data TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_UNUSED == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -30253,13 +33062,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_UNUSED != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = NULL;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -30283,14 +33092,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -30308,25 +33117,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -30389,7 +33198,11 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -30397,14 +33210,10 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
-
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -30412,19 +33221,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -30443,7 +33240,11 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
@@ -30451,14 +33252,10 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
-
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -30466,19 +33263,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZVAL_DEREF(var_ptr);
SEPARATE_ZVAL_NOREF(var_ptr);
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
@@ -30492,50 +33277,36 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_increment_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
-
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_increment_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- increment_function(var_ptr);
- }
+ increment_function(var_ptr);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -30545,50 +33316,36 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval *var_ptr, *retval;
+ zval *var_ptr;
SAVE_OPLINE();
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
+ }
+
+ if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_decrement_function(var_ptr);
ZEND_VM_NEXT_OPCODE();
}
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
- zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
- }
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
ZVAL_NULL(EX_VAR(opline->result.var));
-
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = EX_VAR(opline->result.var);
-
if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
var_ptr = Z_REFVAL_P(var_ptr);
- ZVAL_DUP(retval, var_ptr);
+ ZVAL_DUP(EX_VAR(opline->result.var), var_ptr);
} else {
- ZVAL_DUP(retval, var_ptr);
- SEPARATE_ZVAL_NOREF(var_ptr);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
+ zval_opt_copy_ctor(var_ptr);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_P(var_ptr, get)
- && Z_OBJ_HANDLER_P(var_ptr, set)) {
- /* proxy object */
- zval rv;
- zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr, &rv TSRMLS_CC);
- Z_ADDREF_P(val);
- fast_decrement_function(val);
- Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(val);
- } else {
- decrement_function(var_ptr);
- }
+ decrement_function(var_ptr);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -30613,7 +33370,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -30798,7 +33555,7 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval_copy_ctor_func(EX(return_value));
}
}
- } else if (Z_ISREF_P(retval_ptr)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(retval_ptr)) {
ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
} else {
@@ -30832,6 +33589,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
if (IS_CV != IS_TMP_VAR) {
zval_opt_copy_ctor_no_imm(EX(return_value));
}
@@ -30841,7 +33599,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
retval_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(retval_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
@@ -30851,9 +33609,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
} else {
zend_error(E_NOTICE, "Only variable references should be returned by reference");
if (EX(return_value)) {
- zval tmp;
- ZVAL_DUP(&tmp, retval_ptr);
- ZVAL_NEW_REF(EX(return_value), &tmp);
+ ZVAL_NEW_REF(EX(return_value), retval_ptr);
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
+ if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
}
break;
}
@@ -30863,6 +33621,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
ZVAL_MAKE_REF(retval_ptr);
Z_ADDREF_P(retval_ptr);
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
+ Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
}
} while (0);
@@ -30905,7 +33664,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
} else {
@@ -30970,7 +33729,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
varptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(varptr == NULL)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
@@ -31009,7 +33768,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
EX(call)->num_args = opline->op2.num;
- if (Z_ISREF_P(varptr)) {
+ if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(varptr)) {
ZVAL_COPY(arg, Z_REFVAL_P(varptr));
} else {
@@ -31060,12 +33819,12 @@ static int ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
- if (EX(call)->object) {
- OBJ_RELEASE(EX(call)->object);
+ if (Z_OBJ(EX(call)->This)) {
+ OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
- EX(call)->object = NULL;
+ Z_OBJ(EX(call)->This) = NULL;
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -31125,7 +33884,7 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
obj = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CONST ||
- UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
+ (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -31201,8 +33960,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break;
- case IS_INT:
- ZVAL_INT(result, zval_get_int(expr));
+ case IS_LONG:
+ ZVAL_LONG(result, zval_get_long(expr));
break;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr));
@@ -31236,15 +33995,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CV != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -31256,21 +34013,16 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CV != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (!0) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
CHECK_EXCEPTION();
@@ -31291,12 +34043,11 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
ZVAL_UNDEF(&tmp_inc_filename);
if (Z_TYPE_P(inc_filename) != IS_STRING) {
- ZVAL_DUP(&tmp_inc_filename, inc_filename);
- convert_to_string(&tmp_inc_filename);
+ ZVAL_STR(&tmp_inc_filename, zval_get_string(inc_filename));
inc_filename = &tmp_inc_filename;
}
- if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) {
+ if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else {
@@ -31309,9 +34060,9 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
zend_file_handle file_handle;
char *resolved_path;
- resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC);
+ resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), (int)Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
+ failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, (int)strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -31324,7 +34075,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
+ if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, (int)strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
@@ -31371,8 +34122,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
return_value = EX_VAR(opline->result.var);
}
- call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
+ call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
+ (zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
if (EX(symbol_table)) {
call->symbol_table = EX(symbol_table);
@@ -31381,15 +34132,16 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
}
call->prev_execute_data = execute_data;
- i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_code_execute_data(call, new_op_array, return_value TSRMLS_CC);
if (EXPECTED(zend_execute_ex == execute_ex)) {
ZEND_VM_ENTER();
} else {
+ call->frame_info = VM_FRAME_TOP_CODE;
zend_execute_ex(call TSRMLS_CC);
}
destroy_op_array(new_op_array TSRMLS_CC);
- efree(new_op_array);
+ efree_size(new_op_array, sizeof(zend_op_array));
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
HANDLE_EXCEPTION();
@@ -31414,35 +34166,19 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
- (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ (opline->extended_value & ZEND_FE_FETCH_BYREF)) {
array_ptr = array_ref = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
ZVAL_DEREF(array_ptr);
if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ARRAY(array_ptr);
if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- array_ref = array_ptr;
- if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- ZVAL_NEW_REF(array_ptr, array_ptr);
- array_ref = array_ptr;
- array_ptr = Z_REFVAL_P(array_ptr);
- }
- } else if (Z_IMMUTABLE_P(array_ptr)) {
- zval_copy_ctor(array_ptr);
- } else {
- SEPARATE_ZVAL_NOREF(array_ptr);
+ ZVAL_NEW_REF(array_ref, array_ref);
+ array_ptr = Z_REFVAL_P(array_ref);
}
if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
- zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
- ZEND_VM_JMP(opline->op2.jmp_addr);
- }
-
ce = Z_OBJCE_P(array_ptr);
- if (!ce || ce->get_iterator == NULL) {
- if (!Z_ISREF_P(array_ref)) {
- SEPARATE_ZVAL_NOREF(array_ptr);
- }
+ if (ce->get_iterator == NULL) {
Z_ADDREF_P(array_ptr);
}
array_ref = array_ptr;
@@ -31452,9 +34188,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
} else {
array_ptr = array_ref = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
ZVAL_DEREF(array_ptr);
- if (0) { /* IS_TMP_VAR */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&tmp, array_ptr);
- array_ptr = &tmp;
+ if (Z_OPT_IMMUTABLE_P(&tmp)) {
+ zval_copy_ctor_func(&tmp);
+ }
+ array_ref = array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -31463,17 +34202,18 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
- if (!ce || !ce->get_iterator) {
+ if (!ce->get_iterator) {
if (IS_CV == IS_CV) {
Z_ADDREF_P(array_ref);
}
}
} else if (Z_IMMUTABLE_P(array_ref)) {
if (IS_CV == IS_CV) {
- zval_copy_ctor(array_ref);
+ zval_copy_ctor_func(array_ref);
Z_ADDREF_P(array_ref);
} else {
- ZVAL_DUP(&tmp, array_ref);
+ ZVAL_COPY_VALUE(&tmp, array_ref);
+ zval_copy_ctor_func(&tmp);
array_ptr = array_ref = &tmp;
}
} else if (Z_REFCOUNTED_P(array_ref)) {
@@ -31494,14 +34234,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_UNREF(array_ref);
array_ptr = array_ref;
}
- if (Z_IMMUTABLE_P(array_ptr) ||
- (Z_ISREF_P(array_ref) &&
- Z_REFCOUNTED_P(array_ptr) &&
- Z_REFCOUNT_P(array_ptr) > 1)) {
- if (!Z_IMMUTABLE_P(array_ptr)) {
- Z_DELREF_P(array_ptr);
- }
- zval_copy_ctor(array_ptr);
+ if (Z_IMMUTABLE_P(array_ptr)) {
+ zval_copy_ctor_func(array_ptr);
+ } else if (Z_ISREF_P(array_ref) &&
+ Z_COPYABLE_P(array_ptr) &&
+ Z_REFCOUNT_P(array_ptr) > 1) {
+ Z_DELREF_P(array_ptr);
+ zval_copy_ctor_func(array_ptr);
}
if (IS_CV == IS_CV) {
Z_ADDREF_P(array_ref);
@@ -31511,16 +34250,16 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
if (ce && ce->get_iterator) {
- iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
+ iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_FETCH_BYREF TSRMLS_CC);
- if (IS_CV == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
+ if (IS_CV == IS_VAR && !(opline->extended_value & ZEND_FE_FETCH_BYREF)) {
}
if (iter && EXPECTED(EG(exception) == NULL)) {
ZVAL_OBJ(&iterator, &iter->std);
array_ptr = array_ref = &iterator;
} else {
- if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (!EG(exception)) {
@@ -31539,7 +34278,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
@@ -31548,38 +34287,51 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor(array_ref);
- if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
HANDLE_EXCEPTION();
}
iter->index = -1; /* will be set to 0 before using next handler */
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
- zend_hash_internal_pointer_reset(fe_ht);
- if (ce) {
- zend_object *zobj = Z_OBJ_P(array_ptr);
- while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- zend_string *str_key;
- zend_uint_t int_key;
- zend_uchar key_type;
-
- key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
- if (key_type != HASH_KEY_NON_EXISTENT &&
- (key_type == HASH_KEY_IS_INT ||
- zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
- break;
+ HashPointer *ptr = (HashPointer*)EX_VAR((opline+2)->op1.var);
+ HashPosition pos = 0;
+ Bucket *p;
+
+ while (1) {
+ if (pos >= fe_ht->nNumUsed) {
+ is_empty = 1;
+ if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
+
}
- zend_hash_move_forward(fe_ht);
+ ZEND_VM_JMP(opline->op2.jmp_addr);
}
+ p = fe_ht->arData + pos;
+ if (Z_TYPE(p->val) == IS_UNDEF ||
+ (Z_TYPE(p->val) == IS_INDIRECT &&
+ Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
+ pos++;
+ continue;
+ }
+ if (!ce ||
+ !p->key ||
+ zend_check_property_access(Z_OBJ_P(array_ptr), p->key TSRMLS_CC) == SUCCESS) {
+ break;
+ }
+ pos++;
}
- is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
+ fe_ht->nInternalPointer = pos;
+ ptr->pos = pos;
+ ptr->ht = fe_ht;
+ ptr->h = fe_ht->arData[pos].h;
+ ptr->key = fe_ht->arData[pos].key;
+ is_empty = 0;
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
- if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
+ if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_FETCH_BYREF) {
}
if (is_empty) {
@@ -31600,8 +34352,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zval *ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (Z_TYPE_P(ptr) == IS_INT) {
- EG(exit_status) = Z_IVAL_P(ptr);
+ if (Z_TYPE_P(ptr) == IS_LONG) {
+ EG(exit_status) = Z_LVAL_P(ptr);
} else {
zend_print_variable(ptr TSRMLS_CC);
}
@@ -31617,10 +34369,15 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
if (i_zend_is_true(value TSRMLS_CC)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_CV == IS_CONST) {
@@ -31629,6 +34386,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
} else if (IS_CV == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_CV == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -31637,16 +34397,22 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_COALESCE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
+ int is_ref = 0;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
- if (i_zend_is_true(value TSRMLS_CC)) {
+ if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(value)) {
+ is_ref = 1;
+ value = Z_REFVAL_P(value);
+ }
+
+ if (Z_TYPE_P(value) > IS_NULL) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
@@ -31654,6 +34420,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
}
} else if (IS_CV == IS_CV) {
if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ } else if (IS_CV == IS_VAR && is_ref) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+
}
ZEND_VM_JMP(opline->op2.jmp_addr);
}
@@ -31671,33 +34440,18 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_CV == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
- }
- } else if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- ZEND_VM_NEXT_OPCODE();
-}
-
-static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
+ if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(value)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), Z_REFVAL_P(value));
- zval *value;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
-
- ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
- if (IS_CV == IS_CONST) {
- if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
- zval_copy_ctor_func(EX_VAR(opline->result.var));
+ } else {
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
+ if (IS_CV == IS_CONST) {
+ if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+ zval_copy_ctor_func(EX_VAR(opline->result.var));
+ }
+ } else if (IS_CV == IS_CV) {
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -31712,7 +34466,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
expr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
+ if (Z_TYPE_P(expr) == IS_OBJECT) {
result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
@@ -31732,24 +34486,26 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
- ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value));
+ ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
} else {
if (Z_TYPE_P(value) < IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 0);
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
} else if (Z_TYPE_P(value) == IS_TRUE) {
- ZVAL_INT(EX_VAR(opline->result.var), 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
} else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value);
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str;
+ zval tmp;
- if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
+ ZVAL_COPY(&tmp, value);
+ if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
goto strlen_error;
}
- ZVAL_INT(EX_VAR(opline->result.var), str->len);
- STR_RELEASE(str);
+ ZVAL_LONG(EX_VAR(opline->result.var), str->len);
+ zval_dtor(&tmp);
} else {
strlen_error:
zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
@@ -31771,7 +34527,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
switch (opline->extended_value) {
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
case IS_ARRAY:
@@ -31782,16 +34538,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
break;
case IS_OBJECT:
if (Z_TYPE_P(value) == opline->extended_value) {
- if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
- ZVAL_TRUE(EX_VAR(opline->result.var));
+ zend_class_entry *ce = Z_OBJCE_P(value);
+ if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
+ && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
+ ZVAL_FALSE(EX_VAR(opline->result.var));
} else {
- zend_class_entry *ce = Z_OBJCE_P(value);
- if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
- && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
- ZVAL_FALSE(EX_VAR(opline->result.var));
- } else {
- ZVAL_TRUE(EX_VAR(opline->result.var));
- }
+ ZVAL_TRUE(EX_VAR(opline->result.var));
}
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -31804,8 +34556,8 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
} else {
ZVAL_FALSE(EX_VAR(opline->result.var));
}
+ break;
EMPTY_SWITCH_DEFAULT_CASE()
-
}
CHECK_EXCEPTION();
@@ -32096,15 +34848,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
zval *value;
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -32118,7 +34872,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -32189,9 +34944,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CONST(int (*bi
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_CV == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -32200,11 +34955,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CONST(int (*bi
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -32256,7 +35011,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary
value = opline->op2.zv;
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -32451,13 +35206,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -32473,7 +35230,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -32542,13 +35300,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
property = opline->op2.zv;
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -32563,12 +35323,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -32631,7 +35390,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -32646,7 +35405,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -32669,8 +35428,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -32690,8 +35448,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -32713,7 +35470,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
}
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -32778,9 +35535,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -32794,7 +35549,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -32803,7 +35558,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -32820,12 +35575,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -32857,12 +35612,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -32889,12 +35647,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -32902,7 +35660,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -32914,7 +35672,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -32934,11 +35692,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_CV_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -32950,13 +35703,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
property = opline->op2.zv;
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -32975,12 +35728,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
property = opline->op2.zv;
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -33000,7 +35753,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -33033,19 +35786,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPC
property = opline->op2.zv;
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_CV_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -33059,12 +35815,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = opline->op2.zv;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -33072,6 +35828,39 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
ZEND_VM_NEXT_OPCODE();
}
+static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+
+ zval *container;
+
+ SAVE_OPLINE();
+ container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+
+ zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
+ EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
+ zval *result = EX_VAR(opline->result.var);
+ zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY(result, retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+ } else {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -33083,10 +35872,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = opline->op2.zv;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -33104,7 +35893,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -33114,7 +35903,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
zval *property_name = opline->op2.zv;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -33122,34 +35911,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
zval *dim = opline->op2.zv;
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
/* assign_dim has two opcodes! */
@@ -33169,23 +35954,15 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
value = opline->op2.zv;
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_CONST, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_CONST == IS_TMP_VAR) {
+
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_CONST == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_CONST == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -33222,19 +35999,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CONST != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -33244,7 +36057,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -33254,14 +36067,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -33293,7 +36106,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
if ((IS_CV == IS_VAR || IS_CV == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -33301,7 +36114,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
} else {
expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CV == IS_CONST) {
@@ -33309,9 +36122,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CV == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -33322,15 +36135,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
zval *offset = opline->op2.zv;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -33374,7 +36187,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -33408,28 +36221,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -33442,10 +36262,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -33464,10 +36282,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -33480,94 +36296,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_CV != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = opline->op2.zv;
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CONST != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CONST != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CONST == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CONST == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
CHECK_EXCEPTION();
@@ -33583,13 +36384,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = opline->op2.zv;
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_CV == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -33606,26 +36407,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -33647,39 +36450,27 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -33688,14 +36479,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -33710,14 +36501,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -33748,8 +36539,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -33758,24 +36549,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -33807,8 +36598,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -33861,13 +36652,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CV != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -33891,14 +36682,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_DUP(&generator->value, value);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -33916,25 +36707,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
ZVAL_DUP(&generator->key, key);
} else if (IS_CONST == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CONST == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -33984,19 +36775,46 @@ static int ZEND_FASTCALL ZEND_BIND_GLOBAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
zval *varname;
zval *value;
zval *variable_ptr;
- zend_string *name;
+ Bucket *p;
+ uint32_t idx;
SAVE_OPLINE();
varname = opline->op2.zv;
- name = Z_STR_P(varname);
- value = zend_hash_find(&EG(symbol_table).ht, name);
- if (value == NULL) {
- value = zend_hash_add_new(&EG(symbol_table).ht, name, &EG(uninitialized_zval));
+ idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname));
+ /* index 0 can't be cached (NULL is a mark of uninitialized cache slot) */
+ p = EG(symbol_table).ht.arData + idx;
+ if (EXPECTED(idx > 0) &&
+ EXPECTED(idx < EG(symbol_table).ht.nNumUsed) &&
+ EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+ (EXPECTED(p->key == Z_STR_P(varname)) ||
+ (EXPECTED(p->h == Z_STR_P(varname)->h) &&
+ EXPECTED(p->key != NULL) &&
+ EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
+ EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
+ value = &EG(symbol_table).ht.arData[idx].val;
/* GLOBAL variable may be an INDIRECT pointer to CV */
- } else if (Z_TYPE_P(value) == IS_INDIRECT) {
- value = Z_INDIRECT_P(value);
- if (Z_TYPE_P(value) == IS_UNDEF) {
- ZVAL_NULL(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
+ } else {
+ value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
+ if (UNEXPECTED(value == NULL)) {
+ value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
+ idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+ CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
+ } else {
+ idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+ CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
+ /* GLOBAL variable may be an INDIRECT pointer to CV */
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
}
}
@@ -34017,7 +36835,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34032,7 +36850,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34047,7 +36865,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34062,7 +36880,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34077,7 +36895,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34092,7 +36910,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34107,7 +36925,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34122,7 +36940,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34137,7 +36955,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34153,7 +36971,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34169,7 +36987,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34185,7 +37003,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34201,7 +37019,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34217,7 +37035,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCO
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34232,7 +37050,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34247,7 +37065,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34262,7 +37080,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34277,7 +37095,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34291,17 +37109,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
zval *value;
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
@@ -34313,7 +37133,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -34366,7 +37187,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
}
@@ -34385,9 +37206,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_TMP(int (*bina
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_CV == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -34396,11 +37217,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_TMP(int (*bina
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -34432,7 +37253,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_TMP(int (*bina
}
assign_op_dim_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
@@ -34452,7 +37273,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -34484,7 +37305,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
}
assign_op_exit:
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34647,15 +37468,17 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(retval);
}
@@ -34669,7 +37492,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -34709,7 +37533,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34739,15 +37563,17 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
CHECK_EXCEPTION();
@@ -34760,12 +37586,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -34797,7 +37622,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34822,10 +37647,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
+ zval_ptr_dtor_nogc(free_op2.var);
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -34839,7 +37662,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -34847,8 +37670,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
} else {
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
}
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -34865,12 +37688,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -34887,7 +37710,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34902,15 +37725,18 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
if (IS_TMP_VAR == IS_UNUSED) {
@@ -34918,7 +37744,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -34934,12 +37760,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -34947,7 +37773,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -34959,7 +37785,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -34974,17 +37800,12 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -34996,13 +37817,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -35021,12 +37842,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -35046,7 +37867,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -35060,7 +37881,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -35080,19 +37901,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCOD
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -35106,12 +37930,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -35130,11 +37954,11 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
@@ -35151,7 +37975,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -35161,43 +37985,38 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR TSRMLS_CC);
- zval_dtor(free_op2.var);
-
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
- } else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
+ } else {
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
/* assign_dim has two opcodes! */
@@ -35217,23 +38036,15 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_TMP_VAR, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (1) {
- zval_dtor(value);
+ if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_TMP_VAR == IS_TMP_VAR) {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_TMP_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_TMP_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -35270,19 +38081,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
+ HANDLE_EXCEPTION();
+ }
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_TMP_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -35292,7 +38139,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -35302,16 +38149,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -35328,7 +38175,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35343,7 +38190,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
if ((IS_CV == IS_VAR || IS_CV == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -35351,7 +38198,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
} else {
expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CV == IS_CONST) {
@@ -35359,9 +38206,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CV == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -35372,15 +38219,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -35413,7 +38260,7 @@ str_index:
/* do nothing */
break;
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
@@ -35424,7 +38271,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -35458,94 +38305,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_CV != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_TMP_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_TMP_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_dtor(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_TMP_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_dtor(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_dtor(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_TMP_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -35561,20 +38393,20 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_CV == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -35586,14 +38418,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OP
zend_free_op free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -35608,14 +38440,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -35646,8 +38478,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -35656,24 +38488,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -35687,7 +38519,7 @@ num_index_prop:
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
CHECK_EXCEPTION();
@@ -35706,8 +38538,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_O
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -35720,7 +38552,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_O
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_BOOL(EX_VAR(opline->result.var), result);
CHECK_EXCEPTION();
@@ -35761,13 +38593,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CV != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -35791,14 +38623,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->value, value);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -35816,25 +38648,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->key, key);
} else if (IS_TMP_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_TMP_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -35867,7 +38699,7 @@ static int ZEND_FASTCALL ZEND_POW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
_get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_dtor(free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -36161,15 +38993,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
zval *value;
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
@@ -36183,7 +39017,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -36255,9 +39090,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_VAR(int (*bina
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_CV == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -36266,11 +39101,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_VAR(int (*bina
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -36319,10 +39154,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -36517,13 +39352,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
@@ -36539,7 +39376,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -36609,13 +39447,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
@@ -36630,12 +39470,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -36699,7 +39538,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -36714,7 +39553,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -36737,8 +39576,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -36758,8 +39596,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -36781,7 +39618,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
}
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -36846,9 +39683,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -36862,7 +39697,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -36871,7 +39706,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
}
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -36888,12 +39723,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -36925,12 +39760,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
zval_ptr_dtor_nogc(free_op2.var);
@@ -36957,12 +39795,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -36970,7 +39808,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -36982,7 +39820,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -37003,11 +39841,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -37019,13 +39852,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -37044,12 +39877,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -37069,7 +39902,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -37103,19 +39936,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCOD
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -37129,12 +39965,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -37153,10 +39989,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
/* assign_obj has two opcodes! */
@@ -37174,7 +40010,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -37184,7 +40020,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
@@ -37192,35 +40028,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
-
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
- } else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
+ } else {
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
/* assign_dim has two opcodes! */
@@ -37237,26 +40068,18 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_VAR, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_VAR == IS_TMP_VAR) {
+ zval_ptr_dtor_nogc(free_op2.var);
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -37305,8 +40128,8 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
}
- if ((IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
- (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
+ if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) ||
+ (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == NULL))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
if ((IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) ||
@@ -37356,19 +40179,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+ zval_ptr_dtor_nogc(free_op2.var);
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_VAR != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -37378,7 +40237,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -37388,14 +40247,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
zval_ptr_dtor_nogc(free_op2.var);
@@ -37429,7 +40288,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
if ((IS_CV == IS_VAR || IS_CV == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -37437,7 +40296,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
} else {
expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CV == IS_CONST) {
@@ -37445,9 +40304,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CV == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -37458,15 +40317,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -37510,7 +40369,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -37544,28 +40403,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -37578,10 +40444,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -37600,10 +40464,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -37616,94 +40478,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_CV != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_VAR != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_VAR != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_VAR == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- zval_ptr_dtor_nogc(free_op2.var);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
- zval_ptr_dtor_nogc(free_op2.var);
- break;
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
+ }
+//??? if (IS_VAR == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -37719,13 +40566,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_CV == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -37742,26 +40589,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -37783,39 +40632,27 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -37824,14 +40661,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OP
zend_free_op free_op2;
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -37846,14 +40683,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -37884,8 +40721,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -37894,24 +40731,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -37944,8 +40781,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_O
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -37999,13 +40836,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CV != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -38029,14 +40866,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->value, value);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -38054,25 +40891,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZVAL_DUP(&generator->key, key);
} else if (IS_VAR == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
zval_ptr_dtor_nogc(free_op2.var);
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_VAR == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -38124,15 +40961,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
zval *value;
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -38146,7 +40985,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -38217,9 +41057,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_UNUSED(int (*b
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_CV == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -38228,11 +41068,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_UNUSED(int (*b
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -38284,7 +41124,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binar
value = NULL;
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -38481,7 +41321,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
- STR_ADDREF(name);
+ zend_string_addref(name);
} else {
name = zval_get_string(varname);
}
@@ -38496,7 +41336,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
CHECK_EXCEPTION();
@@ -38519,8 +41359,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -38540,8 +41379,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
/* break missing intentionally */
case BP_VAR_IS:
- retval = EX_VAR(opline->result.var);
- ZVAL_NULL(retval);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", name->val);
@@ -38563,7 +41401,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
}
if (IS_CV != IS_CONST) {
- STR_RELEASE(name);
+ zend_string_release(name);
}
ZEND_ASSERT(retval != NULL);
@@ -38627,7 +41465,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -38636,7 +41474,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HA
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -38653,12 +41491,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -38675,12 +41513,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OP
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -38707,7 +41548,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -38717,7 +41558,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
zval *property_name = NULL;
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -38725,34 +41566,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
zval *dim = NULL;
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
/* assign_dim has two opcodes! */
@@ -38771,7 +41608,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
if ((IS_CV == IS_VAR || IS_CV == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -38779,7 +41616,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
} else {
expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CV == IS_CONST) {
@@ -38787,9 +41624,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CV == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -38800,15 +41637,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
zval *offset = NULL;
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -38852,7 +41689,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -38886,28 +41723,35 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
zval tmp, *varname;
HashTable *target_symbol_table;
- zend_bool tmp_is_dup = 0;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
- ZVAL_UNDEF(EX_VAR(opline->op1.var));
- zval_ptr_dtor(&tmp);
+ zval *var = EX_VAR(opline->op1.var);
+
+ if (Z_REFCOUNTED_P(var)) {
+ zend_refcounted *garbage = Z_COUNTED_P(var);
+
+ if (!--GC_REFCOUNT(garbage)) {
+ ZVAL_UNDEF(var);
+ _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+ } else {
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(var);
+ ZVAL_UNDEF(var);
+ }
+ } else {
+ ZVAL_UNDEF(var);
+ }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_UNDEF(&tmp);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
- varname = &tmp;
- tmp_is_dup = 1;
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- ZVAL_COPY(&tmp, varname);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -38920,10 +41764,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
} else {
ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
HANDLE_EXCEPTION();
@@ -38942,10 +41784,8 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
}
- if (IS_CV != IS_CONST && tmp_is_dup) {
+ if (IS_CV != IS_CONST) {
zval_dtor(&tmp);
- } else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&tmp);
}
CHECK_EXCEPTION();
@@ -38956,26 +41796,28 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *value;
- zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
- value = EX_VAR(opline->op1.var);
- ZVAL_DEREF(value);
- } else {
- isset = 0;
+ value = EX_VAR(opline->op1.var);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !i_zend_is_true(value TSRMLS_CC));
+ CHECK_EXCEPTION();
}
+ ZEND_VM_NEXT_OPCODE();
} else {
- HashTable *target_symbol_table;
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_DUP(&tmp, varname);
- convert_to_string(&tmp);
+ ZVAL_STR(&tmp, zval_get_string(varname));
varname = &tmp;
}
@@ -38997,39 +41839,27 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
- if (!value) {
- isset = 0;
- }
} else {
- target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
- isset = 0;
- }
+ HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
+ value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- }
-
- if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_P(value) != IS_NULL &&
- (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
- }
- } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_BOOL(EX_VAR(opline->result.var), 1);
- } else {
- ZVAL_BOOL(EX_VAR(opline->result.var), 0);
+ if (opline->extended_value & ZEND_ISSET) {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ value && Z_TYPE_P(value) > IS_NULL &&
+ (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
+ } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
+ ZVAL_BOOL(EX_VAR(opline->result.var),
+ !value || !i_zend_is_true(value TSRMLS_CC));
}
- }
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+ }
}
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -39066,13 +41896,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CV != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -39096,14 +41926,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->value, value);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -39121,25 +41951,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
ZVAL_DUP(&generator->key, key);
} else if (IS_UNUSED == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_UNUSED == IS_VAR || IS_UNUSED == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_UNUSED == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -39451,15 +42281,17 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
zval *value;
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- object = make_real_object(object TSRMLS_CC);
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC);
+ }
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
FREE_OP(free_op_data1);
@@ -39473,7 +42305,8 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
binary_op(zptr, zptr, value TSRMLS_CC);
@@ -39544,9 +42377,9 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CV(int (*binar
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ } else if (IS_CV == IS_UNUSED || UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
@@ -39555,11 +42388,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CV(int (*binar
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -39608,10 +42441,10 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
@@ -39806,13 +42639,15 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
@@ -39828,7 +42663,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
+ ZVAL_DEREF(zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
have_get_ptr = 1;
incdec_op(zptr);
@@ -39897,13 +42733,15 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ if (IS_CV != IS_UNUSED) {
+ object = make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
+ }
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -39918,12 +42756,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
- SEPARATE_ZVAL_IF_NOT_REF(zptr);
-
- ZVAL_DUP(retval, zptr);
+ ZVAL_DEREF(zptr);
+ ZVAL_COPY(retval, zptr);
+ SEPARATE_ZVAL_NOREF(zptr);
incdec_op(zptr);
-
}
}
@@ -39980,9 +42817,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -39996,7 +42831,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (EXPECTED(opline->extended_value == 0)) {
@@ -40005,7 +42840,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
zend_fetch_dimension_address_W_ref(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40022,12 +42857,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40059,12 +42894,15 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40091,12 +42929,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40104,7 +42942,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND_OPCODE_HANDLER_ARGS)
+static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -40116,7 +42954,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -40136,11 +42974,6 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
ZEND_VM_NEXT_OPCODE();
}
-static int ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- return zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
-}
-
static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -40152,13 +42985,13 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, (opline->extended_value & ZEND_FETCH_MAKE_REF) != 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40177,12 +43010,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40202,7 +43035,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
+ if ((IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -40235,19 +43068,22 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR) {
+ zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
+ }
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
- return zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ return ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
}
@@ -40261,12 +43097,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET, 0 TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+ if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
}
@@ -40285,10 +43121,10 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
/* assign_obj has two opcodes! */
@@ -40306,7 +43142,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
if (UNEXPECTED(Z_ISREF_P(object_ptr)) && Z_TYPE_P(Z_REFVAL_P(object_ptr)) == IS_OBJECT) {
@@ -40316,7 +43152,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, IS_CV, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property_name)) : NULL) TSRMLS_CC);
} else {
zend_free_op free_op_data1, free_op_data2;
@@ -40324,34 +43160,30 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *variable_ptr;
- zend_fetch_dimension_address_W(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV TSRMLS_CC);
+ variable_ptr = zend_fetch_dimension_address_W_str(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, (opline+1)->op1_type, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (IS_TMP_FREE(free_op_data1)) {
- zval_dtor(value);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- FREE_OP_VAR_PTR(free_op_data2);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ if (UNEXPECTED(variable_ptr != NULL)) {
+ zend_assign_to_string_offset(variable_ptr, Z_LVAL_P(EX_VAR((opline+1)->op2.var)), value, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
+ FREE_OP(free_op_data1);
} else {
- if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ FREE_OP(free_op_data1);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
} else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ value = zend_assign_to_variable(variable_ptr, value, (opline+1)->op1_type TSRMLS_CC);
+ if ((opline+1)->op1_type == IS_VAR) {
+ FREE_OP(free_op_data1);
+ }
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_VAR_PTR(free_op_data2);
}
- FREE_OP_IF_VAR(free_op_data1);
}
/* assign_dim has two opcodes! */
@@ -40368,26 +43200,18 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
- zend_assign_to_string_offset(variable_ptr, value, IS_CV, (RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : NULL) TSRMLS_CC);
- } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
- if (0) {
- zval_dtor(value);
+ if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
+ if (IS_CV == IS_TMP_VAR) {
+
}
if (RETURN_VALUE_USED(opline)) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
- if (IS_CV == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
- } else if (IS_CV == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
- } else {
- value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
- }
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
@@ -40435,8 +43259,8 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
UNEXPECTED(!Z_ISREF_P(variable_ptr))) {
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
}
- if ((IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
- (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
+ if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) ||
+ (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == NULL))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
if ((IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) ||
@@ -40485,19 +43309,55 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
object = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
+ uint32_t nesting = 1;
+
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+ zend_error(E_RECOVERABLE_ERROR, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
+
+
+ if (EG(exception) != NULL) {
+ HANDLE_EXCEPTION();
+ }
+
+ /* No exception raised: Skip over arguments until fcall opcode with correct
+ * nesting level. Return NULL (except when return value unused) */
+ do {
+ opline++;
+ if (opline->opcode == ZEND_INIT_FCALL ||
+ opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
+ opline->opcode == ZEND_INIT_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
+ opline->opcode == ZEND_INIT_USER_CALL ||
+ opline->opcode == ZEND_NEW
+ ) {
+ nesting++;
+ } else if (opline->opcode == ZEND_DO_FCALL) {
+ nesting--;
+ }
+ } while (nesting);
+
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* We've skipped EXT_FCALL_BEGIND, so also skip the ending opcode */
+ if ((opline + 1)->opcode == ZEND_EXT_FCALL_END) {
+ opline++;
+ }
+ ZEND_VM_JMP(++opline);
}
obj = Z_OBJ_P(object);
- called_scope = zend_get_class_entry(obj TSRMLS_CC);
+ called_scope = obj->ce;
if (IS_CV != IS_CONST ||
- (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL) {
+ EXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
zend_object *orig_obj = obj;
if (UNEXPECTED(obj->handlers->get_method == NULL)) {
@@ -40507,7 +43367,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
/* First, locate the function. */
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(function_name));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
@@ -40517,14 +43377,14 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
}
}
- if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
obj = NULL;
} else {
GC_REFCOUNT(obj)++; /* For $this pointer */
}
- EX(call) = zend_vm_stack_push_call_frame(
- fbc, opline->extended_value, 0, called_scope, obj, EX(call) TSRMLS_CC);
+ EX(call) = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_FUNCTION,
+ fbc, opline->extended_value, called_scope, obj, EX(call) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -40556,7 +43416,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
if ((IS_CV == IS_VAR || IS_CV == IS_CV) &&
(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
ZVAL_MAKE_REF(expr_ptr);
@@ -40564,7 +43424,7 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
} else {
expr_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (0) { /* temporary variable */
+ if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&new_expr, expr_ptr);
expr_ptr = &new_expr;
} else if (IS_CV == IS_CONST) {
@@ -40572,9 +43432,9 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
ZVAL_DUP(&new_expr, expr_ptr);
expr_ptr = &new_expr;
}
- } else if (Z_ISREF_P(expr_ptr)) {
- ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
- expr_ptr = &new_expr;
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(expr_ptr)) {
+ expr_ptr = Z_REFVAL_P(expr_ptr);
+ if (Z_REFCOUNTED_P(expr_ptr)) Z_ADDREF_P(expr_ptr);
} else if (IS_CV == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
@@ -40585,15 +43445,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_string *str;
- zend_uint_t hval;
+ zend_ulong hval;
add_again:
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index:
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
@@ -40637,7 +43497,7 @@ str_index:
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zval *array;
- zend_uint size;
+ uint32_t size;
USE_OPLINE
array = EX_VAR(opline->result.var);
@@ -40671,94 +43531,79 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
zval *container;
zval *offset;
- zend_uint_t hval;
+ zend_ulong hval;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ }
if (IS_CV != IS_UNUSED) {
ZVAL_DEREF(container);
SEPARATE_ZVAL_NOREF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- switch (Z_TYPE_P(container)) {
- case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_P(container);
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
+ HashTable *ht = Z_ARRVAL_P(container);
offset_again:
- switch (Z_TYPE_P(offset)) {
- case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
- zend_hash_index_del(ht, hval);
- break;
- case IS_INT:
- hval = Z_IVAL_P(offset);
+ switch (Z_TYPE_P(offset)) {
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_LONG:
+ hval = Z_LVAL_P(offset);
num_index_dim:
- zend_hash_index_del(ht, hval);
- break;
- case IS_STRING:
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- if (Z_REFCOUNTED_P(offset)) Z_ADDREF_P(offset);
- }
- if (IS_CV != IS_CONST) {
- if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
- goto numeric_index_dim;
- }
- }
- if (ht == &EG(symbol_table).ht) {
- zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
- } else {
- zend_hash_del(ht, Z_STR_P(offset));
- }
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
- }
- break;
-numeric_index_dim:
- zend_hash_index_del(ht, hval);
- if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(offset);
+ zend_hash_index_del(ht, hval);
+ break;
+ case IS_STRING:
+ if (IS_CV != IS_CONST) {
+ if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), hval)) {
+ goto num_index_dim;
}
- break;
- case IS_NULL:
- zend_hash_del(ht, STR_EMPTY_ALLOC());
- break;
- case IS_FALSE:
- hval = 0;
- goto num_index_dim;
- case IS_TRUE:
- hval = 1;
- goto num_index_dim;
- case IS_RESOURCE:
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_dim;
- case IS_REFERENCE:
- offset = Z_REFVAL_P(offset);
- goto offset_again;
- break;
- default:
- zend_error(E_WARNING, "Illegal offset type in unset");
- break;
- }
+ }
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
+ } else {
+ zend_hash_del(ht, Z_STR_P(offset));
+ }
+ break;
+ case IS_NULL:
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
+ break;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index_dim;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index_dim;
+ case IS_RESOURCE:
+ hval = Z_RES_HANDLE_P(offset);
+ goto num_index_dim;
+ case IS_REFERENCE:
+ offset = Z_REFVAL_P(offset);
+ goto offset_again;
+ break;
+ default:
+ zend_error(E_WARNING, "Illegal offset type in unset");
+ break;
+ }
- break;
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
+ zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
- case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
- zend_error_noreturn(E_ERROR, "Cannot use object as array");
- }
-//??? if (IS_CV == IS_CONST) {
-//??? zval_copy_ctor(offset);
-//??? }
- Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
+//??? if (IS_CV == IS_CONST) {
+//??? zval_copy_ctor(offset);
+//??? }
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
- break;
- case IS_STRING:
- case IS_STR_OFFSET:
- zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
- ZEND_VM_CONTINUE(); /* bailed out before */
- default:
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
+ ZEND_VM_CONTINUE(); /* bailed out before */
+ } else {
- break;
}
CHECK_EXCEPTION();
@@ -40774,13 +43619,13 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && Z_TYPE_P(container) == IS_STR_OFFSET) {
+ if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
ZVAL_DEREF(container);
- if (Z_TYPE_P(container) == IS_OBJECT) {
+ if (IS_CV == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->unset_property) {
Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
@@ -40799,14 +43644,14 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPC
zval *container;
int result;
- zend_uint_t hval;
+ zend_ulong hval;
zval *offset;
SAVE_OPLINE();
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_ARRAY) {
+ if (IS_CV != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value;
zend_string *str;
@@ -40821,14 +43666,14 @@ isset_again:
}
str_index_prop:
value = zend_hash_find_ind(ht, str);
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) {
- hval = Z_IVAL_P(offset);
+ } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ hval = Z_LVAL_P(offset);
num_index_prop:
value = zend_hash_index_find(ht, hval);
} else {
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
- hval = zend_dval_to_ival(Z_DVAL_P(offset));
+ hval = zend_dval_to_lval(Z_DVAL_P(offset));
goto num_index_prop;
case IS_NULL:
str = STR_EMPTY_ALLOC();
@@ -40859,8 +43704,8 @@ num_index_prop:
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
- } else if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_dimension) {
+ } else if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
@@ -40869,24 +43714,24 @@ num_index_prop:
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
- } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zval tmp;
result = 0;
- if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) {
+ if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
ZVAL_DEREF(offset);
}
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
- && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) {
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
ZVAL_DUP(&tmp, offset);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
offset = &tmp;
}
}
- if (Z_TYPE_P(offset) == IS_INT) {
- if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) {
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1;
@@ -40918,8 +43763,8 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OP
container = _get_zval_ptr_cv_deref_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (Z_TYPE_P(container) == IS_OBJECT) {
- if (Z_OBJ_HT_P(container)->has_property) {
+ if (IS_CV == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
@@ -40972,13 +43817,13 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
/* Temporary variables don't need ctor copying */
- if (!0) {
- zval_copy_ctor(&generator->value);
+ if (IS_CV != IS_TMP_VAR) {
+ zval_opt_copy_ctor(&generator->value);
}
} else {
zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
}
@@ -41002,14 +43847,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_DUP(&generator->value, value);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->value, value);
- } else if (Z_ISREF_P(value)) {
+ } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) && Z_ISREF_P(value)) {
ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
} else {
+ ZVAL_COPY_VALUE(&generator->value, value);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
+ if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- ZVAL_COPY_VALUE(&generator->value, value);
}
}
} else {
@@ -41027,25 +43872,25 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
ZVAL_DUP(&generator->key, key);
} else if (IS_CV == IS_TMP_VAR) {
ZVAL_COPY_VALUE(&generator->key, key);
- } else if (Z_ISREF_P(key)) {
+ } else if ((IS_CV == IS_VAR || IS_CV == IS_CV) && Z_ISREF_P(key)) {
ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
} else {
+ ZVAL_COPY_VALUE(&generator->key, key);
if (IS_CV == IS_CV) {
- if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
+ if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
}
- ZVAL_COPY_VALUE(&generator->key, key);
}
- if (Z_TYPE(generator->key) == IS_INT
- && Z_IVAL(generator->key) > generator->largest_used_integer_key
+ if (Z_TYPE(generator->key) == IS_LONG
+ && Z_LVAL(generator->key) > generator->largest_used_integer_key
) {
- generator->largest_used_integer_key = Z_IVAL(generator->key);
+ generator->largest_used_integer_key = Z_LVAL(generator->key);
}
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
- ZVAL_INT(&generator->key, generator->largest_used_integer_key);
+ ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
if (RETURN_VALUE_USED(opline)) {
@@ -42333,11 +45178,11 @@ void zend_init_opcodes_handlers(void)
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_SWITCH_FREE_SPEC_VAR_HANDLER,
- ZEND_SWITCH_FREE_SPEC_VAR_HANDLER,
- ZEND_SWITCH_FREE_SPEC_VAR_HANDLER,
- ZEND_SWITCH_FREE_SPEC_VAR_HANDLER,
- ZEND_SWITCH_FREE_SPEC_VAR_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -42423,31 +45268,31 @@ void zend_init_opcodes_handlers(void)
ZEND_BOOL_SPEC_CV_HANDLER,
ZEND_BOOL_SPEC_CV_HANDLER,
ZEND_BOOL_SPEC_CV_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
- ZEND_INIT_STRING_SPEC_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -43148,16 +45993,16 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_CONST_TMP_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_TMP_TMP_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLER,
ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_OBJ_R_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_OBJ_R_SPEC_VAR_VAR_HANDLER,
@@ -43348,16 +46193,16 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_IS_SPEC_CV_VAR_HANDLER,
ZEND_FETCH_IS_SPEC_CV_UNUSED_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_CONST_TMP_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_CONST_CV_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_TMP_CONST_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_TMP_TMP_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_DIM_IS_SPEC_TMP_CV_HANDLER,
ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER,
@@ -43373,16 +46218,16 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_CONST_TMP_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_TMP_CONST_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_TMP_TMP_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_IS_SPEC_TMP_CV_HANDLER,
ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER,
@@ -43423,16 +46268,16 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_FUNC_ARG_SPEC_CV_VAR_HANDLER,
ZEND_FETCH_FUNC_ARG_SPEC_CV_UNUSED_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CONST_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_TMP_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_VAR_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_UNUSED_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CV_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CONST_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TMP_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_VAR_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER,
+ ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CV_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER,
@@ -43448,16 +46293,16 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER,
ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CONST_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_TMP_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CV_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CONST_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TMP_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV_HANDLER,
ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER,
ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER,
ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER,
@@ -43548,18 +46393,17 @@ void zend_init_opcodes_handlers(void)
ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER,
- ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_FETCH_LIST_SPEC_CONST_CONST_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER,
- ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_LIST_SPEC_TMP_CONST_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_LIST_SPEC_VAR_CONST_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -43569,6 +46413,7 @@ void zend_init_opcodes_handlers(void)
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_FETCH_LIST_SPEC_CV_CONST_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -43973,16 +46818,16 @@ void zend_init_opcodes_handlers(void)
ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER,
ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_TMP_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CV_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_CONST_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_TMP_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMP_CV_HANDLER,
ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER,
ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER,
ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER,
@@ -44648,31 +47493,31 @@ void zend_init_opcodes_handlers(void)
ZEND_DECLARE_FUNCTION_SPEC_HANDLER,
ZEND_DECLARE_FUNCTION_SPEC_HANDLER,
ZEND_DECLARE_FUNCTION_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
- ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -44798,16 +47643,16 @@ void zend_init_opcodes_handlers(void)
ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER,
ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER,
ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_TMP_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_VAR_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CV_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_CONST_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_TMP_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_VAR_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
- ZEND_NULL_HANDLER,
+ ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMP_CV_HANDLER,
ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER,
ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER,
ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER,
@@ -45023,56 +47868,56 @@ void zend_init_opcodes_handlers(void)
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER,
- ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CV_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CV_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CV_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CV_HANDLER,
- ZEND_JMP_SET_VAR_SPEC_CV_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
ZEND_DISCARD_EXCEPTION_SPEC_HANDLER,
ZEND_DISCARD_EXCEPTION_SPEC_HANDLER,
ZEND_DISCARD_EXCEPTION_SPEC_HANDLER,
@@ -45323,11 +48168,36 @@ void zend_init_opcodes_handlers(void)
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
+ ZEND_COALESCE_SPEC_CONST_HANDLER,
+ ZEND_COALESCE_SPEC_CONST_HANDLER,
+ ZEND_COALESCE_SPEC_CONST_HANDLER,
+ ZEND_COALESCE_SPEC_CONST_HANDLER,
+ ZEND_COALESCE_SPEC_CONST_HANDLER,
+ ZEND_COALESCE_SPEC_TMP_HANDLER,
+ ZEND_COALESCE_SPEC_TMP_HANDLER,
+ ZEND_COALESCE_SPEC_TMP_HANDLER,
+ ZEND_COALESCE_SPEC_TMP_HANDLER,
+ ZEND_COALESCE_SPEC_TMP_HANDLER,
+ ZEND_COALESCE_SPEC_VAR_HANDLER,
+ ZEND_COALESCE_SPEC_VAR_HANDLER,
+ ZEND_COALESCE_SPEC_VAR_HANDLER,
+ ZEND_COALESCE_SPEC_VAR_HANDLER,
+ ZEND_COALESCE_SPEC_VAR_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_COALESCE_SPEC_CV_HANDLER,
+ ZEND_COALESCE_SPEC_CV_HANDLER,
+ ZEND_COALESCE_SPEC_CV_HANDLER,
+ ZEND_COALESCE_SPEC_CV_HANDLER,
+ ZEND_COALESCE_SPEC_CV_HANDLER,
ZEND_NULL_HANDLER
};
zend_opcode_handlers = (opcode_handler_t*)labels;
}
-static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op)
+static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)
{
static const int zend_vm_decode[] = {
_UNUSED_CODE, /* 0 */
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 4825e02b53..03ed7ca65e 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -8,7 +8,6 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC)
{%INTERNAL_LABELS%}
- LOAD_REGS();
LOAD_OPLINE();
while (1) {
@@ -35,15 +34,15 @@ ZEND_API void zend_{%EXECUTOR_NAME%}(zend_op_array *op_array, zval *return_value
return;
}
- execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ execute_data = zend_vm_stack_push_call_frame(VM_FRAME_TOP_CODE,
+ (zend_function*)op_array, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, EG(current_execute_data) ? Z_OBJ(EG(current_execute_data)->This) : NULL, NULL TSRMLS_CC);
if (EG(current_execute_data)) {
execute_data->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
} else {
execute_data->symbol_table = &EG(symbol_table);
}
EX(prev_execute_data) = EG(current_execute_data);
- i_init_execute_data(execute_data, op_array, return_value, VM_FRAME_TOP_CODE TSRMLS_CC);
+ i_init_execute_data(execute_data, op_array, return_value TSRMLS_CC);
zend_{%EXECUTOR_NAME%}_ex(execute_data TSRMLS_CC);
}
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 50506f566b..69c25085aa 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -212,7 +212,7 @@ $op1_get_obj_zval_ptr_deref = array(
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
"CONST" => "opline->op1.zv",
- "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
);
@@ -221,7 +221,7 @@ $op2_get_obj_zval_ptr_deref = array(
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
"CONST" => "opline->op2.zv",
- "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
@@ -230,7 +230,7 @@ $op1_get_obj_zval_ptr_ptr = array(
"TMP" => "NULL",
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
"CONST" => "NULL",
- "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
);
@@ -239,31 +239,13 @@ $op2_get_obj_zval_ptr_ptr = array(
"TMP" => "NULL",
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
"CONST" => "NULL",
- "UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
+ "UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
-$op1_is_tmp_free = array(
- "ANY" => "IS_TMP_FREE(free_op1)",
- "TMP" => "1",
- "VAR" => "0",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
-);
-
-$op2_is_tmp_free = array(
- "ANY" => "IS_TMP_FREE(free_op2)",
- "TMP" => "1",
- "VAR" => "0",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
-);
-
$op1_free_op = array(
"ANY" => "FREE_OP(free_op1)",
- "TMP" => "zval_dtor(free_op1.var)",
+ "TMP" => "zval_ptr_dtor_nogc(free_op1.var)",
"VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
"CONST" => "",
"UNUSED" => "",
@@ -272,7 +254,7 @@ $op1_free_op = array(
$op2_free_op = array(
"ANY" => "FREE_OP(free_op2)",
- "TMP" => "zval_dtor(free_op2.var)",
+ "TMP" => "zval_ptr_dtor_nogc(free_op2.var)",
"VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
"CONST" => "",
"UNUSED" => "",
@@ -280,7 +262,7 @@ $op2_free_op = array(
);
$op1_free_op_if_var = array(
- "ANY" => "FREE_OP_IF_VAR(free_op1)",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1.var);}",
"TMP" => "",
"VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
"CONST" => "",
@@ -289,7 +271,7 @@ $op1_free_op_if_var = array(
);
$op2_free_op_if_var = array(
- "ANY" => "FREE_OP_IF_VAR(free_op2)",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1.var);}",
"TMP" => "",
"VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
"CONST" => "",
@@ -305,8 +287,6 @@ $op1_free_op_var_ptr = array(
"UNUSED" => "",
"CV" => "",
);
-$op1_free_op_var_ptr_fast = $op1_free_op_var_ptr;
-$op1_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(free_op1.var)";
$op2_free_op_var_ptr = array(
"ANY" => "if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);}",
@@ -316,8 +296,6 @@ $op2_free_op_var_ptr = array(
"UNUSED" => "",
"CV" => "",
);
-$op2_free_op_var_ptr_fast = $op2_free_op_var_ptr;
-$op2_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(free_op2.var)";
$list = array(); // list of opcode handlers and helpers in original order
$opcodes = array(); // opcode handlers by code
@@ -370,10 +348,9 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr,
$op1_get_obj_zval_ptr_deref, $op2_get_obj_zval_ptr_deref,
$op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr,
- $op1_is_tmp_free, $op2_is_tmp_free, $op1_free, $op2_free,
+ $op1_free, $op2_free,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
- $op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix,
- $op1_free_op_var_ptr_fast, $op2_free_op_var_ptr_fast;
+ $op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix;
// Specializing
$code = preg_replace(
@@ -396,16 +373,12 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
"/GET_OP2_OBJ_ZVAL_PTR_DEREF\(([^)]*)\)/",
"/GET_OP1_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
"/GET_OP2_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
- "/IS_OP1_TMP_FREE\(\)/",
- "/IS_OP2_TMP_FREE\(\)/",
"/FREE_OP1\(\)/",
"/FREE_OP2\(\)/",
"/FREE_OP1_IF_VAR\(\)/",
"/FREE_OP2_IF_VAR\(\)/",
"/FREE_OP1_VAR_PTR\(\)/",
"/FREE_OP2_VAR_PTR\(\)/",
- "/FREE_OP1_VAR_PTR_FAST\(\)/",
- "/FREE_OP2_VAR_PTR_FAST\(\)/",
"/^#ifdef\s+ZEND_VM_SPEC\s*\n/m",
"/^#ifndef\s+ZEND_VM_SPEC\s*\n/m",
"/\!defined\(ZEND_VM_SPEC\)/m",
@@ -436,16 +409,12 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op2_get_obj_zval_ptr_deref[$op2],
$op1_get_obj_zval_ptr_ptr[$op1],
$op2_get_obj_zval_ptr_ptr[$op2],
- $op1_is_tmp_free[$op1],
- $op2_is_tmp_free[$op2],
$op1_free_op[$op1],
$op2_free_op[$op2],
$op1_free_op_if_var[$op1],
$op2_free_op_if_var[$op2],
$op1_free_op_var_ptr[$op1],
$op2_free_op_var_ptr[$op2],
- $op1_free_op_var_ptr_fast[$op1],
- $op2_free_op_var_ptr_fast[$op2],
($op1!="ANY"||$op2!="ANY")?"#if 1\n":"#if 0\n",
($op1!="ANY"||$op2!="ANY")?"#if 0\n":"#if 1\n",
($op1!="ANY"||$op2!="ANY")?"0":"1",
@@ -893,7 +862,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
if (ZEND_VM_OLD_EXECUTOR && $spec) {
out($f,"static int zend_vm_old_executor = 0;\n\n");
}
- out($f,"static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);\n\n");
+ out($f,"static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);\n\n");
switch ($kind) {
case ZEND_VM_KIND_CALL:
out($f,"\n");
@@ -904,7 +873,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#undef SAVE_OPLINE\n");
out($f,"#define OPLINE EX(opline)\n");
out($f,"#define DCL_OPLINE\n");
- out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
+ out($f,"#define USE_OPLINE const zend_op *opline = EX(opline);\n");
out($f,"#define LOAD_OPLINE()\n");
out($f,"#define SAVE_OPLINE()\n");
out($f,"#undef CHECK_EXCEPTION\n");
@@ -913,7 +882,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
- out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() return 0\n");
out($f,"#define ZEND_VM_RETURN() return -1\n");
out($f,"#define ZEND_VM_ENTER() return 1\n");
@@ -939,7 +907,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
- out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
out($f,"#define ZEND_VM_RETURN() return\n");
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
@@ -971,7 +938,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
}
- out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
out($f,"#define ZEND_VM_RETURN() return\n");
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
@@ -1342,7 +1308,7 @@ function gen_vm($def, $skel) {
}
// Generate zend_vm_get_opcode_handler() function
- out($f, "static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op)\n");
+ out($f, "static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n");
out($f, "{\n");
if (!ZEND_VM_SPEC) {
out($f, "\treturn zend_opcode_handlers[opcode];\n");
@@ -1395,7 +1361,7 @@ function gen_vm($def, $skel) {
out($f,"#undef SAVE_OPLINE\n");
out($f,"#define OPLINE EX(opline)\n");
out($f,"#define DCL_OPLINE\n");
- out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
+ out($f,"#define USE_OPLINE const zend_op *opline = EX(opline);\n");
out($f,"#define LOAD_OPLINE()\n");
out($f,"#define SAVE_OPLINE()\n");
out($f,"#undef CHECK_EXCEPTION\n");
diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c
index 729f922963..067fd362e6 100644
--- a/Zend/zend_vm_opcodes.c
+++ b/Zend/zend_vm_opcodes.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <zend.h>
-const char *zend_vm_opcodes_map[169] = {
+const char *zend_vm_opcodes_map[170] = {
"ZEND_NOP",
"ZEND_ADD",
"ZEND_SUB",
@@ -71,11 +71,11 @@ const char *zend_vm_opcodes_map[169] = {
"ZEND_JMPZ_EX",
"ZEND_JMPNZ_EX",
"ZEND_CASE",
- "ZEND_SWITCH_FREE",
+ NULL,
"ZEND_BRK",
"ZEND_CONT",
"ZEND_BOOL",
- "ZEND_INIT_STRING",
+ NULL,
"ZEND_ADD_CHAR",
"ZEND_ADD_STRING",
"ZEND_ADD_VAR",
@@ -120,7 +120,7 @@ const char *zend_vm_opcodes_map[169] = {
"ZEND_FETCH_UNSET",
"ZEND_FETCH_DIM_UNSET",
"ZEND_FETCH_OBJ_UNSET",
- "ZEND_FETCH_DIM_TMP_VAR",
+ "ZEND_FETCH_LIST",
"ZEND_FETCH_CONSTANT",
"ZEND_GOTO",
"ZEND_EXT_STMT",
@@ -164,7 +164,7 @@ const char *zend_vm_opcodes_map[169] = {
"ZEND_DECLARE_CLASS",
"ZEND_DECLARE_INHERITED_CLASS",
"ZEND_DECLARE_FUNCTION",
- "ZEND_RAISE_ABSTRACT_ERROR",
+ NULL,
"ZEND_DECLARE_CONST",
"ZEND_ADD_INTERFACE",
"ZEND_DECLARE_INHERITED_CLASS_DELAYED",
@@ -179,8 +179,8 @@ const char *zend_vm_opcodes_map[169] = {
"ZEND_ADD_TRAIT",
"ZEND_BIND_TRAITS",
"ZEND_SEPARATE",
- "ZEND_QM_ASSIGN_VAR",
- "ZEND_JMP_SET_VAR",
+ NULL,
+ NULL,
"ZEND_DISCARD_EXCEPTION",
"ZEND_YIELD",
"ZEND_GENERATOR_RETURN",
@@ -191,6 +191,7 @@ const char *zend_vm_opcodes_map[169] = {
"ZEND_POW",
"ZEND_ASSIGN_POW",
"ZEND_BIND_GLOBAL",
+ "ZEND_COALESCE",
};
ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h
index 9274d3e044..c06fd84ff4 100644
--- a/Zend/zend_vm_opcodes.h
+++ b/Zend/zend_vm_opcodes.h
@@ -72,11 +72,9 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_JMPZ_EX 46
#define ZEND_JMPNZ_EX 47
#define ZEND_CASE 48
-#define ZEND_SWITCH_FREE 49
#define ZEND_BRK 50
#define ZEND_CONT 51
#define ZEND_BOOL 52
-#define ZEND_INIT_STRING 53
#define ZEND_ADD_CHAR 54
#define ZEND_ADD_STRING 55
#define ZEND_ADD_VAR 56
@@ -121,7 +119,7 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_FETCH_UNSET 95
#define ZEND_FETCH_DIM_UNSET 96
#define ZEND_FETCH_OBJ_UNSET 97
-#define ZEND_FETCH_DIM_TMP_VAR 98
+#define ZEND_FETCH_LIST 98
#define ZEND_FETCH_CONSTANT 99
#define ZEND_GOTO 100
#define ZEND_EXT_STMT 101
@@ -156,7 +154,6 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_DECLARE_CLASS 139
#define ZEND_DECLARE_INHERITED_CLASS 140
#define ZEND_DECLARE_FUNCTION 141
-#define ZEND_RAISE_ABSTRACT_ERROR 142
#define ZEND_DECLARE_CONST 143
#define ZEND_ADD_INTERFACE 144
#define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145
@@ -170,8 +167,6 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_ADD_TRAIT 154
#define ZEND_BIND_TRAITS 155
#define ZEND_SEPARATE 156
-#define ZEND_QM_ASSIGN_VAR 157
-#define ZEND_JMP_SET_VAR 158
#define ZEND_DISCARD_EXCEPTION 159
#define ZEND_YIELD 160
#define ZEND_GENERATOR_RETURN 161
@@ -182,5 +177,6 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_POW 166
#define ZEND_ASSIGN_POW 167
#define ZEND_BIND_GLOBAL 168
+#define ZEND_COALESCE 169
#endif
diff --git a/acinclude.m4 b/acinclude.m4
index 81dc0db34a..678296aac7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -844,7 +844,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
;;
*netware*[)]
suffix=nlm
- link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
+ link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php7lib, , -L$(top_builddir)/netware -lphp7lib) $(translit(ifelse($1, php7lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*[)]
suffix=la
diff --git a/build/build.mk b/build/build.mk
index 2c189159a2..007f081f19 100644
--- a/build/build.mk
+++ b/build/build.mk
@@ -1,5 +1,5 @@
# +----------------------------------------------------------------------+
-# | PHP Version 5 |
+# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2014 The PHP Group |
# +----------------------------------------------------------------------+
@@ -39,7 +39,7 @@ $(STAMP): build/buildcheck.sh
snapshot:
distname='$(DISTNAME)'; \
if test -z "$$distname"; then \
- distname='php5-snapshot'; \
+ distname='php7-snapshot'; \
fi; \
myname=`basename \`pwd\`` ; \
cd .. && cp -rp $$myname $$distname; \
diff --git a/build/build2.mk b/build/build2.mk
index be103fc322..2d9e684ec0 100644
--- a/build/build2.mk
+++ b/build/build2.mk
@@ -1,5 +1,5 @@
# +----------------------------------------------------------------------+
-# | PHP Version 5 |
+# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2007 The PHP Group |
# +----------------------------------------------------------------------+
diff --git a/build/buildcheck.sh b/build/buildcheck.sh
index 8ff3531825..f8f827d671 100755
--- a/build/buildcheck.sh
+++ b/build/buildcheck.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# +----------------------------------------------------------------------+
-# | PHP Version 5 |
+# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2007 The PHP Group |
# +----------------------------------------------------------------------+
diff --git a/build/libtool.m4 b/build/libtool.m4
index 4d948b9078..37dc159882 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -615,7 +615,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -629,7 +629,10 @@ s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -648,7 +651,10 @@ s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*)
diff --git a/build/mkdep.awk b/build/mkdep.awk
index 06547c79c1..c1adefe612 100644
--- a/build/mkdep.awk
+++ b/build/mkdep.awk
@@ -1,5 +1,5 @@
# +----------------------------------------------------------------------+
-# | PHP Version 5 |
+# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) 2000-2006 The PHP Group |
# +----------------------------------------------------------------------+
diff --git a/config.guess b/config.guess
index 1578aa1736..63b63d81d6 100644
--- a/config.guess
+++ b/config.guess
@@ -982,6 +982,12 @@ EOF
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-gnu
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-gnu
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
diff --git a/configure.in b/configure.in
index d07b7192cb..f947d2f9de 100644
--- a/configure.in
+++ b/configure.in
@@ -95,10 +95,10 @@ int zend_sprintf(char *buffer, const char *format, ...);
#define zend_isinf(a) 0
#endif
-#ifdef HAVE_FINITE
-#define zend_finite(a) finite(a)
-#elif defined(HAVE_ISFINITE) || defined(isfinite)
+#if defined(HAVE_ISFINITE) || defined(isfinite)
#define zend_finite(a) isfinite(a)
+#elif defined(HAVE_FINITE)
+#define zend_finite(a) finite(a)
#elif defined(fpclassify)
#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
#else
@@ -335,10 +335,10 @@ case $host_alias in
PHP_BUILD_PROGRAM
PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS)
PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS)
- PHP5LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
+ PHP7LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
EXTENSION_DIR=sys:/php$PHP_MAJOR_VERSION/ext
- PHP_SUBST(PHP5LIB_SHARED_LIBADD)
- PHP_SHARED_MODULE(php5lib, PHP_GLOBAL_OBJS, netware)
+ PHP_SUBST(PHP7LIB_SHARED_LIBADD)
+ PHP_SHARED_MODULE(php7lib, PHP_GLOBAL_OBJS, netware)
;;
esac
@@ -787,7 +787,12 @@ if test "$PHP_GCOV" = "yes"; then
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
- ltp_version_list="1.5 1.6 1.7 1.9 1.10"
+ dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
+ ltp_version_min="105"
+ dnl non-working versions, e.g. "1.8 1.18";
+ dnl remove "none" when introducing the first incompatible LTP version an
+ dnl separate any following additions by spaces
+ ltp_version_exclude="1.8"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
@@ -797,21 +802,30 @@ if test "$PHP_GCOV" = "yes"; then
if test "$LTP"; then
AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
php_cv_ltp_version=invalid
- ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
- for ltp_check_version in $ltp_version_list; do
- if test "$ltp_version" = "$ltp_check_version"; then
- php_cv_ltp_version="$ltp_check_version (ok)"
+ ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
+ if test -n "$ltp_version_vars"; then
+ set $ltp_version_vars
+ ltp_version="${1}.${2}"
+ ltp_version_num="`expr ${1} \* 100 + ${2}`"
+ if test $ltp_version_num -ge $ltp_version_min; then
+ php_cv_ltp_version="$ltp_version (ok)"
+ for ltp_check_version in $ltp_version_exclude; do
+ if test "$ltp_version" = "$ltp_check_version"; then
+ php_cv_ltp_version=invalid
+ break
+ fi
+ done
fi
- done
+ fi
])
else
- ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
+ ltp_msg="To enable code coverage reporting you must have LTP installed"
AC_MSG_ERROR([$ltp_msg])
fi
case $php_cv_ltp_version in
""|invalid[)]
- ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
+ ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
AC_MSG_ERROR([$ltp_msg])
LTP="exit 0;"
;;
@@ -1468,7 +1482,7 @@ esac
PHP_ADD_SOURCES(Zend, \
zend_language_parser.c zend_language_scanner.c \
zend_ini_parser.c zend_ini_scanner.c \
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \
+ zend_alloc.c zend_compile.c zend_constants.c zend_dtrace.c \
zend_execute_API.c zend_highlight.c zend_llist.c \
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
@@ -1476,11 +1490,8 @@ PHP_ADD_SOURCES(Zend, \
zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
- zend_virtual_cwd.c zend_ast.c)
-
-if test -r "$abs_srcdir/Zend/zend_objects.c"; then
- PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c)
-fi
+ zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
+ zend_default_classes.c zend_inheritance.c)
dnl Selectively disable optimization due to high RAM usage during
dnl compiling the executor.
@@ -1509,7 +1520,7 @@ $php_shtool mkdir -p pear/scripts
$php_shtool mkdir -p scripts
$php_shtool mkdir -p scripts/man1
-ALL_OUTPUT_FILES="php5.spec main/build-defs.h \
+ALL_OUTPUT_FILES="php7.spec main/build-defs.h \
scripts/phpize scripts/man1/phpize.1 \
scripts/php-config scripts/man1/php-config.1 \
$PHP_OUTPUT_FILES"
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index b45a738a04..7ef30cad5e 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -206,12 +206,12 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
PHP_FUNCTION(bcadd)
{
char *left, *right;
- php_int_t scale_param = 0;
+ zend_long scale_param = 0;
bc_num first, second, result;
- int left_len, right_len;
+ size_t left_len, right_len;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -243,12 +243,12 @@ PHP_FUNCTION(bcadd)
PHP_FUNCTION(bcsub)
{
char *left, *right;
- int left_len, right_len;
- php_int_t scale_param = 0;
+ size_t left_len, right_len;
+ zend_long scale_param = 0;
bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -280,12 +280,12 @@ PHP_FUNCTION(bcsub)
PHP_FUNCTION(bcmul)
{
char *left, *right;
- int left_len, right_len;
- php_int_t scale_param = 0;
+ size_t left_len, right_len;
+ zend_long scale_param = 0;
bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -317,12 +317,12 @@ PHP_FUNCTION(bcmul)
PHP_FUNCTION(bcdiv)
{
char *left, *right;
- int left_len, right_len;
- php_int_t scale_param = 0;
+ size_t left_len, right_len;
+ zend_long scale_param = 0;
bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -360,7 +360,7 @@ PHP_FUNCTION(bcdiv)
PHP_FUNCTION(bcmod)
{
char *left, *right;
- int left_len, right_len;
+ size_t left_len, right_len;
bc_num first, second, result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
@@ -394,12 +394,12 @@ PHP_FUNCTION(bcmod)
PHP_FUNCTION(bcpowmod)
{
char *left, *right, *modulous;
- int left_len, right_len, modulous_len;
+ size_t left_len, right_len, modulous_len;
bc_num first, second, mod, result;
- php_int_t scale = BCG(bc_precision);
+ zend_long scale = BCG(bc_precision);
int scale_int;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
return;
}
@@ -435,12 +435,12 @@ PHP_FUNCTION(bcpowmod)
PHP_FUNCTION(bcpow)
{
char *left, *right;
- int left_len, right_len;
- php_int_t scale_param = 0;
+ size_t left_len, right_len;
+ zend_long scale_param = 0;
bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -472,12 +472,12 @@ PHP_FUNCTION(bcpow)
PHP_FUNCTION(bcsqrt)
{
char *left;
- int left_len;
- php_int_t scale_param = 0;
+ size_t left_len;
+ zend_long scale_param = 0;
bc_num result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "s|i", &left, &left_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
return;
}
@@ -507,12 +507,12 @@ PHP_FUNCTION(bcsqrt)
PHP_FUNCTION(bccomp)
{
char *left, *right;
- int left_len, right_len;
- php_int_t scale_param = 0;
+ size_t left_len, right_len;
+ zend_long scale_param = 0;
bc_num first, second;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
@@ -525,7 +525,7 @@ PHP_FUNCTION(bccomp)
bc_str2num(&first, left, scale TSRMLS_CC);
bc_str2num(&second, right, scale TSRMLS_CC);
- RETVAL_INT(bc_compare(first, second));
+ RETVAL_LONG(bc_compare(first, second));
bc_free_num(&first);
bc_free_num(&second);
@@ -537,9 +537,9 @@ PHP_FUNCTION(bccomp)
Sets default scale parameter for all bc math functions */
PHP_FUNCTION(bcscale)
{
- php_int_t new_scale;
+ zend_long new_scale;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_scale) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
return;
}
diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c
index 47990d2e92..e38bf87797 100644
--- a/ext/bcmath/libbcmath/src/num2str.c
+++ b/ext/bcmath/libbcmath/src/num2str.c
@@ -52,9 +52,9 @@ zend_string
/* Allocate the string memory. */
signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */
if (num->n_scale > 0)
- str = STR_ALLOC(num->n_len + num->n_scale + signch + 1, 0);
+ str = zend_string_alloc(num->n_len + num->n_scale + signch + 1, 0);
else
- str = STR_ALLOC(num->n_len + signch, 0);
+ str = zend_string_alloc(num->n_len + signch, 0);
if (str == NULL) bc_out_of_memory();
/* The negative sign if needed. */
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index 96f0baf189..12098cff89 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -45,7 +45,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
bc_num _zero_;
bc_num _one_;
bc_num _two_;
- php_int_t bc_precision;
+ zend_long bc_precision;
ZEND_END_MODULE_GLOBALS(bcmath)
#ifdef ZTS
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index c6a03935d9..6e6f2a95c3 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -343,11 +343,11 @@ static PHP_MINFO_FUNCTION(bz2)
static PHP_FUNCTION(bzread)
{
zval *bz;
- php_int_t len = 1024;
+ zend_long len = 1024;
php_stream *stream;
zend_string *data;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &bz, &len)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
RETURN_FALSE;
}
@@ -357,14 +357,8 @@ static PHP_FUNCTION(bzread)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative");
RETURN_FALSE;
}
- data = STR_ALLOC(len, 0);
+ data = zend_string_alloc(len, 0);
data->len = php_stream_read(stream, data->val, data->len);
-
- if (data->len < 0) {
- STR_FREE(data);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
- RETURN_FALSE;
- }
data->val[data->len] = '\0';
RETURN_STR(data);
@@ -377,7 +371,7 @@ static PHP_FUNCTION(bzopen)
{
zval *file; /* The file to open */
char *mode; /* The mode to open the stream with */
- int mode_len;
+ size_t mode_len;
BZFILE *bz; /* The compressed file stream */
php_stream *stream = NULL;
@@ -393,7 +387,7 @@ static PHP_FUNCTION(bzopen)
/* If it's not a resource its a string containing the filename to open */
if (Z_TYPE_P(file) == IS_STRING) {
- if (Z_STRSIZE_P(file) == 0) {
+ if (Z_STRLEN_P(file) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty");
RETURN_FALSE;
}
@@ -406,7 +400,7 @@ static PHP_FUNCTION(bzopen)
} else if (Z_TYPE_P(file) == IS_RESOURCE) {
/* If it is a resource, than its a stream resource */
php_socket_t fd;
- php_size_t stream_mode_len;
+ size_t stream_mode_len;
php_stream_from_zval(stream, file);
stream_mode_len = strlen(stream->mode);
@@ -490,19 +484,19 @@ static PHP_FUNCTION(bzerror)
static PHP_FUNCTION(bzcompress)
{
char *source; /* Source data to compress */
- php_int_t zblock_size = 0; /* Optional block size to use */
- php_int_t zwork_factor = 0;/* Optional work factor to use */
+ zend_long zblock_size = 0; /* Optional block size to use */
+ zend_long zwork_factor = 0;/* Optional work factor to use */
zend_string *dest = NULL; /* Destination to place the compressed data into */
int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */
work_factor = 0, /* Work factor for compression algorithm */
argc; /* Argument count */
- int source_len; /* Length of the source data */
+ size_t source_len; /* Length of the source data */
unsigned int dest_len; /* Length of the destination buffer */
argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
return;
}
@@ -513,7 +507,7 @@ static PHP_FUNCTION(bzcompress)
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
/* Allocate the destination buffer */
- dest = STR_ALLOC(dest_len, 0);
+ dest = zend_string_alloc(dest_len, 0);
/* Handle the optional arguments */
if (argc > 1) {
@@ -526,8 +520,8 @@ static PHP_FUNCTION(bzcompress)
error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
- STR_FREE(dest);
- RETURN_INT(error);
+ zend_string_free(dest);
+ RETURN_LONG(error);
} else {
/* Copy the buffer, we have perhaps allocate a lot more than we need,
so we erealloc() the buffer to the proper size */
@@ -543,8 +537,9 @@ static PHP_FUNCTION(bzcompress)
static PHP_FUNCTION(bzdecompress)
{
char *source, *dest;
- int source_len, error;
- php_int_t small = 0;
+ size_t source_len;
+ int error;
+ zend_long small = 0;
#if defined(PHP_WIN32)
unsigned __int64 size = 0;
#else
@@ -552,7 +547,7 @@ static PHP_FUNCTION(bzdecompress)
#endif
bz_stream bzs;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &small)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) {
RETURN_FALSE;
}
@@ -586,7 +581,7 @@ static PHP_FUNCTION(bzdecompress)
efree(dest);
} else { /* real error */
efree(dest);
- RETVAL_INT(error);
+ RETVAL_LONG(error);
}
BZ2_bzDecompressEnd(&bzs);
@@ -621,7 +616,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
/* Determine what to return */
switch (opt) {
case PHP_BZ_ERRNO:
- RETURN_INT(errnum);
+ RETURN_LONG(errnum);
break;
case PHP_BZ_ERRSTR:
RETURN_STRING((char*)errstr);
@@ -629,7 +624,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
case PHP_BZ_ERRBOTH:
array_init(return_value);
- add_assoc_int (return_value, "errno", errnum);
+ add_assoc_long (return_value, "errno", errnum);
add_assoc_string(return_value, "errstr", (char*)errstr);
break;
}
diff --git a/ext/bz2/bz2.dsp b/ext/bz2/bz2.dsp
deleted file mode 100644
index a054c522a7..0000000000
--- a/ext/bz2/bz2.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="bz2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=bz2 - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "bz2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "bz2.mak" CFG="bz2 - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "bz2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "bz2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "bz2 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_bz2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "bz2 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_bz2.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "bz2 - Win32 Release_TS"
-# Name "bz2 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\bz2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bz2_filter.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_bz2.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index f32226bc84..1c1d6ccfb6 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -34,17 +34,17 @@ enum strm_status {
};
typedef struct _php_bz2_filter_data {
- int persistent;
bz_stream strm;
char *inbuf;
- size_t inbuf_len;
char *outbuf;
+ size_t inbuf_len;
size_t outbuf_len;
- /* Decompress options */
- enum strm_status status;
- unsigned int small_footprint : 1;
- unsigned int expect_concatenated : 1;
+ enum strm_status status; /* Decompress option */
+ unsigned int small_footprint : 1; /* Decompress option */
+ unsigned int expect_concatenated : 1; /* Decompress option */
+
+ int persistent;
} php_bz2_filter_data;
/* }}} */
@@ -380,11 +380,11 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
zval tmp;
ZVAL_DUP(&tmp, tmpzval);
- convert_to_int(&tmp);
- if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_IVAL_P(tmpzval));
+ convert_to_long(&tmp);
+ if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_LVAL_P(tmpzval));
} else {
- blockSize100k = Z_IVAL(tmp);
+ blockSize100k = Z_LVAL(tmp);
}
}
@@ -393,12 +393,12 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
zval tmp;
ZVAL_DUP(&tmp, tmpzval);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
- if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_IVAL(tmp));
+ if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_LVAL(tmp));
} else {
- workFactor = Z_IVAL(tmp);
+ workFactor = Z_LVAL(tmp);
}
}
}
diff --git a/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h
index ceb151b9e4..6e90e8d67f 100644
--- a/ext/bz2/php_bz2.h
+++ b/ext/bz2/php_bz2.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index 6149a0c054..3dd16ce45b 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -31,7 +31,7 @@ PHP_FUNCTION(unixtojd)
time_t ts = 0;
struct tm *ta, tmbuf;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &ts) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts) == FAILURE) {
return;
}
@@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd)
RETURN_FALSE;
}
- RETURN_INT(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday));
+ RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday));
}
/* }}} */
@@ -53,7 +53,7 @@ PHP_FUNCTION(unixtojd)
Convert Julian Day to UNIX timestamp */
PHP_FUNCTION(jdtounix)
{
- long uday;
+ zend_long uday;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uday) == FAILURE) {
return;
@@ -64,7 +64,7 @@ PHP_FUNCTION(jdtounix)
RETURN_FALSE;
}
- RETURN_INT(uday * 24 * 3600);
+ RETURN_LONG(uday * 24 * 3600);
}
/* }}} */
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 35652a9ce6..50385482a7 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -178,8 +178,8 @@ enum cal_name_type_t {
CAL_NUM_CALS
};
-typedef php_int_t (*cal_to_jd_func_t) (int month, int day, int year);
-typedef void (*cal_from_jd_func_t) (php_int_t jd, int *year, int *month, int *day);
+typedef zend_long (*cal_to_jd_func_t) (int month, int day, int year);
+typedef void (*cal_from_jd_func_t) (zend_long jd, int *year, int *month, int *day);
typedef char *(*cal_as_string_func_t) (int year, int month, int day);
struct cal_entry_t {
@@ -225,31 +225,31 @@ static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú";
PHP_MINIT_FUNCTION(calendar)
{
- REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
/* constants for jddayofweek */
- REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
/* constants for jdmonthname */
- REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
/* constants for easter calculation */
- REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
/* constants for Jewish date formatting */
- REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -279,7 +279,7 @@ static void _php_cal_info(int cal, zval *ret)
add_assoc_zval(ret, "months", &months);
add_assoc_zval(ret, "abbrevmonths", &smonths);
- add_assoc_int(ret, "maxdaysinmonth", calendar->max_days_in_month);
+ add_assoc_long(ret, "maxdaysinmonth", calendar->max_days_in_month);
add_assoc_string(ret, "calname", calendar->name);
add_assoc_string(ret, "calsymbol", calendar->symbol);
@@ -289,10 +289,10 @@ static void _php_cal_info(int cal, zval *ret)
Returns information about a particular calendar */
PHP_FUNCTION(cal_info)
{
- php_int_t cal = -1;
+ zend_long cal = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &cal) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) {
RETURN_FALSE;
}
@@ -311,7 +311,7 @@ PHP_FUNCTION(cal_info)
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal);
RETURN_FALSE;
}
@@ -324,11 +324,11 @@ PHP_FUNCTION(cal_info)
Returns the number of days in a month for a given year and calendar */
PHP_FUNCTION(cal_days_in_month)
{
- php_int_t cal, month, year;
+ zend_long cal, month, year;
struct cal_entry_t *calendar;
- php_int_t sdn_start, sdn_next;
+ zend_long sdn_start, sdn_next;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &cal, &month, &year) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) {
RETURN_FALSE;
}
@@ -360,7 +360,7 @@ PHP_FUNCTION(cal_days_in_month)
}
}
- RETURN_INT(sdn_next - sdn_start);
+ RETURN_LONG(sdn_next - sdn_start);
}
/* }}} */
@@ -368,9 +368,9 @@ PHP_FUNCTION(cal_days_in_month)
Converts from a supported calendar to Julian Day Count */
PHP_FUNCTION(cal_to_jd)
{
- php_int_t cal, month, day, year;
+ zend_long cal, month, day, year;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiii", &cal, &month, &day, &year) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
RETURN_FALSE;
}
@@ -379,7 +379,7 @@ PHP_FUNCTION(cal_to_jd)
RETURN_FALSE;
}
- RETURN_INT(cal_conversion_table[cal].to_jd(year, month, day));
+ RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day));
}
/* }}} */
@@ -387,12 +387,12 @@ PHP_FUNCTION(cal_to_jd)
Converts from Julian Day Count to a supported calendar and return extended information */
PHP_FUNCTION(cal_from_jd)
{
- php_int_t jd, cal;
+ zend_long jd, cal;
int month, day, year, dow;
char date[16];
struct cal_entry_t *calendar;
- if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ii", &jd, &cal) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) {
RETURN_FALSE;
}
@@ -409,13 +409,13 @@ PHP_FUNCTION(cal_from_jd)
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
add_assoc_string(return_value, "date", date);
- add_assoc_int(return_value, "month", month);
- add_assoc_int(return_value, "day", day);
- add_assoc_int(return_value, "year", year);
+ add_assoc_long(return_value, "month", month);
+ add_assoc_long(return_value, "day", day);
+ add_assoc_long(return_value, "year", year);
/* day of week */
dow = DayOfWeek(jd);
- add_assoc_int(return_value, "dow", dow);
+ add_assoc_long(return_value, "dow", dow);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]);
add_assoc_string(return_value, "dayname", DayNameLong[dow]);
/* month name */
@@ -434,11 +434,11 @@ PHP_FUNCTION(cal_from_jd)
Converts a julian day count to a gregorian calendar date */
PHP_FUNCTION(jdtogregorian)
{
- php_int_t julday;
+ zend_long julday;
int year, month, day;
char date[16];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
}
@@ -453,13 +453,13 @@ PHP_FUNCTION(jdtogregorian)
Converts a gregorian calendar date to julian day count */
PHP_FUNCTION(gregoriantojd)
{
- php_int_t year, month, day;
+ zend_long year, month, day;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
}
- RETURN_INT(GregorianToSdn(year, month, day));
+ RETURN_LONG(GregorianToSdn(year, month, day));
}
/* }}} */
@@ -467,11 +467,11 @@ PHP_FUNCTION(gregoriantojd)
Convert a julian day count to a julian calendar date */
PHP_FUNCTION(jdtojulian)
{
- php_int_t julday;
+ zend_long julday;
int year, month, day;
char date[16];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
}
@@ -486,13 +486,13 @@ PHP_FUNCTION(jdtojulian)
Converts a julian calendar date to julian day count */
PHP_FUNCTION(juliantojd)
{
- php_int_t year, month, day;
+ zend_long year, month, day;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
}
- RETURN_INT(JulianToSdn(year, month, day));
+ RETURN_LONG(JulianToSdn(year, month, day));
}
/* }}} */
@@ -595,13 +595,13 @@ static char *heb_number_to_chars(int n, int fl, char **ret)
Converts a julian day count to a jewish calendar date */
PHP_FUNCTION(jdtojewish)
{
- php_int_t julday, fl = 0;
+ zend_long julday, fl = 0;
zend_bool heb = 0;
int year, month, day;
char date[16], hebdate[32];
char *dayp, *yearp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|bi", &julday, &heb, &fl) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) {
RETURN_FALSE;
}
@@ -634,13 +634,13 @@ PHP_FUNCTION(jdtojewish)
Converts a jewish calendar date to a julian day count */
PHP_FUNCTION(jewishtojd)
{
- php_int_t year, month, day;
+ zend_long year, month, day;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
}
- RETURN_INT(JewishToSdn(year, month, day));
+ RETURN_LONG(JewishToSdn(year, month, day));
}
/* }}} */
@@ -648,11 +648,11 @@ PHP_FUNCTION(jewishtojd)
Converts a julian day count to a french republic calendar date */
PHP_FUNCTION(jdtofrench)
{
- php_int_t julday;
+ zend_long julday;
int year, month, day;
char date[16];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
RETURN_FALSE;
}
@@ -667,13 +667,13 @@ PHP_FUNCTION(jdtofrench)
Converts a french republic calendar date to julian day count */
PHP_FUNCTION(frenchtojd)
{
- php_int_t year, month, day;
+ zend_long year, month, day;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
RETURN_FALSE;
}
- RETURN_INT(FrenchToSdn(year, month, day));
+ RETURN_LONG(FrenchToSdn(year, month, day));
}
/* }}} */
@@ -681,11 +681,11 @@ PHP_FUNCTION(frenchtojd)
Returns name or number of day of week from julian day count */
PHP_FUNCTION(jddayofweek)
{
- php_int_t julday, mode = CAL_DOW_DAYNO;
+ zend_long julday, mode = CAL_DOW_DAYNO;
int day;
char *daynamel, *daynames;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &julday, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) {
RETURN_FALSE;
}
@@ -702,7 +702,7 @@ PHP_FUNCTION(jddayofweek)
break;
case CAL_DOW_DAYNO:
default:
- RETURN_INT(day);
+ RETURN_LONG(day);
break;
}
}
@@ -712,11 +712,11 @@ PHP_FUNCTION(jddayofweek)
Returns name of month for julian day count */
PHP_FUNCTION(jdmonthname)
{
- php_int_t julday, mode;
+ zend_long julday, mode;
char *monthname = NULL;
int month, day, year;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &julday, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) {
RETURN_FALSE;
}
diff --git a/ext/calendar/dow.c b/ext/calendar/dow.c
index 1e9b99694c..44f0490ed1 100644
--- a/ext/calendar/dow.c
+++ b/ext/calendar/dow.c
@@ -32,7 +32,7 @@
#include "sdncal.h"
int DayOfWeek(
- php_int_t sdn)
+ zend_long sdn)
{
int dow;
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index a61a970461..b6dc135d33 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -24,14 +24,14 @@
#include "sdncal.h"
#include <time.h>
-static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm)
+static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
{
/* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
struct tm te;
- php_int_t year, golden, solar, lunar, pfm, dom, tmp, easter, result;
- php_int_t method = CAL_EASTER_DEFAULT;
+ zend_long year, golden, solar, lunar, pfm, dom, tmp, easter, result;
+ zend_long method = CAL_EASTER_DEFAULT;
/* Default to the current year if year parameter is not given */
{
@@ -47,7 +47,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm)
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "|ii", &year, &method) == FAILURE) {
+ "|ll", &year, &method) == FAILURE) {
return;
}
@@ -115,7 +115,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm)
} else { /* return the days after March 21 */
result = easter;
}
- ZVAL_INT(return_value, result);
+ ZVAL_LONG(return_value, result);
}
/* {{{ proto int easter_date([int year])
diff --git a/ext/calendar/french.c b/ext/calendar/french.c
index c6584695e9..4eb0e78021 100644
--- a/ext/calendar/french.c
+++ b/ext/calendar/french.c
@@ -93,12 +93,12 @@
#define LAST_VALID 2380952
void SdnToFrench(
- php_int_t sdn,
+ zend_long sdn,
int *pYear,
int *pMonth,
int *pDay)
{
- php_int_t temp;
+ zend_long temp;
int dayOfYear;
if (sdn < FIRST_VALID || sdn > LAST_VALID) {
@@ -114,7 +114,7 @@ void SdnToFrench(
*pDay = dayOfYear % DAYS_PER_MONTH + 1;
}
-php_int_t FrenchToSdn(
+zend_long FrenchToSdn(
int year,
int month,
int day)
diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c
index b67de5fcc8..069fe6eb5a 100644
--- a/ext/calendar/gregor.c
+++ b/ext/calendar/gregor.c
@@ -135,7 +135,7 @@
#define DAYS_PER_400_YEARS 146097
void SdnToGregorian(
- php_int_t sdn,
+ zend_long sdn,
int *pYear,
int *pMonth,
int *pDay)
@@ -144,7 +144,7 @@ void SdnToGregorian(
int year;
int month;
int day;
- php_int_t temp;
+ zend_long temp;
int dayOfYear;
if (sdn <= 0 ||
@@ -190,7 +190,7 @@ fail:
*pDay = 0;
}
-php_int_t GregorianToSdn(
+zend_long GregorianToSdn(
int inputYear,
int inputMonth,
int inputDay)
diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c
index 83efb9949f..6a32e6ff08 100644
--- a/ext/calendar/jewish.c
+++ b/ext/calendar/jewish.c
@@ -382,12 +382,12 @@ char *JewishMonthHebName[14] =
* (called dehiyyot) delays it. These 4 rules can delay the start of the
* year by as much as 2 days.
*/
-static php_int_t Tishri1(
+static zend_long Tishri1(
int metonicYear,
- php_int_t moladDay,
- php_int_t moladHalakim)
+ zend_long moladDay,
+ zend_long moladHalakim)
{
- php_int_t tishri1;
+ zend_long tishri1;
int dow;
int leapYear;
int lastWasLeapYear;
@@ -429,10 +429,10 @@ static php_int_t Tishri1(
*/
static void MoladOfMetonicCycle(
int metonicCycle,
- php_int_t *pMoladDay,
- php_int_t *pMoladHalakim)
+ zend_long *pMoladDay,
+ zend_long *pMoladHalakim)
{
- register php_uint_t r1, r2, d1, d2;
+ register zend_ulong r1, r2, d1, d2;
/* Start with the time of the first molad after creation. */
r1 = NEW_MOON_OF_CREATION;
@@ -468,14 +468,14 @@ static void MoladOfMetonicCycle(
* us to avoid calculating the length of the year in most cases.
*/
static void FindTishriMolad(
- php_int_t inputDay,
+ zend_long inputDay,
int *pMetonicCycle,
int *pMetonicYear,
- php_int_t *pMoladDay,
- php_int_t *pMoladHalakim)
+ zend_long *pMoladDay,
+ zend_long *pMoladHalakim)
{
- php_int_t moladDay;
- php_int_t moladHalakim;
+ zend_long moladDay;
+ zend_long moladHalakim;
int metonicCycle;
int metonicYear;
@@ -523,8 +523,8 @@ static void FindStartOfYear(
int year,
int *pMetonicCycle,
int *pMetonicYear,
- php_int_t *pMoladDay,
- php_int_t *pMoladHalakim,
+ zend_long *pMoladDay,
+ zend_long *pMoladHalakim,
int *pTishri1)
{
*pMetonicCycle = (year - 1) / 19;
@@ -546,14 +546,14 @@ static void FindStartOfYear(
* range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive.
*/
void SdnToJewish(
- php_int_t sdn,
+ zend_long sdn,
int *pYear,
int *pMonth,
int *pDay)
{
- php_int_t inputDay;
- php_int_t day;
- php_int_t halakim;
+ zend_long inputDay;
+ zend_long day;
+ zend_long halakim;
int metonicCycle;
int metonicYear;
int tishri1;
@@ -684,18 +684,18 @@ void SdnToJewish(
* value. To verify that a date is valid, convert it to SDN and then back
* and compare with the original.
*/
-php_int_t JewishToSdn(
+zend_long JewishToSdn(
int year,
int month,
int day)
{
- php_int_t sdn;
+ zend_long sdn;
int metonicCycle;
int metonicYear;
int tishri1;
int tishri1After;
- php_int_t moladDay;
- php_int_t moladHalakim;
+ zend_long moladDay;
+ zend_long moladHalakim;
int yearLength;
int lengthOfAdarIAndII;
diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c
index 3527627c2f..659ffc1740 100644
--- a/ext/calendar/julian.c
+++ b/ext/calendar/julian.c
@@ -11,7 +11,7 @@
*
* void
* SdnToJulian(
- * php_int_t sdn,
+ * zend_long sdn,
* int *pYear,
* int *pMonth,
* int *pDay);
@@ -21,7 +21,7 @@
* will be >= -4713 and != 0; *pMonth will be in the range 1 to 12
* inclusive; *pDay will be in the range 1 to 31 inclusive.
*
- * php_int_t
+ * zend_long
* JulianToSdn(
* int inputYear,
* int inputMonth,
@@ -153,7 +153,7 @@
#define DAYS_PER_4_YEARS 1461
void SdnToJulian(
- php_int_t sdn,
+ zend_long sdn,
int *pYear,
int *pMonth,
int *pDay)
@@ -161,7 +161,7 @@ void SdnToJulian(
int year;
int month;
int day;
- php_int_t temp;
+ zend_long temp;
int dayOfYear;
if (sdn <= 0) {
@@ -212,7 +212,7 @@ fail:
*pDay = 0;
}
-php_int_t JulianToSdn(
+zend_long JulianToSdn(
int inputYear,
int inputMonth,
int inputDay)
diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h
index 47d7748c4c..c76fc0063b 100644
--- a/ext/calendar/sdncal.h
+++ b/ext/calendar/sdncal.h
@@ -53,7 +53,7 @@
*
* int y1, m1, d1;
* int y2, m2, d2;
- * php_int_t sdn;
+ * zend_long sdn;
* ...
* sdn = GregorianToSdn(y1, m1, d1);
* if (sdn > 0) {
@@ -68,18 +68,18 @@
#include "php.h"
/* Gregorian calendar conversions. */
-void SdnToGregorian(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
-php_int_t GregorianToSdn(int year, int month, int day);
+void SdnToGregorian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
+zend_long GregorianToSdn(int year, int month, int day);
extern char *MonthNameShort[13];
extern char *MonthNameLong[13];
/* Julian calendar conversions. */
-void SdnToJulian(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
-php_int_t JulianToSdn(int year, int month, int day);
+void SdnToJulian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
+zend_long JulianToSdn(int year, int month, int day);
/* Jewish calendar conversions. */
-void SdnToJewish(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
-php_int_t JewishToSdn(int year, int month, int day);
+void SdnToJewish(zend_long sdn, int *pYear, int *pMonth, int *pDay);
+zend_long JewishToSdn(int year, int month, int day);
extern char *JewishMonthName[14];
extern char *JewishMonthNameLeap[14];
extern char *JewishMonthHebName[14];
@@ -87,15 +87,15 @@ extern char *JewishMonthHebNameLeap[14];
extern int monthsPerYear[19];
/* French republic calendar conversions. */
-void SdnToFrench(php_int_t sdn, int *pYear, int *pMonth, int *pDay);
-php_int_t FrenchToSdn(int inputYear, int inputMonth, int inputDay);
+void SdnToFrench(zend_long sdn, int *pYear, int *pMonth, int *pDay);
+zend_long FrenchToSdn(int inputYear, int inputMonth, int inputDay);
extern char *FrenchMonthName[14];
/* Islamic calendar conversions. */
/* Not implemented yet. */
/* Day of week conversion. 0=Sunday, 6=Saturday */
-int DayOfWeek(php_int_t sdn);
+int DayOfWeek(zend_long sdn);
extern char *DayNameShort[7];
extern char *DayNameLong[7];
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 00b62bb2d2..5f0b8ff697 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,7 +37,7 @@ PHP_FUNCTION(com_create_instance)
php_com_dotnet_object *obj;
char *module_name, *typelib_name = NULL, *server_name = NULL;
char *user_name = NULL, *domain_name = NULL, *password = NULL;
- int module_name_len, typelib_name_len, server_name_len,
+ size_t module_name_len, typelib_name_len, server_name_len,
user_name_len, domain_name_len, password_len;
OLECHAR *moniker;
CLSID clsid;
@@ -57,11 +57,11 @@ PHP_FUNCTION(com_create_instance)
obj = CDNO_FETCH(object);
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "s|s!is",
+ ZEND_NUM_ARGS() TSRMLS_CC, "s|s!ls",
&module_name, &module_name_len, &server_name, &server_name_len,
&obj->code_page, &typelib_name, &typelib_name_len) &&
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "sa|is",
+ ZEND_NUM_ARGS() TSRMLS_CC, "sa|ls",
&module_name, &module_name_len, &server_params, &obj->code_page,
&typelib_name, &typelib_name_len)) {
@@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance)
"Server", sizeof("Server")-1))) {
convert_to_string_ex(tmp);
server_name = Z_STRVAL_P(tmp);
- server_name_len = Z_STRSIZE_P(tmp);
+ server_name_len = Z_STRLEN_P(tmp);
ctx = CLSCTX_REMOTE_SERVER;
}
@@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance)
"Username", sizeof("Username")-1))) {
convert_to_string_ex(tmp);
user_name = Z_STRVAL_P(tmp);
- user_name_len = Z_STRSIZE_P(tmp);
+ user_name_len = Z_STRLEN_P(tmp);
}
if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Password", sizeof("Password")-1))) {
convert_to_string_ex(tmp);
password = Z_STRVAL_P(tmp);
- password_len = Z_STRSIZE_P(tmp);
+ password_len = Z_STRLEN_P(tmp);
}
if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Domain", sizeof("Domain")-1))) {
convert_to_string_ex(tmp);
domain_name = Z_STRVAL_P(tmp);
- domain_name_len = Z_STRSIZE_P(tmp);
+ domain_name_len = Z_STRLEN_P(tmp);
}
if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Flags", sizeof("Flags")-1))) {
- convert_to_int_ex(tmp);
- ctx = (CLSCTX)Z_IVAL_P(tmp);
+ convert_to_long_ex(tmp);
+ ctx = (CLSCTX)Z_LVAL_P(tmp);
}
}
@@ -289,14 +289,14 @@ PHP_FUNCTION(com_get_active_object)
CLSID clsid;
char *module_name;
int module_name_len;
- php_int_t code_page = COMG(code_page);
+ zend_long code_page = COMG(code_page);
IUnknown *unk = NULL;
IDispatch *obj = NULL;
HRESULT res;
OLECHAR *module = NULL;
php_com_initialize(TSRMLS_C);
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
&module_name, &module_name_len, &code_page)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC);
return;
@@ -349,7 +349,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
if (silent == 0 && FAILED(hr)) {
char *source = NULL, *desc = NULL, *msg = NULL;
- int source_len, desc_len;
+ size_t source_len, desc_len;
switch (hr) {
case DISP_E_EXCEPTION:
@@ -416,7 +416,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
/* map an ID to a name */
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
- int namelen, DISPID *dispid TSRMLS_DC)
+ size_t namelen, DISPID *dispid TSRMLS_DC)
{
OLECHAR *olename;
HRESULT hr;
@@ -427,7 +427,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
}
if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) {
- *dispid = Z_IVAL_P(tmp);
+ *dispid = Z_LVAL_P(tmp);
return S_OK;
}
@@ -456,7 +456,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
ALLOC_HASHTABLE(obj->id_of_name_cache);
zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0);
}
- ZVAL_INT(&tmp, *dispid);
+ ZVAL_LONG(&tmp, *dispid);
zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp);
}
@@ -464,7 +464,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
}
/* the core of COM */
-int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
+int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
WORD flags, VARIANT *v, int nargs, zval *args TSRMLS_DC)
{
DISPID dispid, altdispid;
@@ -472,20 +472,19 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
HRESULT hr;
VARIANT *vargs = NULL, *byref_vals = NULL;
int i, byref_count = 0, j;
- zend_internal_function *f = (zend_internal_function*)EG(current_execute_data)->func;
/* assumption: that the active function (f) is the function we generated for the engine */
if (!f || f->arg_info == NULL) {
f = NULL;
}
- hr = php_com_get_id_of_name(obj, name, namelen, &dispid TSRMLS_CC);
+ hr = php_com_get_id_of_name(obj, f->function_name->val, f->function_name->len, &dispid TSRMLS_CC);
if (FAILED(hr)) {
char *winerr = NULL;
char *msg = NULL;
winerr = php_win32_error_to_msg(hr);
- spprintf(&msg, 0, "Unable to lookup `%s': %s", name, winerr);
+ spprintf(&msg, 0, "Unable to lookup `%s': %s", f->function_name->val, winerr);
LocalFree(winerr);
php_com_throw_exception(hr, msg TSRMLS_CC);
efree(msg);
@@ -667,7 +666,7 @@ PHP_FUNCTION(com_create_guid)
php_com_initialize(TSRMLS_C);
if (CoCreateGuid(&retval) == S_OK && StringFromCLSID(&retval, &guid_string) == S_OK) {
- int len;
+ size_t len;
char *str;
str = php_com_olestring_to_string(guid_string, &len, CP_ACP TSRMLS_CC);
@@ -750,7 +749,7 @@ PHP_FUNCTION(com_print_typeinfo)
zval *arg1;
char *ifacename = NULL;
char *typelibname = NULL;
- int ifacelen;
+ size_t ifacelen;
zend_bool wantsink = 0;
php_com_dotnet_object *obj = NULL;
ITypeInfo *typeinfo;
@@ -784,11 +783,11 @@ PHP_FUNCTION(com_print_typeinfo)
Process COM messages, sleeping for up to timeoutms milliseconds */
PHP_FUNCTION(com_message_pump)
{
- php_int_t timeoutms = 0;
+ zend_long timeoutms = 0;
MSG msg;
DWORD result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timeoutms) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE)
RETURN_FALSE;
php_com_initialize(TSRMLS_C);
@@ -813,7 +812,7 @@ PHP_FUNCTION(com_message_pump)
PHP_FUNCTION(com_load_typelib)
{
char *name;
- int namelen;
+ size_t namelen;
ITypeLib *pTL = NULL;
zend_bool cs = TRUE;
int codepage = COMG(code_page);
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index c742fd30fc..ae2c6ee2f0 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -188,7 +188,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
zval *object = getThis();
php_com_dotnet_object *obj;
char *assembly_name, *datatype_name;
- int assembly_name_len, datatype_name_len;
+ size_t assembly_name_len, datatype_name_len;
struct dotnet_runtime_stuff *stuff;
OLECHAR *oleassembly, *oletype;
BSTR oleassembly_sys, oletype_sys;
@@ -243,7 +243,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
obj = CDNO_FETCH(object);
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l",
&assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len,
&obj->code_page)) {
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index db9f5b21f9..f66119842e 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -272,7 +272,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
char *strtok_buf = NULL;
int cached;
- if (!new_value || !new_value[0] || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
+ if (NULL == new_value || !new_value->val[0] || (typelib_file = VCWD_FOPEN(new_value->val, "r"))==NULL) {
return FAILURE;
}
@@ -383,12 +383,12 @@ PHP_MINIT_FUNCTION(com_dotnet)
REGISTER_INI_ENTRIES();
-#define COM_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
+#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
#define COM_ERR_CONST(x) { \
- php_int_t __tmp; \
+ zend_long __tmp; \
ULongToUIntPtr(x, &__tmp); \
- REGISTER_INT_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
+ REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
}
COM_CONST(CLSCTX_INPROC_SERVER);
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index 791aaeb5cc..6f63a1fbd8 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -44,7 +44,7 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
convert_to_string_ex(member);
- res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member),
+ res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC);
if (res == SUCCESS) {
@@ -71,7 +71,7 @@ static void com_property_write(zval *object, zval *member, zval *value, void **c
VariantInit(&v);
convert_to_string_ex(member);
- if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member),
+ if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0 TSRMLS_CC)) {
VariantClear(&v);
}
@@ -98,10 +98,10 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T
VariantClear(&v);
}
} else if (V_ISARRAY(&obj->v)) {
- convert_to_int(offset);
+ convert_to_long(offset);
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) {
- if (php_com_safearray_get_elem(&obj->v, &v, Z_IVAL_P(offset) TSRMLS_CC)) {
+ if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) {
php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
}
@@ -144,8 +144,8 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
vt = V_VT(&obj->v) & ~VT_ARRAY;
}
- convert_to_int(offset);
- indices = Z_IVAL_P(offset);
+ convert_to_long(offset);
+ indices = Z_LVAL_P(offset);
VariantInit(&v);
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC);
@@ -197,7 +197,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
if (V_VT(&obj->v) == VT_DISPATCH) {
convert_to_string_ex(member);
- if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), &dispid TSRMLS_CC))) {
+ if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid TSRMLS_CC))) {
/* TODO: distinguish between property and method! */
return 1;
}
@@ -238,7 +238,7 @@ static void function_dtor(zval *zv)
{
zend_internal_function *f = (zend_internal_function*)Z_PTR_P(zv);
- STR_RELEASE(f->function_name);
+ zend_string_release(f->function_name);
if (f->arg_info) {
efree(f->arg_info);
}
@@ -250,7 +250,7 @@ static PHP_FUNCTION(com_method_handler)
zval *object = getThis();
Z_OBJ_HANDLER_P(object, call_method)(
- ((zend_internal_function*)EG(current_execute_data)->func)->function_name,
+ ((zend_internal_function*)EX(func))->function_name,
Z_OBJ_P(object),
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
@@ -277,7 +277,7 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin
f.arg_info = NULL;
f.scope = obj->ce;
f.fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
- f.function_name = STR_COPY(name);
+ f.function_name = zend_string_copy(name);
f.handler = PHP_FN(com_method_handler);
fptr = &f;
@@ -378,7 +378,7 @@ static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FU
VariantInit(&v);
- if (SUCCESS == php_com_do_invoke_byref(obj, method->val, method->len, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
+ if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
ret = SUCCESS;
VariantClear(&v);
@@ -423,18 +423,11 @@ static union _zend_function *com_constructor_get(zend_object *object TSRMLS_DC)
}
}
-static zend_class_entry *com_class_entry_get(const zend_object *object TSRMLS_DC)
+static zend_string* com_class_name_get(const zend_object *object TSRMLS_DC)
{
php_com_dotnet_object *obj = (php_com_dotnet_object *)object;
- return obj->ce;
-}
-
-static zend_string* com_class_name_get(const zend_object *object, int parent TSRMLS_DC)
-{
- php_com_dotnet_object *obj = (php_com_dotnet_object *)object;
-
- return STR_COPY(obj->ce->name);
+ return zend_string_copy(obj->ce->name);
}
/* This compares two variants for equality */
@@ -491,7 +484,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
}
switch(type) {
- case IS_INT:
+ case IS_LONG:
vt = VT_INT;
break;
case IS_DOUBLE:
@@ -525,7 +518,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
return zend_std_cast_object_tostring(readobj, writeobj, type TSRMLS_CC);
}
-static int com_object_count(zval *object, long *count TSRMLS_DC)
+static int com_object_count(zval *object, zend_long *count TSRMLS_DC)
{
php_com_dotnet_object *obj;
LONG ubound = 0, lbound = 0;
@@ -564,7 +557,6 @@ zend_object_handlers php_com_object_handlers = {
com_method_get,
com_call_method,
com_constructor_get,
- com_class_entry_get,
com_class_name_get,
com_objects_compare,
com_object_cast,
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index d22bf1efde..a7614673f8 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -32,7 +32,7 @@
struct php_com_iterator {
zend_object_iterator iter;
IEnumVARIANT *ev;
- php_uint_t key;
+ zend_ulong key;
VARIANT v; /* cached element */
int code_page;
VARIANT safe_array;
@@ -75,10 +75,10 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data);
- if (I->key == (php_uint_t)-1) {
+ if (I->key == (zend_ulong)-1) {
ZVAL_NULL(key);
} else {
- ZVAL_INT(key, I->key);
+ ZVAL_LONG(key, I->key);
}
}
diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c
index 294ff26fe7..084a720ea1 100644
--- a/ext/com_dotnet/com_misc.c
+++ b/ext/com_dotnet/com_misc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
message = php_win32_error_to_msg(code);
free_msg = 1;
}
- zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)code TSRMLS_CC);
+ zend_throw_exception(php_com_exception_class_entry, message, (zend_long)code TSRMLS_CC);
if (free_msg) {
LocalFree(message);
}
diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c
index bf42b4fffb..51cc7e8f1d 100644
--- a/ext/com_dotnet/com_olechar.c
+++ b/ext/com_dotnet/com_olechar.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,7 +30,7 @@
#include "php_com_dotnet_internal.h"
-PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint string_len, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, size_t string_len, int codepage TSRMLS_DC)
{
OLECHAR *olestring = NULL;
DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS;
@@ -71,7 +71,7 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, uint strin
return olestring;
}
-PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, int codepage TSRMLS_DC)
+PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, size_t *string_len, int codepage TSRMLS_DC)
{
char *string;
uint length = 0;
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index 2a2657ae3c..eb80e760c8 100644
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -349,7 +349,7 @@ CPH_METHOD(GetCurFileName)
res = IPersistFile_GetCurFile(helper->ipf, &olename);
if (res == S_OK) {
- int len;
+ size_t len;
char *str = php_com_olestring_to_string(olename,
&len, helper->codepage TSRMLS_CC);
RETVAL_STRINGL(str, len);
@@ -375,7 +375,7 @@ CPH_METHOD(SaveToFile)
{
HRESULT res;
char *filename, *fullpath = NULL;
- int filename_len;
+ size_t filename_len;
zend_bool remember = TRUE;
OLECHAR *olefilename = NULL;
CPH_FETCH();
@@ -438,8 +438,8 @@ CPH_METHOD(LoadFromFile)
{
HRESULT res;
char *filename, *fullpath;
- int filename_len;
- php_int_t flags = 0;
+ size_t filename_len;
+ zend_long flags = 0;
OLECHAR *olefilename;
CPH_FETCH();
@@ -448,7 +448,7 @@ CPH_METHOD(LoadFromFile)
res = get_persist_file(helper);
if (helper->ipf) {
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l",
&filename, &filename_len, &flags)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
return;
@@ -506,7 +506,7 @@ CPH_METHOD(GetMaxStreamSize)
php_com_throw_exception(res, NULL TSRMLS_CC);
} else {
/* TODO: handle 64 bit properly */
- RETURN_INT((php_int_t)size.QuadPart);
+ RETURN_LONG((zend_long)size.QuadPart);
}
}
/* }}} */
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c
index 886bd808f9..ddee9bc179 100644
--- a/ext/com_dotnet/com_saproxy.c
+++ b/ext/com_dotnet/com_saproxy.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
VariantInit(&v);
res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
- Z_STRSIZE(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
+ Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
proxy->dimensions, args, 0 TSRMLS_CC);
if (res == SUCCESS) {
@@ -134,7 +134,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
/* the SafeArray case */
/* offset/index must be an integer */
- convert_to_int(offset);
+ convert_to_long(offset);
sa = V_ARRAY(&proxy->obj->v);
dims = SafeArrayGetDim(sa);
@@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
SafeArrayGetLBound(sa, proxy->dimensions, &lbound);
SafeArrayGetUBound(sa, proxy->dimensions, &ubound);
- if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) {
+ if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) {
php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC);
return rv;
}
@@ -166,12 +166,12 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
/* copy indices from proxy */
for (i = 0; i < dims; i++) {
- convert_to_int(&proxy->indices[i]);
- indices[i] = Z_IVAL(proxy->indices[i]);
+ convert_to_long(&proxy->indices[i]);
+ indices[i] = Z_LVAL(proxy->indices[i]);
}
/* add user-supplied index */
- indices[dims-1] = Z_IVAL_P(offset);
+ indices[dims-1] = Z_LVAL_P(offset);
/* now fetch the value */
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) {
@@ -225,7 +225,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
convert_to_string(&proxy->indices[0]);
VariantInit(&v);
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
- Z_STRSIZE(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
+ Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
args, 0 TSRMLS_CC)) {
VariantClear(&v);
}
@@ -240,13 +240,13 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
indices = safe_emalloc(dims, sizeof(LONG), 0);
/* copy indices from proxy */
for (i = 0; i < dims; i++) {
- convert_to_int(&proxy->indices[i]);
- indices[i] = Z_IVAL(proxy->indices[i]);
+ convert_to_long(&proxy->indices[i]);
+ indices[i] = Z_LVAL(proxy->indices[i]);
}
/* add user-supplied index */
- convert_to_int(offset);
- indices[dims-1] = Z_IVAL_P(offset);
+ convert_to_long(offset);
+ indices[dims-1] = Z_LVAL_P(offset);
if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY;
@@ -333,14 +333,9 @@ static union _zend_function *saproxy_constructor_get(zend_object *object TSRMLS_
return NULL;
}
-static zend_class_entry *saproxy_class_entry_get(const zend_object *object TSRMLS_DC)
+static zend_string* saproxy_class_name_get(const zend_object *object TSRMLS_DC)
{
- return php_com_saproxy_class_entry;
-}
-
-static zend_string* saproxy_class_name_get(const zend_object *object, int parent TSRMLS_DC)
-{
- return STR_COPY(php_com_saproxy_class_entry->name);
+ return zend_string_copy(php_com_saproxy_class_entry->name);
}
static int saproxy_objects_compare(zval *object1, zval *object2 TSRMLS_DC)
@@ -353,7 +348,7 @@ static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC
return FAILURE;
}
-static int saproxy_count_elements(zval *object, php_int_t *count TSRMLS_DC)
+static int saproxy_count_elements(zval *object, zend_long *count TSRMLS_DC)
{
php_com_saproxy *proxy = SA_FETCH(object);
LONG ubound, lbound;
@@ -420,7 +415,6 @@ zend_object_handlers php_com_saproxy_handlers = {
saproxy_method_get,
saproxy_call_method,
saproxy_constructor_get,
- saproxy_class_entry_get,
saproxy_class_name_get,
saproxy_objects_compare,
saproxy_object_cast,
@@ -516,7 +510,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC
if (I->key == -1) {
ZVAL_NULL(key);
} else {
- ZVAL_INT(key, I->key);
+ ZVAL_LONG(key, I->key);
}
}
@@ -560,8 +554,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec
I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
for (i = 0; i < proxy->dimensions; i++) {
- convert_to_int(&proxy->indices[i]);
- I->indices[i] = Z_IVAL(proxy->indices[i]);
+ convert_to_long(&proxy->indices[i]);
+ I->indices[i] = Z_LVAL(proxy->indices[i]);
}
SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 0cb8c4de28..33b1c65c9c 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -164,7 +164,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
zend_constant c;
zval *exists, results, value;
char *const_name;
- int len;
+ size_t len;
if (TL == NULL) {
return FAILURE;
@@ -186,7 +186,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
}
const_name = php_com_olestring_to_string(bstr_ids, &len, codepage TSRMLS_CC);
- c.name = STR_INIT(const_name, len, 1);
+ c.name = zend_string_init(const_name, len, 1);
// TODO: avoid reallocation???
efree(const_name);
if(c.name == NULL) {
@@ -201,16 +201,16 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
if (COMG(autoreg_verbose) && !compare_function(&results, &c.value, exists TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type library constant %s is already defined", c.name);
}
- STR_RELEASE(c.name);
+ zend_string_release(c.name);
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
continue;
}
/* register the constant */
php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC);
- if (Z_TYPE(value) == IS_INT) {
+ if (Z_TYPE(value) == IS_LONG) {
c.flags = mode;
- ZVAL_INT(&c.value, Z_IVAL(value));
+ ZVAL_LONG(&c.value, Z_LVAL(value));
c.module_number = 0;
zend_register_constant(&c TSRMLS_CC);
}
@@ -437,7 +437,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
int i;
OLECHAR *olename;
char *ansiname = NULL;
- unsigned int ansinamelen;
+ size_t ansinamelen;
int ret = 0;
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
@@ -491,7 +491,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
if (printdef) {
int j;
char *funcdesc;
- unsigned int funcdesclen, cnames = 0;
+ size_t funcdesclen;
+ unsigned int cnames = 0;
BSTR *names;
names = (BSTR*)safe_emalloc((func->cParams + 1), sizeof(BSTR), 0);
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index 27583e5dc9..dbd5529f6d 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -39,8 +39,8 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
HashPosition pos;
int keytype;
zend_string *strindex;
- php_int_t intindex = -1;
- php_int_t max_index = 0;
+ zend_long intindex = -1;
+ zend_long max_index = 0;
VARIANT *va;
zval *item;
@@ -145,9 +145,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
safe_array_from_zval(v, z, codepage TSRMLS_CC);
break;
- case IS_INT:
+ case IS_LONG:
V_VT(v) = VT_I4;
- V_I4(v) = Z_IVAL_P(z);
+ V_I4(v) = Z_LVAL_P(z);
break;
case IS_DOUBLE:
@@ -157,11 +157,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
case IS_STRING:
V_VT(v) = VT_BSTR;
- olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRSIZE_P(z), codepage TSRMLS_CC);
+ olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
if (CP_UTF8 == codepage) {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
} else {
- V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRSIZE_P(z) * sizeof(OLECHAR));
+ V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
}
efree(olestring);
break;
@@ -187,28 +187,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
ZVAL_NULL(z);
break;
case VT_UI1:
- ZVAL_INT(z, (php_int_t)V_UI1(v));
+ ZVAL_LONG(z, (zend_long)V_UI1(v));
break;
case VT_I1:
- ZVAL_INT(z, (php_int_t)V_I1(v));
+ ZVAL_LONG(z, (zend_long)V_I1(v));
break;
case VT_UI2:
- ZVAL_INT(z, (php_int_t)V_UI2(v));
+ ZVAL_LONG(z, (zend_long)V_UI2(v));
break;
case VT_I2:
- ZVAL_INT(z, (php_int_t)V_I2(v));
+ ZVAL_LONG(z, (zend_long)V_I2(v));
break;
case VT_UI4: /* TODO: promote to double if large? */
- ZVAL_INT(z, (php_int_t)V_UI4(v));
+ ZVAL_LONG(z, (zend_long)V_UI4(v));
break;
case VT_I4:
- ZVAL_INT(z, (php_int_t)V_I4(v));
+ ZVAL_LONG(z, (zend_long)V_I4(v));
break;
case VT_INT:
- ZVAL_INT(z, V_INT(v));
+ ZVAL_LONG(z, V_INT(v));
break;
case VT_UINT: /* TODO: promote to double if large? */
- ZVAL_INT(z, (php_int_t)V_UINT(v));
+ ZVAL_LONG(z, (zend_long)V_UINT(v));
break;
case VT_R4:
ZVAL_DOUBLE(z, (double)V_R4(v));
@@ -222,7 +222,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
case VT_BSTR:
olestring = V_BSTR(v);
if (olestring) {
- int len;
+ size_t len;
char *str = php_com_olestring_to_string(olestring,
&len, codepage TSRMLS_CC);
ZVAL_STRINGL(z, str, len);
@@ -406,8 +406,8 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR
/* {{{ com_variant_create_instance - ctor for new VARIANT() */
PHP_FUNCTION(com_variant_create_instance)
{
- /* VARTYPE == unsigned short */ php_int_t vt = VT_EMPTY;
- php_int_t codepage = CP_ACP;
+ /* VARTYPE == unsigned short */ zend_long vt = VT_EMPTY;
+ zend_long codepage = CP_ACP;
zval *object = getThis();
php_com_dotnet_object *obj;
zval *zvalue = NULL;
@@ -421,7 +421,7 @@ PHP_FUNCTION(com_variant_create_instance)
obj = CDNO_FETCH(object);
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "z!|ii", &zvalue, &vt, &codepage)) {
+ "z!|ll", &zvalue, &vt, &codepage)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
return;
}
@@ -444,7 +444,7 @@ PHP_FUNCTION(com_variant_create_instance)
but will probably fail (original behavior)
*/
if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) {
- php_int_t orig_vt = vt;
+ zend_long orig_vt = vt;
vt &= ~VT_ARRAY;
if (vt) {
@@ -832,7 +832,7 @@ PHP_FUNCTION(variant_round)
zval *zleft = NULL;
php_com_dotnet_object *obj;
int codepage = CP_ACP;
- php_int_t decimals = 0;
+ zend_long decimals = 0;
VariantInit(&left_val);
VariantInit(&vres);
@@ -867,8 +867,8 @@ PHP_FUNCTION(variant_cmp)
zval *zleft = NULL, *zright = NULL;
php_com_dotnet_object *obj;
int codepage = CP_ACP;
- php_int_t lcid = LOCALE_SYSTEM_DEFAULT;
- php_int_t flags = 0;
+ zend_long lcid = LOCALE_SYSTEM_DEFAULT;
+ zend_long flags = 0;
/* it is safe to ignore the warning for this line; see the comments in com_handlers.c */
STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags);
@@ -876,28 +876,28 @@ PHP_FUNCTION(variant_cmp)
VariantInit(&right_val);
if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "OO|ii", &zleft, php_com_variant_class_entry,
+ ZEND_NUM_ARGS() TSRMLS_CC, "OO|ll", &zleft, php_com_variant_class_entry,
&zright, php_com_variant_class_entry, &lcid, &flags)) {
obj = CDNO_FETCH(zleft);
vleft = &obj->v;
obj = CDNO_FETCH(zright);
vright = &obj->v;
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ii", &zleft, php_com_variant_class_entry,
+ ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ll", &zleft, php_com_variant_class_entry,
&zright, &lcid, &flags)) {
obj = CDNO_FETCH(zleft);
vleft = &obj->v;
vright = &right_val;
php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC);
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ii", &zleft, &zright, php_com_variant_class_entry,
+ ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ll", &zleft, &zright, php_com_variant_class_entry,
&lcid, &flags)) {
obj = CDNO_FETCH(zright);
vright = &obj->v;
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
} else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "z!z!|ii", &zleft, &zright, &lcid, &flags)) {
+ "z!z!|ll", &zleft, &zright, &lcid, &flags)) {
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
@@ -909,7 +909,7 @@ PHP_FUNCTION(variant_cmp)
return;
}
- ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags));
+ ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags));
VariantClear(&left_val);
VariantClear(&right_val);
@@ -948,7 +948,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
tmv.tm_isdst = -1;
tzset();
- RETVAL_INT(mktime(&tmv));
+ RETVAL_LONG(mktime(&tmv));
}
VariantClear(&vres);
@@ -959,13 +959,13 @@ PHP_FUNCTION(variant_date_to_timestamp)
Returns a variant date representation of a unix timestamp */
PHP_FUNCTION(variant_date_from_timestamp)
{
- php_int_t timestamp;
+ zend_long timestamp;
time_t ttstamp;
SYSTEMTIME systime;
struct tm *tmv;
VARIANT res;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
&timestamp)) {
return;
}
@@ -1010,7 +1010,7 @@ PHP_FUNCTION(variant_get_type)
}
obj = CDNO_FETCH(zobj);
- RETURN_INT(V_VT(&obj->v));
+ RETURN_LONG(V_VT(&obj->v));
}
/* }}} */
@@ -1020,11 +1020,11 @@ PHP_FUNCTION(variant_set_type)
{
zval *zobj;
php_com_dotnet_object *obj;
- /* VARTYPE == unsigned short */ php_int_t vt;
+ /* VARTYPE == unsigned short */ zend_long vt;
HRESULT res;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "Oi", &zobj, php_com_variant_class_entry, &vt)) {
+ "Ol", &zobj, php_com_variant_class_entry, &vt)) {
return;
}
obj = CDNO_FETCH(zobj);
@@ -1055,12 +1055,12 @@ PHP_FUNCTION(variant_cast)
{
zval *zobj;
php_com_dotnet_object *obj;
- /* VARTYPE == unsigned short */ php_int_t vt;
+ /* VARTYPE == unsigned short */ zend_long vt;
VARIANT vres;
HRESULT res;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "Oi", &zobj, php_com_variant_class_entry, &vt)) {
+ "Ol", &zobj, php_com_variant_class_entry, &vt)) {
return;
}
obj = CDNO_FETCH(zobj);
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index 27ea773748..6112dfb4bf 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -176,7 +176,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
for (i = 0; i < cNames; i++) {
char *name;
- unsigned int namelen;
+ size_t namelen;
zval *tmp;
name = php_com_olestring_to_string(rgszNames[i], &namelen, COMG(code_page) TSRMLS_CC);
@@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
ret = DISP_E_UNKNOWNNAME;
rgDispId[i] = 0;
} else {
- rgDispId[i] = Z_IVAL_P(tmp);
+ rgDispId[i] = Z_LVAL_P(tmp);
}
efree(name);
@@ -220,7 +220,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
{
HRESULT ret = DISP_E_UNKNOWNNAME;
char *name;
- unsigned int namelen;
+ size_t namelen;
zval *tmp;
FETCH_DISP("GetDispID");
@@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
/* Lookup the name in the hash */
if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) {
trace("found it\n");
- *pid = Z_IVAL_P(tmp);
+ *pid = Z_LVAL_P(tmp);
ret = S_OK;
}
@@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) {
/* TODO: add support for overloaded objects */
- trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRSIZE_P(name), wFlags, pdp->cArgs);
+ trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRLEN_P(name), wFlags, pdp->cArgs);
/* convert args into zvals.
* Args are in reverse order */
@@ -283,9 +283,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
* and expose it as a COM exception */
if (wFlags & DISPATCH_PROPERTYGET) {
- retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, 1 TSRMLS_CC);
+ retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, 1 TSRMLS_CC);
} else if (wFlags & DISPATCH_PROPERTYPUT) {
- zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name), &params[0] TSRMLS_CC);
+ zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name), &params[0] TSRMLS_CC);
} else if (wFlags & DISPATCH_METHOD) {
zend_try {
retval = &rv;
@@ -385,7 +385,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername(
FETCH_DISP("GetMemberName");
if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) {
- OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRSIZE_P(name), COMG(code_page) TSRMLS_CC);
+ OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRLEN_P(name), COMG(code_page) TSRMLS_CC);
*pbstrName = SysAllocString(olestr);
efree(olestr);
return S_OK;
@@ -450,7 +450,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
zend_string *name = NULL;
zval *tmp, tmp2;
int keytype;
- php_uint_t pid;
+ zend_ulong pid;
if (disp->dispid_to_name == NULL) {
ALLOC_HASHTABLE(disp->dispid_to_name);
@@ -466,30 +466,30 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
zend_hash_get_current_key_ex(Z_OBJPROP(disp->object), &name,
&pid, 0, &pos))) {
char namebuf[32];
- if (keytype == HASH_KEY_IS_INT) {
- snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid);
- name = STR_INIT(namebuf, strlen(namebuf), 0);
+ if (keytype == HASH_KEY_IS_LONG) {
+ snprintf(namebuf, sizeof(namebuf), ZEND_ULONG_FMT, pid);
+ name = zend_string_init(namebuf, strlen(namebuf), 0);
} else {
- STR_ADDREF(name);
+ zend_string_addref(name);
}
zend_hash_move_forward_ex(Z_OBJPROP(disp->object), &pos);
/* Find the existing id */
if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) {
- STR_RELEASE(name);
+ zend_string_release(name);
continue;
}
/* add the mappings */
- ZVAL_STR(&tmp2, STR_COPY(name));
+ ZVAL_STR_COPY(&tmp2, name);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
- ZVAL_INT(&tmp2, pid);
+ ZVAL_LONG(&tmp2, pid);
zend_hash_update(disp->name_to_dispid, name, &tmp2);
- STR_RELEASE(name);
+ zend_string_release(name);
}
}
@@ -501,30 +501,30 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
&name, &pid, 0, &pos))) {
char namebuf[32];
- if (keytype == HASH_KEY_IS_INT) {
+ if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid);
- name = STR_INIT(namebuf, strlen(namebuf), 0);
+ name = zend_string_init(namebuf, strlen(namebuf), 0);
} else {
- STR_ADDREF(name);
+ zend_string_addref(name);
}
zend_hash_move_forward_ex(&Z_OBJCE(disp->object)->function_table, &pos);
/* Find the existing id */
if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) {
- STR_RELEASE(name);
+ zend_string_release(name);
continue;
}
/* add the mappings */
- ZVAL_STR(&tmp2, STR_COPY(name));
+ ZVAL_STR_COPY(&tmp2, name);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
- ZVAL_INT(&tmp2, pid);
+ ZVAL_LONG(&tmp2, pid);
zend_hash_update(disp->name_to_dispid, name, &tmp2);
- STR_RELEASE(name);
+ zend_string_release(name);
}
}
}
@@ -590,7 +590,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si
zend_string *name = NULL;
zval tmp, *ntmp;
int keytype;
- php_uint_t pid;
+ zend_ulong pid;
disp->dispid_to_name = id_to_name;
@@ -604,11 +604,11 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si
while (HASH_KEY_NON_EXISTENT != (keytype =
zend_hash_get_current_key_ex(id_to_name, &name, &pid, 0, &pos))) {
- if (keytype == HASH_KEY_IS_INT) {
+ if (keytype == HASH_KEY_IS_LONG) {
ntmp = zend_hash_get_current_data_ex(id_to_name, &pos);
- ZVAL_INT(&tmp, pid);
+ ZVAL_LONG(&tmp, pid);
zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp);
}
diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h
index 51f621bd5f..cb60083289 100644
--- a/ext/com_dotnet/php_com_dotnet.h
+++ b/ext/com_dotnet/php_com_dotnet.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index 5d4e75b3f8..e79e6f586d 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,7 +38,7 @@ typedef struct _php_com_dotnet_object {
int modified;
ITypeInfo *typeinfo;
- php_int_t code_page;
+ zend_long code_page;
zend_class_entry *ce;
@@ -87,9 +87,9 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index TSRMLS
/* com_olechar.c */
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
- uint *string_len, int codepage TSRMLS_DC);
+ size_t *string_len, int codepage TSRMLS_DC);
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
- uint string_len, int codepage TSRMLS_DC);
+ size_t string_len, int codepage TSRMLS_DC);
/* com_com.c */
@@ -104,12 +104,12 @@ PHP_FUNCTION(com_get_active_object);
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent, int allow_noarg TSRMLS_DC);
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
- int namelen, DISPID *dispid TSRMLS_DC);
+ size_t namelen, DISPID *dispid TSRMLS_DC);
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
WORD flags, VARIANT *v, int nargs, zval *args, int silent, int allow_noarg TSRMLS_DC);
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC);
-int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
+int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
WORD flags, VARIANT *v, int nargs, zval *args TSRMLS_DC);
/* com_wrapper.c */
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index e9ccc9f3de..41d5559c67 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -146,11 +146,11 @@ static PHP_MINFO_FUNCTION(ctype)
zval *c, tmp; \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
return; \
- if (Z_TYPE_P(c) == IS_INT) { \
- if (Z_IVAL_P(c) <= 255 && Z_IVAL_P(c) >= 0) { \
- RETURN_BOOL(iswhat(Z_IVAL_P(c))); \
- } else if (Z_IVAL_P(c) >= -128 && Z_IVAL_P(c) < 0) { \
- RETURN_BOOL(iswhat(Z_IVAL_P(c) + 256)); \
+ if (Z_TYPE_P(c) == IS_LONG) { \
+ if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
+ RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
+ } else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
+ RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
} \
tmp = *c; \
zval_copy_ctor(&tmp); \
@@ -159,18 +159,18 @@ static PHP_MINFO_FUNCTION(ctype)
tmp = *c; \
} \
if (Z_TYPE(tmp) == IS_STRING) { \
- char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRSIZE(tmp); \
+ char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
if (e == p) { \
- if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \
+ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) { \
- if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \
+ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
} \
- if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \
+ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_TRUE; \
} else { \
RETURN_FALSE; \
diff --git a/ext/ctype/ctype.dsp b/ext/ctype/ctype.dsp
deleted file mode 100644
index 1305c72f6a..0000000000
--- a/ext/ctype/ctype.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ctype" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ctype - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak" CFG="ctype - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ctype - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ctype - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ctype - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D HAVE_CTYPE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ctype.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ctype - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CTYPE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ctype.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ctype - Win32 Release_TS"
-# Name "ctype - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ctype.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ctype.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
index ab5ec44ec4..fc99a58c9b 100644
--- a/ext/ctype/php_ctype.h
+++ b/ext/ctype/php_ctype.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/curl/curl.dsp b/ext/curl/curl.dsp
deleted file mode 100644
index 6524fceb89..0000000000
--- a/ext/curl/curl.dsp
+++ /dev/null
@@ -1,190 +0,0 @@
-# Microsoft Developer Studio Project File - Name="curl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=curl - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak" CFG="curl - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "curl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Release_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "curl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS_SSL"
-# PROP Intermediate_Dir "Debug_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php5ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"MSVCRTD" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none /nodefaultlib
-
-!ELSEIF "$(CFG)" == "curl - Win32 Release_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SSL"
-# PROP Intermediate_Dir "Release_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\php_build\curl\include" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php5ts.lib libcurl.lib ssleay32.lib libeay32.lib msvcrt.lib ws2_32.lib winmm.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\curl\lib"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "curl - Win32 Release_TS"
-# Name "curl - Win32 Debug_TS"
-# Name "curl - Win32 Debug_TS_SSL"
-# Name "curl - Win32 Release_TS_SSL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\interface.c
-# End Source File
-
-# Begin Source File
-SOURCE=.\multi.c
-# End Source File
-
-# Begin Source File
-SOURCE=.\share.c
-# End Source File
-
-# Begin Source File
-SOURCE=.\streams.c
-# End Source File
-
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_curl.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c
index f48480593c..6b0e5462a1 100644
--- a/ext/curl/curl_file.c
+++ b/ext/curl/curl_file.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -32,7 +32,7 @@ PHP_CURL_API zend_class_entry *curl_CURLFile_class;
static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
char *fname = NULL, *mime = NULL, *postname = NULL;
- int fname_len, mime_len, postname_len;
+ size_t fname_len, mime_len, postname_len;
zval *cf = return_value;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
@@ -83,7 +83,7 @@ static void curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS)
static void curlfile_set_property(char *name, INTERNAL_FUNCTION_PARAMETERS)
{
char *arg = NULL;
- int arg_len;
+ size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
return;
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 2f493e2686..affcd02d39 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -82,7 +82,7 @@
#define SMART_STR_PREALLOC 4096
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "ext/standard/url.h"
@@ -154,7 +154,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC);
#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
-#define CAAL(s, v) add_assoc_int_ex(return_value, s, sizeof(s) - 1, (php_int_t) v);
+#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v);
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v);
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : ""));
#define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : STR_EMPTY_ALLOC());
@@ -166,10 +166,15 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC);
# define php_curl_ret(__ret) RETVAL_FALSE; return;
#endif
-static int php_curl_option_str(php_curl *ch, php_int_t option, const char *str, const int len, zend_bool make_copy TSRMLS_DC)
+static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC)
{
CURLcode error = CURLE_OK;
+ if (strlen(str) != len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
+ return FAILURE;
+ }
+
#if LIBCURL_VERSION_NUM >= 0x071100
if (make_copy) {
#endif
@@ -557,6 +562,12 @@ PHP_MINFO_FUNCTION(curl)
#if LIBCURL_VERSION_NUM >= 0x071504 /* 7.21.4 */
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
#endif
+#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
+ {"HTTP2", CURL_VERSION_HTTP2},
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072600 /* 7.38.0 */
+ {"GSSAPI", CURL_VERSION_GSSAPI},
+#endif
{NULL, 0}
};
@@ -612,7 +623,7 @@ PHP_MINFO_FUNCTION(curl)
}
/* }}} */
-#define REGISTER_CURL_CONSTANT(__c) REGISTER_INT_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT)
+#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT)
/* {{{ PHP_MINIT_FUNCTION
*/
@@ -1318,10 +1329,10 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
length = -1;
} else if (!Z_ISUNDEF(retval)) {
- if (Z_TYPE(retval) != IS_INT) {
- convert_to_int_ex(&retval);
+ if (Z_TYPE(retval) != IS_LONG) {
+ convert_to_long_ex(&retval);
}
- length = Z_IVAL(retval);
+ length = Z_LVAL(retval);
}
zval_ptr_dtor(&argv[0]);
@@ -1371,10 +1382,10 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION");
} else if (!Z_ISUNDEF(retval)) {
- if (Z_TYPE(retval) != IS_INT) {
- convert_to_int_ex(&retval);
+ if (Z_TYPE(retval) != IS_LONG) {
+ convert_to_long_ex(&retval);
}
- rval = Z_IVAL(retval);
+ rval = Z_LVAL(retval);
}
zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]);
@@ -1410,10 +1421,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
- ZVAL_INT(&argv[1], (long)dltotal);
- ZVAL_INT(&argv[2], (long)dlnow);
- ZVAL_INT(&argv[3], (long)ultotal);
- ZVAL_INT(&argv[4], (long)ulnow);
+ ZVAL_LONG(&argv[1], (zend_long)dltotal);
+ ZVAL_LONG(&argv[2], (zend_long)dlnow);
+ ZVAL_LONG(&argv[3], (zend_long)ultotal);
+ ZVAL_LONG(&argv[4], (zend_long)ulnow);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
@@ -1431,10 +1442,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
} else if (!Z_ISUNDEF(retval)) {
- if (Z_TYPE(retval) != IS_INT) {
- convert_to_int_ex(&retval);
+ if (Z_TYPE(retval) != IS_LONG) {
+ convert_to_long_ex(&retval);
}
- if (0 != Z_IVAL(retval)) {
+ if (0 != Z_LVAL(retval)) {
rval = 1;
}
}
@@ -1475,7 +1486,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
Z_ADDREF(argv[0]);
ZVAL_RES(&argv[1], t->res);
Z_ADDREF(argv[1]);
- ZVAL_INT(&argv[2], (int)size * nmemb);
+ ZVAL_LONG(&argv[2], (int)size * nmemb);
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
@@ -1497,7 +1508,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
#endif
} else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) == IS_STRING) {
- length = MIN((int) (size * nmemb), Z_STRSIZE(retval));
+ length = MIN((int) (size * nmemb), Z_STRLEN(retval));
memcpy(data, Z_STRVAL(retval), length);
}
zval_ptr_dtor(&retval);
@@ -1562,10 +1573,10 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
length = -1;
} else if (!Z_ISUNDEF(retval)) {
- if (Z_TYPE(retval) != IS_INT) {
- convert_to_int_ex(&retval);
+ if (Z_TYPE(retval) != IS_LONG) {
+ convert_to_long_ex(&retval);
}
- length = Z_IVAL(retval);
+ length = Z_LVAL(retval);
}
zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]);
@@ -1589,10 +1600,10 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v
if (type == CURLINFO_HEADER_OUT) {
if (ch->header.str) {
- STR_RELEASE(ch->header.str);
+ zend_string_release(ch->header.str);
}
if (buf_len > 0) {
- ch->header.str = STR_INIT(buf, buf_len, 0);
+ ch->header.str = zend_string_init(buf, buf_len, 0);
}
}
@@ -1616,16 +1627,16 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
ZVAL_STRING(&argv[1], prompt);
- ZVAL_INT(&argv[2], buflen);
+ ZVAL_LONG(&argv[2], buflen);
error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv TSRMLS_CC);
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION");
} else if (Z_TYPE(retval) == IS_STRING) {
- if (Z_STRSIZE(retval) > buflen) {
+ if (Z_STRLEN(retval) > buflen) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle");
} else {
- memcpy(buf, Z_STRVAL(retval), Z_STRSIZE(retval) + 1);
+ memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1);
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func));
@@ -1670,9 +1681,9 @@ static void curl_free_slist(zval *el)
PHP_FUNCTION(curl_version)
{
curl_version_info_data *d;
- php_int_t uversion = CURLVERSION_NOW;
+ zend_long uversion = CURLVERSION_NOW;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &uversion) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uversion) == FAILURE) {
return;
}
@@ -1832,10 +1843,10 @@ static void _php_curl_set_default_options(php_curl *ch)
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
cainfo = INI_STR("openssl.cafile");
- if (!(cainfo && strlen(cainfo) > 0)) {
+ if (!(cainfo && cainfo[0] != '\0')) {
cainfo = INI_STR("curl.cainfo");
}
- if (cainfo && strlen(cainfo) > 0) {
+ if (cainfo && cainfo[0] != '\0') {
curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo);
}
@@ -1852,7 +1863,7 @@ PHP_FUNCTION(curl_init)
php_curl *ch;
CURL *cp;
char *url = NULL;
- int url_len = 0;
+ size_t url_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &url, &url_len) == FAILURE) {
return;
@@ -1986,15 +1997,15 @@ PHP_FUNCTION(curl_copy_handle)
}
/* }}} */
-static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_DC) /* {{{ */
+static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue TSRMLS_DC) /* {{{ */
{
CURLcode error = CURLE_OK;
switch (option) {
/* Long options */
case CURLOPT_SSL_VERIFYHOST:
- convert_to_int(zvalue);
- if (Z_IVAL_P(zvalue) == 1) {
+ convert_to_long(zvalue);
+ if (Z_LVAL_P(zvalue) == 1) {
#if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead");
#else
@@ -2148,19 +2159,19 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
#if CURLOPT_MUTE != 0
case CURLOPT_MUTE:
#endif
- convert_to_int_ex(zvalue);
+ convert_to_long_ex(zvalue);
#if LIBCURL_VERSION_NUM >= 0x71304
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
- (PG(open_basedir) && *PG(open_basedir)) && (Z_IVAL_P(zvalue) & CURLPROTO_FILE)) {
+ (PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_P(zvalue) & CURLPROTO_FILE)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
return 1;
}
#endif
- error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue));
+ error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue));
break;
case CURLOPT_SAFE_UPLOAD:
- convert_to_int_ex(zvalue);
- ch->safe_upload = (Z_IVAL_P(zvalue) != 0);
+ convert_to_long_ex(zvalue);
+ ch->safe_upload = (Z_LVAL_P(zvalue) != 0);
break;
/* String options */
@@ -2222,7 +2233,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
#endif
{
convert_to_string_ex(zvalue);
- return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC);
+ return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC);
}
/* Curl nullable string options */
@@ -2245,7 +2256,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
error = curl_easy_setopt(ch->cp, option, NULL);
} else {
convert_to_string_ex(zvalue);
- return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC);
+ return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC);
}
break;
}
@@ -2253,12 +2264,12 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
/* Curl private option */
case CURLOPT_PRIVATE:
convert_to_string_ex(zvalue);
- return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 1 TSRMLS_CC);
+ return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 1 TSRMLS_CC);
/* Curl url option */
case CURLOPT_URL:
convert_to_string_ex(zvalue);
- return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue) TSRMLS_CC);
+ return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue) TSRMLS_CC);
/* Curl file handle options */
case CURLOPT_FILE:
@@ -2436,16 +2447,16 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
break;
case CURLOPT_FOLLOWLOCATION:
- convert_to_int_ex(zvalue);
+ convert_to_long_ex(zvalue);
#if LIBCURL_VERSION_NUM < 0x071304
if (PG(open_basedir) && *PG(open_basedir)) {
- if (Z_IVAL_P(zvalue) != 0) {
+ if (Z_LVAL_P(zvalue) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
return FAILURE;
}
}
#endif
- error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue));
+ error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue));
break;
case CURLOPT_HEADERFUNCTION:
@@ -2462,7 +2473,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
zval *current;
HashTable *postfields;
zend_string *string_key;
- ulong num_key;
+ zend_ulong num_key;
struct HttpPost *first = NULL;
struct HttpPost *last = NULL;
@@ -2476,9 +2487,9 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
char *postval;
/* Pretend we have a string_key here */
if (!string_key) {
- string_key = zend_int_to_str(num_key);
+ string_key = zend_long_to_str(num_key);
} else {
- STR_ADDREF(string_key);
+ zend_string_addref(string_key);
}
if (Z_TYPE_P(current) == IS_OBJECT &&
@@ -2498,11 +2509,11 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
}
prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0 TSRMLS_CC);
- if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) {
+ if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
type = Z_STRVAL_P(prop);
}
prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0 TSRMLS_CC);
- if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) {
+ if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
filename = Z_STRVAL_P(prop);
}
error = curl_formadd(&first, &last,
@@ -2514,7 +2525,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
CURLFORM_END);
}
- STR_RELEASE(string_key);
+ zend_string_release(string_key);
continue;
}
@@ -2533,13 +2544,13 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
php_error_docref("curl.curlfile" TSRMLS_CC, E_DEPRECATED,
"The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead");
- name = estrndup(postval, Z_STRSIZE_P(current));
- if ((type = php_memnstr(name, ";type=", sizeof(";type=") - 1,
- name + Z_STRSIZE_P(current)))) {
+ name = estrndup(postval, Z_STRLEN_P(current));
+ if ((type = (char *)php_memnstr(name, ";type=", sizeof(";type=") - 1,
+ name + Z_STRLEN_P(current)))) {
*type = '\0';
}
- if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1,
- name + Z_STRSIZE_P(current)))) {
+ if ((filename = (char *)php_memnstr(name, ";filename=", sizeof(";filename=") - 1,
+ name + Z_STRLEN_P(current)))) {
*filename = '\0';
}
/* open_basedir check */
@@ -2558,13 +2569,13 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
} else {
error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, string_key->val,
- CURLFORM_NAMELENGTH, (long)string_key->len,
+ CURLFORM_NAMELENGTH, (zend_long)string_key->len,
CURLFORM_COPYCONTENTS, postval,
- CURLFORM_CONTENTSLENGTH, (long)Z_STRSIZE_P(current),
+ CURLFORM_CONTENTSLENGTH, (zend_long)Z_STRLEN_P(current),
CURLFORM_END);
}
- STR_RELEASE(string_key);
+ zend_string_release(string_key);
} ZEND_HASH_FOREACH_END();
SAVE_CURL_ERROR(ch, error);
@@ -2581,17 +2592,17 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
#if LIBCURL_VERSION_NUM >= 0x071101
convert_to_string_ex(zvalue);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue));
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue));
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_P(zvalue));
#else
char *post = NULL;
convert_to_string_ex(zvalue);
- post = estrndup(Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue));
+ post = estrndup(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue));
zend_llist_add_element(&ch->to_free->str, &post);
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue));
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue));
#endif
}
break;
@@ -2619,8 +2630,8 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
break;
case CURLOPT_RETURNTRANSFER:
- convert_to_int_ex(zvalue);
- if (Z_IVAL_P(zvalue)) {
+ convert_to_long_ex(zvalue);
+ if (Z_LVAL_P(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
} else {
ch->handlers->write->method = PHP_CURL_STDOUT;
@@ -2639,15 +2650,15 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
#if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */
case CURLOPT_MAX_RECV_SPEED_LARGE:
case CURLOPT_MAX_SEND_SPEED_LARGE:
- convert_to_int_ex(zvalue);
- error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_IVAL_P(zvalue));
+ convert_to_long_ex(zvalue);
+ error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_LVAL_P(zvalue));
break;
#endif
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
case CURLOPT_POSTREDIR:
- convert_to_int_ex(zvalue);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_IVAL_P(zvalue) & CURL_REDIR_POST_ALL);
+ convert_to_long_ex(zvalue);
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_LVAL_P(zvalue) & CURL_REDIR_POST_ALL);
break;
#endif
@@ -2684,16 +2695,16 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
{
convert_to_string_ex(zvalue);
- if (Z_STRSIZE_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) {
+ if (Z_STRLEN_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) {
return FAILURE;
}
- return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC);
+ return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC);
}
case CURLINFO_HEADER_OUT:
- convert_to_int_ex(zvalue);
- if (Z_IVAL_P(zvalue) == 1) {
+ convert_to_long_ex(zvalue);
+ if (Z_LVAL_P(zvalue) == 1) {
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
@@ -2744,10 +2755,10 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
PHP_FUNCTION(curl_setopt)
{
zval *zid, *zvalue;
- php_int_t options;
+ zend_long options;
php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) {
return;
}
@@ -2772,7 +2783,7 @@ PHP_FUNCTION(curl_setopt_array)
{
zval *zid, *arr, *entry;
php_curl *ch;
- php_uint_t option;
+ zend_ulong option;
zend_string *string_key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) {
@@ -2787,7 +2798,7 @@ PHP_FUNCTION(curl_setopt_array)
"Array keys must be CURLOPT constants or equivalent integer values");
RETURN_FALSE;
}
- if (_php_curl_setopt(ch, (php_int_t) option, entry TSRMLS_CC) == FAILURE) {
+ if (_php_curl_setopt(ch, (zend_long) option, entry TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
}
} ZEND_HASH_FOREACH_END();
@@ -2802,7 +2813,7 @@ void _php_curl_cleanup_handle(php_curl *ch)
{
smart_str_free(&ch->handlers->write->buf);
if (ch->header.str) {
- STR_RELEASE(ch->header.str);
+ zend_string_release(ch->header.str);
ch->header.str = NULL;
}
@@ -2847,7 +2858,7 @@ PHP_FUNCTION(curl_exec)
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
smart_str_0(&ch->handlers->write->buf);
- RETURN_STR(STR_COPY(ch->handlers->write->buf.s));
+ RETURN_STR(zend_string_copy(ch->handlers->write->buf.s));
}
/* flush the file handle, so any remaining data is synched to disk */
@@ -2872,9 +2883,9 @@ PHP_FUNCTION(curl_getinfo)
{
zval *zid;
php_curl *ch;
- php_int_t option = 0;
+ zend_long option = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zid, &option) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zid, &option) == FAILURE) {
return;
}
@@ -2882,7 +2893,7 @@ PHP_FUNCTION(curl_getinfo)
if (ZEND_NUM_ARGS() < 2) {
char *s_code;
- php_int_t l_code;
+ zend_long l_code;
double d_code;
#if LIBCURL_VERSION_NUM > 0x071301
struct curl_certinfo *ci = NULL;
@@ -2992,7 +3003,7 @@ PHP_FUNCTION(curl_getinfo)
switch (option) {
case CURLINFO_HEADER_OUT:
if (ch->header.str) {
- RETURN_STR(STR_COPY(ch->header.str));
+ RETURN_STR(zend_string_copy(ch->header.str));
} else {
RETURN_FALSE;
}
@@ -3026,10 +3037,10 @@ PHP_FUNCTION(curl_getinfo)
}
case CURLINFO_LONG:
{
- php_int_t code = 0;
+ zend_long code = 0;
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
- RETURN_INT(code);
+ RETURN_LONG(code);
} else {
RETURN_FALSE;
}
@@ -3103,7 +3114,7 @@ PHP_FUNCTION(curl_errno)
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
- RETURN_INT(ch->err.no);
+ RETURN_LONG(ch->err.no);
}
/* }}} */
@@ -3175,7 +3186,7 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
#endif
zval_ptr_dtor(&ch->handlers->std_err);
if (ch->header.str) {
- STR_RELEASE(ch->header.str);
+ zend_string_release(ch->header.str);
}
zval_ptr_dtor(&ch->handlers->write_header->stream);
@@ -3217,10 +3228,10 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC)
return string describing error code */
PHP_FUNCTION(curl_strerror)
{
- php_int_t code;
+ zend_long code;
const char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) {
return;
}
@@ -3314,7 +3325,7 @@ PHP_FUNCTION(curl_reset)
PHP_FUNCTION(curl_escape)
{
char *str = NULL, *res = NULL;
- int str_len = 0;
+ size_t str_len = 0;
zval *zid;
php_curl *ch;
@@ -3363,17 +3374,17 @@ PHP_FUNCTION(curl_unescape)
pause and unpause a connection */
PHP_FUNCTION(curl_pause)
{
- php_int_t bitmask;
+ zend_long bitmask;
zval *zid;
php_curl *ch;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zid, &bitmask) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zid, &bitmask) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
- RETURN_INT(curl_easy_pause(ch->cp, bitmask));
+ RETURN_LONG(curl_easy_pause(ch->cp, bitmask));
}
/* }}} */
#endif
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index a3441bda78..d9e6df2c98 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -92,7 +92,7 @@ PHP_FUNCTION(curl_multi_add_handle)
zend_llist_add_element(&mh->easyh, &tmp_val);
- RETURN_INT((php_int_t)curl_multi_add_handle(mh->multi, ch->cp));
+ RETURN_LONG((zend_long)curl_multi_add_handle(mh->multi, ch->cp));
}
/* }}} */
@@ -140,7 +140,7 @@ PHP_FUNCTION(curl_multi_remove_handle)
ZEND_FETCH_RESOURCE(mh, php_curlm *, z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle);
ZEND_FETCH_RESOURCE(ch, php_curl *, z_ch, -1, le_curl_name, le_curl);
- RETVAL_INT((php_int_t)curl_multi_remove_handle(mh->multi, ch->cp));
+ RETVAL_LONG((zend_long)curl_multi_remove_handle(mh->multi, ch->cp));
zend_llist_del_element(&mh->easyh, &z_ch, (int (*)(void *, void *))curl_compare_resources);
}
@@ -183,9 +183,9 @@ PHP_FUNCTION(curl_multi_select)
curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
if (maxfd == -1) {
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
- RETURN_INT(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
+ RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
}
/* }}} */
@@ -218,12 +218,12 @@ PHP_FUNCTION(curl_multi_exec)
}
}
- convert_to_int_ex(z_still_running);
- still_running = Z_IVAL_P(z_still_running);
+ convert_to_long_ex(z_still_running);
+ still_running = Z_LVAL_P(z_still_running);
result = curl_multi_perform(mh->multi, &still_running);
- ZVAL_INT(z_still_running, still_running);
+ ZVAL_LONG(z_still_running, still_running);
- RETURN_INT(result);
+ RETURN_LONG(result);
}
/* }}} */
@@ -242,7 +242,7 @@ PHP_FUNCTION(curl_multi_getcontent)
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
smart_str_0(&ch->handlers->write->buf);
- RETURN_STR(STR_COPY(ch->handlers->write->buf.s));
+ RETURN_STR(zend_string_copy(ch->handlers->write->buf.s));
}
RETURN_EMPTY_STRING();
@@ -271,12 +271,12 @@ PHP_FUNCTION(curl_multi_info_read)
}
if (zmsgs_in_queue) {
zval_dtor(zmsgs_in_queue);
- ZVAL_INT(zmsgs_in_queue, queued_msgs);
+ ZVAL_LONG(zmsgs_in_queue, queued_msgs);
}
array_init(return_value);
- add_assoc_int(return_value, "msg", tmp_msg->msg);
- add_assoc_int(return_value, "result", tmp_msg->data.result);
+ add_assoc_long(return_value, "msg", tmp_msg->msg);
+ add_assoc_long(return_value, "result", tmp_msg->data.result);
/* find the original easy curl handle */
{
@@ -357,10 +357,10 @@ void _php_curl_multi_close(zend_resource *rsrc TSRMLS_DC) /* {{{ */
return string describing error code */
PHP_FUNCTION(curl_multi_strerror)
{
- php_int_t code;
+ zend_long code;
const char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) {
return;
}
@@ -375,7 +375,7 @@ PHP_FUNCTION(curl_multi_strerror)
#endif
#if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */
-static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */
+static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
CURLMcode error = CURLM_OK;
@@ -386,8 +386,8 @@ static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue,
#if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */
case CURLMOPT_MAXCONNECTS:
#endif
- convert_to_int_ex(zvalue);
- error = curl_multi_setopt(mh->multi, option, Z_IVAL_P(zvalue));
+ convert_to_long_ex(zvalue);
+ error = curl_multi_setopt(mh->multi, option, Z_LVAL_P(zvalue));
break;
default:
@@ -409,10 +409,10 @@ static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue,
PHP_FUNCTION(curl_multi_setopt)
{
zval *z_mh, *zvalue;
- php_int_t options;
+ zend_long options;
php_curlm *mh;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_mh, &options, &zvalue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_mh, &options, &zvalue) == FAILURE) {
return;
}
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index e82fd3f38b..ad44ae7b96 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,7 @@
#define _PHP_CURL_H
#include "php.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#ifdef COMPILE_DL_CURL
#undef HAVE_CURL
@@ -179,7 +179,7 @@ typedef struct {
php_curl_handlers *handlers;
zend_resource *res;
zend_bool in_callback;
- zend_uint clone;
+ uint32_t clone;
zend_bool safe_upload;
} php_curl;
diff --git a/ext/curl/share.c b/ext/curl/share.c
index a0d5b006d0..94694e0b2e 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -66,15 +66,15 @@ PHP_FUNCTION(curl_share_close)
}
/* }}} */
-static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */
+static int _php_curl_share_setopt(php_curlsh *sh, zend_long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
CURLSHcode error = CURLSHE_OK;
switch (option) {
case CURLSHOPT_SHARE:
case CURLSHOPT_UNSHARE:
- convert_to_int_ex(zvalue);
- error = curl_share_setopt(sh->share, option, Z_IVAL_P(zvalue));
+ convert_to_long_ex(zvalue);
+ error = curl_share_setopt(sh->share, option, Z_LVAL_P(zvalue));
break;
default:
@@ -96,10 +96,10 @@ static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue
PHP_FUNCTION(curl_share_setopt)
{
zval *zid, *zvalue;
- php_int_t options;
+ zend_long options;
php_curlsh *sh;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) {
return;
}
diff --git a/ext/curl/tests/bug68089.phpt b/ext/curl/tests/bug68089.phpt
new file mode 100644
index 0000000000..3bd5889709
--- /dev/null
+++ b/ext/curl/tests/bug68089.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #68089 (NULL byte injection - cURL lib)
+--SKIPIF--
+<?php
+include 'skipif.inc';
+
+?>
+--FILE--
+<?php
+$url = "file:///etc/passwd\0http://google.com";
+$ch = curl_init();
+var_dump(curl_setopt($ch, CURLOPT_URL, $url));
+?>
+Done
+--EXPECTF--
+Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
+bool(false)
+Done
diff --git a/ext/curl/tests/check_win_config.phpt b/ext/curl/tests/check_win_config.phpt
index 103f1cf692..3d13638f90 100644
--- a/ext/curl/tests/check_win_config.phpt
+++ b/ext/curl/tests/check_win_config.phpt
@@ -28,7 +28,7 @@ Features
AsynchDNS => Yes
CharConv => No
Debug => No
-GSS-Negotiate => Yes
+GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
@@ -40,6 +40,8 @@ SPNEGO => Yes
SSL => Yes
SSPI => Yes
TLS-SRP => No
+HTTP2 => No
+GSSAPI => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => %s-pc-win32
SSL Version => OpenSSL/%s
diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c
index 7f51c71d92..84e8a40021 100644
--- a/ext/date/lib/astro.c
+++ b/ext/date/lib/astro.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index a77fdd7182..1739566728 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c
index 86e98ea744..58a185d3be 100644
--- a/ext/date/lib/interval.c
+++ b/ext/date/lib/interval.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index ad9727d197..2a615559f6 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,8 +1,8 @@
-/* Generated by re2c 0.13.5 on Tue Aug 19 08:27:07 2014 */
+/* Generated by re2c 0.13.5 on Tue Aug 26 10:40:19 2014 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -566,11 +566,11 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
return timelib_lookup_relative_text(ptr, behavior);
}
-static long timelib_lookup_month(char **ptr)
+static timelib_long timelib_lookup_month(char **ptr)
{
char *word;
char *begin = *ptr, *end;
- long value = 0;
+ timelib_long value = 0;
const timelib_lookup_table *tp;
while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
@@ -590,7 +590,7 @@ static long timelib_lookup_month(char **ptr)
return value;
}
-static long timelib_get_month(char **ptr)
+static timelib_long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
@@ -670,7 +670,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
-const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
+const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@@ -708,11 +708,11 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
-static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
+static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
- long value = 0;
+ timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
@@ -735,10 +735,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
-long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
+timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
{
timelib_tzinfo *res;
- long retval = 0;
+ timelib_long retval = 0;
*tz_not_found = 0;
@@ -766,7 +766,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
- long offset = 0;
+ timelib_long offset = 0;
char *tz_abbr;
t->is_localtime = 1;
@@ -25193,7 +25193,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
-char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
+char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index c7953e75ba..cb5df16251 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -564,11 +564,11 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
return timelib_lookup_relative_text(ptr, behavior);
}
-static long timelib_lookup_month(char **ptr)
+static timelib_long timelib_lookup_month(char **ptr)
{
char *word;
char *begin = *ptr, *end;
- long value = 0;
+ timelib_long value = 0;
const timelib_lookup_table *tp;
while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
@@ -588,7 +588,7 @@ static long timelib_lookup_month(char **ptr)
return value;
}
-static long timelib_get_month(char **ptr)
+static timelib_long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
@@ -668,7 +668,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
}
}
-const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
+const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
{
int first_found = 0;
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
@@ -706,11 +706,11 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs
return NULL;
}
-static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
+static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
{
char *word;
char *begin = *ptr, *end;
- long value = 0;
+ timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
@@ -733,10 +733,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found
return value;
}
-long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
+timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
{
timelib_tzinfo *res;
- long retval = 0;
+ timelib_long retval = 0;
*tz_not_found = 0;
@@ -764,7 +764,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
retval = timelib_parse_tz_cor(ptr);
} else {
int found = 0;
- long offset = 0;
+ timelib_long offset = 0;
char *tz_abbr;
t->is_localtime = 1;
@@ -2202,7 +2202,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
-char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
+char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;
diff --git a/ext/date/lib/parse_iso_intervals.c b/ext/date/lib/parse_iso_intervals.c
index c14a07465a..3b7580f9d1 100644
--- a/ext/date/lib/parse_iso_intervals.c
+++ b/ext/date/lib/parse_iso_intervals.c
@@ -1,8 +1,8 @@
-/* Generated by re2c 0.13.5 on Wed Nov 27 11:14:23 2013 */
+/* Generated by re2c 0.13.5 on Tue Aug 26 10:39:58 2014 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -190,9 +190,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
-static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
+static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
- long retval = 0;
+ timelib_long retval = 0;
*tz_not_found = 0;
diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re
index 8c82cfc3b9..097488ec57 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -188,9 +188,9 @@ static void timelib_eat_until_separator(char **ptr)
}
}
-static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
+static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
{
- long retval = 0;
+ timelib_long retval = 0;
*tz_not_found = 0;
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 5d2aec9c93..a503f9e01e 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -221,12 +221,12 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
printf("Geo Location: %f,%f\n", tz->location.latitude, tz->location.longitude);
printf("Comments:\n%s\n", tz->location.comments);
printf("BC: %s\n", tz->bc ? "" : "yes");
- printf("UTC/Local count: %lu\n", (unsigned long) tz->ttisgmtcnt);
- printf("Std/Wall count: %lu\n", (unsigned long) tz->ttisstdcnt);
- printf("Leap.sec. count: %lu\n", (unsigned long) tz->leapcnt);
- printf("Trans. count: %lu\n", (unsigned long) tz->timecnt);
- printf("Local types count: %lu\n", (unsigned long) tz->typecnt);
- printf("Zone Abbr. count: %lu\n", (unsigned long) tz->charcnt);
+ printf("UTC/Local count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->ttisgmtcnt);
+ printf("Std/Wall count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->ttisstdcnt);
+ printf("Leap.sec. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->leapcnt);
+ printf("Trans. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->timecnt);
+ printf("Local types count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->typecnt);
+ printf("Zone Abbr. count: " TIMELIB_ULONG_FMT "\n", (timelib_ulong) tz->charcnt);
printf ("%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n",
"", "", 0,
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index ad25f8b5c6..ea88a2256a 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -71,10 +71,11 @@ timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
{
unsigned int i;
+ size_t tz_abbr_len = strlen(tz_abbr);
TIMELIB_TIME_FREE(tm->tz_abbr);
tm->tz_abbr = strdup(tz_abbr);
- for (i = 0; i < strlen(tz_abbr); i++) {
+ for (i = 0; i < tz_abbr_len; i++) {
tm->tz_abbr[i] = toupper(tz_abbr[i]);
}
}
@@ -176,13 +177,13 @@ void timelib_error_container_dtor(timelib_error_container *errors)
free(errors);
}
-php_int_t timelib_date_to_int(timelib_time *d, int *error)
+timelib_long timelib_date_to_int(timelib_time *d, int *error)
{
timelib_sll ts;
ts = d->sse;
- if (ts < PHP_INT_MIN || ts > PHP_INT_MAX) {
+ if (ts < TIMELIB_LONG_MIN || ts > TIMELIB_LONG_MAX) {
if (error) {
*error = 1;
}
@@ -191,7 +192,7 @@ php_int_t timelib_date_to_int(timelib_time *d, int *error)
if (error) {
*error = 0;
}
- return (php_int_t) d->sse;
+ return (timelib_long) d->sse;
}
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
@@ -286,10 +287,10 @@ void timelib_dump_rel_time(timelib_rel_time *d)
printf("\n");
}
-long timelib_parse_tz_cor(char **ptr)
+timelib_long timelib_parse_tz_cor(char **ptr)
{
char *begin = *ptr, *end;
- long tmp;
+ timelib_long tmp;
while (isdigit(**ptr) || **ptr == ':') {
++*ptr;
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index 45160ae238..b7c49888cb 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -21,7 +21,6 @@
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
-#include "php.h" /* for php_int_t */
#include "timelib_structs.h"
#if HAVE_LIMITS_H
#include <limits.h>
@@ -72,9 +71,9 @@ int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
-char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
+char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
-long timelib_parse_tz_cor(char**);
+timelib_long timelib_parse_tz_cor(char**);
/* From parse_iso_intervals.re */
void timelib_strtointerval(char *s, int len,
@@ -106,7 +105,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t);
void timelib_dump_tzinfo(timelib_tzinfo *tz);
const timelib_tzdb *timelib_builtin_db(void);
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
-long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
+timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
/* From timelib.c */
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
@@ -129,12 +128,12 @@ void timelib_time_offset_dtor(timelib_time_offset* t);
void timelib_error_container_dtor(timelib_error_container *errors);
-php_int_t timelib_date_to_int(timelib_time *d, int *error);
+timelib_long timelib_date_to_int(timelib_time *d, int *error);
void timelib_dump_date(timelib_time *d, int options);
void timelib_dump_rel_time(timelib_rel_time *d);
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
-long timelib_parse_tz_cor(char **ptr);
+timelib_long timelib_parse_tz_cor(char **ptr);
/* from astro.c */
double timelib_ts_to_juliandate(timelib_sll ts);
diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h
index 5033321356..3f9f5b07e7 100644
--- a/ext/date/lib/timelib_structs.h
+++ b/ext/date/lib/timelib_structs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,6 +37,24 @@
#include <strings.h>
#endif
+#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
+typedef int64_t timelib_long;
+typedef uint64_t timelib_ulong;
+# define TIMELIB_LONG_MAX INT64_MAX
+# define TIMELIB_LONG_MIN INT64_MIN
+# define TIMELIB_ULONG_MAX UINT64_MAX
+# define TIMELIB_LONG_FMT "%" PRId64
+# define TIMELIB_ULONG_FMT "%" PRIu64
+#else
+typedef int32_t timelib_long;
+typedef uint32_t timelib_ulong;
+# define TIMELIB_LONG_MAX INT32_MAX
+# define TIMELIB_LONG_MIN INT32_MIN
+# define TIMELIB_ULONG_MAX UINT32_MAX
+# define TIMELIB_LONG_FMT "%" PRId32
+# define TIMELIB_ULONG_FMT "%" PRIu32
+#endif
+
#if defined(_MSC_VER)
typedef uint64_t timelib_ull;
typedef int64_t timelib_sll;
@@ -155,10 +173,10 @@ typedef struct timelib_error_message {
} timelib_error_message;
typedef struct timelib_error_container {
- int warning_count;
+ struct timelib_error_message *error_messages;
struct timelib_error_message *warning_messages;
int error_count;
- struct timelib_error_message *error_messages;
+ int warning_count;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h
index 5423a58d26..98e7b2292c 100644
--- a/ext/date/lib/timezonedb.h
+++ b/ext/date/lib/timezonedb.h
@@ -12,578 +12,578 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[582] = {
{ "Africa/Blantyre" , 0x00052F },
{ "Africa/Brazzaville" , 0x000584 },
{ "Africa/Bujumbura" , 0x0005D9 },
- { "Africa/Cairo" , 0x00061D },
- { "Africa/Casablanca" , 0x000A04 },
- { "Africa/Ceuta" , 0x000C66 },
- { "Africa/Conakry" , 0x000F6D },
- { "Africa/Dakar" , 0x000FC2 },
- { "Africa/Dar_es_Salaam" , 0x001017 },
- { "Africa/Djibouti" , 0x001084 },
- { "Africa/Douala" , 0x0010D9 },
- { "Africa/El_Aaiun" , 0x00112E },
- { "Africa/Freetown" , 0x001359 },
- { "Africa/Gaborone" , 0x0013AE },
- { "Africa/Harare" , 0x00141B },
- { "Africa/Johannesburg" , 0x001470 },
- { "Africa/Juba" , 0x0014DE },
- { "Africa/Kampala" , 0x0015F1 },
- { "Africa/Khartoum" , 0x001670 },
- { "Africa/Kigali" , 0x001783 },
- { "Africa/Kinshasa" , 0x0017D8 },
- { "Africa/Lagos" , 0x001833 },
- { "Africa/Libreville" , 0x001888 },
- { "Africa/Lome" , 0x0018DD },
- { "Africa/Luanda" , 0x001932 },
- { "Africa/Lubumbashi" , 0x001987 },
- { "Africa/Lusaka" , 0x0019E2 },
- { "Africa/Malabo" , 0x001A37 },
- { "Africa/Maputo" , 0x001A9D },
- { "Africa/Maseru" , 0x001AF2 },
- { "Africa/Mbabane" , 0x001B5A },
- { "Africa/Mogadishu" , 0x001BB0 },
- { "Africa/Monrovia" , 0x001C0B },
- { "Africa/Nairobi" , 0x001C71 },
- { "Africa/Ndjamena" , 0x001CF0 },
- { "Africa/Niamey" , 0x001D5C },
- { "Africa/Nouakchott" , 0x001DCF },
- { "Africa/Ouagadougou" , 0x001E24 },
- { "Africa/Porto-Novo" , 0x001E79 },
- { "Africa/Sao_Tome" , 0x001EDF },
- { "Africa/Timbuktu" , 0x001F34 },
- { "Africa/Tripoli" , 0x001F89 },
- { "Africa/Tunis" , 0x002092 },
- { "Africa/Windhoek" , 0x0021A4 },
- { "America/Adak" , 0x0023EB },
- { "America/Anchorage" , 0x002761 },
- { "America/Anguilla" , 0x002AD5 },
- { "America/Antigua" , 0x002B2A },
- { "America/Araguaina" , 0x002B90 },
- { "America/Argentina/Buenos_Aires" , 0x002CF5 },
- { "America/Argentina/Catamarca" , 0x002EA3 },
- { "America/Argentina/ComodRivadavia" , 0x003064 },
- { "America/Argentina/Cordoba" , 0x00320A },
- { "America/Argentina/Jujuy" , 0x0033DF },
- { "America/Argentina/La_Rioja" , 0x003593 },
- { "America/Argentina/Mendoza" , 0x00374B },
- { "America/Argentina/Rio_Gallegos" , 0x00390B },
- { "America/Argentina/Salta" , 0x003AC0 },
- { "America/Argentina/San_Juan" , 0x003C6C },
- { "America/Argentina/San_Luis" , 0x003E24 },
- { "America/Argentina/Tucuman" , 0x003FEA },
- { "America/Argentina/Ushuaia" , 0x0041A6 },
- { "America/Aruba" , 0x004361 },
- { "America/Asuncion" , 0x0043C7 },
- { "America/Atikokan" , 0x0046AC },
- { "America/Atka" , 0x004782 },
- { "America/Bahia" , 0x004AE8 },
- { "America/Bahia_Banderas" , 0x004C7B },
- { "America/Barbados" , 0x004EF4 },
- { "America/Belem" , 0x004F8E },
- { "America/Belize" , 0x005089 },
- { "America/Blanc-Sablon" , 0x005205 },
- { "America/Boa_Vista" , 0x0052B9 },
- { "America/Bogota" , 0x0053C2 },
- { "America/Boise" , 0x00542E },
- { "America/Buenos_Aires" , 0x0057C5 },
- { "America/Cambridge_Bay" , 0x00595E },
- { "America/Campo_Grande" , 0x005C86 },
- { "America/Cancun" , 0x005F75 },
- { "America/Caracas" , 0x0061B7 },
- { "America/Catamarca" , 0x00621E },
- { "America/Cayenne" , 0x0063C4 },
- { "America/Cayman" , 0x006426 },
- { "America/Chicago" , 0x00647B },
- { "America/Chihuahua" , 0x006992 },
- { "America/Coral_Harbour" , 0x006BFD },
- { "America/Cordoba" , 0x006C8F },
- { "America/Costa_Rica" , 0x006E35 },
- { "America/Creston" , 0x006EBF },
- { "America/Cuiaba" , 0x006F4B },
- { "America/Curacao" , 0x007229 },
- { "America/Danmarkshavn" , 0x00728F },
- { "America/Dawson" , 0x0073D3 },
- { "America/Dawson_Creek" , 0x0076F0 },
- { "America/Denver" , 0x0078CA },
- { "America/Detroit" , 0x007C50 },
- { "America/Dominica" , 0x007FAF },
- { "America/Edmonton" , 0x008004 },
- { "America/Eirunepe" , 0x0083BC },
- { "America/El_Salvador" , 0x0084D4 },
- { "America/Ensenada" , 0x008549 },
- { "America/Fort_Wayne" , 0x0089F0 },
- { "America/Fortaleza" , 0x0088B2 },
- { "America/Glace_Bay" , 0x008C5A },
- { "America/Godthab" , 0x008FD1 },
- { "America/Goose_Bay" , 0x009295 },
- { "America/Grand_Turk" , 0x009752 },
- { "America/Grenada" , 0x009A01 },
- { "America/Guadeloupe" , 0x009A56 },
- { "America/Guatemala" , 0x009AAB },
- { "America/Guayaquil" , 0x009B34 },
- { "America/Guyana" , 0x009B91 },
- { "America/Halifax" , 0x009C12 },
- { "America/Havana" , 0x00A128 },
- { "America/Hermosillo" , 0x00A49B },
- { "America/Indiana/Indianapolis" , 0x00A579 },
- { "America/Indiana/Knox" , 0x00A80A },
- { "America/Indiana/Marengo" , 0x00ABA1 },
- { "America/Indiana/Petersburg" , 0x00AE47 },
- { "America/Indiana/Tell_City" , 0x00B394 },
- { "America/Indiana/Vevay" , 0x00B62D },
- { "America/Indiana/Vincennes" , 0x00B868 },
- { "America/Indiana/Winamac" , 0x00BB1C },
- { "America/Indianapolis" , 0x00B12A },
- { "America/Inuvik" , 0x00BDD5 },
- { "America/Iqaluit" , 0x00C0CC },
- { "America/Jamaica" , 0x00C3EE },
- { "America/Jujuy" , 0x00C4B3 },
- { "America/Juneau" , 0x00C65D },
- { "America/Kentucky/Louisville" , 0x00C9DB },
- { "America/Kentucky/Monticello" , 0x00CDF9 },
- { "America/Knox_IN" , 0x00D17E },
- { "America/Kralendijk" , 0x00D4EF },
- { "America/La_Paz" , 0x00D555 },
- { "America/Lima" , 0x00D5BC },
- { "America/Los_Angeles" , 0x00D664 },
- { "America/Louisville" , 0x00DA75 },
- { "America/Lower_Princes" , 0x00DE6A },
- { "America/Maceio" , 0x00DED0 },
- { "America/Managua" , 0x00E00A },
- { "America/Manaus" , 0x00E0BD },
- { "America/Marigot" , 0x00E1BF },
- { "America/Martinique" , 0x00E214 },
- { "America/Matamoros" , 0x00E280 },
- { "America/Mazatlan" , 0x00E4D9 },
- { "America/Mendoza" , 0x00E746 },
- { "America/Menominee" , 0x00E8FA },
- { "America/Merida" , 0x00EC7B },
- { "America/Metlakatla" , 0x00EEB6 },
- { "America/Mexico_City" , 0x00EFF1 },
- { "America/Miquelon" , 0x00F26C },
- { "America/Moncton" , 0x00F4DE },
- { "America/Monterrey" , 0x00F975 },
- { "America/Montevideo" , 0x00FBD8 },
- { "America/Montreal" , 0x00FEEA },
- { "America/Montserrat" , 0x0103DA },
- { "America/Nassau" , 0x01042F },
- { "America/New_York" , 0x010774 },
- { "America/Nipigon" , 0x010C7F },
- { "America/Nome" , 0x010FD0 },
- { "America/Noronha" , 0x01134E },
- { "America/North_Dakota/Beulah" , 0x01147E },
- { "America/North_Dakota/Center" , 0x011812 },
- { "America/North_Dakota/New_Salem" , 0x011BA6 },
- { "America/Ojinaga" , 0x011F4F },
- { "America/Panama" , 0x0121B0 },
- { "America/Pangnirtung" , 0x012205 },
- { "America/Paramaribo" , 0x01253B },
- { "America/Phoenix" , 0x0125CD },
- { "America/Port-au-Prince" , 0x01268B },
- { "America/Port_of_Spain" , 0x0129AF },
- { "America/Porto_Acre" , 0x0128AB },
- { "America/Porto_Velho" , 0x012A04 },
- { "America/Puerto_Rico" , 0x012AFA },
- { "America/Rainy_River" , 0x012B65 },
- { "America/Rankin_Inlet" , 0x012E9D },
- { "America/Recife" , 0x013183 },
- { "America/Regina" , 0x0132AD },
- { "America/Resolute" , 0x01346B },
- { "America/Rio_Branco" , 0x013753 },
- { "America/Rosario" , 0x01385B },
- { "America/Santa_Isabel" , 0x013A01 },
- { "America/Santarem" , 0x013DA4 },
- { "America/Santiago" , 0x013EA9 },
- { "America/Santo_Domingo" , 0x014252 },
- { "America/Sao_Paulo" , 0x014318 },
- { "America/Scoresbysund" , 0x014627 },
- { "America/Shiprock" , 0x014915 },
- { "America/Sitka" , 0x014C8E },
- { "America/St_Barthelemy" , 0x015016 },
- { "America/St_Johns" , 0x01506B },
- { "America/St_Kitts" , 0x0155BE },
- { "America/St_Lucia" , 0x015613 },
- { "America/St_Thomas" , 0x015668 },
- { "America/St_Vincent" , 0x0156BD },
- { "America/Swift_Current" , 0x015712 },
- { "America/Tegucigalpa" , 0x015833 },
- { "America/Thule" , 0x0158B2 },
- { "America/Thunder_Bay" , 0x015AF9 },
- { "America/Tijuana" , 0x015E42 },
- { "America/Toronto" , 0x0161DB },
- { "America/Tortola" , 0x0166FB },
- { "America/Vancouver" , 0x016750 },
- { "America/Virgin" , 0x016B8D },
- { "America/Whitehorse" , 0x016BE2 },
- { "America/Winnipeg" , 0x016EFF },
- { "America/Yakutat" , 0x01733F },
- { "America/Yellowknife" , 0x0176AA },
- { "Antarctica/Casey" , 0x0179BA },
- { "Antarctica/Davis" , 0x017A58 },
- { "Antarctica/DumontDUrville" , 0x017AF9 },
- { "Antarctica/Macquarie" , 0x017B8B },
- { "Antarctica/Mawson" , 0x017DD8 },
- { "Antarctica/McMurdo" , 0x017E54 },
- { "Antarctica/Palmer" , 0x0181FF },
- { "Antarctica/Rothera" , 0x01851B },
- { "Antarctica/South_Pole" , 0x018591 },
- { "Antarctica/Syowa" , 0x01890F },
- { "Antarctica/Troll" , 0x01897D },
- { "Antarctica/Vostok" , 0x018B4F },
- { "Arctic/Longyearbyen" , 0x018BC0 },
- { "Asia/Aden" , 0x018EF2 },
- { "Asia/Almaty" , 0x018F47 },
- { "Asia/Amman" , 0x0190C6 },
- { "Asia/Anadyr" , 0x01937C },
- { "Asia/Aqtau" , 0x01957E },
- { "Asia/Aqtobe" , 0x01977D },
- { "Asia/Ashgabat" , 0x019935 },
- { "Asia/Ashkhabad" , 0x019A52 },
- { "Asia/Baghdad" , 0x019B6F },
- { "Asia/Bahrain" , 0x019CE4 },
- { "Asia/Baku" , 0x019D4A },
- { "Asia/Bangkok" , 0x01A032 },
- { "Asia/Beirut" , 0x01A087 },
- { "Asia/Bishkek" , 0x01A394 },
- { "Asia/Brunei" , 0x01A540 },
- { "Asia/Calcutta" , 0x01A5A2 },
- { "Asia/Chita" , 0x01A61B },
- { "Asia/Choibalsan" , 0x01A830 },
- { "Asia/Chongqing" , 0x01A9A9 },
- { "Asia/Chungking" , 0x01AA49 },
- { "Asia/Colombo" , 0x01AAE9 },
- { "Asia/Dacca" , 0x01AB85 },
- { "Asia/Damascus" , 0x01AC2B },
- { "Asia/Dhaka" , 0x01AF7B },
- { "Asia/Dili" , 0x01B021 },
- { "Asia/Dubai" , 0x01B0AB },
- { "Asia/Dushanbe" , 0x01B100 },
- { "Asia/Gaza" , 0x01B203 },
- { "Asia/Harbin" , 0x01B556 },
- { "Asia/Hebron" , 0x01B5F6 },
- { "Asia/Ho_Chi_Minh" , 0x01B952 },
- { "Asia/Hong_Kong" , 0x01B9CA },
- { "Asia/Hovd" , 0x01BB8C },
- { "Asia/Irkutsk" , 0x01BD04 },
- { "Asia/Istanbul" , 0x01BEEF },
- { "Asia/Jakarta" , 0x01C2DC },
- { "Asia/Jayapura" , 0x01C386 },
- { "Asia/Jerusalem" , 0x01C423 },
- { "Asia/Kabul" , 0x01C752 },
- { "Asia/Kamchatka" , 0x01C7A3 },
- { "Asia/Karachi" , 0x01C99C },
- { "Asia/Kashgar" , 0x01CA51 },
- { "Asia/Kathmandu" , 0x01CAA6 },
- { "Asia/Katmandu" , 0x01CB0C },
- { "Asia/Khandyga" , 0x01CB72 },
- { "Asia/Kolkata" , 0x01CD9C },
- { "Asia/Krasnoyarsk" , 0x01CE15 },
- { "Asia/Kuala_Lumpur" , 0x01D002 },
- { "Asia/Kuching" , 0x01D0BF },
- { "Asia/Kuwait" , 0x01D1AD },
- { "Asia/Macao" , 0x01D202 },
- { "Asia/Macau" , 0x01D33D },
- { "Asia/Magadan" , 0x01D478 },
- { "Asia/Makassar" , 0x01D67C },
- { "Asia/Manila" , 0x01D741 },
- { "Asia/Muscat" , 0x01D7C6 },
- { "Asia/Nicosia" , 0x01D81B },
- { "Asia/Novokuznetsk" , 0x01DB03 },
- { "Asia/Novosibirsk" , 0x01DD23 },
- { "Asia/Omsk" , 0x01DF13 },
- { "Asia/Oral" , 0x01E0FF },
- { "Asia/Phnom_Penh" , 0x01E2CF },
- { "Asia/Pontianak" , 0x01E347 },
- { "Asia/Pyongyang" , 0x01E409 },
- { "Asia/Qatar" , 0x01E499 },
- { "Asia/Qyzylorda" , 0x01E4FF },
- { "Asia/Rangoon" , 0x01E6D5 },
- { "Asia/Riyadh" , 0x01E74D },
- { "Asia/Saigon" , 0x01E7A2 },
- { "Asia/Sakhalin" , 0x01E81A },
- { "Asia/Samarkand" , 0x01EA17 },
- { "Asia/Seoul" , 0x01EB4D },
- { "Asia/Shanghai" , 0x01EC14 },
- { "Asia/Singapore" , 0x01ECC0 },
- { "Asia/Srednekolymsk" , 0x01ED77 },
- { "Asia/Taipei" , 0x01EF77 },
- { "Asia/Tashkent" , 0x01F0A8 },
- { "Asia/Tbilisi" , 0x01F1D9 },
- { "Asia/Tehran" , 0x01F393 },
- { "Asia/Tel_Aviv" , 0x01F601 },
- { "Asia/Thimbu" , 0x01F930 },
- { "Asia/Thimphu" , 0x01F996 },
- { "Asia/Tokyo" , 0x01F9FC },
- { "Asia/Ujung_Pandang" , 0x01FA86 },
- { "Asia/Ulaanbaatar" , 0x01FB03 },
- { "Asia/Ulan_Bator" , 0x01FC5E },
- { "Asia/Urumqi" , 0x01FDAB },
- { "Asia/Ust-Nera" , 0x01FE0D },
- { "Asia/Vientiane" , 0x02001F },
- { "Asia/Vladivostok" , 0x020097 },
- { "Asia/Yakutsk" , 0x020281 },
- { "Asia/Yekaterinburg" , 0x02046B },
- { "Asia/Yerevan" , 0x02067B },
- { "Atlantic/Azores" , 0x02087B },
- { "Atlantic/Bermuda" , 0x020D7E },
- { "Atlantic/Canary" , 0x02105F },
- { "Atlantic/Cape_Verde" , 0x021335 },
- { "Atlantic/Faeroe" , 0x0213AE },
- { "Atlantic/Faroe" , 0x021652 },
- { "Atlantic/Jan_Mayen" , 0x0218F6 },
- { "Atlantic/Madeira" , 0x021C28 },
- { "Atlantic/Reykjavik" , 0x022131 },
- { "Atlantic/South_Georgia" , 0x0222EA },
- { "Atlantic/St_Helena" , 0x0224FC },
- { "Atlantic/Stanley" , 0x02232E },
- { "Australia/ACT" , 0x022551 },
- { "Australia/Adelaide" , 0x022874 },
- { "Australia/Brisbane" , 0x022BA6 },
- { "Australia/Broken_Hill" , 0x022C73 },
- { "Australia/Canberra" , 0x022FB7 },
- { "Australia/Currie" , 0x0232DA },
- { "Australia/Darwin" , 0x023613 },
- { "Australia/Eucla" , 0x02369F },
- { "Australia/Hobart" , 0x02377B },
- { "Australia/LHI" , 0x023ADF },
- { "Australia/Lindeman" , 0x023D80 },
- { "Australia/Lord_Howe" , 0x023E67 },
- { "Australia/Melbourne" , 0x024118 },
- { "Australia/North" , 0x024443 },
- { "Australia/NSW" , 0x0244BD },
- { "Australia/Perth" , 0x0247E0 },
- { "Australia/Queensland" , 0x0248BE },
- { "Australia/South" , 0x024970 },
- { "Australia/Sydney" , 0x024C93 },
- { "Australia/Tasmania" , 0x024FD6 },
- { "Australia/Victoria" , 0x025321 },
- { "Australia/West" , 0x025644 },
- { "Australia/Yancowinna" , 0x025700 },
- { "Brazil/Acre" , 0x025A28 },
- { "Brazil/DeNoronha" , 0x025B2C },
- { "Brazil/East" , 0x025C4C },
- { "Brazil/West" , 0x025F29 },
- { "Canada/Atlantic" , 0x026021 },
- { "Canada/Central" , 0x026509 },
- { "Canada/East-Saskatchewan" , 0x026E13 },
- { "Canada/Eastern" , 0x026923 },
- { "Canada/Mountain" , 0x026F9C },
- { "Canada/Newfoundland" , 0x027312 },
- { "Canada/Pacific" , 0x02783D },
- { "Canada/Saskatchewan" , 0x027C56 },
- { "Canada/Yukon" , 0x027DDF },
- { "CET" , 0x0280E2 },
- { "Chile/Continental" , 0x0283EB },
- { "Chile/EasterIsland" , 0x028786 },
- { "CST6CDT" , 0x028AC8 },
- { "Cuba" , 0x028E19 },
- { "EET" , 0x02918C },
- { "Egypt" , 0x02943F },
- { "Eire" , 0x029826 },
- { "EST" , 0x029D37 },
- { "EST5EDT" , 0x029D7B },
- { "Etc/GMT" , 0x02A0CC },
- { "Etc/GMT+0" , 0x02A198 },
- { "Etc/GMT+1" , 0x02A222 },
- { "Etc/GMT+10" , 0x02A2AF },
- { "Etc/GMT+11" , 0x02A33D },
- { "Etc/GMT+12" , 0x02A3CB },
- { "Etc/GMT+2" , 0x02A4E6 },
- { "Etc/GMT+3" , 0x02A572 },
- { "Etc/GMT+4" , 0x02A5FE },
- { "Etc/GMT+5" , 0x02A68A },
- { "Etc/GMT+6" , 0x02A716 },
- { "Etc/GMT+7" , 0x02A7A2 },
- { "Etc/GMT+8" , 0x02A82E },
- { "Etc/GMT+9" , 0x02A8BA },
- { "Etc/GMT-0" , 0x02A154 },
- { "Etc/GMT-1" , 0x02A1DC },
- { "Etc/GMT-10" , 0x02A268 },
- { "Etc/GMT-11" , 0x02A2F6 },
- { "Etc/GMT-12" , 0x02A384 },
- { "Etc/GMT-13" , 0x02A412 },
- { "Etc/GMT-14" , 0x02A459 },
- { "Etc/GMT-2" , 0x02A4A0 },
- { "Etc/GMT-3" , 0x02A52C },
- { "Etc/GMT-4" , 0x02A5B8 },
- { "Etc/GMT-5" , 0x02A644 },
- { "Etc/GMT-6" , 0x02A6D0 },
- { "Etc/GMT-7" , 0x02A75C },
- { "Etc/GMT-8" , 0x02A7E8 },
- { "Etc/GMT-9" , 0x02A874 },
- { "Etc/GMT0" , 0x02A110 },
- { "Etc/Greenwich" , 0x02A900 },
- { "Etc/UCT" , 0x02A944 },
- { "Etc/Universal" , 0x02A988 },
- { "Etc/UTC" , 0x02A9CC },
- { "Etc/Zulu" , 0x02AA10 },
- { "Europe/Amsterdam" , 0x02AA54 },
- { "Europe/Andorra" , 0x02AE92 },
- { "Europe/Athens" , 0x02B10E },
- { "Europe/Belfast" , 0x02B451 },
- { "Europe/Belgrade" , 0x02B988 },
- { "Europe/Berlin" , 0x02BC51 },
- { "Europe/Bratislava" , 0x02BFB5 },
- { "Europe/Brussels" , 0x02C2E7 },
- { "Europe/Bucharest" , 0x02C71E },
- { "Europe/Budapest" , 0x02CA48 },
- { "Europe/Busingen" , 0x02CDB1 },
- { "Europe/Chisinau" , 0x02D068 },
- { "Europe/Copenhagen" , 0x02D3F6 },
- { "Europe/Dublin" , 0x02D700 },
- { "Europe/Gibraltar" , 0x02DC11 },
- { "Europe/Guernsey" , 0x02E068 },
- { "Europe/Helsinki" , 0x02E59F },
- { "Europe/Isle_of_Man" , 0x02E855 },
- { "Europe/Istanbul" , 0x02ED8C },
- { "Europe/Jersey" , 0x02F179 },
- { "Europe/Kaliningrad" , 0x02F6B0 },
- { "Europe/Kiev" , 0x02F91B },
- { "Europe/Lisbon" , 0x02FC37 },
- { "Europe/Ljubljana" , 0x03013B },
- { "Europe/London" , 0x030404 },
- { "Europe/Luxembourg" , 0x03093B },
- { "Europe/Madrid" , 0x030D91 },
- { "Europe/Malta" , 0x031157 },
- { "Europe/Mariehamn" , 0x031510 },
- { "Europe/Minsk" , 0x0317C6 },
- { "Europe/Monaco" , 0x0319D4 },
- { "Europe/Moscow" , 0x031E0F },
- { "Europe/Nicosia" , 0x032069 },
- { "Europe/Oslo" , 0x032351 },
- { "Europe/Paris" , 0x032683 },
- { "Europe/Podgorica" , 0x032AC9 },
- { "Europe/Prague" , 0x032D92 },
- { "Europe/Riga" , 0x0330C4 },
- { "Europe/Rome" , 0x033409 },
- { "Europe/Samara" , 0x0337CC },
- { "Europe/San_Marino" , 0x033A35 },
- { "Europe/Sarajevo" , 0x033DF8 },
- { "Europe/Simferopol" , 0x0340C1 },
- { "Europe/Skopje" , 0x034312 },
- { "Europe/Sofia" , 0x0345DB },
- { "Europe/Stockholm" , 0x0348E3 },
- { "Europe/Tallinn" , 0x034B92 },
- { "Europe/Tirane" , 0x034ECC },
- { "Europe/Tiraspol" , 0x0351D2 },
- { "Europe/Uzhgorod" , 0x035560 },
- { "Europe/Vaduz" , 0x035877 },
- { "Europe/Vatican" , 0x035B26 },
- { "Europe/Vienna" , 0x035EE9 },
- { "Europe/Vilnius" , 0x036216 },
- { "Europe/Volgograd" , 0x036555 },
- { "Europe/Warsaw" , 0x036776 },
- { "Europe/Zagreb" , 0x036B57 },
- { "Europe/Zaporozhye" , 0x036E20 },
- { "Europe/Zurich" , 0x037161 },
- { "Factory" , 0x037410 },
- { "GB" , 0x037481 },
- { "GB-Eire" , 0x0379B8 },
- { "GMT" , 0x037EEF },
- { "GMT+0" , 0x037FBB },
- { "GMT-0" , 0x037F77 },
- { "GMT0" , 0x037F33 },
- { "Greenwich" , 0x037FFF },
- { "Hongkong" , 0x038043 },
- { "HST" , 0x038205 },
- { "Iceland" , 0x038249 },
- { "Indian/Antananarivo" , 0x038402 },
- { "Indian/Chagos" , 0x038476 },
- { "Indian/Christmas" , 0x0384D8 },
- { "Indian/Cocos" , 0x03851C },
- { "Indian/Comoro" , 0x038560 },
- { "Indian/Kerguelen" , 0x0385B5 },
- { "Indian/Mahe" , 0x03860A },
- { "Indian/Maldives" , 0x03865F },
- { "Indian/Mauritius" , 0x0386B4 },
- { "Indian/Mayotte" , 0x03872A },
- { "Indian/Reunion" , 0x03877F },
- { "Iran" , 0x0387D4 },
- { "Israel" , 0x038A42 },
- { "Jamaica" , 0x038D71 },
- { "Japan" , 0x038E36 },
- { "Kwajalein" , 0x038EC0 },
- { "Libya" , 0x038F23 },
- { "MET" , 0x03902C },
- { "Mexico/BajaNorte" , 0x039335 },
- { "Mexico/BajaSur" , 0x03969E },
- { "Mexico/General" , 0x0398E3 },
- { "MST" , 0x039B41 },
- { "MST7MDT" , 0x039B85 },
- { "Navajo" , 0x039ED6 },
- { "NZ" , 0x03A24F },
- { "NZ-CHAT" , 0x03A5CD },
- { "Pacific/Apia" , 0x03A8B1 },
- { "Pacific/Auckland" , 0x03AA4D },
- { "Pacific/Chatham" , 0x03ADD9 },
- { "Pacific/Chuuk" , 0x03B0CC },
- { "Pacific/Easter" , 0x03B125 },
- { "Pacific/Efate" , 0x03B474 },
- { "Pacific/Enderbury" , 0x03B53A },
- { "Pacific/Fakaofo" , 0x03B5A8 },
- { "Pacific/Fiji" , 0x03B5F9 },
- { "Pacific/Funafuti" , 0x03B78C },
- { "Pacific/Galapagos" , 0x03B7D0 },
- { "Pacific/Gambier" , 0x03B848 },
- { "Pacific/Guadalcanal" , 0x03B8AD },
- { "Pacific/Guam" , 0x03B902 },
- { "Pacific/Honolulu" , 0x03B958 },
- { "Pacific/Johnston" , 0x03B9CF },
- { "Pacific/Kiritimati" , 0x03BA4E },
- { "Pacific/Kosrae" , 0x03BAB9 },
- { "Pacific/Kwajalein" , 0x03BB16 },
- { "Pacific/Majuro" , 0x03BB82 },
- { "Pacific/Marquesas" , 0x03BBE1 },
- { "Pacific/Midway" , 0x03BC48 },
- { "Pacific/Nauru" , 0x03BCD2 },
- { "Pacific/Niue" , 0x03BD4A },
- { "Pacific/Norfolk" , 0x03BDA8 },
- { "Pacific/Noumea" , 0x03BDFD },
- { "Pacific/Pago_Pago" , 0x03BE8D },
- { "Pacific/Palau" , 0x03BF04 },
- { "Pacific/Pitcairn" , 0x03BF48 },
- { "Pacific/Pohnpei" , 0x03BF9D },
- { "Pacific/Ponape" , 0x03BFF2 },
- { "Pacific/Port_Moresby" , 0x03C037 },
- { "Pacific/Rarotonga" , 0x03C07B },
- { "Pacific/Saipan" , 0x03C157 },
- { "Pacific/Samoa" , 0x03C1BA },
- { "Pacific/Tahiti" , 0x03C231 },
- { "Pacific/Tarawa" , 0x03C296 },
- { "Pacific/Tongatapu" , 0x03C2EA },
- { "Pacific/Truk" , 0x03C376 },
- { "Pacific/Wake" , 0x03C3BB },
- { "Pacific/Wallis" , 0x03C40B },
- { "Pacific/Yap" , 0x03C44F },
- { "Poland" , 0x03C494 },
- { "Portugal" , 0x03C875 },
- { "PRC" , 0x03CD71 },
- { "PST8PDT" , 0x03CE11 },
- { "ROC" , 0x03D162 },
- { "ROK" , 0x03D293 },
- { "Singapore" , 0x03D35A },
- { "Turkey" , 0x03D411 },
- { "UCT" , 0x03D7FE },
- { "Universal" , 0x03D842 },
- { "US/Alaska" , 0x03D886 },
- { "US/Aleutian" , 0x03DBEF },
- { "US/Arizona" , 0x03DF55 },
- { "US/Central" , 0x03DFE3 },
- { "US/East-Indiana" , 0x03E9ED },
- { "US/Eastern" , 0x03E4EE },
- { "US/Hawaii" , 0x03EC57 },
- { "US/Indiana-Starke" , 0x03ECC8 },
- { "US/Michigan" , 0x03F039 },
- { "US/Mountain" , 0x03F370 },
- { "US/Pacific" , 0x03F6E9 },
- { "US/Pacific-New" , 0x03FAEE },
- { "US/Samoa" , 0x03FEF3 },
- { "UTC" , 0x03FF6A },
- { "W-SU" , 0x040261 },
- { "WET" , 0x03FFAE },
- { "Zulu" , 0x0404A4 },
+ { "Africa/Cairo" , 0x00062E },
+ { "Africa/Casablanca" , 0x000A15 },
+ { "Africa/Ceuta" , 0x000C77 },
+ { "Africa/Conakry" , 0x000F7E },
+ { "Africa/Dakar" , 0x000FD3 },
+ { "Africa/Dar_es_Salaam" , 0x001028 },
+ { "Africa/Djibouti" , 0x001095 },
+ { "Africa/Douala" , 0x0010EA },
+ { "Africa/El_Aaiun" , 0x00113F },
+ { "Africa/Freetown" , 0x00136A },
+ { "Africa/Gaborone" , 0x0013BF },
+ { "Africa/Harare" , 0x001414 },
+ { "Africa/Johannesburg" , 0x001469 },
+ { "Africa/Juba" , 0x0014D7 },
+ { "Africa/Kampala" , 0x0015EA },
+ { "Africa/Khartoum" , 0x001669 },
+ { "Africa/Kigali" , 0x00177C },
+ { "Africa/Kinshasa" , 0x0017D1 },
+ { "Africa/Lagos" , 0x00183D },
+ { "Africa/Libreville" , 0x001892 },
+ { "Africa/Lome" , 0x0018E7 },
+ { "Africa/Luanda" , 0x00193C },
+ { "Africa/Lubumbashi" , 0x001991 },
+ { "Africa/Lusaka" , 0x0019FD },
+ { "Africa/Malabo" , 0x001A52 },
+ { "Africa/Maputo" , 0x001AA7 },
+ { "Africa/Maseru" , 0x001AFC },
+ { "Africa/Mbabane" , 0x001B6A },
+ { "Africa/Mogadishu" , 0x001BD8 },
+ { "Africa/Monrovia" , 0x001C33 },
+ { "Africa/Nairobi" , 0x001C99 },
+ { "Africa/Ndjamena" , 0x001D18 },
+ { "Africa/Niamey" , 0x001D84 },
+ { "Africa/Nouakchott" , 0x001DD9 },
+ { "Africa/Ouagadougou" , 0x001E2E },
+ { "Africa/Porto-Novo" , 0x001E83 },
+ { "Africa/Sao_Tome" , 0x001ED8 },
+ { "Africa/Timbuktu" , 0x001F2D },
+ { "Africa/Tripoli" , 0x001F82 },
+ { "Africa/Tunis" , 0x00208B },
+ { "Africa/Windhoek" , 0x00219D },
+ { "America/Adak" , 0x0023E4 },
+ { "America/Anchorage" , 0x00275A },
+ { "America/Anguilla" , 0x002ACE },
+ { "America/Antigua" , 0x002B23 },
+ { "America/Araguaina" , 0x002B89 },
+ { "America/Argentina/Buenos_Aires" , 0x002CEE },
+ { "America/Argentina/Catamarca" , 0x002E9C },
+ { "America/Argentina/ComodRivadavia" , 0x00305D },
+ { "America/Argentina/Cordoba" , 0x003203 },
+ { "America/Argentina/Jujuy" , 0x0033D8 },
+ { "America/Argentina/La_Rioja" , 0x00358C },
+ { "America/Argentina/Mendoza" , 0x003744 },
+ { "America/Argentina/Rio_Gallegos" , 0x003904 },
+ { "America/Argentina/Salta" , 0x003AB9 },
+ { "America/Argentina/San_Juan" , 0x003C65 },
+ { "America/Argentina/San_Luis" , 0x003E1D },
+ { "America/Argentina/Tucuman" , 0x003FE3 },
+ { "America/Argentina/Ushuaia" , 0x00419F },
+ { "America/Aruba" , 0x00435A },
+ { "America/Asuncion" , 0x0043C0 },
+ { "America/Atikokan" , 0x0046A5 },
+ { "America/Atka" , 0x00477B },
+ { "America/Bahia" , 0x004AE1 },
+ { "America/Bahia_Banderas" , 0x004C74 },
+ { "America/Barbados" , 0x004EED },
+ { "America/Belem" , 0x004F87 },
+ { "America/Belize" , 0x005082 },
+ { "America/Blanc-Sablon" , 0x0051FE },
+ { "America/Boa_Vista" , 0x0052B2 },
+ { "America/Bogota" , 0x0053BB },
+ { "America/Boise" , 0x005427 },
+ { "America/Buenos_Aires" , 0x0057BE },
+ { "America/Cambridge_Bay" , 0x005957 },
+ { "America/Campo_Grande" , 0x005C7F },
+ { "America/Cancun" , 0x005F6E },
+ { "America/Caracas" , 0x0061B0 },
+ { "America/Catamarca" , 0x006217 },
+ { "America/Cayenne" , 0x0063BD },
+ { "America/Cayman" , 0x00641F },
+ { "America/Chicago" , 0x006474 },
+ { "America/Chihuahua" , 0x00698B },
+ { "America/Coral_Harbour" , 0x006BF6 },
+ { "America/Cordoba" , 0x006C88 },
+ { "America/Costa_Rica" , 0x006E2E },
+ { "America/Creston" , 0x006EB8 },
+ { "America/Cuiaba" , 0x006F44 },
+ { "America/Curacao" , 0x007222 },
+ { "America/Danmarkshavn" , 0x007288 },
+ { "America/Dawson" , 0x0073CC },
+ { "America/Dawson_Creek" , 0x0076E9 },
+ { "America/Denver" , 0x0078C3 },
+ { "America/Detroit" , 0x007C49 },
+ { "America/Dominica" , 0x007FA8 },
+ { "America/Edmonton" , 0x007FFD },
+ { "America/Eirunepe" , 0x0083B5 },
+ { "America/El_Salvador" , 0x0084CD },
+ { "America/Ensenada" , 0x008542 },
+ { "America/Fort_Wayne" , 0x0089E9 },
+ { "America/Fortaleza" , 0x0088AB },
+ { "America/Glace_Bay" , 0x008C53 },
+ { "America/Godthab" , 0x008FCA },
+ { "America/Goose_Bay" , 0x00928E },
+ { "America/Grand_Turk" , 0x00974B },
+ { "America/Grenada" , 0x009920 },
+ { "America/Guadeloupe" , 0x009975 },
+ { "America/Guatemala" , 0x0099CA },
+ { "America/Guayaquil" , 0x009A53 },
+ { "America/Guyana" , 0x009AB0 },
+ { "America/Halifax" , 0x009B31 },
+ { "America/Havana" , 0x00A047 },
+ { "America/Hermosillo" , 0x00A3BA },
+ { "America/Indiana/Indianapolis" , 0x00A498 },
+ { "America/Indiana/Knox" , 0x00A729 },
+ { "America/Indiana/Marengo" , 0x00AAC0 },
+ { "America/Indiana/Petersburg" , 0x00AD66 },
+ { "America/Indiana/Tell_City" , 0x00B2B3 },
+ { "America/Indiana/Vevay" , 0x00B54C },
+ { "America/Indiana/Vincennes" , 0x00B787 },
+ { "America/Indiana/Winamac" , 0x00BA3B },
+ { "America/Indianapolis" , 0x00B049 },
+ { "America/Inuvik" , 0x00BCF4 },
+ { "America/Iqaluit" , 0x00BFEB },
+ { "America/Jamaica" , 0x00C30D },
+ { "America/Jujuy" , 0x00C3D2 },
+ { "America/Juneau" , 0x00C57C },
+ { "America/Kentucky/Louisville" , 0x00C8FA },
+ { "America/Kentucky/Monticello" , 0x00CD18 },
+ { "America/Knox_IN" , 0x00D09D },
+ { "America/Kralendijk" , 0x00D40E },
+ { "America/La_Paz" , 0x00D474 },
+ { "America/Lima" , 0x00D4DB },
+ { "America/Los_Angeles" , 0x00D583 },
+ { "America/Louisville" , 0x00D994 },
+ { "America/Lower_Princes" , 0x00DD89 },
+ { "America/Maceio" , 0x00DDEF },
+ { "America/Managua" , 0x00DF29 },
+ { "America/Manaus" , 0x00DFDC },
+ { "America/Marigot" , 0x00E0DE },
+ { "America/Martinique" , 0x00E133 },
+ { "America/Matamoros" , 0x00E19F },
+ { "America/Mazatlan" , 0x00E3F8 },
+ { "America/Mendoza" , 0x00E665 },
+ { "America/Menominee" , 0x00E819 },
+ { "America/Merida" , 0x00EB9A },
+ { "America/Metlakatla" , 0x00EDD5 },
+ { "America/Mexico_City" , 0x00EF10 },
+ { "America/Miquelon" , 0x00F18B },
+ { "America/Moncton" , 0x00F3FD },
+ { "America/Monterrey" , 0x00F894 },
+ { "America/Montevideo" , 0x00FAF7 },
+ { "America/Montreal" , 0x00FE09 },
+ { "America/Montserrat" , 0x0102F9 },
+ { "America/Nassau" , 0x01034E },
+ { "America/New_York" , 0x010693 },
+ { "America/Nipigon" , 0x010B9E },
+ { "America/Nome" , 0x010EEF },
+ { "America/Noronha" , 0x01126D },
+ { "America/North_Dakota/Beulah" , 0x01139D },
+ { "America/North_Dakota/Center" , 0x011731 },
+ { "America/North_Dakota/New_Salem" , 0x011AC5 },
+ { "America/Ojinaga" , 0x011E6E },
+ { "America/Panama" , 0x0120CF },
+ { "America/Pangnirtung" , 0x012124 },
+ { "America/Paramaribo" , 0x01245A },
+ { "America/Phoenix" , 0x0124EC },
+ { "America/Port-au-Prince" , 0x0125AA },
+ { "America/Port_of_Spain" , 0x0128CE },
+ { "America/Porto_Acre" , 0x0127CA },
+ { "America/Porto_Velho" , 0x012923 },
+ { "America/Puerto_Rico" , 0x012A19 },
+ { "America/Rainy_River" , 0x012A84 },
+ { "America/Rankin_Inlet" , 0x012DBC },
+ { "America/Recife" , 0x0130A2 },
+ { "America/Regina" , 0x0131CC },
+ { "America/Resolute" , 0x01338A },
+ { "America/Rio_Branco" , 0x013672 },
+ { "America/Rosario" , 0x01377A },
+ { "America/Santa_Isabel" , 0x013920 },
+ { "America/Santarem" , 0x013CC3 },
+ { "America/Santiago" , 0x013DC8 },
+ { "America/Santo_Domingo" , 0x014171 },
+ { "America/Sao_Paulo" , 0x014237 },
+ { "America/Scoresbysund" , 0x014546 },
+ { "America/Shiprock" , 0x014834 },
+ { "America/Sitka" , 0x014BAD },
+ { "America/St_Barthelemy" , 0x014F35 },
+ { "America/St_Johns" , 0x014F8A },
+ { "America/St_Kitts" , 0x0154DD },
+ { "America/St_Lucia" , 0x015532 },
+ { "America/St_Thomas" , 0x015587 },
+ { "America/St_Vincent" , 0x0155DC },
+ { "America/Swift_Current" , 0x015631 },
+ { "America/Tegucigalpa" , 0x015752 },
+ { "America/Thule" , 0x0157D1 },
+ { "America/Thunder_Bay" , 0x015A18 },
+ { "America/Tijuana" , 0x015D61 },
+ { "America/Toronto" , 0x0160FA },
+ { "America/Tortola" , 0x01661A },
+ { "America/Vancouver" , 0x01666F },
+ { "America/Virgin" , 0x016AAC },
+ { "America/Whitehorse" , 0x016B01 },
+ { "America/Winnipeg" , 0x016E1E },
+ { "America/Yakutat" , 0x01725E },
+ { "America/Yellowknife" , 0x0175C9 },
+ { "Antarctica/Casey" , 0x0178D9 },
+ { "Antarctica/Davis" , 0x017977 },
+ { "Antarctica/DumontDUrville" , 0x017A18 },
+ { "Antarctica/Macquarie" , 0x017AA9 },
+ { "Antarctica/Mawson" , 0x017CF6 },
+ { "Antarctica/McMurdo" , 0x017D72 },
+ { "Antarctica/Palmer" , 0x01811D },
+ { "Antarctica/Rothera" , 0x018439 },
+ { "Antarctica/South_Pole" , 0x0184AF },
+ { "Antarctica/Syowa" , 0x01882D },
+ { "Antarctica/Troll" , 0x01889B },
+ { "Antarctica/Vostok" , 0x018A6D },
+ { "Arctic/Longyearbyen" , 0x018ADE },
+ { "Asia/Aden" , 0x018E10 },
+ { "Asia/Almaty" , 0x018E65 },
+ { "Asia/Amman" , 0x018FE4 },
+ { "Asia/Anadyr" , 0x01929A },
+ { "Asia/Aqtau" , 0x01949C },
+ { "Asia/Aqtobe" , 0x01969B },
+ { "Asia/Ashgabat" , 0x019853 },
+ { "Asia/Ashkhabad" , 0x019970 },
+ { "Asia/Baghdad" , 0x019A8D },
+ { "Asia/Bahrain" , 0x019C02 },
+ { "Asia/Baku" , 0x019C68 },
+ { "Asia/Bangkok" , 0x019F50 },
+ { "Asia/Beirut" , 0x019FA5 },
+ { "Asia/Bishkek" , 0x01A2B2 },
+ { "Asia/Brunei" , 0x01A45E },
+ { "Asia/Calcutta" , 0x01A4C0 },
+ { "Asia/Chita" , 0x01A539 },
+ { "Asia/Choibalsan" , 0x01A74E },
+ { "Asia/Chongqing" , 0x01A8C7 },
+ { "Asia/Chungking" , 0x01A967 },
+ { "Asia/Colombo" , 0x01AA07 },
+ { "Asia/Dacca" , 0x01AAA3 },
+ { "Asia/Damascus" , 0x01AB49 },
+ { "Asia/Dhaka" , 0x01AE99 },
+ { "Asia/Dili" , 0x01AF3F },
+ { "Asia/Dubai" , 0x01AFC9 },
+ { "Asia/Dushanbe" , 0x01B01E },
+ { "Asia/Gaza" , 0x01B121 },
+ { "Asia/Harbin" , 0x01B474 },
+ { "Asia/Hebron" , 0x01B514 },
+ { "Asia/Ho_Chi_Minh" , 0x01B870 },
+ { "Asia/Hong_Kong" , 0x01B8E8 },
+ { "Asia/Hovd" , 0x01BAAA },
+ { "Asia/Irkutsk" , 0x01BC22 },
+ { "Asia/Istanbul" , 0x01BE0D },
+ { "Asia/Jakarta" , 0x01C1FA },
+ { "Asia/Jayapura" , 0x01C2A4 },
+ { "Asia/Jerusalem" , 0x01C341 },
+ { "Asia/Kabul" , 0x01C670 },
+ { "Asia/Kamchatka" , 0x01C6C1 },
+ { "Asia/Karachi" , 0x01C8BA },
+ { "Asia/Kashgar" , 0x01C96F },
+ { "Asia/Kathmandu" , 0x01C9C4 },
+ { "Asia/Katmandu" , 0x01CA2A },
+ { "Asia/Khandyga" , 0x01CA90 },
+ { "Asia/Kolkata" , 0x01CCBA },
+ { "Asia/Krasnoyarsk" , 0x01CD33 },
+ { "Asia/Kuala_Lumpur" , 0x01CF20 },
+ { "Asia/Kuching" , 0x01CFDD },
+ { "Asia/Kuwait" , 0x01D0CB },
+ { "Asia/Macao" , 0x01D120 },
+ { "Asia/Macau" , 0x01D25B },
+ { "Asia/Magadan" , 0x01D396 },
+ { "Asia/Makassar" , 0x01D59A },
+ { "Asia/Manila" , 0x01D65F },
+ { "Asia/Muscat" , 0x01D6E4 },
+ { "Asia/Nicosia" , 0x01D739 },
+ { "Asia/Novokuznetsk" , 0x01DA21 },
+ { "Asia/Novosibirsk" , 0x01DC41 },
+ { "Asia/Omsk" , 0x01DE31 },
+ { "Asia/Oral" , 0x01E01D },
+ { "Asia/Phnom_Penh" , 0x01E1ED },
+ { "Asia/Pontianak" , 0x01E265 },
+ { "Asia/Pyongyang" , 0x01E327 },
+ { "Asia/Qatar" , 0x01E3B7 },
+ { "Asia/Qyzylorda" , 0x01E41D },
+ { "Asia/Rangoon" , 0x01E5F3 },
+ { "Asia/Riyadh" , 0x01E66B },
+ { "Asia/Saigon" , 0x01E6C0 },
+ { "Asia/Sakhalin" , 0x01E738 },
+ { "Asia/Samarkand" , 0x01E935 },
+ { "Asia/Seoul" , 0x01EA6B },
+ { "Asia/Shanghai" , 0x01EB32 },
+ { "Asia/Singapore" , 0x01EBDE },
+ { "Asia/Srednekolymsk" , 0x01EC95 },
+ { "Asia/Taipei" , 0x01EE95 },
+ { "Asia/Tashkent" , 0x01EFC6 },
+ { "Asia/Tbilisi" , 0x01F0F7 },
+ { "Asia/Tehran" , 0x01F2B1 },
+ { "Asia/Tel_Aviv" , 0x01F51F },
+ { "Asia/Thimbu" , 0x01F84E },
+ { "Asia/Thimphu" , 0x01F8B4 },
+ { "Asia/Tokyo" , 0x01F91A },
+ { "Asia/Ujung_Pandang" , 0x01F9A4 },
+ { "Asia/Ulaanbaatar" , 0x01FA21 },
+ { "Asia/Ulan_Bator" , 0x01FB7C },
+ { "Asia/Urumqi" , 0x01FCC9 },
+ { "Asia/Ust-Nera" , 0x01FD2B },
+ { "Asia/Vientiane" , 0x01FF3D },
+ { "Asia/Vladivostok" , 0x01FFB5 },
+ { "Asia/Yakutsk" , 0x02019F },
+ { "Asia/Yekaterinburg" , 0x020389 },
+ { "Asia/Yerevan" , 0x0205AA },
+ { "Atlantic/Azores" , 0x0207AA },
+ { "Atlantic/Bermuda" , 0x020CAD },
+ { "Atlantic/Canary" , 0x020F8E },
+ { "Atlantic/Cape_Verde" , 0x021264 },
+ { "Atlantic/Faeroe" , 0x0212DD },
+ { "Atlantic/Faroe" , 0x021581 },
+ { "Atlantic/Jan_Mayen" , 0x021825 },
+ { "Atlantic/Madeira" , 0x021B57 },
+ { "Atlantic/Reykjavik" , 0x022060 },
+ { "Atlantic/South_Georgia" , 0x022219 },
+ { "Atlantic/St_Helena" , 0x02242B },
+ { "Atlantic/Stanley" , 0x02225D },
+ { "Australia/ACT" , 0x022480 },
+ { "Australia/Adelaide" , 0x0227A3 },
+ { "Australia/Brisbane" , 0x022AD5 },
+ { "Australia/Broken_Hill" , 0x022BA2 },
+ { "Australia/Canberra" , 0x022EE6 },
+ { "Australia/Currie" , 0x023209 },
+ { "Australia/Darwin" , 0x023542 },
+ { "Australia/Eucla" , 0x0235CE },
+ { "Australia/Hobart" , 0x0236AA },
+ { "Australia/LHI" , 0x023A0E },
+ { "Australia/Lindeman" , 0x023CAF },
+ { "Australia/Lord_Howe" , 0x023D96 },
+ { "Australia/Melbourne" , 0x024047 },
+ { "Australia/North" , 0x024372 },
+ { "Australia/NSW" , 0x0243EC },
+ { "Australia/Perth" , 0x02470F },
+ { "Australia/Queensland" , 0x0247ED },
+ { "Australia/South" , 0x02489F },
+ { "Australia/Sydney" , 0x024BC2 },
+ { "Australia/Tasmania" , 0x024F05 },
+ { "Australia/Victoria" , 0x025250 },
+ { "Australia/West" , 0x025573 },
+ { "Australia/Yancowinna" , 0x02562F },
+ { "Brazil/Acre" , 0x025957 },
+ { "Brazil/DeNoronha" , 0x025A5B },
+ { "Brazil/East" , 0x025B7B },
+ { "Brazil/West" , 0x025E58 },
+ { "Canada/Atlantic" , 0x025F50 },
+ { "Canada/Central" , 0x026438 },
+ { "Canada/East-Saskatchewan" , 0x026D42 },
+ { "Canada/Eastern" , 0x026852 },
+ { "Canada/Mountain" , 0x026ECB },
+ { "Canada/Newfoundland" , 0x027241 },
+ { "Canada/Pacific" , 0x02776C },
+ { "Canada/Saskatchewan" , 0x027B85 },
+ { "Canada/Yukon" , 0x027D0E },
+ { "CET" , 0x028011 },
+ { "Chile/Continental" , 0x02831A },
+ { "Chile/EasterIsland" , 0x0286B5 },
+ { "CST6CDT" , 0x0289F7 },
+ { "Cuba" , 0x028D48 },
+ { "EET" , 0x0290BB },
+ { "Egypt" , 0x02936E },
+ { "Eire" , 0x029755 },
+ { "EST" , 0x029C66 },
+ { "EST5EDT" , 0x029CAA },
+ { "Etc/GMT" , 0x029FFB },
+ { "Etc/GMT+0" , 0x02A0C7 },
+ { "Etc/GMT+1" , 0x02A151 },
+ { "Etc/GMT+10" , 0x02A1DE },
+ { "Etc/GMT+11" , 0x02A26C },
+ { "Etc/GMT+12" , 0x02A2FA },
+ { "Etc/GMT+2" , 0x02A415 },
+ { "Etc/GMT+3" , 0x02A4A1 },
+ { "Etc/GMT+4" , 0x02A52D },
+ { "Etc/GMT+5" , 0x02A5B9 },
+ { "Etc/GMT+6" , 0x02A645 },
+ { "Etc/GMT+7" , 0x02A6D1 },
+ { "Etc/GMT+8" , 0x02A75D },
+ { "Etc/GMT+9" , 0x02A7E9 },
+ { "Etc/GMT-0" , 0x02A083 },
+ { "Etc/GMT-1" , 0x02A10B },
+ { "Etc/GMT-10" , 0x02A197 },
+ { "Etc/GMT-11" , 0x02A225 },
+ { "Etc/GMT-12" , 0x02A2B3 },
+ { "Etc/GMT-13" , 0x02A341 },
+ { "Etc/GMT-14" , 0x02A388 },
+ { "Etc/GMT-2" , 0x02A3CF },
+ { "Etc/GMT-3" , 0x02A45B },
+ { "Etc/GMT-4" , 0x02A4E7 },
+ { "Etc/GMT-5" , 0x02A573 },
+ { "Etc/GMT-6" , 0x02A5FF },
+ { "Etc/GMT-7" , 0x02A68B },
+ { "Etc/GMT-8" , 0x02A717 },
+ { "Etc/GMT-9" , 0x02A7A3 },
+ { "Etc/GMT0" , 0x02A03F },
+ { "Etc/Greenwich" , 0x02A82F },
+ { "Etc/UCT" , 0x02A873 },
+ { "Etc/Universal" , 0x02A8B7 },
+ { "Etc/UTC" , 0x02A8FB },
+ { "Etc/Zulu" , 0x02A93F },
+ { "Europe/Amsterdam" , 0x02A983 },
+ { "Europe/Andorra" , 0x02ADC1 },
+ { "Europe/Athens" , 0x02B03D },
+ { "Europe/Belfast" , 0x02B380 },
+ { "Europe/Belgrade" , 0x02B8B7 },
+ { "Europe/Berlin" , 0x02BB80 },
+ { "Europe/Bratislava" , 0x02BEE4 },
+ { "Europe/Brussels" , 0x02C216 },
+ { "Europe/Bucharest" , 0x02C64D },
+ { "Europe/Budapest" , 0x02C977 },
+ { "Europe/Busingen" , 0x02CCE0 },
+ { "Europe/Chisinau" , 0x02CF97 },
+ { "Europe/Copenhagen" , 0x02D325 },
+ { "Europe/Dublin" , 0x02D62F },
+ { "Europe/Gibraltar" , 0x02DB40 },
+ { "Europe/Guernsey" , 0x02DF97 },
+ { "Europe/Helsinki" , 0x02E4CE },
+ { "Europe/Isle_of_Man" , 0x02E784 },
+ { "Europe/Istanbul" , 0x02ECBB },
+ { "Europe/Jersey" , 0x02F0A8 },
+ { "Europe/Kaliningrad" , 0x02F5DF },
+ { "Europe/Kiev" , 0x02F84A },
+ { "Europe/Lisbon" , 0x02FB66 },
+ { "Europe/Ljubljana" , 0x03006A },
+ { "Europe/London" , 0x030333 },
+ { "Europe/Luxembourg" , 0x03086A },
+ { "Europe/Madrid" , 0x030CC0 },
+ { "Europe/Malta" , 0x031086 },
+ { "Europe/Mariehamn" , 0x03143F },
+ { "Europe/Minsk" , 0x0316F5 },
+ { "Europe/Monaco" , 0x031903 },
+ { "Europe/Moscow" , 0x031D3E },
+ { "Europe/Nicosia" , 0x031F98 },
+ { "Europe/Oslo" , 0x032280 },
+ { "Europe/Paris" , 0x0325B2 },
+ { "Europe/Podgorica" , 0x0329F8 },
+ { "Europe/Prague" , 0x032CC1 },
+ { "Europe/Riga" , 0x032FF3 },
+ { "Europe/Rome" , 0x033338 },
+ { "Europe/Samara" , 0x0336FB },
+ { "Europe/San_Marino" , 0x033964 },
+ { "Europe/Sarajevo" , 0x033D27 },
+ { "Europe/Simferopol" , 0x033FF0 },
+ { "Europe/Skopje" , 0x034241 },
+ { "Europe/Sofia" , 0x03450A },
+ { "Europe/Stockholm" , 0x034812 },
+ { "Europe/Tallinn" , 0x034AC1 },
+ { "Europe/Tirane" , 0x034DFB },
+ { "Europe/Tiraspol" , 0x035101 },
+ { "Europe/Uzhgorod" , 0x03548F },
+ { "Europe/Vaduz" , 0x0357A6 },
+ { "Europe/Vatican" , 0x035A55 },
+ { "Europe/Vienna" , 0x035E18 },
+ { "Europe/Vilnius" , 0x036145 },
+ { "Europe/Volgograd" , 0x036484 },
+ { "Europe/Warsaw" , 0x0366A5 },
+ { "Europe/Zagreb" , 0x036A86 },
+ { "Europe/Zaporozhye" , 0x036D4F },
+ { "Europe/Zurich" , 0x037090 },
+ { "Factory" , 0x03733F },
+ { "GB" , 0x0373B0 },
+ { "GB-Eire" , 0x0378E7 },
+ { "GMT" , 0x037E1E },
+ { "GMT+0" , 0x037EEA },
+ { "GMT-0" , 0x037EA6 },
+ { "GMT0" , 0x037E62 },
+ { "Greenwich" , 0x037F2E },
+ { "Hongkong" , 0x037F72 },
+ { "HST" , 0x038134 },
+ { "Iceland" , 0x038178 },
+ { "Indian/Antananarivo" , 0x038331 },
+ { "Indian/Chagos" , 0x0383A5 },
+ { "Indian/Christmas" , 0x038407 },
+ { "Indian/Cocos" , 0x03844B },
+ { "Indian/Comoro" , 0x03848F },
+ { "Indian/Kerguelen" , 0x0384E4 },
+ { "Indian/Mahe" , 0x038539 },
+ { "Indian/Maldives" , 0x03858E },
+ { "Indian/Mauritius" , 0x0385E3 },
+ { "Indian/Mayotte" , 0x038659 },
+ { "Indian/Reunion" , 0x0386AE },
+ { "Iran" , 0x038703 },
+ { "Israel" , 0x038971 },
+ { "Jamaica" , 0x038CA0 },
+ { "Japan" , 0x038D65 },
+ { "Kwajalein" , 0x038DEF },
+ { "Libya" , 0x038E52 },
+ { "MET" , 0x038F5B },
+ { "Mexico/BajaNorte" , 0x039264 },
+ { "Mexico/BajaSur" , 0x0395CD },
+ { "Mexico/General" , 0x039812 },
+ { "MST" , 0x039A70 },
+ { "MST7MDT" , 0x039AB4 },
+ { "Navajo" , 0x039E05 },
+ { "NZ" , 0x03A17E },
+ { "NZ-CHAT" , 0x03A4FC },
+ { "Pacific/Apia" , 0x03A7E0 },
+ { "Pacific/Auckland" , 0x03A97C },
+ { "Pacific/Chatham" , 0x03AD08 },
+ { "Pacific/Chuuk" , 0x03AFFB },
+ { "Pacific/Easter" , 0x03B054 },
+ { "Pacific/Efate" , 0x03B3A3 },
+ { "Pacific/Enderbury" , 0x03B469 },
+ { "Pacific/Fakaofo" , 0x03B4D7 },
+ { "Pacific/Fiji" , 0x03B528 },
+ { "Pacific/Funafuti" , 0x03B6BB },
+ { "Pacific/Galapagos" , 0x03B6FF },
+ { "Pacific/Gambier" , 0x03B777 },
+ { "Pacific/Guadalcanal" , 0x03B7DC },
+ { "Pacific/Guam" , 0x03B831 },
+ { "Pacific/Honolulu" , 0x03B887 },
+ { "Pacific/Johnston" , 0x03B8FE },
+ { "Pacific/Kiritimati" , 0x03B97D },
+ { "Pacific/Kosrae" , 0x03B9E8 },
+ { "Pacific/Kwajalein" , 0x03BA45 },
+ { "Pacific/Majuro" , 0x03BAB1 },
+ { "Pacific/Marquesas" , 0x03BB10 },
+ { "Pacific/Midway" , 0x03BB77 },
+ { "Pacific/Nauru" , 0x03BC01 },
+ { "Pacific/Niue" , 0x03BC79 },
+ { "Pacific/Norfolk" , 0x03BCD7 },
+ { "Pacific/Noumea" , 0x03BD2C },
+ { "Pacific/Pago_Pago" , 0x03BDBC },
+ { "Pacific/Palau" , 0x03BE33 },
+ { "Pacific/Pitcairn" , 0x03BE77 },
+ { "Pacific/Pohnpei" , 0x03BECC },
+ { "Pacific/Ponape" , 0x03BF21 },
+ { "Pacific/Port_Moresby" , 0x03BF66 },
+ { "Pacific/Rarotonga" , 0x03BFAA },
+ { "Pacific/Saipan" , 0x03C086 },
+ { "Pacific/Samoa" , 0x03C0E9 },
+ { "Pacific/Tahiti" , 0x03C160 },
+ { "Pacific/Tarawa" , 0x03C1C5 },
+ { "Pacific/Tongatapu" , 0x03C219 },
+ { "Pacific/Truk" , 0x03C2A5 },
+ { "Pacific/Wake" , 0x03C2EA },
+ { "Pacific/Wallis" , 0x03C33A },
+ { "Pacific/Yap" , 0x03C37E },
+ { "Poland" , 0x03C3C3 },
+ { "Portugal" , 0x03C7A4 },
+ { "PRC" , 0x03CCA0 },
+ { "PST8PDT" , 0x03CD40 },
+ { "ROC" , 0x03D091 },
+ { "ROK" , 0x03D1C2 },
+ { "Singapore" , 0x03D289 },
+ { "Turkey" , 0x03D340 },
+ { "UCT" , 0x03D72D },
+ { "Universal" , 0x03D771 },
+ { "US/Alaska" , 0x03D7B5 },
+ { "US/Aleutian" , 0x03DB1E },
+ { "US/Arizona" , 0x03DE84 },
+ { "US/Central" , 0x03DF12 },
+ { "US/East-Indiana" , 0x03E91C },
+ { "US/Eastern" , 0x03E41D },
+ { "US/Hawaii" , 0x03EB86 },
+ { "US/Indiana-Starke" , 0x03EBF7 },
+ { "US/Michigan" , 0x03EF68 },
+ { "US/Mountain" , 0x03F29F },
+ { "US/Pacific" , 0x03F618 },
+ { "US/Pacific-New" , 0x03FA1D },
+ { "US/Samoa" , 0x03FE22 },
+ { "UTC" , 0x03FE99 },
+ { "W-SU" , 0x040190 },
+ { "WET" , 0x03FEDD },
+ { "Zulu" , 0x0403D3 },
};
/* This is a generated file, do not modify */
-const unsigned char timelib_timezone_db_data_builtin[263400] = {
+const unsigned char timelib_timezone_db_data_builtin[263191] = {
/* Africa/Abidjan */
@@ -673,8 +673,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Bangui */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0x7D, 0x14,
-0x01, 0x00, 0x00, 0x11, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0xFD, 0xFA, 0x01, 0x2F, 0x03,
0x9D, 0x00, 0x00, 0x00, 0x00,
@@ -689,7 +689,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Bissau */
0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x91, 0xC4, 0x93, 0x1C,
+0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x92, 0xE6, 0x9D, 0x1C,
0x09, 0x67, 0x61, 0x10, 0x01, 0x02, 0xFF, 0xFF, 0xF1, 0x64, 0x00, 0x00, 0xFF, 0xFF, 0xF1, 0xF0,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x57, 0x41, 0x54, 0x00,
0x47, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0x69, 0x28, 0x00, 0xFA,
@@ -698,25 +698,26 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Blantyre */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC3, 0xB0,
-0x01, 0x00, 0x00, 0x20, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x3E, 0xE2, 0x01, 0x48, 0x10,
0x60, 0x00, 0x00, 0x00, 0x00,
/* Africa/Brazzaville */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0x80, 0x2C,
-0x01, 0x00, 0x00, 0x0E, 0x54, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xD1, 0x95, 0x01, 0x29, 0xFA,
0x8D, 0x00, 0x00, 0x00, 0x00,
/* Africa/Bujumbura */
0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1C, 0x20,
-0x00, 0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2A, 0xA2, 0x01, 0x3F, 0x77, 0xDA,
-0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2A, 0xA2, 0x01, 0x3F, 0x77,
+0xDA, 0x00, 0x00, 0x00, 0x00,
/* Africa/Cairo */
0x50, 0x48, 0x50, 0x31, 0x01, 0x45, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -911,8 +912,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Douala */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0x85, 0x68,
-0x01, 0x00, 0x00, 0x09, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x82, 0x48, 0x01, 0x21, 0x75,
0x90, 0x00, 0x00, 0x00, 0x00,
@@ -963,18 +964,17 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Gaborone */
0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x82, 0x46, 0xCF, 0x68,
-0xCE, 0x8E, 0x6E, 0x80, 0xCF, 0x7E, 0x51, 0x70, 0x01, 0x02, 0x01, 0x00, 0x00, 0x15, 0x18, 0x00,
-0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x05, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x09, 0x53, 0x41, 0x53,
-0x54, 0x00, 0x43, 0x41, 0x54, 0x00, 0x43, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x63, 0xB7, 0x57, 0x01, 0x3A, 0x34, 0x32, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0xB7, 0x57, 0x01, 0x3A, 0x34,
+0x32, 0x00, 0x00, 0x00, 0x00,
/* Africa/Harare */
0x50, 0x48, 0x50, 0x31, 0x01, 0x5A, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC7, 0x64,
-0x01, 0x00, 0x00, 0x1D, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x1E, 0x1A, 0x01, 0x42, 0x09,
0x68, 0x00, 0x00, 0x00, 0x00,
@@ -1040,18 +1040,19 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Kigali */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xBE, 0xF1, 0x0E, 0x50,
-0x01, 0x00, 0x00, 0x1C, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x5A, 0x88, 0x01, 0x40, 0x89,
0x4A, 0x00, 0x00, 0x00, 0x00,
/* Africa/Kinshasa */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0E, 0x10,
-0x00, 0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x82, 0xC4, 0x90, 0x01, 0x2A, 0x01, 0x10,
-0x00, 0x00, 0x00, 0x17, 0x77, 0x65, 0x73, 0x74, 0x20, 0x44, 0x65, 0x6D, 0x2E, 0x20, 0x52, 0x65,
-0x70, 0x2E, 0x20, 0x6F, 0x66, 0x20, 0x43, 0x6F, 0x6E, 0x67, 0x6F,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xC4, 0x90, 0x01, 0x2A, 0x01,
+0x10, 0x00, 0x00, 0x00, 0x17, 0x77, 0x65, 0x73, 0x74, 0x20, 0x44, 0x65, 0x6D, 0x2E, 0x20, 0x52,
+0x65, 0x70, 0x2E, 0x20, 0x6F, 0x66, 0x20, 0x43, 0x6F, 0x6E, 0x67, 0x6F,
/* Africa/Lagos */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4E, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1064,8 +1065,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Libreville */
0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x92, 0xE6, 0x85, 0xA4,
-0x01, 0x00, 0x00, 0x08, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xE9, 0xFD, 0x01, 0x21, 0x13,
0xE8, 0x00, 0x00, 0x00, 0x00,
@@ -1080,35 +1081,35 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Luanda */
0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xC4, 0x78, 0x4C,
-0x01, 0x00, 0x00, 0x0C, 0x34, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x41, 0x4F, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xE6, 0xC0, 0x01, 0x26, 0xD9,
0xC5, 0x00, 0x00, 0x00, 0x00,
/* Africa/Lubumbashi */
0x50, 0x48, 0x50, 0x31, 0x01, 0x43, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1C, 0x20,
-0x00, 0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x77, 0x86, 0xF5, 0x01, 0x3C, 0x91, 0xAA,
-0x00, 0x00, 0x00, 0x17, 0x65, 0x61, 0x73, 0x74, 0x20, 0x44, 0x65, 0x6D, 0x2E, 0x20, 0x52, 0x65,
-0x70, 0x2E, 0x20, 0x6F, 0x66, 0x20, 0x43, 0x6F, 0x6E, 0x67, 0x6F,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x86, 0xF5, 0x01, 0x3C, 0x91,
+0xAA, 0x00, 0x00, 0x00, 0x17, 0x65, 0x61, 0x73, 0x74, 0x20, 0x44, 0x65, 0x6D, 0x2E, 0x20, 0x52,
+0x65, 0x70, 0x2E, 0x20, 0x6F, 0x66, 0x20, 0x43, 0x6F, 0x6E, 0x67, 0x6F,
/* Africa/Lusaka */
0x50, 0x48, 0x50, 0x31, 0x01, 0x5A, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC9, 0xFC,
-0x01, 0x00, 0x00, 0x1A, 0x84, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x82, 0x46, 0xC5, 0xF4,
+0x01, 0x00, 0x00, 0x1E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
0x00, 0x43, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0xCE, 0x1D, 0x01, 0x3D, 0xD0,
0xAD, 0x00, 0x00, 0x00, 0x00,
/* Africa/Malabo */
0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x92, 0xE6, 0x86, 0x44,
-0xF4, 0x9F, 0xBE, 0x80, 0x01, 0x02, 0x00, 0x00, 0x08, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x47, 0x4D, 0x54, 0x00,
-0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x0D, 0x18, 0x01, 0x20,
-0x0F, 0x7D, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x0D, 0x18, 0x01, 0x20, 0x0F,
+0x7D, 0x00, 0x00, 0x00, 0x00,
/* Africa/Maputo */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1121,19 +1122,20 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Maseru */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x82, 0x46, 0xCA, 0xB8,
-0xCE, 0x8E, 0x6E, 0x80, 0xCF, 0x7E, 0x51, 0x70, 0x01, 0x02, 0x01, 0x00, 0x00, 0x19, 0xC8, 0x00,
-0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x4C, 0x4D, 0x54,
-0x00, 0x53, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x5D, 0xD5,
-0x01, 0x3C, 0x9E, 0xB0, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x82, 0x46, 0xCF, 0x68,
+0xCC, 0xAE, 0x8C, 0x80, 0xCD, 0x9E, 0x6F, 0x70, 0xCE, 0x8E, 0x6E, 0x80, 0xCF, 0x7E, 0x51, 0x70,
+0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x15, 0x18, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01,
+0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x00, 0x53, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x5C, 0x5D, 0xD5, 0x01, 0x3C, 0x9E, 0xB0, 0x00, 0x00, 0x00, 0x00,
/* Africa/Mbabane */
0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x82, 0x46, 0xC7, 0x58,
-0x01, 0x00, 0x00, 0x1D, 0x28, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x04, 0x4C, 0x4D, 0x54,
-0x00, 0x53, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x32, 0xD0, 0x01, 0x42,
-0x1C, 0xF0, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x82, 0x46, 0xCF, 0x68,
+0xCC, 0xAE, 0x8C, 0x80, 0xCD, 0x9E, 0x6F, 0x70, 0xCE, 0x8E, 0x6E, 0x80, 0xCF, 0x7E, 0x51, 0x70,
+0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x15, 0x18, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01,
+0x00, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x00, 0x53, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x61, 0x32, 0xD0, 0x01, 0x42, 0x1C, 0xF0, 0x00, 0x00, 0x00, 0x00,
/* Africa/Mogadishu */
0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1173,13 +1175,11 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Niamey */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4E, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x92, 0xE6, 0x8C, 0x84,
-0xBC, 0x92, 0xC6, 0x90, 0xED, 0x30, 0x08, 0x80, 0x01, 0x02, 0x03, 0x00, 0x00, 0x01, 0xFC, 0x00,
-0x00, 0xFF, 0xFF, 0xF1, 0xF0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0E,
-0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x57, 0x41, 0x54, 0x00, 0x47, 0x4D, 0x54, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0xF4, 0x32, 0x01, 0x15, 0xE3, 0x52, 0x00,
-0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0xF4, 0x32, 0x01, 0x15, 0xE3,
+0x52, 0x00, 0x00, 0x00, 0x00,
/* Africa/Nouakchott */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4D, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1199,12 +1199,11 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Africa/Porto-Novo */
0x50, 0x48, 0x50, 0x31, 0x01, 0x42, 0x4A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x92, 0xE6, 0x8C, 0x0C,
-0xBC, 0x92, 0xB8, 0x80, 0x01, 0x02, 0x00, 0x00, 0x02, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x04, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x47, 0x4D, 0x54, 0x00,
-0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x38, 0xCD, 0x01, 0x16,
-0xA6, 0xA2, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0xA1, 0x51, 0xF3, 0x50,
+0x01, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x57, 0x41, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x38, 0xCD, 0x01, 0x16, 0xA6,
+0xA2, 0x00, 0x00, 0x00, 0x00,
/* Africa/Sao_Tome */
0x50, 0x48, 0x50, 0x31, 0x01, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -3305,8 +3304,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* America/Grand_Turk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x93, 0x0F, 0xB4, 0xFF,
0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0, 0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0,
0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0, 0x17, 0x29, 0x0B, 0xF0, 0x18, 0x22, 0x29, 0x60,
0x19, 0x08, 0xED, 0xF0, 0x1A, 0x02, 0x0B, 0x60, 0x1A, 0xF2, 0x0A, 0x70, 0x1B, 0xE1, 0xED, 0x60,
@@ -3325,28 +3324,15 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x49, 0xB3, 0x6C, 0xF0, 0x4A, 0xED, 0x23, 0xE0, 0x4B, 0x9C, 0x89, 0x70, 0x4C, 0xD6, 0x40, 0x60,
0x4D, 0x7C, 0x6B, 0x70, 0x4E, 0xB6, 0x22, 0x60, 0x4F, 0x5C, 0x4D, 0x70, 0x50, 0x96, 0x04, 0x60,
0x51, 0x3C, 0x2F, 0x70, 0x52, 0x75, 0xE6, 0x60, 0x53, 0x1C, 0x11, 0x70, 0x54, 0x55, 0xC8, 0x60,
-0x54, 0xFB, 0xF3, 0x70, 0x56, 0x35, 0xAA, 0x60, 0x56, 0xE5, 0x0F, 0xF0, 0x58, 0x1E, 0xC6, 0xE0,
-0x58, 0xC4, 0xF1, 0xF0, 0x59, 0xFE, 0xA8, 0xE0, 0x5A, 0xA4, 0xD3, 0xF0, 0x5B, 0xDE, 0x8A, 0xE0,
-0x5C, 0x84, 0xB5, 0xF0, 0x5D, 0xBE, 0x6C, 0xE0, 0x5E, 0x64, 0x97, 0xF0, 0x5F, 0x9E, 0x4E, 0xE0,
-0x60, 0x4D, 0xB4, 0x70, 0x61, 0x87, 0x6B, 0x60, 0x62, 0x2D, 0x96, 0x70, 0x63, 0x67, 0x4D, 0x60,
-0x64, 0x0D, 0x78, 0x70, 0x65, 0x47, 0x2F, 0x60, 0x65, 0xED, 0x5A, 0x70, 0x67, 0x27, 0x11, 0x60,
-0x67, 0xCD, 0x3C, 0x70, 0x69, 0x06, 0xF3, 0x60, 0x69, 0xAD, 0x1E, 0x70, 0x6A, 0xE6, 0xD5, 0x60,
-0x6B, 0x96, 0x3A, 0xF0, 0x6C, 0xCF, 0xF1, 0xE0, 0x6D, 0x76, 0x1C, 0xF0, 0x6E, 0xAF, 0xD3, 0xE0,
-0x6F, 0x55, 0xFE, 0xF0, 0x70, 0x8F, 0xB5, 0xE0, 0x71, 0x35, 0xE0, 0xF0, 0x72, 0x6F, 0x97, 0xE0,
-0x73, 0x15, 0xC2, 0xF0, 0x74, 0x4F, 0x79, 0xE0, 0x74, 0xFE, 0xDF, 0x70, 0x76, 0x38, 0x96, 0x60,
-0x76, 0xDE, 0xC1, 0x70, 0x78, 0x18, 0x78, 0x60, 0x78, 0xBE, 0xA3, 0x70, 0x79, 0xF8, 0x5A, 0x60,
-0x7A, 0x9E, 0x85, 0x70, 0x7B, 0xD8, 0x3C, 0x60, 0x7C, 0x7E, 0x67, 0x70, 0x7D, 0xB8, 0x1E, 0x60,
-0x7E, 0x5E, 0x49, 0x70, 0x7F, 0x98, 0x00, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
-0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0xFF,
-0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x00,
-0x08, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xAA, 0x15, 0xAA, 0x00, 0xA6, 0x1E, 0x0A, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0xFF, 0xFF, 0xB8, 0x01, 0x00, 0x00, 0xFF,
+0xFF, 0xB9, 0xB0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x08, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x0C, 0x4B, 0x4D, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x41, 0x53, 0x54,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x15, 0xAA, 0x00, 0xA6, 0x1E,
+0x0A, 0x00, 0x00, 0x00, 0x00,
/* America/Grenada */
0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -4072,7 +4058,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x50, 0x48, 0x50, 0x31, 0x01, 0x4A, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF,
-0x08, 0x20, 0xC1, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60,
+0x07, 0x8D, 0x19, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60,
0x0B, 0xE0, 0x85, 0x70, 0x0C, 0xD9, 0xA2, 0xE0, 0x0D, 0xC0, 0x67, 0x70, 0x0E, 0xB9, 0x84, 0xE0,
0x0F, 0xA9, 0x83, 0xF0, 0x10, 0x99, 0x66, 0xE0, 0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0,
0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0, 0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0,
@@ -7221,10 +7207,10 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0xDE, 0x34, 0x60, 0x60, 0xE7, 0x3C, 0x02, 0x80, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x04, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x08, 0x7A, 0x7A, 0x7A,
0x00, 0x50, 0x4D, 0x54, 0x00, 0x44, 0x44, 0x55, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x23, 0x9A, 0x95, 0x01, 0xE8, 0x4E, 0x82, 0x00, 0x00, 0x00, 0x26, 0x44, 0x75, 0x6D, 0x6F,
+0x00, 0x23, 0x9A, 0x95, 0x01, 0xE8, 0x4E, 0x82, 0x00, 0x00, 0x00, 0x25, 0x44, 0x75, 0x6D, 0x6F,
0x6E, 0x74, 0x2D, 0x64, 0x27, 0x55, 0x72, 0x76, 0x69, 0x6C, 0x6C, 0x65, 0x20, 0x53, 0x74, 0x61,
-0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x54, 0x65, 0x72, 0x72, 0x65, 0x20, 0x41, 0x64, 0x65, 0x6C,
-0x69, 0x65,
+0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x20, 0x41, 0x64, 0x65, 0x6C, 0x69, 0x65, 0x20, 0x4C, 0x61, 0x6E,
+0x64,
/* Antarctica/Macquarie */
0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -8076,7 +8062,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1B, 0xCA, 0xDB, 0x86, 0xB0,
0xCC, 0x05, 0x71, 0x18, 0xCC, 0x95, 0x32, 0xA8, 0xDD, 0xA8, 0xD2, 0x98, 0x02, 0x4F, 0x9D, 0x20,
-0x4A, 0x3B, 0xC4, 0x10, 0x4B, 0x3C, 0xD8, 0x54, 0x01, 0x02, 0x01, 0x03, 0x04, 0x05, 0x04, 0x00,
+0x4A, 0x3B, 0xC4, 0x10, 0x4B, 0x3C, 0xD8, 0x90, 0x01, 0x02, 0x01, 0x03, 0x04, 0x05, 0x04, 0x00,
0x00, 0x52, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x68, 0x00, 0x04, 0x00, 0x00, 0x4D, 0x58, 0x00,
0x09, 0x00, 0x00, 0x54, 0x60, 0x00, 0x0D, 0x00, 0x00, 0x54, 0x60, 0x00, 0x12, 0x00, 0x00, 0x62,
0x70, 0x01, 0x16, 0x48, 0x4D, 0x54, 0x00, 0x42, 0x55, 0x52, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00,
@@ -8145,7 +8131,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1B, 0xCA, 0xDB, 0x86, 0xB0,
0xCC, 0x05, 0x71, 0x18, 0xCC, 0x95, 0x32, 0xA8, 0xDD, 0xA8, 0xD2, 0x98, 0x02, 0x4F, 0x9D, 0x20,
-0x4A, 0x3B, 0xC4, 0x10, 0x4B, 0x3C, 0xD8, 0x54, 0x01, 0x02, 0x01, 0x03, 0x04, 0x05, 0x04, 0x00,
+0x4A, 0x3B, 0xC4, 0x10, 0x4B, 0x3C, 0xD8, 0x90, 0x01, 0x02, 0x01, 0x03, 0x04, 0x05, 0x04, 0x00,
0x00, 0x52, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x68, 0x00, 0x04, 0x00, 0x00, 0x4D, 0x58, 0x00,
0x09, 0x00, 0x00, 0x54, 0x60, 0x00, 0x0D, 0x00, 0x00, 0x54, 0x60, 0x00, 0x12, 0x00, 0x00, 0x62,
0x70, 0x01, 0x16, 0x48, 0x4D, 0x54, 0x00, 0x42, 0x55, 0x52, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00,
@@ -8386,7 +8372,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Irkutsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA2, 0x12, 0x0F, 0xB5,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA2, 0x12, 0x0F, 0xBF,
0xB5, 0xA3, 0xD3, 0x10, 0x15, 0x27, 0x61, 0x80, 0x16, 0x18, 0x95, 0xF0, 0x17, 0x08, 0x95, 0x00,
0x17, 0xF9, 0xC9, 0x70, 0x18, 0xE9, 0xC8, 0x80, 0x19, 0xDA, 0xFC, 0xF0, 0x1A, 0xCC, 0x4D, 0x80,
0x1B, 0xBC, 0x5A, 0xA0, 0x1C, 0xAC, 0x4B, 0xA0, 0x1D, 0x9C, 0x3C, 0xA0, 0x1E, 0x8C, 0x2D, 0xA0,
@@ -8407,7 +8393,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x04, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x08,
-0x04, 0x00, 0x00, 0x61, 0xCB, 0x00, 0x00, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00, 0x00, 0x7E,
+0x04, 0x00, 0x00, 0x61, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00, 0x00, 0x7E,
0x90, 0x01, 0x09, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x00,
0x00, 0x7E, 0x90, 0x01, 0x09, 0x00, 0x00, 0x70, 0x80, 0x01, 0x09, 0x00, 0x00, 0x62, 0x70, 0x00,
0x04, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x49, 0x4D, 0x54, 0x00, 0x49, 0x52, 0x4B, 0x54, 0x00,
@@ -8691,7 +8677,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Krasnoyarsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xF9, 0x0D, 0xF8,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xF9, 0x0D, 0xF2,
0xB5, 0xA3, 0xE1, 0x20, 0x15, 0x27, 0x6F, 0x90, 0x16, 0x18, 0xA4, 0x00, 0x17, 0x08, 0xA3, 0x10,
0x17, 0xF9, 0xD7, 0x80, 0x18, 0xE9, 0xD6, 0x90, 0x19, 0xDB, 0x0B, 0x00, 0x1A, 0xCC, 0x5B, 0x90,
0x1B, 0xBC, 0x68, 0xB0, 0x1C, 0xAC, 0x59, 0xB0, 0x1D, 0x9C, 0x4A, 0xB0, 0x1E, 0x8C, 0x3B, 0xB0,
@@ -8712,7 +8698,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x04, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x08,
-0x04, 0x00, 0x00, 0x57, 0x08, 0x00, 0x00, 0x00, 0x00, 0x54, 0x60, 0x00, 0x04, 0x00, 0x00, 0x70,
+0x04, 0x00, 0x00, 0x57, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x54, 0x60, 0x00, 0x04, 0x00, 0x00, 0x70,
0x80, 0x01, 0x09, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00,
0x00, 0x70, 0x80, 0x01, 0x09, 0x00, 0x00, 0x62, 0x70, 0x01, 0x09, 0x00, 0x00, 0x54, 0x60, 0x00,
0x04, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x4B, 0x52, 0x41, 0x54, 0x00,
@@ -8925,7 +8911,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Novokuznetsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1A, 0xA1, 0xF9, 0x13, 0x40,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1A, 0xAA, 0x18, 0x20, 0xC0,
0xB5, 0xA3, 0xE1, 0x20, 0x15, 0x27, 0x6F, 0x90, 0x16, 0x18, 0xA4, 0x00, 0x17, 0x08, 0xA3, 0x10,
0x17, 0xF9, 0xD7, 0x80, 0x18, 0xE9, 0xD6, 0x90, 0x19, 0xDB, 0x0B, 0x00, 0x1A, 0xCC, 0x5B, 0x90,
0x1B, 0xBC, 0x68, 0xB0, 0x1C, 0xAC, 0x59, 0xB0, 0x1D, 0x9C, 0x4A, 0xB0, 0x1E, 0x8C, 0x3B, 0xB0,
@@ -8950,7 +8936,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x80, 0x01, 0x09, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x00,
0x00, 0x70, 0x80, 0x01, 0x09, 0x00, 0x00, 0x62, 0x70, 0x01, 0x09, 0x00, 0x00, 0x54, 0x60, 0x00,
0x04, 0x00, 0x00, 0x62, 0x70, 0x01, 0x0F, 0x00, 0x00, 0x54, 0x60, 0x00, 0x15, 0x00, 0x00, 0x62,
-0x70, 0x00, 0x15, 0x4E, 0x4D, 0x54, 0x00, 0x4B, 0x52, 0x41, 0x54, 0x00, 0x4B, 0x52, 0x41, 0x53,
+0x70, 0x00, 0x15, 0x4C, 0x4D, 0x54, 0x00, 0x4B, 0x52, 0x41, 0x54, 0x00, 0x4B, 0x52, 0x41, 0x53,
0x54, 0x00, 0x4E, 0x4F, 0x56, 0x53, 0x54, 0x00, 0x4E, 0x4F, 0x56, 0x54, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xDB, 0x58, 0x58, 0x01, 0x97, 0x96, 0x72, 0x00, 0x00, 0x00, 0x31, 0x4D,
@@ -8996,7 +8982,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Omsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xB3, 0x40, 0xB0,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xB3, 0x40, 0xB6,
0xB5, 0xA3, 0xEF, 0x30, 0x15, 0x27, 0x7D, 0xA0, 0x16, 0x18, 0xB2, 0x10, 0x17, 0x08, 0xB1, 0x20,
0x17, 0xF9, 0xE5, 0x90, 0x18, 0xE9, 0xE4, 0xA0, 0x19, 0xDB, 0x19, 0x10, 0x1A, 0xCC, 0x69, 0xA0,
0x1B, 0xBC, 0x76, 0xC0, 0x1C, 0xAC, 0x67, 0xC0, 0x1D, 0x9C, 0x58, 0xC0, 0x1E, 0x8C, 0x49, 0xC0,
@@ -9017,7 +9003,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x04, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x08,
-0x04, 0x00, 0x00, 0x44, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04, 0x00, 0x00, 0x62,
+0x04, 0x00, 0x00, 0x44, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04, 0x00, 0x00, 0x62,
0x70, 0x01, 0x09, 0x00, 0x00, 0x54, 0x60, 0x00, 0x04, 0x00, 0x00, 0x54, 0x60, 0x00, 0x04, 0x00,
0x00, 0x62, 0x70, 0x01, 0x09, 0x00, 0x00, 0x54, 0x60, 0x01, 0x09, 0x00, 0x00, 0x46, 0x50, 0x00,
0x04, 0x00, 0x00, 0x62, 0x70, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x4F, 0x4D, 0x53, 0x54, 0x00,
@@ -9201,7 +9187,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Samarkand */
0x50, 0x48, 0x50, 0x31, 0x01, 0x55, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x1D, 0xAA, 0x19, 0x85, 0x60,
+0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x1D, 0xAA, 0x19, 0x85, 0x37,
0xB5, 0xA3, 0xFD, 0x40, 0x15, 0x27, 0x8B, 0xB0, 0x16, 0x18, 0xC0, 0x20, 0x17, 0x08, 0xB1, 0x20,
0x17, 0xF9, 0xF3, 0xA0, 0x18, 0xE9, 0xF2, 0xB0, 0x19, 0xDB, 0x27, 0x20, 0x1A, 0xCC, 0x77, 0xB0,
0x1B, 0xBC, 0x84, 0xD0, 0x1C, 0xAC, 0x75, 0xD0, 0x1D, 0x9C, 0x66, 0xD0, 0x1E, 0x8C, 0x57, 0xD0,
@@ -9210,7 +9196,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x27, 0x05, 0x0B, 0x50, 0x27, 0xF4, 0xFC, 0x50, 0x28, 0xBF, 0xD9, 0x20, 0x28, 0xE4, 0xED, 0x50,
0x29, 0x60, 0xBE, 0x30, 0x01, 0x02, 0x03, 0x04, 0x03, 0x02, 0x03, 0x02, 0x03, 0x05, 0x06, 0x05,
0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x08, 0x07, 0x09, 0x00, 0x00,
-0x3E, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04,
+0x3E, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04,
0x00, 0x00, 0x54, 0x60, 0x01, 0x09, 0x00, 0x00, 0x54, 0x60, 0x00, 0x0F, 0x00, 0x00, 0x46, 0x50,
0x00, 0x04, 0x00, 0x00, 0x54, 0x60, 0x01, 0x09, 0x00, 0x00, 0x46, 0x50, 0x00, 0x14, 0x00, 0x00,
0x54, 0x60, 0x01, 0x18, 0x00, 0x00, 0x46, 0x50, 0x00, 0x14, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x41,
@@ -9344,7 +9330,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Tbilisi */
0x50, 0x48, 0x50, 0x31, 0x01, 0x47, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x19, 0xAA, 0x19, 0x9A, 0x06,
+0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x19, 0xAA, 0x19, 0x9A, 0x01,
0xE7, 0xDA, 0x0C, 0x50, 0x15, 0x27, 0x99, 0xC0, 0x16, 0x18, 0xCE, 0x30, 0x17, 0x08, 0xCD, 0x40,
0x17, 0xFA, 0x01, 0xB0, 0x18, 0xEA, 0x00, 0xC0, 0x19, 0xDB, 0x35, 0x30, 0x1A, 0xCC, 0x85, 0xC0,
0x1B, 0xBC, 0x92, 0xE0, 0x1C, 0xAC, 0x83, 0xE0, 0x1D, 0x9C, 0x74, 0xE0, 0x1E, 0x8C, 0x65, 0xE0,
@@ -9361,7 +9347,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x08, 0x07, 0x09, 0x08, 0x09, 0x08, 0x09, 0x08, 0x0B,
0x0A, 0x0B, 0x0A, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
-0x0B, 0x0A, 0x08, 0x07, 0x0B, 0x00, 0x00, 0x29, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00,
+0x0B, 0x0A, 0x08, 0x07, 0x0B, 0x00, 0x00, 0x29, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00,
0x05, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0A, 0x00, 0x00, 0x38, 0x40, 0x00, 0x05, 0x00, 0x00, 0x38,
0x40, 0x00, 0x05, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0A, 0x00, 0x00, 0x38, 0x40, 0x01, 0x0A, 0x00,
0x00, 0x2A, 0x30, 0x00, 0x10, 0x00, 0x00, 0x38, 0x40, 0x01, 0x14, 0x00, 0x00, 0x2A, 0x30, 0x00,
@@ -9609,7 +9595,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Vladivostok */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA7, 0x59, 0x47, 0x5A,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA7, 0x59, 0x47, 0x5D,
0xB5, 0xA3, 0xB6, 0xF0, 0x15, 0x27, 0x45, 0x60, 0x16, 0x18, 0x79, 0xD0, 0x17, 0x08, 0x78, 0xE0,
0x17, 0xF9, 0xAD, 0x50, 0x18, 0xE9, 0xAC, 0x60, 0x19, 0xDA, 0xE0, 0xD0, 0x1A, 0xCC, 0x31, 0x60,
0x1B, 0xBC, 0x3E, 0x80, 0x1C, 0xAC, 0x2F, 0x80, 0x1D, 0x9C, 0x20, 0x80, 0x1E, 0x8C, 0x11, 0x80,
@@ -9630,7 +9616,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x04, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x08,
-0x04, 0x00, 0x00, 0x7B, 0xA6, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x9A,
+0x04, 0x00, 0x00, 0x7B, 0xA3, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x9A,
0xB0, 0x01, 0x09, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x04, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x04, 0x00,
0x00, 0x9A, 0xB0, 0x01, 0x09, 0x00, 0x00, 0x8C, 0xA0, 0x01, 0x09, 0x00, 0x00, 0x7E, 0x90, 0x00,
0x04, 0x00, 0x00, 0x9A, 0xB0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x56, 0x4C, 0x41, 0x54, 0x00,
@@ -9642,7 +9628,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Yakutsk */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xDB, 0xEA, 0x70,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0F, 0xA1, 0xDB, 0xEA, 0x5E,
0xB5, 0xA3, 0xC5, 0x00, 0x15, 0x27, 0x53, 0x70, 0x16, 0x18, 0x87, 0xE0, 0x17, 0x08, 0x86, 0xF0,
0x17, 0xF9, 0xBB, 0x60, 0x18, 0xE9, 0xBA, 0x70, 0x19, 0xDA, 0xEE, 0xE0, 0x1A, 0xCC, 0x3F, 0x70,
0x1B, 0xBC, 0x4C, 0x90, 0x1C, 0xAC, 0x3D, 0x90, 0x1D, 0x9C, 0x2E, 0x90, 0x1E, 0x8C, 0x1F, 0x90,
@@ -9663,7 +9649,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x04, 0x02, 0x03, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x08,
-0x04, 0x00, 0x00, 0x79, 0x90, 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x00, 0x00, 0x8C,
+0x04, 0x00, 0x00, 0x79, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x00, 0x04, 0x00, 0x00, 0x8C,
0xA0, 0x01, 0x09, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00, 0x00, 0x7E, 0x90, 0x00, 0x04, 0x00,
0x00, 0x8C, 0xA0, 0x01, 0x09, 0x00, 0x00, 0x7E, 0x90, 0x01, 0x09, 0x00, 0x00, 0x70, 0x80, 0x00,
0x04, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x04, 0x4C, 0x4D, 0x54, 0x00, 0x59, 0x41, 0x4B, 0x54, 0x00,
@@ -9674,39 +9660,40 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Asia/Yekaterinburg */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x1A, 0xA1, 0x12, 0xAD, 0xE7,
-0xB5, 0xA3, 0xFD, 0x40, 0x15, 0x27, 0x8B, 0xB0, 0x16, 0x18, 0xC0, 0x20, 0x17, 0x08, 0xBF, 0x30,
-0x17, 0xF9, 0xF3, 0xA0, 0x18, 0xE9, 0xF2, 0xB0, 0x19, 0xDB, 0x27, 0x20, 0x1A, 0xCC, 0x77, 0xB0,
-0x1B, 0xBC, 0x84, 0xD0, 0x1C, 0xAC, 0x75, 0xD0, 0x1D, 0x9C, 0x66, 0xD0, 0x1E, 0x8C, 0x57, 0xD0,
-0x1F, 0x7C, 0x48, 0xD0, 0x20, 0x6C, 0x39, 0xD0, 0x21, 0x5C, 0x2A, 0xD0, 0x22, 0x4C, 0x1B, 0xD0,
-0x23, 0x3C, 0x0C, 0xD0, 0x24, 0x2B, 0xFD, 0xD0, 0x25, 0x1B, 0xEE, 0xD0, 0x26, 0x0B, 0xDF, 0xD0,
-0x27, 0x05, 0x0B, 0x50, 0x27, 0xF4, 0xFC, 0x50, 0x28, 0xE4, 0xFB, 0x60, 0x29, 0x78, 0xA3, 0x60,
-0x29, 0xD4, 0xB4, 0x20, 0x2A, 0xC4, 0x97, 0x10, 0x2B, 0xB4, 0xC0, 0x50, 0x2C, 0xA4, 0xB1, 0x50,
-0x2D, 0x94, 0xA2, 0x50, 0x2E, 0x84, 0x93, 0x50, 0x2F, 0x74, 0x84, 0x50, 0x30, 0x64, 0x75, 0x50,
-0x31, 0x5D, 0xA0, 0xD0, 0x32, 0x72, 0x7B, 0xD0, 0x33, 0x3D, 0x82, 0xD0, 0x34, 0x52, 0x5D, 0xD0,
-0x35, 0x1D, 0x64, 0xD0, 0x36, 0x32, 0x3F, 0xD0, 0x36, 0xFD, 0x46, 0xD0, 0x38, 0x1B, 0x5C, 0x50,
-0x38, 0xDD, 0x28, 0xD0, 0x39, 0xFB, 0x3E, 0x50, 0x3A, 0xBD, 0x0A, 0xD0, 0x3B, 0xDB, 0x20, 0x50,
-0x3C, 0xA6, 0x27, 0x50, 0x3D, 0xBB, 0x02, 0x50, 0x3E, 0x86, 0x09, 0x50, 0x3F, 0x9A, 0xE4, 0x50,
-0x40, 0x65, 0xEB, 0x50, 0x41, 0x84, 0x00, 0xD0, 0x42, 0x45, 0xCD, 0x50, 0x43, 0x63, 0xE2, 0xD0,
-0x44, 0x25, 0xAF, 0x50, 0x45, 0x43, 0xC4, 0xD0, 0x46, 0x05, 0x91, 0x50, 0x47, 0x23, 0xA6, 0xD0,
-0x47, 0xEE, 0xAD, 0xD0, 0x49, 0x03, 0x88, 0xD0, 0x49, 0xCE, 0x8F, 0xD0, 0x4A, 0xE3, 0x6A, 0xD0,
-0x4B, 0xAE, 0x71, 0xD0, 0x4C, 0xCC, 0x87, 0x50, 0x4D, 0x8E, 0x53, 0xD0, 0x54, 0x4C, 0x01, 0x40,
-0x01, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
-0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x06, 0x07, 0x0B, 0x08, 0x09, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
-0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A,
-0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0A, 0x0B, 0x0C,
-0x0B, 0x00, 0x00, 0x38, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x04, 0x00, 0x00, 0x54,
-0x60, 0x01, 0x09, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x00, 0x04, 0x00,
-0x00, 0x54, 0x60, 0x01, 0x09, 0x00, 0x00, 0x46, 0x50, 0x01, 0x09, 0x00, 0x00, 0x38, 0x40, 0x00,
-0x04, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0F, 0x00, 0x00, 0x46, 0x50, 0x00, 0x15, 0x00, 0x00, 0x54,
-0x60, 0x01, 0x0F, 0x00, 0x00, 0x46, 0x50, 0x00, 0x15, 0x00, 0x00, 0x54, 0x60, 0x00, 0x15, 0x4C,
-0x4D, 0x54, 0x00, 0x53, 0x56, 0x45, 0x54, 0x00, 0x53, 0x56, 0x45, 0x53, 0x54, 0x00, 0x59, 0x45,
-0x4B, 0x53, 0x54, 0x00, 0x59, 0x45, 0x4B, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x9B, 0x5F, 0x09, 0x27,
+0xA1, 0x12, 0xB1, 0xFF, 0xB5, 0xA3, 0xFD, 0x40, 0x15, 0x27, 0x8B, 0xB0, 0x16, 0x18, 0xC0, 0x20,
+0x17, 0x08, 0xBF, 0x30, 0x17, 0xF9, 0xF3, 0xA0, 0x18, 0xE9, 0xF2, 0xB0, 0x19, 0xDB, 0x27, 0x20,
+0x1A, 0xCC, 0x77, 0xB0, 0x1B, 0xBC, 0x84, 0xD0, 0x1C, 0xAC, 0x75, 0xD0, 0x1D, 0x9C, 0x66, 0xD0,
+0x1E, 0x8C, 0x57, 0xD0, 0x1F, 0x7C, 0x48, 0xD0, 0x20, 0x6C, 0x39, 0xD0, 0x21, 0x5C, 0x2A, 0xD0,
+0x22, 0x4C, 0x1B, 0xD0, 0x23, 0x3C, 0x0C, 0xD0, 0x24, 0x2B, 0xFD, 0xD0, 0x25, 0x1B, 0xEE, 0xD0,
+0x26, 0x0B, 0xDF, 0xD0, 0x27, 0x05, 0x0B, 0x50, 0x27, 0xF4, 0xFC, 0x50, 0x28, 0xE4, 0xFB, 0x60,
+0x29, 0x78, 0xA3, 0x60, 0x29, 0xD4, 0xB4, 0x20, 0x2A, 0xC4, 0x97, 0x10, 0x2B, 0xB4, 0xC0, 0x50,
+0x2C, 0xA4, 0xB1, 0x50, 0x2D, 0x94, 0xA2, 0x50, 0x2E, 0x84, 0x93, 0x50, 0x2F, 0x74, 0x84, 0x50,
+0x30, 0x64, 0x75, 0x50, 0x31, 0x5D, 0xA0, 0xD0, 0x32, 0x72, 0x7B, 0xD0, 0x33, 0x3D, 0x82, 0xD0,
+0x34, 0x52, 0x5D, 0xD0, 0x35, 0x1D, 0x64, 0xD0, 0x36, 0x32, 0x3F, 0xD0, 0x36, 0xFD, 0x46, 0xD0,
+0x38, 0x1B, 0x5C, 0x50, 0x38, 0xDD, 0x28, 0xD0, 0x39, 0xFB, 0x3E, 0x50, 0x3A, 0xBD, 0x0A, 0xD0,
+0x3B, 0xDB, 0x20, 0x50, 0x3C, 0xA6, 0x27, 0x50, 0x3D, 0xBB, 0x02, 0x50, 0x3E, 0x86, 0x09, 0x50,
+0x3F, 0x9A, 0xE4, 0x50, 0x40, 0x65, 0xEB, 0x50, 0x41, 0x84, 0x00, 0xD0, 0x42, 0x45, 0xCD, 0x50,
+0x43, 0x63, 0xE2, 0xD0, 0x44, 0x25, 0xAF, 0x50, 0x45, 0x43, 0xC4, 0xD0, 0x46, 0x05, 0x91, 0x50,
+0x47, 0x23, 0xA6, 0xD0, 0x47, 0xEE, 0xAD, 0xD0, 0x49, 0x03, 0x88, 0xD0, 0x49, 0xCE, 0x8F, 0xD0,
+0x4A, 0xE3, 0x6A, 0xD0, 0x4B, 0xAE, 0x71, 0xD0, 0x4C, 0xCC, 0x87, 0x50, 0x4D, 0x8E, 0x53, 0xD0,
+0x54, 0x4C, 0x01, 0x40, 0x01, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x06,
+0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x06, 0x05, 0x07, 0x08, 0x0C, 0x09, 0x0A,
+0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C,
+0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C, 0x0B, 0x0C,
+0x0B, 0x0C, 0x0B, 0x0C, 0x0D, 0x0C, 0x00, 0x00, 0x38, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x34, 0xC1,
+0x00, 0x04, 0x00, 0x00, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0D, 0x00, 0x00,
+0x46, 0x50, 0x00, 0x08, 0x00, 0x00, 0x46, 0x50, 0x00, 0x08, 0x00, 0x00, 0x54, 0x60, 0x01, 0x0D,
+0x00, 0x00, 0x46, 0x50, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x54, 0x60,
+0x01, 0x13, 0x00, 0x00, 0x46, 0x50, 0x00, 0x19, 0x00, 0x00, 0x54, 0x60, 0x01, 0x13, 0x00, 0x00,
+0x46, 0x50, 0x00, 0x19, 0x00, 0x00, 0x54, 0x60, 0x00, 0x19, 0x4C, 0x4D, 0x54, 0x00, 0x50, 0x4D,
+0x54, 0x00, 0x53, 0x56, 0x45, 0x54, 0x00, 0x53, 0x56, 0x45, 0x53, 0x54, 0x00, 0x59, 0x45, 0x4B,
+0x53, 0x54, 0x00, 0x59, 0x45, 0x4B, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xE0, 0x13, 0x48, 0x01, 0x6F, 0x20, 0x60, 0x00, 0x00, 0x00, 0x11, 0x4D,
-0x6F, 0x73, 0x63, 0x6F, 0x77, 0x2B, 0x30, 0x32, 0x20, 0x2D, 0x20, 0x55, 0x72, 0x61, 0x6C, 0x73,
-
+0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x13, 0x48, 0x01, 0x6F, 0x20, 0x60, 0x00, 0x00, 0x00, 0x11,
+0x4D, 0x6F, 0x73, 0x63, 0x6F, 0x77, 0x2B, 0x30, 0x32, 0x20, 0x2D, 0x20, 0x55, 0x72, 0x61, 0x6C,
+0x73,
/* Asia/Yerevan */
0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -9746,7 +9733,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Atlantic/Azores */
0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x19, 0x91, 0xC1, 0xFC, 0x58,
+0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x19, 0x92, 0xE6, 0xA9, 0x58,
0x9B, 0x4B, 0x89, 0x90, 0x9B, 0xFE, 0xE3, 0xA0, 0x9C, 0x9D, 0x09, 0x90, 0x9D, 0xC9, 0x9F, 0x90,
0x9E, 0x7F, 0x8E, 0x90, 0x9F, 0xAA, 0xD3, 0x10, 0xA0, 0x5F, 0x70, 0x90, 0xA1, 0x8C, 0x06, 0x90,
0xA2, 0x41, 0xF5, 0x90, 0xA3, 0x6E, 0x8B, 0x90, 0xA4, 0x23, 0x29, 0x10, 0xA5, 0x4F, 0xBF, 0x10,
@@ -10080,7 +10067,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Atlantic/Madeira */
0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1E, 0x91, 0xC1, 0xF1, 0x58,
+0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1E, 0x92, 0xE6, 0x9E, 0x58,
0x9B, 0x4B, 0x7B, 0x80, 0x9B, 0xFE, 0xD5, 0x90, 0x9C, 0x9C, 0xFB, 0x80, 0x9D, 0xC9, 0x91, 0x80,
0x9E, 0x7F, 0x80, 0x80, 0x9F, 0xAA, 0xC5, 0x00, 0xA0, 0x5F, 0x62, 0x80, 0xA1, 0x8B, 0xF8, 0x80,
0xA2, 0x41, 0xE7, 0x80, 0xA3, 0x6E, 0x7D, 0x80, 0xA4, 0x23, 0x1B, 0x00, 0xA5, 0x4F, 0xB1, 0x00,
@@ -13945,7 +13932,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Europe/Lisbon */
0x50, 0x48, 0x50, 0x31, 0x01, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1B, 0x92, 0xE6, 0x97, 0x10,
+0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1B, 0x92, 0xE6, 0x97, 0x1D,
0x9B, 0x4B, 0x6D, 0x70, 0x9B, 0xFE, 0xC7, 0x80, 0x9C, 0x9C, 0xED, 0x70, 0x9D, 0xC9, 0x83, 0x70,
0x9E, 0x7F, 0x72, 0x70, 0x9F, 0xAA, 0xB6, 0xF0, 0xA0, 0x5F, 0x54, 0x70, 0xA1, 0x8B, 0xEA, 0x70,
0xA2, 0x41, 0xD9, 0x70, 0xA3, 0x6E, 0x6F, 0x70, 0xA4, 0x23, 0x0C, 0xF0, 0xA5, 0x4F, 0xA2, 0xF0,
@@ -14015,7 +14002,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0xFF, 0xFF, 0xF7,
-0x70, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
+0x63, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x1C, 0x20, 0x01,
0x0D, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x12, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x12, 0x00, 0x00, 0x1C,
0x20, 0x01, 0x16, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x4C,
@@ -14824,8 +14811,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Europe/Riga */
0x50, 0x48, 0x50, 0x31, 0x01, 0x4C, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x22, 0x9E, 0xB9, 0x88, 0x04,
-0x9F, 0x84, 0x8F, 0x04, 0xA0, 0x88, 0x46, 0x84, 0xA0, 0xCB, 0x83, 0x04, 0xAD, 0xE7, 0xF1, 0xE4,
+0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x22, 0x9E, 0xB9, 0x87, 0xFE,
+0x9F, 0x84, 0x8E, 0xFE, 0xA0, 0x88, 0x46, 0x7E, 0xA0, 0xCB, 0x82, 0xFE, 0xAD, 0xE7, 0xF1, 0xDE,
0xC8, 0xAF, 0x64, 0x60, 0xCA, 0x62, 0x65, 0x50, 0xCC, 0xE7, 0x4B, 0x10, 0xCD, 0xA9, 0x17, 0x90,
0xCE, 0xA2, 0x43, 0x10, 0xCF, 0x92, 0x34, 0x10, 0xD0, 0x82, 0x25, 0x10, 0xD0, 0x90, 0x89, 0x70,
0x15, 0x27, 0xA7, 0xD0, 0x16, 0x18, 0xDC, 0x40, 0x17, 0x08, 0xDB, 0x50, 0x17, 0xFA, 0x0F, 0xC0,
@@ -14864,8 +14851,8 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C,
0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C,
0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C,
-0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x00, 0x00, 0x16, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x24,
-0xAC, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x0C, 0x00,
+0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x0C, 0x0D, 0x00, 0x00, 0x16, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x24,
+0xB2, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x0C, 0x00,
0x00, 0x0E, 0x10, 0x00, 0x10, 0x00, 0x00, 0x1C, 0x20, 0x01, 0x14, 0x00, 0x00, 0x1C, 0x20, 0x01,
0x14, 0x00, 0x00, 0x38, 0x40, 0x01, 0x19, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x38,
0x40, 0x01, 0x19, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x1D, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x08, 0x00,
@@ -14942,7 +14929,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Europe/Samara */
0x50, 0x48, 0x50, 0x31, 0x01, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x2B, 0xA1, 0x00, 0x26, 0x9C,
+0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x2B, 0xA1, 0x00, 0x26, 0xAC,
0xB5, 0xA4, 0x0B, 0x50, 0xBE, 0x4C, 0x26, 0xC0, 0x15, 0x27, 0x99, 0xC0, 0x16, 0x18, 0xCE, 0x30,
0x17, 0x08, 0xCD, 0x40, 0x17, 0xFA, 0x01, 0xB0, 0x18, 0xEA, 0x00, 0xC0, 0x19, 0xDB, 0x35, 0x30,
0x1A, 0xCC, 0x85, 0xC0, 0x1B, 0xBC, 0x92, 0xE0, 0x1C, 0xAC, 0x83, 0xE0, 0x1D, 0x9C, 0x74, 0xE0,
@@ -14963,7 +14950,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x05, 0x06, 0x05, 0x07, 0x08, 0x07, 0x08, 0x09, 0x0B, 0x02, 0x0C, 0x02, 0x0D, 0x0E, 0x0D, 0x0E,
0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E,
0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0D, 0x0E, 0x0F, 0x10,
-0x0E, 0x00, 0x00, 0x2F, 0x04, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38,
+0x0E, 0x00, 0x00, 0x2E, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38,
0x40, 0x00, 0x04, 0x00, 0x00, 0x46, 0x50, 0x01, 0x09, 0x00, 0x00, 0x38, 0x40, 0x00, 0x0F, 0x00,
0x00, 0x38, 0x40, 0x00, 0x0F, 0x00, 0x00, 0x46, 0x50, 0x01, 0x09, 0x00, 0x00, 0x38, 0x40, 0x01,
0x14, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x18, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x1C, 0x00, 0x00, 0x1C,
@@ -16427,7 +16414,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x93, 0x0F, 0xB4, 0xFF,
-0x08, 0x20, 0xC1, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60,
+0x07, 0x8D, 0x19, 0x70, 0x09, 0x10, 0xA4, 0x60, 0x09, 0xAD, 0x94, 0xF0, 0x0A, 0xF0, 0x86, 0x60,
0x0B, 0xE0, 0x85, 0x70, 0x0C, 0xD9, 0xA2, 0xE0, 0x0D, 0xC0, 0x67, 0x70, 0x0E, 0xB9, 0x84, 0xE0,
0x0F, 0xA9, 0x83, 0xF0, 0x10, 0x99, 0x66, 0xE0, 0x11, 0x89, 0x65, 0xF0, 0x12, 0x79, 0x48, 0xE0,
0x13, 0x69, 0x47, 0xF0, 0x14, 0x59, 0x2A, 0xE0, 0x15, 0x49, 0x29, 0xF0, 0x16, 0x39, 0x0C, 0xE0,
@@ -17513,7 +17500,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
/* Portugal */
0x50, 0x48, 0x50, 0x31, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1B, 0x92, 0xE6, 0x97, 0x10,
+0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x1B, 0x92, 0xE6, 0x97, 0x1D,
0x9B, 0x4B, 0x6D, 0x70, 0x9B, 0xFE, 0xC7, 0x80, 0x9C, 0x9C, 0xED, 0x70, 0x9D, 0xC9, 0x83, 0x70,
0x9E, 0x7F, 0x72, 0x70, 0x9F, 0xAA, 0xB6, 0xF0, 0xA0, 0x5F, 0x54, 0x70, 0xA1, 0x8B, 0xEA, 0x70,
0xA2, 0x41, 0xD9, 0x70, 0xA3, 0x6E, 0x6F, 0x70, 0xA4, 0x23, 0x0C, 0xF0, 0xA5, 0x4F, 0xA2, 0xF0,
@@ -17583,7 +17570,7 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09,
0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0x09, 0x0A, 0xFF, 0xFF, 0xF7,
-0x70, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
+0x63, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x1C, 0x20, 0x01,
0x0D, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x12, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x12, 0x00, 0x00, 0x1C,
0x20, 0x01, 0x16, 0x00, 0x00, 0x0E, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x4C,
@@ -18545,4 +18532,4 @@ const unsigned char timelib_timezone_db_data_builtin[263400] = {
0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80,
0x00, 0x00, 0x00, 0x00, };
-const timelib_tzdb timezonedb_builtin = { "2014.6", 582, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { "2014.8", 582, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c
index 7231dff093..40fbd6805a 100644
--- a/ext/date/lib/tm2unixtime.c
+++ b/ext/date/lib/tm2unixtime.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c
index 9870313fbc..93c4126d14 100644
--- a/ext/date/lib/unixtime2tm.c
+++ b/ext/date/lib/unixtime2tm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 813f8663f0..f2ced7bd59 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -39,6 +39,24 @@ static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i
static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; }
#endif
+#ifdef PHP_WIN32
+#define DATE_I64_BUF_LEN 65
+# define DATE_I64A(i, s, len) _i64toa_s(i, s, len, 10)
+# define DATE_A64I(i, s) i = _atoi64(s)
+#else
+#define DATE_I64_BUF_LEN 65
+# define DATE_I64A(i, s, len) \
+ do { \
+ int st = snprintf(s, len, "%lld", i); \
+ s[st] = '\0'; \
+ } while (0);
+#ifdef HAVE_ATOLL
+# define DATE_A64I(i, s) i = atoll(s)
+#else
+# define DATE_A64I(i, s) i = strtoll(s, NULL, 10)
+#endif
+#endif
+
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1)
ZEND_ARG_INFO(0, format)
@@ -307,12 +325,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, datetime)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_offset_get, 0, 0, 1)
- ZEND_ARG_INFO(0, datetime)
+ ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1)
@@ -842,9 +860,9 @@ PHP_MINIT_FUNCTION(date)
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
php_date_global_timezone_db = NULL;
php_date_global_timezone_db_enabled = 0;
@@ -914,7 +932,7 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib
/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
static PHP_INI_MH(OnUpdate_date_timezone)
{
- if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+ if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
return FAILURE;
}
@@ -941,11 +959,11 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
/* Check config setting for default timezone */
if (!DATEG(default_timezone)) {
/* Special case: ext/date wasn't initialized yet */
- zval ztz;
+ zval *ztz;
- if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz)
- && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
- return Z_STRVAL(ztz);
+ if (NULL != (ztz = cfg_get_entry("date.timezone", sizeof("date.timezone")))
+ && Z_TYPE_P(ztz) == IS_STRING && Z_STRLEN_P(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL_P(ztz), tzdb)) {
+ return Z_STRVAL_P(ztz);
}
} else if (*DATEG(default_timezone)) {
if (DATEG(timezone_valid) == 1) {
@@ -981,7 +999,7 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D)
/* {{{ date() and gmdate() data */
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
static char *mon_full_names[] = {
"January", "February", "March", "April",
@@ -1037,7 +1055,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
/* }}} */
/* {{{ date_format - (gm)date helper */
-static zend_string *date_format(char *format, int format_len, timelib_time *t, int localtime TSRMLS_DC)
+static zend_string *date_format(char *format, size_t format_len, timelib_time *t, int localtime TSRMLS_DC)
{
smart_str string = {0};
int i, length = 0;
@@ -1198,10 +1216,10 @@ static zend_string *date_format(char *format, int format_len, timelib_time *t, i
static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
{
char *format;
- int format_len;
- php_int_t ts;
+ size_t format_len;
+ zend_long ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 1) {
@@ -1354,11 +1372,11 @@ PHP_FUNCTION(gmdate)
PHP_FUNCTION(idate)
{
char *format;
- int format_len;
- php_int_t ts = 0;
+ size_t format_len;
+ zend_long ts = 0;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
@@ -1376,7 +1394,7 @@ PHP_FUNCTION(idate)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
RETURN_FALSE;
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1393,12 +1411,12 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
/* }}} */
/* {{{ php_parse_date: Backwards compatibility function */
-PHPAPI php_int_t php_parse_date(char *string, php_int_t *now)
+PHPAPI zend_long php_parse_date(char *string, zend_long *now)
{
timelib_time *parsed_time;
timelib_error_container *error = NULL;
int error2;
- php_int_t retval;
+ zend_long retval;
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (error->error_count) {
@@ -1422,21 +1440,22 @@ PHPAPI php_int_t php_parse_date(char *string, php_int_t *now)
PHP_FUNCTION(strtotime)
{
char *times, *initial_ts;
- int time_len, error1, error2;
+ size_t time_len;
+ int error1, error2;
struct timelib_error_container *error;
- php_int_t preset_ts = 0, ts;
+ zend_long preset_ts = 0, ts;
timelib_time *t, *now;
timelib_tzinfo *tzi;
tzi = get_timezone_info(TSRMLS_C);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "si", &times, &time_len, &preset_ts) != FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", &times, &time_len, &preset_ts) != FAILURE) {
/* We have an initial timestamp */
now = timelib_time_ctor();
initial_ts = emalloc(25);
- snprintf(initial_ts, 24, "@%ld UTC", preset_ts);
+ snprintf(initial_ts, 24, "@" ZEND_LONG_FMT " UTC", preset_ts);
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); /* we ignore the error here, as this should never fail */
timelib_update_ts(t, tzi);
now->tz_info = tzi;
@@ -1444,7 +1463,7 @@ PHP_FUNCTION(strtotime)
timelib_unixtime2local(now, t->sse);
timelib_time_dtor(t);
efree(initial_ts);
- } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &times, &time_len, &preset_ts) != FAILURE) {
+ } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &times, &time_len, &preset_ts) != FAILURE) {
/* We have no initial timestamp */
now = timelib_time_ctor();
now->tz_info = tzi;
@@ -1472,7 +1491,7 @@ PHP_FUNCTION(strtotime)
if (error1 || error2) {
RETURN_FALSE;
} else {
- RETURN_INT(ts);
+ RETURN_LONG(ts);
}
}
/* }}} */
@@ -1480,13 +1499,13 @@ PHP_FUNCTION(strtotime)
/* {{{ php_mktime - (gm)mktime helper */
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
{
- php_int_t hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1;
+ zend_long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1;
timelib_time *now;
timelib_tzinfo *tzi = NULL;
- php_int_t ts, adjust_seconds = 0;
+ zend_long ts, adjust_seconds = 0;
int error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iiiiiii", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lllllll", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) {
RETURN_FALSE;
}
/* Initialize structure with current time */
@@ -1564,7 +1583,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (error) {
RETURN_FALSE;
} else {
- RETURN_INT(ts);
+ RETURN_LONG(ts);
}
}
/* }}} */
@@ -1589,9 +1608,9 @@ PHP_FUNCTION(gmmktime)
Returns true(1) if it is a valid date in gregorian calendar */
PHP_FUNCTION(checkdate)
{
- php_int_t m, d, y;
+ zend_long m, d, y;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &m, &d, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) {
RETURN_FALSE;
}
@@ -1607,8 +1626,8 @@ PHP_FUNCTION(checkdate)
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
{
char *format;
- int format_len;
- php_int_t timestamp = 0;
+ size_t format_len;
+ zend_long timestamp = 0;
struct tm ta;
int max_reallocs = 5;
size_t buf_len = 256, real_len;
@@ -1617,9 +1636,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
timelib_time_offset *offset = NULL;
zend_string *buf;
- timestamp = (php_int_t) time(NULL);
+ timestamp = (zend_long) time(NULL);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &timestamp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -1668,10 +1687,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
/* VS2012 crt has a bug where strftime crash with %z and %Z format when the
initial buffer is too small. See
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */
- buf = STR_ALLOC(buf_len, 0);
+ buf = zend_string_alloc(buf_len, 0);
while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) {
buf_len *= 2;
- buf = STR_REALLOC(buf, buf_len, 0);
+ buf = zend_string_realloc(buf, buf_len, 0);
if (!--max_reallocs) {
break;
}
@@ -1690,10 +1709,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
if (real_len && real_len != buf_len) {
- buf = STR_REALLOC(buf, real_len, 0);
+ buf = zend_string_realloc(buf, real_len, 0);
RETURN_STR(buf);
}
- STR_FREE(buf);
+ zend_string_free(buf);
RETURN_FALSE;
}
/* }}} */
@@ -1719,7 +1738,7 @@ PHP_FUNCTION(gmstrftime)
Return current UNIX timestamp */
PHP_FUNCTION(time)
{
- RETURN_INT((php_int_t)time(NULL));
+ RETURN_LONG((zend_long)time(NULL));
}
/* }}} */
@@ -1727,12 +1746,12 @@ PHP_FUNCTION(time)
Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
PHP_FUNCTION(localtime)
{
- php_int_t timestamp = (php_int_t)time(NULL);
+ zend_long timestamp = (zend_long)time(NULL);
zend_bool associative = 0;
timelib_tzinfo *tzi;
timelib_time *ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ib", &timestamp, &associative) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &timestamp, &associative) == FAILURE) {
RETURN_FALSE;
}
@@ -1745,25 +1764,25 @@ PHP_FUNCTION(localtime)
array_init(return_value);
if (associative) {
- add_assoc_int(return_value, "tm_sec", ts->s);
- add_assoc_int(return_value, "tm_min", ts->i);
- add_assoc_int(return_value, "tm_hour", ts->h);
- add_assoc_int(return_value, "tm_mday", ts->d);
- add_assoc_int(return_value, "tm_mon", ts->m - 1);
- add_assoc_int(return_value, "tm_year", ts->y - 1900);
- add_assoc_int(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "tm_isdst", ts->dst);
+ add_assoc_long(return_value, "tm_sec", ts->s);
+ add_assoc_long(return_value, "tm_min", ts->i);
+ add_assoc_long(return_value, "tm_hour", ts->h);
+ add_assoc_long(return_value, "tm_mday", ts->d);
+ add_assoc_long(return_value, "tm_mon", ts->m - 1);
+ add_assoc_long(return_value, "tm_year", ts->y - 1900);
+ add_assoc_long(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "tm_isdst", ts->dst);
} else {
- add_next_index_int(return_value, ts->s);
- add_next_index_int(return_value, ts->i);
- add_next_index_int(return_value, ts->h);
- add_next_index_int(return_value, ts->d);
- add_next_index_int(return_value, ts->m - 1);
- add_next_index_int(return_value, ts->y- 1900);
- add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d));
- add_next_index_int(return_value, timelib_day_of_year(ts->y, ts->m, ts->d));
- add_next_index_int(return_value, ts->dst);
+ add_next_index_long(return_value, ts->s);
+ add_next_index_long(return_value, ts->i);
+ add_next_index_long(return_value, ts->h);
+ add_next_index_long(return_value, ts->d);
+ add_next_index_long(return_value, ts->m - 1);
+ add_next_index_long(return_value, ts->y- 1900);
+ add_next_index_long(return_value, timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_next_index_long(return_value, timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_next_index_long(return_value, ts->dst);
}
timelib_time_dtor(ts);
@@ -1774,11 +1793,11 @@ PHP_FUNCTION(localtime)
Get date/time information */
PHP_FUNCTION(getdate)
{
- php_int_t timestamp = (php_int_t)time(NULL);
+ zend_long timestamp = (zend_long)time(NULL);
timelib_tzinfo *tzi;
timelib_time *ts;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timestamp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -1790,17 +1809,17 @@ PHP_FUNCTION(getdate)
array_init(return_value);
- add_assoc_int(return_value, "seconds", ts->s);
- add_assoc_int(return_value, "minutes", ts->i);
- add_assoc_int(return_value, "hours", ts->h);
- add_assoc_int(return_value, "mday", ts->d);
- add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d));
- add_assoc_int(return_value, "mon", ts->m);
- add_assoc_int(return_value, "year", ts->y);
- add_assoc_int(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "seconds", ts->s);
+ add_assoc_long(return_value, "minutes", ts->i);
+ add_assoc_long(return_value, "hours", ts->h);
+ add_assoc_long(return_value, "mday", ts->d);
+ add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d));
+ add_assoc_long(return_value, "mon", ts->m);
+ add_assoc_long(return_value, "year", ts->y);
+ add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d));
add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]);
- add_index_int(return_value, 0, timestamp);
+ add_index_long(return_value, 0, timestamp);
timelib_time_dtor(ts);
}
@@ -1907,7 +1926,7 @@ static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC)
static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
date_period_it *iterator = (date_period_it *)iter;
- ZVAL_INT(key, iterator->current_index);
+ ZVAL_LONG(key, iterator->current_index);
}
/* }}} */
@@ -2031,7 +2050,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */
date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
#define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \
- zend_declare_class_constant_int(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC);
+ zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC);
REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA);
REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA);
@@ -2078,7 +2097,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */
date_object_handlers_period.write_property = date_period_write_property;
#define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \
- zend_declare_class_constant_int(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC);
+ zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC);
REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE);
} /* }}} */
@@ -2185,7 +2204,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
- ZVAL_INT(&zv, dateobj->time->zone_type);
+ ZVAL_LONG(&zv, dateobj->time->zone_type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (dateobj->time->zone_type) {
@@ -2193,7 +2212,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
ZVAL_STRING(&zv, dateobj->time->tz_info->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = dateobj->time->z;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
@@ -2201,7 +2220,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */
abs(utc_offset / 60),
abs((utc_offset % 60)));
- ZVAL_STR(&zv, tmpstr);
+ ZVAL_NEW_STR(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
@@ -2278,7 +2297,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /*
return props;
}
- ZVAL_INT(&zv, tzobj->type);
+ ZVAL_LONG(&zv, tzobj->type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (tzobj->type) {
@@ -2286,14 +2305,14 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /*
ZVAL_STRING(&zv, tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+',
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
- ZVAL_STR(&zv, tmpstr);
+ ZVAL_NEW_STR(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
@@ -2359,7 +2378,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) /*
}
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
- ZVAL_INT(&zv, (php_int_t)intervalobj->diff->f); \
+ ZVAL_LONG(&zv, (zend_long)intervalobj->diff->f); \
zend_hash_str_update(props, n, sizeof(n)-1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
@@ -2485,7 +2504,7 @@ static void update_errors_warnings(timelib_error_container *last_errors TSRMLS_D
DATEG(last_errors) = last_errors;
} /* }}} */
-PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) /* {{{ */
+PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) /* {{{ */
{
timelib_time *now;
timelib_tzinfo *tzi = NULL;
@@ -2577,7 +2596,7 @@ PHP_FUNCTION(date_create)
{
zval *timezone_object = NULL;
char *time_str = NULL;
- int time_str_len = 0;
+ size_t time_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
@@ -2600,7 +2619,7 @@ PHP_FUNCTION(date_create_immutable)
{
zval *timezone_object = NULL;
char *time_str = NULL;
- int time_str_len = 0;
+ size_t time_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
@@ -2623,7 +2642,7 @@ PHP_FUNCTION(date_create_from_format)
{
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
- int time_str_len = 0, format_str_len = 0;
+ size_t time_str_len = 0, format_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
@@ -2646,7 +2665,7 @@ PHP_FUNCTION(date_create_immutable_from_format)
{
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
- int time_str_len = 0, format_str_len = 0;
+ size_t time_str_len = 0, format_str_len = 0;
zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
@@ -2669,7 +2688,7 @@ PHP_METHOD(DateTime, __construct)
{
zval *timezone_object = NULL;
char *time_str = NULL;
- int time_str_len = 0;
+ size_t time_str_len = 0;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
@@ -2689,7 +2708,7 @@ PHP_METHOD(DateTimeImmutable, __construct)
{
zval *timezone_object = NULL;
char *time_str = NULL;
- int time_str_len = 0;
+ size_t time_str_len = 0;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
@@ -2742,18 +2761,18 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
convert_to_string(z_date);
z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1);
if (z_timezone_type) {
- convert_to_int(z_timezone_type);
+ convert_to_long(z_timezone_type);
z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1);
if (z_timezone) {
convert_to_string(z_timezone);
- switch (Z_IVAL_P(z_timezone_type)) {
+ switch (Z_LVAL_P(z_timezone_type)) {
case TIMELIB_ZONETYPE_OFFSET:
case TIMELIB_ZONETYPE_ABBR: {
- char *tmp = emalloc(Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2);
+ char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2);
int ret;
- snprintf(tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone));
- ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
+ snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone));
+ ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
efree(tmp);
return 1 == ret;
}
@@ -2773,7 +2792,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRSIZE_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC);
+ ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
return 1 == ret;
}
@@ -2852,14 +2871,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) /
int i;
zval element;
- add_assoc_int(z, "warning_count", error->warning_count);
+ add_assoc_long(z, "warning_count", error->warning_count);
array_init(&element);
for (i = 0; i < error->warning_count; i++) {
add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message);
}
add_assoc_zval(z, "warnings", &element);
- add_assoc_int(z, "error_count", error->error_count);
+ add_assoc_long(z, "error_count", error->error_count);
array_init(&element);
for (i = 0; i < error->error_count; i++) {
add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message);
@@ -2890,7 +2909,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
if (parsed_time->elem == -99999) { \
add_assoc_bool(return_value, #name, 0); \
} else { \
- add_assoc_int(return_value, #name, parsed_time->elem); \
+ add_assoc_long(return_value, #name, parsed_time->elem); \
}
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m);
@@ -2935,17 +2954,17 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
}
if (parsed_time->have_relative) {
array_init(&element);
- add_assoc_int(&element, "year", parsed_time->relative.y);
- add_assoc_int(&element, "month", parsed_time->relative.m);
- add_assoc_int(&element, "day", parsed_time->relative.d);
- add_assoc_int(&element, "hour", parsed_time->relative.h);
- add_assoc_int(&element, "minute", parsed_time->relative.i);
- add_assoc_int(&element, "second", parsed_time->relative.s);
+ add_assoc_long(&element, "year", parsed_time->relative.y);
+ add_assoc_long(&element, "month", parsed_time->relative.m);
+ add_assoc_long(&element, "day", parsed_time->relative.d);
+ add_assoc_long(&element, "hour", parsed_time->relative.h);
+ add_assoc_long(&element, "minute", parsed_time->relative.i);
+ add_assoc_long(&element, "second", parsed_time->relative.s);
if (parsed_time->relative.have_weekday_relative) {
- add_assoc_int(&element, "weekday", parsed_time->relative.weekday);
+ add_assoc_long(&element, "weekday", parsed_time->relative.weekday);
}
if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) {
- add_assoc_int(&element, "weekdays", parsed_time->relative.special.amount);
+ add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount);
}
if (parsed_time->relative.first_last_day_of) {
add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1);
@@ -2961,7 +2980,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
PHP_FUNCTION(date_parse)
{
char *date;
- int date_len;
+ size_t date_len;
struct timelib_error_container *error;
timelib_time *parsed_time;
@@ -2980,7 +2999,7 @@ PHP_FUNCTION(date_parse)
PHP_FUNCTION(date_parse_from_format)
{
char *date, *format;
- int date_len, format_len;
+ size_t date_len, format_len;
struct timelib_error_container *error;
timelib_time *parsed_time;
@@ -3001,7 +3020,7 @@ PHP_FUNCTION(date_format)
zval *object;
php_date_obj *dateobj;
char *format;
- int format_len;
+ size_t format_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) {
RETURN_FALSE;
@@ -3081,7 +3100,7 @@ PHP_FUNCTION(date_modify)
{
zval *object;
char *modify;
- int modify_len;
+ size_t modify_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) {
RETURN_FALSE;
@@ -3101,7 +3120,7 @@ PHP_METHOD(DateTimeImmutable, modify)
{
zval *object, new_object;
char *modify;
- int modify_len;
+ size_t modify_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) {
RETURN_FALSE;
@@ -3342,24 +3361,24 @@ PHP_FUNCTION(date_offset_get)
switch (dateobj->time->zone_type) {
case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info);
- RETVAL_INT(offset->offset);
+ RETVAL_LONG(offset->offset);
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
- RETVAL_INT(dateobj->time->z * -60);
+ RETVAL_LONG(dateobj->time->z * -60);
break;
case TIMELIB_ZONETYPE_ABBR:
- RETVAL_INT((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
+ RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
break;
}
return;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
-static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t s, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long s, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3377,9 +3396,9 @@ static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t
PHP_FUNCTION(date_time_set)
{
zval *object;
- php_int_t h, i, s = 0;
+ zend_long h, i, s = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &h, &i, &s) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
@@ -3394,9 +3413,9 @@ PHP_FUNCTION(date_time_set)
PHP_METHOD(DateTimeImmutable, setTime)
{
zval *object, new_object;
- php_int_t h, i, s = 0;
+ zend_long h, i, s = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
@@ -3407,7 +3426,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
}
/* }}} */
-static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_date_set(zval *object, zend_long y, zend_long m, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3425,9 +3444,9 @@ static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t
PHP_FUNCTION(date_date_set)
{
zval *object;
- php_int_t y, m, d;
+ zend_long y, m, d;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_date, &y, &m, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3442,9 +3461,9 @@ PHP_FUNCTION(date_date_set)
PHP_METHOD(DateTimeImmutable, setDate)
{
zval *object, new_object;
- php_int_t y, m, d;
+ zend_long y, m, d;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3455,7 +3474,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
}
/* }}} */
-static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_isodate_set(zval *object, zend_long y, zend_long w, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3477,9 +3496,9 @@ static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int
PHP_FUNCTION(date_isodate_set)
{
zval *object;
- php_int_t y, w, d = 1;
+ zend_long y, w, d = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &y, &w, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3494,9 +3513,9 @@ PHP_FUNCTION(date_isodate_set)
PHP_METHOD(DateTimeImmutable, setISODate)
{
zval *object, new_object;
- php_int_t y, w, d = 1;
+ zend_long y, w, d = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
@@ -3507,7 +3526,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
}
/* }}} */
-static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *return_value TSRMLS_DC) /* {{{ */
+static void php_date_timestamp_set(zval *object, zend_long timestamp, zval *return_value TSRMLS_DC) /* {{{ */
{
php_date_obj *dateobj;
@@ -3523,9 +3542,9 @@ static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *retu
PHP_FUNCTION(date_timestamp_set)
{
zval *object;
- php_int_t timestamp;
+ zend_long timestamp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_date, &timestamp) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -3540,9 +3559,9 @@ PHP_FUNCTION(date_timestamp_set)
PHP_METHOD(DateTimeImmutable, setTimestamp)
{
zval *object, new_object;
- php_int_t timestamp;
+ zend_long timestamp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_immutable, &timestamp) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, &timestamp) == FAILURE) {
RETURN_FALSE;
}
@@ -3560,7 +3579,7 @@ PHP_FUNCTION(date_timestamp_get)
{
zval *object;
php_date_obj *dateobj;
- php_int_t timestamp;
+ zend_long timestamp;
int error;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
@@ -3574,7 +3593,7 @@ PHP_FUNCTION(date_timestamp_get)
if (error) {
RETURN_FALSE;
} else {
- RETVAL_INT(timestamp);
+ RETVAL_LONG(timestamp);
}
}
/* }}} */
@@ -3587,9 +3606,9 @@ PHP_FUNCTION(date_diff)
zval *object1, *object2;
php_date_obj *dateobj1, *dateobj2;
php_interval_obj *interval;
- php_int_t absolute = 0;
+ zend_long absolute = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
RETURN_FALSE;
}
dateobj1 = Z_PHPDATE_P(object1);
@@ -3633,7 +3652,7 @@ static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRML
PHP_FUNCTION(timezone_open)
{
char *tz;
- int tz_len;
+ size_t tz_len;
php_timezone_obj *tzobj;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) {
@@ -3652,7 +3671,7 @@ PHP_FUNCTION(timezone_open)
PHP_METHOD(DateTimeZone, __construct)
{
char *tz;
- int tz_len;
+ size_t tz_len;
php_timezone_obj *tzobj;
zend_error_handling error_handling;
@@ -3674,7 +3693,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
if ((z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1)) != NULL) {
if ((z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1)) != NULL) {
- convert_to_int(z_timezone_type);
+ convert_to_long(z_timezone_type);
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone) TSRMLS_CC)) {
return SUCCESS;
}
@@ -3738,7 +3757,7 @@ PHP_FUNCTION(timezone_name_get)
RETURN_STRING(tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
- zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0);
+ zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = tzobj->tzi.utc_offset;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
@@ -3763,11 +3782,11 @@ PHP_FUNCTION(timezone_name_from_abbr)
{
char *abbr;
char *tzid;
- int abbr_len;
- php_int_t gmtoffset = -1;
- php_int_t isdst = -1;
+ size_t abbr_len;
+ zend_long gmtoffset = -1;
+ zend_long isdst = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
RETURN_FALSE;
}
tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
@@ -3780,7 +3799,7 @@ PHP_FUNCTION(timezone_name_from_abbr)
}
/* }}} */
-/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTime object)
+/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTimeInterface datetime)
Returns the timezone offset.
*/
PHP_FUNCTION(timezone_offset_get)
@@ -3790,25 +3809,25 @@ PHP_FUNCTION(timezone_offset_get)
php_date_obj *dateobj;
timelib_time_offset *offset;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_date) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
tzobj = Z_PHPTIMEZONE_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
dateobj = Z_PHPDATE_P(dateobject);
- DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
+ DATE_CHECK_INITIALIZED(dateobj->time, DateTimeInterface);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz);
- RETVAL_INT(offset->offset);
+ RETVAL_LONG(offset->offset);
timelib_time_offset_dtor(offset);
break;
case TIMELIB_ZONETYPE_OFFSET:
- RETURN_INT(tzobj->tzi.utc_offset * -60);
+ RETURN_LONG(tzobj->tzi.utc_offset * -60);
break;
case TIMELIB_ZONETYPE_ABBR:
- RETURN_INT((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
+ RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
break;
}
}
@@ -3822,9 +3841,9 @@ PHP_FUNCTION(timezone_transitions_get)
zval *object, element;
php_timezone_obj *tzobj;
unsigned int i, begin = 0, found;
- php_int_t timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX;
+ zend_long timestamp_begin = ZEND_LONG_MIN, timestamp_end = ZEND_LONG_MAX;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ii", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
RETURN_FALSE;
}
tzobj = Z_PHPTIMEZONE_P(object);
@@ -3835,18 +3854,18 @@ PHP_FUNCTION(timezone_transitions_get)
#define add_nominal() \
array_init(&element); \
- add_assoc_int(&element, "ts", timestamp_begin); \
+ add_assoc_long(&element, "ts", timestamp_begin); \
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \
- add_assoc_int(&element, "offset", tzobj->tzi.tz->type[0].offset); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \
add_next_index_zval(return_value, &element);
#define add(i,ts) \
array_init(&element); \
- add_assoc_int(&element, "ts", ts); \
+ add_assoc_long(&element, "ts", ts); \
add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \
- add_assoc_int(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \
add_next_index_zval(return_value, &element);
@@ -3855,7 +3874,7 @@ PHP_FUNCTION(timezone_transitions_get)
array_init(return_value);
- if (timestamp_begin == PHP_INT_MIN) {
+ if (timestamp_begin == ZEND_LONG_MIN) {
add_nominal();
begin = 0;
found = 1;
@@ -4005,7 +4024,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
retval = rv;
if (value != -99999) {
- ZVAL_INT(retval, value);
+ ZVAL_LONG(retval, value);
} else {
ZVAL_FALSE(retval);
}
@@ -4044,7 +4063,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
#define SET_VALUE_FROM_STRUCT(n,m) \
if (strcmp(Z_STRVAL_P(member), m) == 0) { \
- obj->diff->n = zval_get_int(value); \
+ obj->diff->n = zval_get_long(value); \
break; \
}
@@ -4073,7 +4092,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
PHP_METHOD(DateInterval, __construct)
{
char *interval_string = NULL;
- int interval_string_length;
+ size_t interval_string_length;
php_interval_obj *diobj;
timelib_rel_time *reltime;
zend_error_handling error_handling;
@@ -4101,7 +4120,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \
- (*intobj)->diff->member = (itype)zval_get_int(z_arg); \
+ (*intobj)->diff->member = (itype)zval_get_long(z_arg); \
} else { \
(*intobj)->diff->member = (itype)def; \
} \
@@ -4112,8 +4131,8 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \
zend_string *str = zval_get_string(z_arg); \
- ZEND_ATOI((*intobj)->diff->member, str->val); \
- STR_RELEASE(str); \
+ DATE_A64I((*intobj)->diff->member, str->val); \
+ zend_string_release(str); \
} else { \
(*intobj)->diff->member = -1LL; \
} \
@@ -4181,7 +4200,7 @@ PHP_METHOD(DateInterval, __wakeup)
PHP_FUNCTION(date_interval_create_from_date_string)
{
char *time_str = NULL;
- int time_str_len = 0;
+ size_t time_str_len = 0;
timelib_time *time;
timelib_error_container *err = NULL;
php_interval_obj *diobj;
@@ -4230,8 +4249,8 @@ static zend_string *date_interval_format(char *format, int format_len, timelib_r
case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break;
- case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (php_int_t) t->s); break;
- case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (php_int_t) t->s); break;
+ case 'S': length = slprintf(buffer, 32, "%02" ZEND_LONG_FMT_SPEC, (zend_long) t->s); break;
+ case 's': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->s); break;
case 'a': {
if ((int) t->days != -99999) {
@@ -4271,7 +4290,7 @@ PHP_FUNCTION(date_interval_format)
zval *object;
php_interval_obj *diobj;
char *format;
- int format_len;
+ size_t format_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) {
RETURN_FALSE;
@@ -4283,7 +4302,7 @@ PHP_FUNCTION(date_interval_format)
}
/* }}} */
-static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, php_int_t *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
+static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, zend_long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
{
timelib_time *b = NULL, *e = NULL;
timelib_rel_time *p = NULL;
@@ -4316,16 +4335,16 @@ PHP_METHOD(DatePeriod, __construct)
php_date_obj *dateobj;
php_interval_obj *intobj;
zval *start, *end = NULL, *interval;
- php_int_t recurrences = 0, options = 0;
+ zend_long recurrences = 0, options = 0;
char *isostr = NULL;
- int isostr_len = 0;
+ size_t isostr_len = 0;
timelib_time *clone;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOi|i", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|i", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &isostr, &isostr_len, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.");
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
@@ -4395,7 +4414,7 @@ PHP_METHOD(DatePeriod, __construct)
}
/* }}} */
-static int check_id_allowed(char *id, php_int_t what) /* {{{ */
+static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1;
@@ -4419,11 +4438,11 @@ PHP_FUNCTION(timezone_identifiers_list)
const timelib_tzdb *tzdb;
const timelib_tzdb_index_entry *table;
int i, item_count;
- php_int_t what = PHP_DATE_TIMEZONE_GROUP_ALL;
+ zend_long what = PHP_DATE_TIMEZONE_GROUP_ALL;
char *option = NULL;
- int option_len = 0;
+ size_t option_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|is", &what, &option, &option_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) {
RETURN_FALSE;
}
@@ -4477,12 +4496,12 @@ PHP_FUNCTION(timezone_abbreviations_list)
do {
array_init(&element);
- add_assoc_bool(&element, "dst", entry->type);
- add_assoc_int(&element, "offset", entry->gmtoffset);
+ add_assoc_bool_ex(&element, "dst", sizeof("dst") -1, entry->type);
+ add_assoc_long_ex(&element, "offset", sizeof("offset") - 1, entry->gmtoffset);
if (entry->full_tz_name) {
- add_assoc_string(&element, "timezone_id", entry->full_tz_name);
+ add_assoc_string_ex(&element, "timezone_id", sizeof("timezone_id") - 1, entry->full_tz_name);
} else {
- add_assoc_null(&element, "timezone_id");
+ add_assoc_null_ex(&element, "timezone_id", sizeof("timezone_id") - 1);
}
abbr_array_p = zend_hash_str_find(HASH_OF(return_value), entry->name, strlen(entry->name));
@@ -4503,7 +4522,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
PHP_FUNCTION(date_default_timezone_set)
{
char *zone;
- int zone_len;
+ size_t zone_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zone, &zone_len) == FAILURE) {
RETURN_FALSE;
@@ -4540,13 +4559,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude;
double h_rise, h_set, N;
timelib_sll rise, set, transit;
- php_int_t time, retformat = 0;
+ zend_long time, retformat = 0;
int rs;
timelib_time *t;
timelib_tzinfo *tzi;
zend_string *retstr;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|idddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
RETURN_FALSE;
}
@@ -4599,7 +4618,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
}
if (retformat == SUNFUNCS_RET_TIMESTAMP) {
- RETURN_INT(calc_sunset ? set : rise);
+ RETURN_LONG(calc_sunset ? set : rise);
}
N = (calc_sunset ? h_set : h_rise) + gmt_offset;
@@ -4639,7 +4658,7 @@ PHP_FUNCTION(date_sunset)
Returns an array with information about sun set/rise and twilight begin/end */
PHP_FUNCTION(date_sun_info)
{
- php_int_t time;
+ zend_long time;
double latitude, longitude;
timelib_time *t, *t2;
timelib_tzinfo *tzi;
@@ -4648,7 +4667,7 @@ PHP_FUNCTION(date_sun_info)
int dummy;
double ddummy;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "idd", &time, &latitude, &longitude) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
RETURN_FALSE;
}
/* Initialize time struct */
@@ -4675,12 +4694,12 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "sunrise", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "sunrise", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "sunset", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "sunset", timelib_date_to_int(t2, &dummy));
}
t2->sse = transit;
- add_assoc_int(return_value, "transit", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy));
/* Get civil twilight */
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit);
@@ -4695,9 +4714,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy));
}
/* Get nautical twilight */
@@ -4713,9 +4732,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy));
}
/* Get astronomical twilight */
@@ -4731,9 +4750,9 @@ PHP_FUNCTION(date_sun_info)
break;
default:
t2->sse = rise;
- add_assoc_int(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy));
t2->sse = set;
- add_assoc_int(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
+ add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
}
timelib_time_dtor(t);
timelib_time_dtor(t2);
@@ -4803,7 +4822,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC) /* {
zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv);
/* converted to larger type (int->long); must check when unserializing */
- ZVAL_INT(&zv, (long) period_obj->recurrences);
+ ZVAL_LONG(&zv, (zend_long) period_obj->recurrences);
zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv);
ZVAL_BOOL(&zv, period_obj->include_start_date);
@@ -4873,8 +4892,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1);
if (ht_entry &&
- Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) {
- period_obj->recurrences = Z_IVAL_P(ht_entry);
+ Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) {
+ period_obj->recurrences = Z_LVAL_P(ht_entry);
} else {
return 0;
}
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index cc71246d94..aa46aa1b6c 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -203,7 +203,7 @@ ZEND_END_MODULE_GLOBALS(date)
#endif
/* Backwards compatibility wrapper */
-PHPAPI php_int_t php_parse_date(char *string, php_int_t *now);
+PHPAPI zend_long php_parse_date(char *string, zend_long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
#if HAVE_STRFTIME
@@ -222,7 +222,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
/* Functions for creating DateTime objects, and initializing them from a string */
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
-PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
+PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
#endif /* PHP_DATE_H */
diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt
index 3adb32c965..1580f1ae70 100644
--- a/ext/date/tests/014.phpt
+++ b/ext/date/tests/014.phpt
@@ -37,6 +37,4 @@ Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on li
bool(false)
int(0)
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
-bool(false)
-Done
+Catchable fatal error: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s
diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt
new file mode 100644
index 0000000000..ce2105abae
--- /dev/null
+++ b/ext/date/tests/68062.phpt
@@ -0,0 +1,13 @@
+--TEST--
+DateTimeZone::getOffset() accepts a DateTimeInterface object
+--FILE--
+<?php
+
+$tz = new DateTimeZone('Europe/London');
+$dt = new DateTimeImmutable('2014-09-20', $tz);
+
+echo $tz->getOffset($dt);
+echo $tz->getOffset(1);
+--EXPECTF--
+3600
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s
diff --git a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt
index a86d5e10bb..ecd99d5bc3 100644
--- a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt
+++ b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt
@@ -112,141 +112,141 @@ fclose( $file_handle );
-- int 0 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 1 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 12345 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int -12345 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- float 10.5 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float -10.5 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float .5 --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- empty array --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- int indexed array --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- associative array --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- nested arrays --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- uppercase NULL --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase null --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase true --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- lowercase false --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase TRUE --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase FALSE --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- empty string DQ --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- empty string SQ --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string DQ --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string SQ --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- mixed case string --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- heredoc --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- instance of classWithToString --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- instance of classWithoutToString --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- undefined var --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- unset var --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- resource --
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, resource given in %s on line %d
+Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d
bool(false)
===DONE===
diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt
index 19b5914aa3..4884d77bac 100644
--- a/ext/date/tests/bug67118.phpt
+++ b/ext/date/tests/bug67118.phpt
@@ -23,4 +23,7 @@ class mydt extends datetime
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
?>
--EXPECTF--
-Fatal error: Call to a member function format() on null in %sbug67118.php on line %d
+
+Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
+Bad date
+
diff --git a/ext/date/tests/bug67118_2.phpt b/ext/date/tests/bug67118_2.phpt
index 368d4d9401..9b6f545525 100644
--- a/ext/date/tests/bug67118_2.phpt
+++ b/ext/date/tests/bug67118_2.phpt
@@ -24,5 +24,12 @@ Done
--EXPECTF--
First try
Second try
-NULL
-Done \ No newline at end of file
+object(Foo)#1 (3) {
+ ["date"]=>
+ string(26) "2007-09-12 15:49:12.000000"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(3) "UTC"
+}
+Done
diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt
index b8ca2c1c15..9e9daacf84 100644
--- a/ext/date/tests/timezone_offset_get_error.phpt
+++ b/ext/date/tests/timezone_offset_get_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test timezone_offset_get() function : error conditions
+Test timezone_offset_get() function : error conditions
--FILE--
<?php
/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime )
@@ -7,12 +7,20 @@ Test timezone_offset_get() function : error conditions
* Source code: ext/date/php_date.c
* Alias to functions: DateTimeZone::getOffset
*/
-
-//Set the default time zone
+
+//Set the default time zone
date_default_timezone_set("GMT");
$tz = timezone_open("Europe/London");
$date = date_create("GMT");
-
+
+set_error_handler('err');
+
+function err($errno, $errstr) {
+ if ($errno === E_RECOVERABLE_ERROR) {
+ var_dump($errstr);
+ }
+}
+
echo "*** Testing timezone_offset_get() : error conditions ***\n";
echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
@@ -27,7 +35,7 @@ var_dump( timezone_offset_get($tz, $date, $extra_arg) );
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
-var_dump( timezone_offset_get($invalid_obj, $date) );
+var_dump( timezone_offset_get($invalid_obj, $date) );
$invalid_obj = 10;
var_dump( timezone_offset_get($invalid_obj, $date) );
$invalid_obj = null;
@@ -35,50 +43,38 @@ var_dump( timezone_offset_get($invalid_obj, $date) );
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n";
$invalid_obj = new stdClass();
-var_dump( timezone_offset_get($tz, $invalid_obj) );
+var_dump( timezone_offset_get($tz, $invalid_obj) );
$invalid_obj = 10;
var_dump( timezone_offset_get($tz, $invalid_obj) );
$invalid_obj = null;
-var_dump( timezone_offset_get($tz, $invalid_obj) );
+var_dump( timezone_offset_get($tz, $invalid_obj) );
?>
===DONE===
--EXPECTF--
*** Testing timezone_offset_get() : error conditions ***
-- Testing timezone_offset_get() function with zero arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with less than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with more than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with an invalid values for $object argument --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given"
bool(false)
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given"
bool(false)
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given"
bool(false)
-- Testing timezone_offset_get() function with an invalid values for $datetime argument --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of stdClass given"
bool(false)
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given"
bool(false)
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given"
bool(false)
===DONE===
diff --git a/ext/date/tests/timezone_offset_get_variation1.phpt b/ext/date/tests/timezone_offset_get_variation1.phpt
index 5fd5e8b270..01013ab5cd 100644
--- a/ext/date/tests/timezone_offset_get_variation1.phpt
+++ b/ext/date/tests/timezone_offset_get_variation1.phpt
@@ -13,6 +13,14 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t
//Set the default time zone
date_default_timezone_set("Europe/London");
+set_error_handler('handler');
+
+function handler($errno, $errstr) {
+ if ($errno === E_RECOVERABLE_ERROR) {
+ echo $errstr . "\n";
+ }
+}
+
//get an unset variable
$unset_var = 10;
unset ($unset_var);
@@ -111,142 +119,114 @@ fclose( $file_handle );
*** Testing timezone_offset_get() : usage variation - unexpected values to first argument $object***
-- int 0 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given
bool(false)
-- int 1 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given
bool(false)
-- int 12345 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given
bool(false)
-- int -12345 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given
bool(false)
-- float 10.5 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given
bool(false)
-- float -10.5 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given
bool(false)
-- float .5 --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given
bool(false)
-- empty array --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given
bool(false)
-- int indexed array --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given
bool(false)
-- associative array --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given
bool(false)
-- nested arrays --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given
bool(false)
-- uppercase NULL --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given
bool(false)
-- lowercase null --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given
bool(false)
-- lowercase true --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given
bool(false)
-- lowercase false --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given
bool(false)
-- uppercase TRUE --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given
bool(false)
-- uppercase FALSE --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given
bool(false)
-- empty string DQ --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- empty string SQ --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- string DQ --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- string SQ --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- mixed case string --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- heredoc --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given
bool(false)
-- instance of classWithToString --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithToString given
bool(false)
-- instance of classWithoutToString --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithoutToString given
bool(false)
-- undefined var --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given
bool(false)
-- unset var --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given
bool(false)
-- resource --
-
-Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d
+Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, resource given
bool(false)
===DONE===
diff --git a/ext/date/tests/timezone_offset_get_variation2.phpt b/ext/date/tests/timezone_offset_get_variation2.phpt
index 93311f3a6b..98e1093514 100644
--- a/ext/date/tests/timezone_offset_get_variation2.phpt
+++ b/ext/date/tests/timezone_offset_get_variation2.phpt
@@ -13,6 +13,14 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t
//Set the default time zone
date_default_timezone_set("Europe/London");
+set_error_handler('handler');
+
+function handler($errno, $errstr) {
+ if ($errno === E_RECOVERABLE_ERROR) {
+ echo $errstr . "\n";
+ }
+}
+
//get an unset variable
$unset_var = 10;
unset ($unset_var);
@@ -111,142 +119,114 @@ fclose( $file_handle );
*** Testing timezone_offset_get() : usage variation - unexpected values to second argument $datetime***
-- int 0 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given
bool(false)
-- int 1 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given
bool(false)
-- int 12345 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given
bool(false)
-- int -12345 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given
bool(false)
-- float 10.5 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given
bool(false)
-- float -10.5 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given
bool(false)
-- float .5 --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given
bool(false)
-- empty array --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given
bool(false)
-- int indexed array --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given
bool(false)
-- associative array --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given
bool(false)
-- nested arrays --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given
bool(false)
-- uppercase NULL --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given
bool(false)
-- lowercase null --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given
bool(false)
-- lowercase true --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given
bool(false)
-- lowercase false --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given
bool(false)
-- uppercase TRUE --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given
bool(false)
-- uppercase FALSE --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given
bool(false)
-- empty string DQ --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- empty string SQ --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- string DQ --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- string SQ --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- mixed case string --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- heredoc --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given
bool(false)
-- instance of classWithToString --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithToString given
bool(false)
-- instance of classWithoutToString --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithoutToString given
bool(false)
-- undefined var --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given
bool(false)
-- unset var --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given
bool(false)
-- resource --
-
-Warning: timezone_offset_get() expects parameter 2 to be DateTime, resource given in %s on line %d
+Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, resource given
bool(false)
===DONE===
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 8e0da59654..de4ea4c464 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -217,10 +217,10 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos);
convert_to_string_ex(group);
convert_to_string_ex(name);
- if (Z_STRSIZE_P(group) == 0) {
+ if (Z_STRLEN_P(group) == 0) {
*key_str = Z_STRVAL_P(name);
*key_free = NULL;
- return Z_STRSIZE_P(name);
+ return Z_STRLEN_P(name);
}
len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name));
*key_free = *key_str;
@@ -232,8 +232,8 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
ZVAL_COPY(&tmp, key);
convert_to_string(&tmp);
- *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp));
- len = Z_STRSIZE(tmp);
+ *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
+ len = Z_STRLEN(tmp);
zval_ptr_dtor(&tmp);
return len;
@@ -256,7 +256,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
zval *key; \
char *key_str, *key_free; \
size_t key_len; \
- php_int_t skip = 0; \
+ zend_long skip = 0; \
switch(ac) { \
case 2: \
if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \
@@ -264,7 +264,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
} \
break; \
case 3: \
- if (zend_parse_parameters(ac TSRMLS_CC, "zir", &key, &skip, &id) == FAILURE) { \
+ if (zend_parse_parameters(ac TSRMLS_CC, "zlr", &key, &skip, &id) == FAILURE) { \
return; \
} \
break; \
@@ -470,19 +470,19 @@ ZEND_INI_MH(OnUpdateDefaultHandler)
{
dba_handler *hptr;
- if (!strlen(new_value)) {
+ if (!new_value->len) {
DBA_G(default_hptr) = NULL;
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
- for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value); hptr++);
+ for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value->val); hptr++);
if (!hptr->name) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such handler: %s", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such handler: %s", new_value->val);
return FAILURE;
}
DBA_G(default_hptr) = hptr;
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
PHP_INI_BEGIN()
@@ -519,7 +519,7 @@ PHP_MSHUTDOWN_FUNCTION(dba)
}
/* }}} */
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* {{{ PHP_MINFO_FUNCTION
*/
@@ -551,7 +551,7 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
- int val_len;
+ size_t val_len;
zval *id;
dba_info *info = NULL;
int ac = ZEND_NUM_ARGS();
@@ -646,7 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} else if (Z_REFCOUNTED(args[i])) {
Z_ADDREF(args[i]);
}
- keylen += Z_STRSIZE(args[i]);
+ keylen += Z_STRLEN(args[i]);
}
if (persistent) {
@@ -658,8 +658,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
keylen = 0;
for(i = 0; i < ac; i++) {
- memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRSIZE(args[i]));
- keylen += Z_STRSIZE(args[i]);
+ memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i]));
+ keylen += Z_STRLEN(args[i]);
}
/* try to find if we already have this link in our persistent list */
@@ -1054,7 +1054,7 @@ PHP_FUNCTION(dba_key_split)
{
zval *zkey;
char *key, *name;
- int key_len;
+ size_t key_len;
if (ZEND_NUM_ARGS() != 1) {
WRONG_PARAM_COUNT;
@@ -1243,7 +1243,7 @@ PHP_FUNCTION(dba_handlers)
List opened databases */
PHP_FUNCTION(dba_list)
{
- php_uint_t numitems, i;
+ zend_ulong numitems, i;
zend_resource *le;
dba_info *info;
diff --git a/ext/dba/dba.dsp b/ext/dba/dba.dsp
deleted file mode 100644
index ddfd1485a9..0000000000
--- a/ext/dba/dba.dsp
+++ /dev/null
@@ -1,213 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dba" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dba - Win32 Debug_TS Berkeley DB3
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak" CFG="dba - Win32 Debug_TS Berkeley DB3"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dba - Win32 Release_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dba - Win32 Debug_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dba - Win32 Release_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_DB3=1 /D DB3_INCLUDE_FILE="db.h" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D DBA_DB3=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /D DBA_INIFILE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php5ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "dba - Win32 Debug_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D "DBA_DB3" /D DB3_INCLUDE_FILE="db.h" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "DBA_DB3" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_FLATFILE=1 /D DBA_CDB=1 /D DBA_CDB_MAKE=1 /D DBA_CDB_BUILTIN=1 /D DBA_INIFILE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-# ADD LINK32 php5ts_debug.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dba - Win32 Release_TS Berkeley DB3"
-# Name "dba - Win32 Debug_TS Berkeley DB3"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\libcdb\cdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\cdb_make.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_cdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db3.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_dbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_flatfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_gdbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_inifile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_ndbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libflatfile\flatfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libinifile\inifile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\uint32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\libcdb\cdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\cdb_make.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libflatfile\flatfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_cdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dba.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_flatfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gdbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_inifile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ndbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libcdb\uint32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libinifile\inifile.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
index 075aedb0c1..17419dcf2e 100644
--- a/ext/dba/dba_cdb.c
+++ b/ext/dba/dba_cdb.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c
index 9f16cb4cd2..66fd58b151 100644
--- a/ext/dba/dba_db1.c
+++ b/ext/dba/dba_db1.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -51,8 +51,8 @@ DBA_OPEN_FUNC(db1)
int filemode = 0644;
if (info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
gmode = 0;
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
index c4c17a1661..6643eebcde 100644
--- a/ext/dba/dba_db2.c
+++ b/ext/dba/dba_db2.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -72,8 +72,8 @@ DBA_OPEN_FUNC(db2)
}
if (info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index 5ed6f502cc..3f31222d9e 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -81,8 +81,8 @@ DBA_OPEN_FUNC(db3)
}
if (info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
#ifdef DB_FCNTL_LOCKING
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index a927c49ee5..a9752a7bf6 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -118,8 +118,8 @@ DBA_OPEN_FUNC(db4)
}
if (info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
if ((err=db_create(&dbp, NULL, 0)) == 0) {
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
index 5d5a234670..b369f11c70 100644
--- a/ext/dba/dba_dbm.c
+++ b/ext/dba/dba_dbm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -60,8 +60,8 @@ DBA_OPEN_FUNC(dbm)
int filemode = 0644;
if(info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
if(info->mode == DBA_TRUNC) {
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
index ee8eefa652..9be6e9be18 100644
--- a/ext/dba/dba_flatfile.c
+++ b/ext/dba/dba_flatfile.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index c5a2bccee0..bea2f4cf58 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,8 +54,8 @@ DBA_OPEN_FUNC(gdbm)
return FAILURE; /* not possible */
if(info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
diff --git a/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
index 6067e99154..aaae690344 100644
--- a/ext/dba/dba_inifile.c
+++ b/ext/dba/dba_inifile.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
index 6805c45d9f..f7b33efd3f 100644
--- a/ext/dba/dba_ndbm.c
+++ b/ext/dba/dba_ndbm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -59,8 +59,8 @@ DBA_OPEN_FUNC(ndbm)
}
if(info->argc > 0) {
- convert_to_int_ex(&info->argv[0]);
- filemode = Z_IVAL(info->argv[0]);
+ convert_to_long_ex(&info->argv[0]);
+ filemode = Z_LVAL(info->argv[0]);
}
dbf = dbm_open(info->path, gmode, filemode);
diff --git a/ext/dba/dba_qdbm.c b/ext/dba/dba_qdbm.c
index a32b7e9e97..023e5e9b27 100644
--- a/ext/dba/dba_qdbm.c
+++ b/ext/dba/dba_qdbm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c
index 341e99fed6..99c10c2f07 100644
--- a/ext/dba/dba_tcadb.c
+++ b/ext/dba/dba_tcadb.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c
index d8c58372ba..c8caf8b8f2 100644
--- a/ext/dba/libcdb/cdb.c
+++ b/ext/dba/libcdb/cdb.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h
index c6ffd17949..4b4a7ff2ff 100644
--- a/ext/dba/libcdb/cdb.h
+++ b/ext/dba/libcdb/cdb.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c
index 2813336b40..b6236f085e 100644
--- a/ext/dba/libcdb/cdb_make.c
+++ b/ext/dba/libcdb/cdb_make.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h
index d43fceb6d8..d33fcb15da 100644
--- a/ext/dba/libcdb/cdb_make.h
+++ b/ext/dba/libcdb/cdb_make.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c
index d8152d5015..76e1bbeaf2 100644
--- a/ext/dba/libcdb/uint32.c
+++ b/ext/dba/libcdb/uint32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h
index b0e0b44002..5390291953 100644
--- a/ext/dba/libcdb/uint32.h
+++ b/ext/dba/libcdb/uint32.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
index a1fce218ab..8eae2d2508 100644
--- a/ext/dba/libflatfile/flatfile.c
+++ b/ext/dba/libflatfile/flatfile.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
index 7e9b1796cd..2cd8db3521 100644
--- a/ext/dba/libflatfile/flatfile.h
+++ b/ext/dba/libflatfile/flatfile.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index 218037ebe3..6b64872649 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h
index e41dac0ca4..9de43b62f5 100644
--- a/ext/dba/libinifile/inifile.h
+++ b/ext/dba/libinifile/inifile.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
index 7276ba6942..d19000cf0f 100644
--- a/ext/dba/php_dba.h
+++ b/ext/dba/php_dba.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -126,7 +126,7 @@ typedef struct dba_handler {
DBA_SYNC_FUNC(x); \
DBA_INFO_FUNC(x)
-#define VALLEN(p) Z_STRVAL_PP(p), Z_STRSIZE_PP(p)
+#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
PHP_FUNCTION(dba_open);
PHP_FUNCTION(dba_popen);
diff --git a/ext/dba/php_tcadb.h b/ext/dba/php_tcadb.h
index b718a172f8..209830a94c 100644
--- a/ext/dba/php_tcadb.h
+++ b/ext/dba/php_tcadb.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index b0489ef122..7cef0230a4 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -60,7 +60,7 @@ PHP_METHOD(domattr, __construct)
xmlNodePtr oldnode = NULL;
dom_object *intern;
char *name, *value = NULL;
- int name_len, value_len, name_valid;
+ size_t name_len, value_len, name_valid;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
@@ -78,7 +78,7 @@ PHP_METHOD(domattr, __construct)
RETURN_FALSE;
}
- nodep = xmlNewProp(NULL, (xmlChar *) name, value);
+ nodep = xmlNewProp(NULL, (xmlChar *) name, (xmlChar *) value);
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
@@ -147,7 +147,7 @@ int dom_attr_value_read(dom_object *obj, zval *retval TSRMLS_DC)
}
if ((content = xmlNodeGetContent((xmlNodePtr) attrp)) != NULL) {
- ZVAL_STRING(retval, content);
+ ZVAL_STRING(retval, (char *) content);
xmlFree(content);
} else {
ZVAL_EMPTY_STRING(retval);
@@ -173,9 +173,9 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
str = zval_get_string(newval);
- xmlNodeSetContentLen((xmlNodePtr) attrp, str->val, str->len + 1);
+ xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) str->val, str->len + 1);
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index a2f0589464..82af257c0a 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,7 +54,7 @@ PHP_METHOD(domcdatasection, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
- int value_len;
+ size_t value_len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index 390e4e032b..aee54bb3d2 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -87,7 +87,7 @@ int dom_characterdata_data_read(dom_object *obj, zval *retval TSRMLS_DC)
}
if ((content = xmlNodeGetContent(nodep)) != NULL) {
- ZVAL_STRING(retval, content);
+ ZVAL_STRING(retval, (char *) content);
xmlFree(content);
} else {
ZVAL_EMPTY_STRING(retval);
@@ -108,9 +108,9 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, str->val, str->len + 1);
+ xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
@@ -139,7 +139,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval TSRMLS_DC)
xmlFree(content);
}
- ZVAL_INT(retval, length);
+ ZVAL_LONG(retval, length);
return SUCCESS;
}
@@ -156,11 +156,11 @@ PHP_FUNCTION(dom_characterdata_substring_data)
xmlChar *cur;
xmlChar *substring;
xmlNodePtr node;
- php_int_t offset, count;
+ zend_long offset, count;
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
return;
}
@@ -187,7 +187,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
xmlFree(cur);
if (substring) {
- RETVAL_STRING(substring);
+ RETVAL_STRING((char *) substring);
xmlFree(substring);
} else {
RETVAL_EMPTY_STRING();
@@ -205,7 +205,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
xmlNode *nodep;
dom_object *intern;
char *arg;
- int arg_len;
+ size_t arg_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) {
return;
@@ -223,7 +223,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
}
nodep->properties = NULL;
#else
- xmlTextConcat(nodep, arg, arg_len);
+ xmlTextConcat(nodep, (xmlChar *) arg, arg_len);
#endif
RETURN_TRUE;
}
@@ -239,11 +239,12 @@ PHP_FUNCTION(dom_characterdata_insert_data)
xmlChar *cur, *first, *second;
xmlNodePtr node;
char *arg;
- php_int_t offset;
- int length, arg_len;
+ zend_long offset;
+ int length;
+ size_t arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) {
return;
}
@@ -267,7 +268,7 @@ PHP_FUNCTION(dom_characterdata_insert_data)
xmlFree(cur);
xmlNodeSetContent(node, first);
- xmlNodeAddContent(node, arg);
+ xmlNodeAddContent(node, (xmlChar *) arg);
xmlNodeAddContent(node, second);
xmlFree(first);
@@ -286,11 +287,11 @@ PHP_FUNCTION(dom_characterdata_delete_data)
zval *id;
xmlChar *cur, *substring, *second;
xmlNodePtr node;
- php_int_t offset, count;
+ zend_long offset, count;
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
return;
}
@@ -342,11 +343,12 @@ PHP_FUNCTION(dom_characterdata_replace_data)
xmlChar *cur, *substring, *second = NULL;
xmlNodePtr node;
char *arg;
- php_int_t offset, count;
- int length, arg_len;
+ zend_long offset, count;
+ int length;
+ size_t arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiis", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) {
return;
}
@@ -379,7 +381,7 @@ PHP_FUNCTION(dom_characterdata_replace_data)
second = xmlUTF8Strsub(cur, offset + count, length - offset);
}
- substring = xmlStrcat(substring, arg);
+ substring = xmlStrcat(substring, (xmlChar *) arg);
substring = xmlStrcat(substring, second);
xmlNodeSetContent(node, substring);
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index 0670337651..9015586fd9 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,7 +54,7 @@ PHP_METHOD(domcomment, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
- int value_len;
+ size_t value_len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
diff --git a/ext/dom/document.c b/ext/dom/document.c
index abe0c55f06..133572af3f 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -352,7 +352,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document Encoding");
}
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
@@ -388,7 +388,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
return FAILURE;
}
- standalone = zval_get_int(newval);
+ standalone = zval_get_long(newval);
docp->standalone = ZEND_NORMALIZE_BOOL(standalone);
return SUCCESS;
@@ -440,7 +440,7 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
docp->version = xmlStrdup((const xmlChar *) str->val);
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
@@ -668,7 +668,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
docp->URL = xmlStrdup((const xmlChar *) str->val);
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
@@ -697,7 +697,8 @@ PHP_FUNCTION(dom_document_create_element)
xmlNode *node;
xmlDocPtr docp;
dom_object *intern;
- int ret, name_len, value_len;
+ int ret;
+ size_t name_len, value_len;
char *name, *value = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
@@ -711,7 +712,7 @@ PHP_FUNCTION(dom_document_create_element)
RETURN_FALSE;
}
- node = xmlNewDocNode(docp, NULL, name, value);
+ node = xmlNewDocNode(docp, NULL, (xmlChar *) name, (xmlChar *) value);
if (!node) {
RETURN_FALSE;
}
@@ -756,7 +757,8 @@ PHP_FUNCTION(dom_document_create_text_node)
zval *id;
xmlNode *node;
xmlDocPtr docp;
- int ret, value_len;
+ int ret;
+ size_t value_len;
dom_object *intern;
char *value;
@@ -784,7 +786,8 @@ PHP_FUNCTION(dom_document_create_comment)
zval *id;
xmlNode *node;
xmlDocPtr docp;
- int ret, value_len;
+ int ret;
+ size_t value_len;
dom_object *intern;
char *value;
@@ -812,7 +815,8 @@ PHP_FUNCTION(dom_document_create_cdatasection)
zval *id;
xmlNode *node;
xmlDocPtr docp;
- int ret, value_len;
+ int ret;
+ size_t value_len;
dom_object *intern;
char *value;
@@ -840,7 +844,8 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
zval *id;
xmlNode *node;
xmlDocPtr docp;
- int ret, value_len, name_len = 0;
+ int ret;
+ size_t value_len, name_len = 0;
dom_object *intern;
char *name, *value = NULL;
@@ -875,7 +880,8 @@ PHP_FUNCTION(dom_document_create_attribute)
zval *id;
xmlAttrPtr node;
xmlDocPtr docp;
- int ret, name_len;
+ int ret;
+ size_t name_len;
dom_object *intern;
char *name;
@@ -910,7 +916,8 @@ PHP_FUNCTION(dom_document_create_entity_reference)
xmlNode *node;
xmlDocPtr docp = NULL;
dom_object *intern;
- int ret, name_len;
+ int ret;
+ size_t name_len;
char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
@@ -924,7 +931,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
RETURN_FALSE;
}
- node = xmlNewReference(docp, name);
+ node = xmlNewReference(docp, (xmlChar *) name);
if (!node) {
RETURN_FALSE;
}
@@ -941,7 +948,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
{
zval *id;
xmlDocPtr docp;
- int name_len;
+ size_t name_len;
dom_object *intern, *namednode;
char *name;
xmlChar *local;
@@ -970,9 +977,9 @@ PHP_FUNCTION(dom_document_import_node)
xmlNodePtr nodep, retnodep;
dom_object *intern, *nodeobj;
int ret;
- php_int_t recursive = 0;
+ zend_long recursive = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
return;
}
@@ -1024,7 +1031,8 @@ PHP_FUNCTION(dom_document_create_element_ns)
xmlDocPtr docp;
xmlNodePtr nodep = NULL;
xmlNsPtr nsptr = NULL;
- int ret, uri_len = 0, name_len = 0, value_len = 0;
+ int ret;
+ size_t uri_len = 0, name_len = 0, value_len = 0;
char *uri, *name, *value = NULL;
char *localname = NULL, *prefix = NULL;
int errorcode;
@@ -1040,9 +1048,9 @@ PHP_FUNCTION(dom_document_create_element_ns)
if (errorcode == 0) {
if (xmlValidateName((xmlChar *) localname, 0) == 0) {
- nodep = xmlNewDocNode (docp, NULL, localname, value);
+ nodep = xmlNewDocNode(docp, NULL, (xmlChar *) localname, (xmlChar *) value);
if (nodep != NULL && uri != NULL) {
- nsptr = xmlSearchNsByHref (nodep->doc, nodep, uri);
+ nsptr = xmlSearchNsByHref(nodep->doc, nodep, (xmlChar *) uri);
if (nsptr == NULL) {
nsptr = dom_get_ns(nodep, uri, &errorcode, prefix);
}
@@ -1087,7 +1095,8 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
xmlDocPtr docp;
xmlNodePtr nodep = NULL, root;
xmlNsPtr nsptr;
- int ret, uri_len = 0, name_len = 0;
+ int ret;
+ size_t uri_len = 0, name_len = 0;
char *uri, *name;
char *localname = NULL, *prefix = NULL;
dom_object *intern;
@@ -1104,9 +1113,9 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
errorcode = dom_check_qname(name, &localname, &prefix, uri_len, name_len);
if (errorcode == 0) {
if (xmlValidateName((xmlChar *) localname, 0) == 0) {
- nodep = (xmlNodePtr) xmlNewDocProp(docp, localname, NULL);
+ nodep = (xmlNodePtr) xmlNewDocProp(docp, (xmlChar *) localname, NULL);
if (nodep != NULL && uri_len > 0) {
- nsptr = xmlSearchNsByHref (nodep->doc, root, uri);
+ nsptr = xmlSearchNsByHref(nodep->doc, root, (xmlChar *) uri);
if (nsptr == NULL) {
nsptr = dom_get_ns(root, uri, &errorcode, prefix);
}
@@ -1150,7 +1159,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
{
zval *id;
xmlDocPtr docp;
- int uri_len, name_len;
+ size_t uri_len, name_len;
dom_object *intern, *namednode;
char *uri, *name;
xmlChar *local, *nsuri;
@@ -1178,7 +1187,8 @@ PHP_FUNCTION(dom_document_get_element_by_id)
zval *id;
xmlDocPtr docp;
xmlAttrPtr attrp;
- int ret, idname_len;
+ int ret;
+ size_t idname_len;
dom_object *intern;
char *idname;
@@ -1247,7 +1257,8 @@ PHP_METHOD(domdocument, __construct)
xmlDoc *docp = NULL, *olddoc;
dom_object *intern;
char *encoding, *version = NULL;
- int encoding_len = 0, version_len = 0, refcount;
+ size_t encoding_len = 0, version_len = 0;
+ int refcount;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
@@ -1257,7 +1268,7 @@ PHP_METHOD(domdocument, __construct)
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
- docp = xmlNewDoc(version);
+ docp = xmlNewDoc((xmlChar *) version);
if (!docp) {
php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
@@ -1265,7 +1276,7 @@ PHP_METHOD(domdocument, __construct)
}
if (encoding_len > 0) {
- docp->encoding = (const xmlChar*)xmlStrdup(encoding);
+ docp->encoding = (const xmlChar *) xmlStrdup((xmlChar *) encoding);
}
intern = Z_DOMOBJ_P(id);
@@ -1295,8 +1306,8 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
int isFileUri = 0;
uri = xmlCreateURI();
- escsource = xmlURIEscapeStr(source, ":");
- xmlParseURIReference(uri, escsource);
+ escsource = xmlURIEscapeStr((xmlChar *) source, (xmlChar *) ":");
+ xmlParseURIReference(uri, (char *) escsource);
xmlFree(escsource);
if (uri->scheme != NULL) {
@@ -1341,7 +1352,7 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
}
/* }}} */
-static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int source_len, int options TSRMLS_DC) /* {{{ */
+static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, size_t source_len, size_t options TSRMLS_DC) /* {{{ */
{
xmlDocPtr ret;
xmlParserCtxtPtr ctxt = NULL;
@@ -1443,7 +1454,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
}
/* If loading from memory, set the base reference uri for the document */
if (ret && ret->URL == NULL && ctxt->directory != NULL) {
- ret->URL = xmlStrdup(ctxt->directory);
+ ret->URL = xmlStrdup((xmlChar *) ctxt->directory);
}
} else {
ret = NULL;
@@ -1464,15 +1475,16 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
dom_doc_propsptr doc_prop;
dom_object *intern;
char *source;
- int source_len, refcount, ret;
- php_int_t options = 0;
+ size_t source_len;
+ int refcount, ret;
+ zend_long options = 0;
id = getThis();
if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) {
id = NULL;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
return;
}
@@ -1543,13 +1555,14 @@ PHP_FUNCTION(dom_document_save)
{
zval *id;
xmlDoc *docp;
- int file_len = 0, bytes, format, saveempty = 0;
+ size_t file_len = 0;
+ int bytes, format, saveempty = 0;
dom_object *intern;
dom_doc_propsptr doc_props;
char *file;
- php_int_t options = 0;
+ zend_long options = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
return;
}
@@ -1575,7 +1588,7 @@ PHP_FUNCTION(dom_document_save)
if (bytes == -1) {
RETURN_FALSE;
}
- RETURN_INT(bytes);
+ RETURN_LONG(bytes);
}
/* }}} end dom_document_save */
@@ -1593,9 +1606,9 @@ PHP_FUNCTION(dom_document_savexml)
dom_object *intern, *nodeobj;
dom_doc_propsptr doc_props;
int size, format, saveempty = 0;
- php_int_t options = 0;
+ zend_long options = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!i", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
return;
}
@@ -1629,7 +1642,7 @@ PHP_FUNCTION(dom_document_savexml)
xmlBufferFree(buf);
RETURN_FALSE;
}
- RETVAL_STRING(mem);
+ RETVAL_STRING((char *) mem);
xmlBufferFree(buf);
} else {
if (options & LIBXML_SAVE_NOEMPTYTAG) {
@@ -1644,7 +1657,7 @@ PHP_FUNCTION(dom_document_savexml)
if (!size) {
RETURN_FALSE;
}
- RETVAL_STRINGL(mem, size);
+ RETVAL_STRINGL((char *) mem, size);
xmlFree(mem);
}
}
@@ -1698,11 +1711,11 @@ PHP_FUNCTION(dom_document_xinclude)
zval *id;
xmlDoc *docp;
xmlNodePtr root;
- php_int_t flags = 0;
+ zend_long flags = 0;
int err;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_document_class_entry, &flags) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) {
return;
}
@@ -1723,7 +1736,7 @@ PHP_FUNCTION(dom_document_xinclude)
}
if (err) {
- RETVAL_INT(err);
+ RETVAL_LONG(err);
} else {
RETVAL_FALSE;
}
@@ -1771,15 +1784,16 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
xmlDoc *docp;
dom_object *intern;
char *source = NULL, *valid_file = NULL;
- int source_len = 0, valid_opts = 0;
- php_int_t flags = 0;
+ size_t source_len = 0;
+ int valid_opts = 0;
+ zend_long flags = 0;
xmlSchemaParserCtxtPtr parser;
xmlSchemaPtr sptr;
xmlSchemaValidCtxtPtr vptr;
int is_valid;
char resolved_path[MAXPATHLEN + 1];
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|i", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
return;
}
@@ -1868,7 +1882,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
xmlDoc *docp;
dom_object *intern;
char *source = NULL, *valid_file = NULL;
- int source_len = 0;
+ size_t source_len = 0;
xmlRelaxNGParserCtxtPtr parser;
xmlRelaxNGPtr sptr;
xmlRelaxNGValidCtxtPtr vptr;
@@ -1962,13 +1976,14 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
dom_object *intern;
dom_doc_propsptr doc_prop;
char *source;
- int source_len, refcount, ret;
- php_int_t options = 0;
+ size_t source_len;
+ int refcount, ret;
+ zend_long options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
return;
}
@@ -1980,7 +1995,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
if (mode == DOM_LOAD_FILE) {
ctxt = htmlCreateFileParserCtxt(source, NULL);
} else {
- source_len = xmlStrlen(source);
+ source_len = xmlStrlen((xmlChar *) source);
ctxt = htmlCreateMemoryParserCtxt(source, source_len);
}
@@ -2060,7 +2075,8 @@ PHP_FUNCTION(dom_document_save_html_file)
{
zval *id;
xmlDoc *docp;
- int file_len, bytes, format;
+ size_t file_len;
+ int bytes, format;
dom_object *intern;
dom_doc_propsptr doc_props;
char *file;
@@ -2087,7 +2103,7 @@ PHP_FUNCTION(dom_document_save_html_file)
if (bytes == -1) {
RETURN_FALSE;
}
- RETURN_INT(bytes);
+ RETURN_LONG(bytes);
}
/* }}} end dom_document_save_html_file */
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index f20ada3db4..d3055214f6 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -122,7 +122,7 @@ PHP_METHOD(domdocumentfragment, appendXML) {
xmlNode *nodep;
dom_object *intern;
char *data = NULL;
- int data_len = 0;
+ size_t data_len = 0;
int err;
xmlNodePtr lst;
@@ -138,7 +138,7 @@ PHP_METHOD(domdocumentfragment, appendXML) {
}
if (data) {
- err = xmlParseBalancedChunkMemory(nodep->doc, NULL, NULL, 0, data, &lst);
+ err = xmlParseBalancedChunkMemory(nodep->doc, NULL, NULL, 0, (xmlChar *) data, &lst);
if (err != 0) {
RETURN_FALSE;
}
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index 1193ed44d5..08b33242b1 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -204,7 +204,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval TSRMLS_D
if (ret_buf.s) {
smart_str_0(&ret_buf);
- ZVAL_STR(retval, ret_buf.s);
+ ZVAL_NEW_STR(retval, ret_buf.s);
return SUCCESS;
}
}
diff --git a/ext/dom/dom.dsp b/ext/dom/dom.dsp
deleted file mode 100644
index f2ae5b1a76..0000000000
--- a/ext/dom/dom.dsp
+++ /dev/null
@@ -1,250 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dom" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dom - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dom.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dom.mak" CFG="dom - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dom - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dom - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dom - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOM" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOM_EXPORTS" /D "COMPILE_DL_DOM" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOM=1 /D "LIBXML_THREAD_ENABLED" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 wsock32.lib php5ts.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"..\..\Release_TS/php_dom.dll" /implib:"..\..\Release_TS/php_dom.lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "dom - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOM" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOM_EXPORTS" /D "COMPILE_DL_DOM" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOM=1 /D LIBXML_THREAD_ENABLED=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib ws2_32.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS\php_dom.dll" /implib:"..\..\Debug_TS/php_dom.lib" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dom - Win32 Release_TS"
-# Name "dom - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\attr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\cdatasection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\characterdata.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\comment.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\document.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\documentfragment.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\documenttype.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domconfiguration.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domerrorhandler.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domexception.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domimplementation.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domimplementationlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domimplementationsource.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domlocator.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\domstringlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\element.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\entity.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\entityreference.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\namednodemap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\namelist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\node.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nodelist.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\notation.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dom.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\processinginstruction.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\string_extend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\text.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\typeinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\userdatahandler.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xpath.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\dom_ce.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dom_fe.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dom_properties.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dom.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\xml_common.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index 0e1002536e..8e6a64ac85 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index b05c4aee42..67cf0d199d 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 9abe2c7c20..ee892f3703 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -158,7 +158,7 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key T
zval *object = &iterator->intern.data;
if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) {
- ZVAL_INT(key, iter->index);
+ ZVAL_LONG(key, iter->index);
} else {
dom_object *intern = Z_DOMOBJ_P(&iterator->curobj);
@@ -218,7 +218,8 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
} else {
goto err;
}
- curnode = dom_get_elements_by_tag_name_ns_raw(basenode, objmap->ns, objmap->local, &previndex, iter->index);
+ curnode = dom_get_elements_by_tag_name_ns_raw(
+ basenode, (char *) objmap->ns, (char *) objmap->local, &previndex, iter->index);
}
}
} else {
@@ -294,7 +295,8 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
} else {
nodep = nodep->children;
}
- curnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &curindex, 0);
+ curnode = dom_get_elements_by_tag_name_ns_raw(
+ nodep, (char *) objmap->ns, (char *) objmap->local, &curindex, 0);
}
}
} else {
diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 60551bdca1..b5c81d271b 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -137,6 +137,8 @@ int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC);
/* nodelist properties */
int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC);
+xmlNodePtr dom_nodelist_xml_item(dom_nnodemap_object *objmap, long index);
+xmlNodePtr dom_nodelist_baseobj_item(dom_nnodemap_object *objmap, long index);
/* notation properties */
int dom_notation_public_id_read(dom_object *obj, zval *retval TSRMLS_DC);
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
index 272fda8f8f..4c189606dc 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
index cd35b326b7..2214c3f786 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
index 78b75fe615..af73819ee1 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index b41b83c6cd..4696e87f21 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 8cdd0fe28b..ea2b784b3c 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -70,7 +70,7 @@ Since:
*/
PHP_METHOD(domimplementation, hasFeature)
{
- int feature_len, version_len;
+ size_t feature_len, version_len;
char *feature, *version;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &feature, &feature_len, &version, &version_len) == FAILURE) {
@@ -92,7 +92,8 @@ Since: DOM Level 2
PHP_METHOD(domimplementation, createDocumentType)
{
xmlDtd *doctype;
- int ret, name_len = 0, publicid_len = 0, systemid_len = 0;
+ int ret;
+ size_t name_len = 0, publicid_len = 0, systemid_len = 0;
char *name = NULL, *publicid = NULL, *systemid = NULL;
xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
xmlURIPtr uri;
@@ -106,14 +107,16 @@ PHP_METHOD(domimplementation, createDocumentType)
RETURN_FALSE;
}
- if (publicid_len > 0)
- pch1 = publicid;
- if (systemid_len > 0)
- pch2 = systemid;
+ if (publicid_len > 0) {
+ pch1 = (xmlChar *) publicid;
+ }
+ if (systemid_len > 0) {
+ pch2 = (xmlChar *) systemid;
+ }
uri = xmlParseURI(name);
if (uri != NULL && uri->opaque != NULL) {
- localname = xmlStrdup(uri->opaque);
+ localname = xmlStrdup((xmlChar *) uri->opaque);
if (xmlStrchr(localname, (xmlChar) ':') != NULL) {
php_dom_throw_error(NAMESPACE_ERR, 1 TSRMLS_CC);
xmlFreeURI(uri);
@@ -121,7 +124,7 @@ PHP_METHOD(domimplementation, createDocumentType)
RETURN_FALSE;
}
} else {
- localname = xmlStrdup(name);
+ localname = xmlStrdup((xmlChar *) name);
}
/* TODO: Test that localname has no invalid chars
@@ -155,7 +158,8 @@ PHP_METHOD(domimplementation, createDocument)
xmlNode *nodep;
xmlDtdPtr doctype = NULL;
xmlNsPtr nsptr = NULL;
- int ret, uri_len = 0, name_len = 0, errorcode = 0;
+ int ret, errorcode = 0;
+ size_t uri_len = 0, name_len = 0;
char *uri = NULL, *name = NULL;
char *prefix = NULL, *localname = NULL;
dom_object *doctobj;
@@ -180,7 +184,9 @@ PHP_METHOD(domimplementation, createDocument)
if (name_len > 0) {
errorcode = dom_check_qname(name, &localname, &prefix, 1, name_len);
- if (errorcode == 0 && uri_len > 0 && ((nsptr = xmlNewNs(NULL, uri, prefix)) == NULL)) {
+ if (errorcode == 0 && uri_len > 0
+ && ((nsptr = xmlNewNs(NULL, (xmlChar *) uri, (xmlChar *) prefix)) == NULL)
+ ) {
errorcode = NAMESPACE_ERR;
}
}
@@ -215,7 +221,7 @@ PHP_METHOD(domimplementation, createDocument)
}
if (localname != NULL) {
- nodep = xmlNewDocNode (docp, nsptr, localname, NULL);
+ nodep = xmlNewDocNode(docp, nsptr, (xmlChar *) localname, NULL);
if (!nodep) {
if (doctype != NULL) {
docp->intSubset = NULL;
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
index 07479f52eb..b4d20172f0 100644
--- a/ext/dom/domimplementationlist.c
+++ b/ext/dom/domimplementationlist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
index 2e8a8d81b2..f3becc6454 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
index 4e01b3a443..8fdd326fcc 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
index a12d8633ac..6e8bc05bac 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 5ecf031c4c..0aff19561a 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -159,8 +159,9 @@ PHP_METHOD(domelement, __construct)
dom_object *intern;
char *name, *value = NULL, *uri = NULL;
char *localname = NULL, *prefix = NULL;
- int errorcode = 0, uri_len = 0;
- int name_len, value_len = 0, name_valid;
+ int errorcode = 0;
+ size_t name_len, value_len = 0, uri_len = 0;
+ int name_valid;
xmlNsPtr nsptr = NULL;
zend_error_handling error_handling;
@@ -200,7 +201,7 @@ PHP_METHOD(domelement, __construct)
}
} else {
/* If you don't pass a namespace uri, then you can't set a prefix */
- localname = xmlSplitQName2((xmlChar *)name, (xmlChar **) &prefix);
+ localname = (char *) xmlSplitQName2((xmlChar *) name, (xmlChar **) &prefix);
if (prefix != NULL) {
xmlFree(localname);
xmlFree(prefix);
@@ -330,7 +331,7 @@ PHP_FUNCTION(dom_element_get_attribute)
xmlChar *value = NULL;
dom_object *intern;
xmlNodePtr attr;
- int name_len;
+ size_t name_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return;
@@ -370,7 +371,8 @@ PHP_FUNCTION(dom_element_set_attribute)
zval *id;
xmlNode *nodep;
xmlNodePtr attr = NULL;
- int ret, name_len, value_len, name_valid;
+ int ret, name_valid;
+ size_t name_len, value_len;
dom_object *intern;
char *name, *value;
@@ -436,7 +438,7 @@ PHP_FUNCTION(dom_element_remove_attribute)
zval *id;
xmlNodePtr nodep, attrp;
dom_object *intern;
- int name_len;
+ size_t name_len;
char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
@@ -483,7 +485,8 @@ PHP_FUNCTION(dom_element_get_attribute_node)
{
zval *id;
xmlNodePtr nodep, attrp;
- int name_len, ret;
+ size_t name_len;
+ int ret;
dom_object *intern;
char *name;
@@ -632,7 +635,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
{
zval *id;
xmlNodePtr elemp;
- int name_len;
+ size_t name_len;
dom_object *intern, *namednode;
char *name;
xmlChar *local;
@@ -660,7 +663,7 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
xmlNodePtr elemp;
xmlNsPtr nsptr;
dom_object *intern;
- int uri_len = 0, name_len = 0;
+ size_t uri_len = 0, name_len = 0;
char *uri, *name;
xmlChar *strattr;
@@ -740,7 +743,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
xmlNodePtr elemp, nodep = NULL;
xmlNsPtr nsptr;
xmlAttr *attr;
- int uri_len = 0, name_len = 0, value_len = 0;
+ size_t uri_len = 0, name_len = 0, value_len = 0;
char *uri, *name, *value;
char *localname = NULL, *prefix = NULL;
dom_object *intern;
@@ -869,7 +872,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
xmlAttr *attrp;
xmlNsPtr nsptr;
dom_object *intern;
- int name_len, uri_len;
+ size_t name_len, uri_len;
char *name, *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
@@ -925,7 +928,8 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
xmlNodePtr elemp;
xmlAttrPtr attrp;
dom_object *intern;
- int uri_len, name_len, ret;
+ size_t uri_len, name_len;
+ int ret;
char *uri, *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
@@ -1026,7 +1030,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
{
zval *id;
xmlNodePtr elemp;
- int uri_len, name_len;
+ size_t uri_len, name_len;
dom_object *intern, *namednode;
char *uri, *name;
xmlChar *local, *nsuri;
@@ -1056,7 +1060,7 @@ PHP_FUNCTION(dom_element_has_attribute)
xmlNode *nodep;
dom_object *intern;
char *name;
- int name_len;
+ size_t name_len;
xmlNodePtr attr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
@@ -1084,7 +1088,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
xmlNodePtr elemp;
xmlNs *nsp;
dom_object *intern;
- int uri_len, name_len;
+ size_t uri_len, name_len;
char *uri, *name;
xmlChar *value;
@@ -1142,7 +1146,7 @@ PHP_FUNCTION(dom_element_set_id_attribute)
xmlAttrPtr attrp;
dom_object *intern;
char *name;
- int name_len;
+ size_t name_len;
zend_bool is_id;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) {
@@ -1177,7 +1181,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
xmlNodePtr elemp;
xmlAttrPtr attrp;
dom_object *intern;
- int uri_len, name_len;
+ size_t uri_len, name_len;
char *uri, *name;
zend_bool is_id;
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index 264683e28b..e0625fdd72 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -107,7 +107,7 @@ int dom_entity_notation_name_read(dom_object *obj, zval *retval TSRMLS_DC)
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
ZVAL_NULL(retval);
} else {
- content = xmlNodeGetContent((xmlNodePtr) nodep);
+ content = (char *) xmlNodeGetContent((xmlNodePtr) nodep);
ZVAL_STRING(retval, content);
xmlFree(content);
}
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index bc03385116..1c3e60e4f1 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -53,7 +53,7 @@ PHP_METHOD(domentityreference, __construct)
xmlNodePtr oldnode = NULL;
dom_object *intern;
char *name;
- int name_len, name_valid;
+ size_t name_len, name_valid;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
@@ -70,7 +70,7 @@ PHP_METHOD(domentityreference, __construct)
RETURN_FALSE;
}
- node = xmlNewReference(NULL, name);
+ node = xmlNewReference(NULL, (xmlChar *) name);
if (!node) {
php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 43c26605bc..ab314851be 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -113,7 +113,7 @@ int dom_namednodemap_length_read(dom_object *obj, zval *retval TSRMLS_DC)
}
}
- ZVAL_INT(retval, count);
+ ZVAL_LONG(retval, count);
return SUCCESS;
}
@@ -126,7 +126,8 @@ Since:
PHP_FUNCTION(dom_namednodemap_get_named_item)
{
zval *id;
- int ret, namedlen=0;
+ int ret;
+ size_t namedlen=0;
dom_object *intern;
xmlNodePtr itemnode = NULL;
char *named;
@@ -148,9 +149,9 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
- itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
+ itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, (xmlChar *) named);
} else {
- notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
+ notep = (xmlNotation *)xmlHashLookup(objmap->ht, (xmlChar *) named);
if (notep) {
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
@@ -159,7 +160,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
} else {
nodep = dom_object_get_node(objmap->baseobj);
if (nodep) {
- itemnode = (xmlNodePtr)xmlHasProp(nodep, named);
+ itemnode = (xmlNodePtr)xmlHasProp(nodep, (xmlChar *) named);
}
}
}
@@ -200,7 +201,7 @@ Since:
PHP_FUNCTION(dom_namednodemap_item)
{
zval *id;
- php_int_t index;
+ zend_long index;
int ret;
dom_object *intern;
xmlNodePtr itemnode = NULL;
@@ -209,7 +210,7 @@ PHP_FUNCTION(dom_namednodemap_item)
xmlNodePtr nodep, curnode;
int count;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_namednodemap_class_entry, &index) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) {
return;
}
if (index >= 0) {
@@ -258,7 +259,8 @@ Since: DOM Level 2
PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
{
zval *id;
- int ret, namedlen=0, urilen=0;
+ int ret;
+ size_t namedlen=0, urilen=0;
dom_object *intern;
xmlNodePtr itemnode = NULL;
char *uri, *named;
@@ -280,9 +282,9 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
- itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
+ itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, (xmlChar *) named);
} else {
- notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
+ notep = (xmlNotation *)xmlHashLookup(objmap->ht, (xmlChar *) named);
if (notep) {
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
@@ -291,7 +293,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
} else {
nodep = dom_object_get_node(objmap->baseobj);
if (nodep) {
- itemnode = (xmlNodePtr)xmlHasNsProp(nodep, named, uri);
+ itemnode = (xmlNodePtr)xmlHasNsProp(nodep, (xmlChar *) named, (xmlChar *) uri);
}
}
}
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
index 02b63af9ff..3f0b8e1640 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/node.c b/ext/dom/node.c
index f34c0347cb..b2079ffda2 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -216,9 +216,9 @@ int dom_node_node_name_read(dom_object *obj, zval *retval TSRMLS_DC)
ns = nodep->ns;
if (ns != NULL && ns->prefix) {
qname = xmlStrdup(ns->prefix);
- qname = xmlStrcat(qname, ":");
+ qname = xmlStrcat(qname, (xmlChar *) ":");
qname = xmlStrcat(qname, nodep->name);
- str = qname;
+ str = (char *) qname;
} else {
str = (char *) nodep->name;
}
@@ -226,10 +226,10 @@ int dom_node_node_name_read(dom_object *obj, zval *retval TSRMLS_DC)
case XML_NAMESPACE_DECL:
ns = nodep->ns;
if (ns != NULL && ns->prefix) {
- qname = xmlStrdup("xmlns");
- qname = xmlStrcat(qname, ":");
+ qname = xmlStrdup((xmlChar *) "xmlns");
+ qname = xmlStrcat(qname, (xmlChar *) ":");
qname = xmlStrcat(qname, nodep->name);
- str = qname;
+ str = (char *) qname;
} else {
str = (char *) nodep->name;
}
@@ -301,10 +301,10 @@ int dom_node_node_value_read(dom_object *obj, zval *retval TSRMLS_DC)
case XML_COMMENT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_PI_NODE:
- str = xmlNodeGetContent(nodep);
+ str = (char *) xmlNodeGetContent(nodep);
break;
case XML_NAMESPACE_DECL:
- str = xmlNodeGetContent(nodep->children);
+ str = (char *) xmlNodeGetContent(nodep->children);
break;
default:
str = NULL;
@@ -344,8 +344,8 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC)
case XML_PI_NODE:
{
zend_string *str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, str->val, str->len + 1);
- STR_RELEASE(str);
+ xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
+ zend_string_release(str);
break;
}
default:
@@ -375,9 +375,9 @@ int dom_node_node_type_read(dom_object *obj, zval *retval TSRMLS_DC)
/* Specs dictate that they are both type XML_DOCUMENT_TYPE_NODE */
if (nodep->type == XML_DTD_NODE) {
- ZVAL_INT(retval, XML_DOCUMENT_TYPE_NODE);
+ ZVAL_LONG(retval, XML_DOCUMENT_TYPE_NODE);
} else {
- ZVAL_INT(retval, nodep->type);
+ ZVAL_LONG(retval, nodep->type);
}
return SUCCESS;
@@ -725,10 +725,10 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
if (nsnode && nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
strURI = (char *) nodep->ns->href;
if (strURI == NULL ||
- (!strcmp (prefix, "xml") && strcmp(strURI, XML_XML_NAMESPACE)) ||
- (nodep->type == XML_ATTRIBUTE_NODE && !strcmp (prefix, "xmlns") &&
- strcmp (strURI, DOM_XMLNS_NAMESPACE)) ||
- (nodep->type == XML_ATTRIBUTE_NODE && !strcmp (nodep->name, "xmlns"))) {
+ (!strcmp(prefix, "xml") && strcmp(strURI, (char *) XML_XML_NAMESPACE)) ||
+ (nodep->type == XML_ATTRIBUTE_NODE && !strcmp(prefix, "xmlns") &&
+ strcmp(strURI, (char *) DOM_XMLNS_NAMESPACE)) ||
+ (nodep->type == XML_ATTRIBUTE_NODE && !strcmp((char *) nodep->name, "xmlns"))) {
ns = NULL;
} else {
curns = nsnode->nsDef;
@@ -745,14 +745,14 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC)
}
if (ns == NULL) {
- STR_RELEASE(str);
+ zend_string_release(str);
php_dom_throw_error(NAMESPACE_ERR, dom_get_strict_error(obj->document) TSRMLS_CC);
return FAILURE;
}
xmlSetNs(nodep, ns);
}
- STR_RELEASE(str);
+ zend_string_release(str);
break;
default:
break;
@@ -831,7 +831,7 @@ int dom_node_text_content_read(dom_object *obj, zval *retval TSRMLS_DC)
return FAILURE;
}
- str = xmlNodeGetContent(nodep);
+ str = (char *) xmlNodeGetContent(nodep);
if (str != NULL) {
ZVAL_STRING(retval, str);
@@ -845,6 +845,21 @@ int dom_node_text_content_read(dom_object *obj, zval *retval TSRMLS_DC)
int dom_node_text_content_write(dom_object *obj, zval *newval TSRMLS_DC)
{
+ xmlNode *nodep = dom_object_get_node(obj);
+ zend_string *str;
+ xmlChar *enc_str;
+
+ if (nodep == NULL) {
+ php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
+ str = zval_get_string(newval);
+ enc_str = xmlEncodeEntitiesReentrant(nodep->doc, (xmlChar *) str->val);
+ xmlNodeSetContent(nodep, enc_str);
+ xmlFree(enc_str);
+ zend_string_release(str);
+
return SUCCESS;
}
@@ -1334,9 +1349,9 @@ PHP_FUNCTION(dom_node_clone_node)
xmlNode *n, *node;
int ret;
dom_object *intern;
- php_int_t recursive = 0;
+ zend_long recursive = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_node_class_entry, &recursive) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_node_class_entry, &recursive) == FAILURE) {
return;
}
@@ -1413,7 +1428,7 @@ Since: DOM Level 2
PHP_FUNCTION(dom_node_is_supported)
{
zval *id;
- int feature_len, version_len;
+ size_t feature_len, version_len;
char *feature, *version;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) {
@@ -1501,7 +1516,7 @@ PHP_FUNCTION(dom_node_lookup_prefix)
xmlNodePtr nodep, lookupp = NULL;
dom_object *intern;
xmlNsPtr nsptr;
- int uri_len = 0;
+ size_t uri_len = 0;
char *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
@@ -1530,8 +1545,9 @@ PHP_FUNCTION(dom_node_lookup_prefix)
lookupp = nodep->parent;
}
- if (lookupp != NULL && (nsptr = xmlSearchNsByHref(lookupp->doc, lookupp, uri))) {
- if (nsptr->prefix != NULL) {
+ if (lookupp != NULL) {
+ nsptr = xmlSearchNsByHref(lookupp->doc, lookupp, (xmlChar *) uri);
+ if (nsptr && nsptr->prefix != NULL) {
RETURN_STRING((char *) nsptr->prefix);
}
}
@@ -1551,7 +1567,7 @@ PHP_FUNCTION(dom_node_is_default_namespace)
xmlNodePtr nodep;
dom_object *intern;
xmlNsPtr nsptr;
- int uri_len = 0;
+ size_t uri_len = 0;
char *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
@@ -1565,7 +1581,7 @@ PHP_FUNCTION(dom_node_is_default_namespace)
if (nodep && uri_len > 0) {
nsptr = xmlSearchNs(nodep->doc, nodep, NULL);
- if (nsptr && xmlStrEqual(nsptr->href, uri)) {
+ if (nsptr && xmlStrEqual(nsptr->href, (xmlChar *) uri)) {
RETURN_TRUE;
}
}
@@ -1584,8 +1600,8 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
xmlNodePtr nodep;
dom_object *intern;
xmlNsPtr nsptr;
- int prefix_len = 0;
- char *prefix=NULL;
+ size_t prefix_len;
+ char *prefix;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
return;
@@ -1599,7 +1615,7 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
}
}
- nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
+ nsptr = xmlSearchNs(nodep->doc, nodep, (xmlChar *) prefix);
if (nsptr && nsptr->href != NULL) {
RETURN_STRING((char *) nsptr->href);
}
@@ -1659,7 +1675,8 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
zend_bool exclusive=0, with_comments=0;
xmlChar **inclusive_ns_prefixes = NULL;
char *file = NULL;
- int ret = -1, file_len = 0;
+ int ret = -1;
+ size_t file_len = 0;
xmlOutputBufferPtr buf;
xmlXPathContextPtr ctxp=NULL;
xmlXPathObjectPtr xpathobjp=NULL;
@@ -1691,7 +1708,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
if (nodep->type != XML_DOCUMENT_NODE) {
ctxp = xmlXPathNewContext(docp);
ctxp->node = nodep;
- xpathobjp = xmlXPathEvalExpression("(.//. | .//@* | .//namespace::*)", ctxp);
+ xpathobjp = xmlXPathEvalExpression((xmlChar *) "(.//. | .//@* | .//namespace::*)", ctxp);
ctxp->node = NULL;
if (xpathobjp && xpathobjp->type == XPATH_NODESET) {
nodeset = xpathobjp->nodesetval;
@@ -1729,13 +1746,13 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(tmp), prefix, tmpns) {
if (Z_TYPE_P(tmpns) == IS_STRING) {
if (prefix) {
- xmlXPathRegisterNs(ctxp, prefix->val, Z_STRVAL_P(tmpns));
+ xmlXPathRegisterNs(ctxp, (xmlChar *) prefix->val, (xmlChar *) Z_STRVAL_P(tmpns));
}
}
} ZEND_HASH_FOREACH_END();
}
- xpathobjp = xmlXPathEvalExpression(xquery, ctxp);
+ xpathobjp = xmlXPathEvalExpression((xmlChar *) xquery, ctxp);
ctxp->node = NULL;
if (xpathobjp && xpathobjp->type == XPATH_NODESET) {
nodeset = xpathobjp->nodesetval;
@@ -1758,7 +1775,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
sizeof(xmlChar *), 0);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(ns_prefixes), tmpns) {
if (Z_TYPE_P(tmpns) == IS_STRING) {
- inclusive_ns_prefixes[nscount++] = Z_STRVAL_P(tmpns);
+ inclusive_ns_prefixes[nscount++] = (xmlChar *) Z_STRVAL_P(tmpns);
}
} ZEND_HASH_FOREACH_END();
inclusive_ns_prefixes[nscount] = NULL;
@@ -1815,7 +1832,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
bytes = xmlOutputBufferClose(buf);
if (mode == 1 && (ret >= 0)) {
- RETURN_INT(bytes);
+ RETURN_LONG(bytes);
}
}
}
@@ -1848,7 +1865,7 @@ PHP_METHOD(domnode, getNodePath)
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
- value = xmlGetNodePath(nodep);
+ value = (char *) xmlGetNodePath(nodep);
if (value == NULL) {
RETURN_NULL();
} else {
@@ -1872,7 +1889,7 @@ PHP_METHOD(domnode, getLineNo)
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
- RETURN_INT(xmlGetLineNo(nodep));
+ RETURN_LONG(xmlGetLineNo(nodep));
}
/* }}} */
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index 5d45ad6edd..15071739d2 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -84,14 +84,15 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC)
} else {
nodep = nodep->children;
}
- curnode = dom_get_elements_by_tag_name_ns_raw(nodep, objmap->ns, objmap->local, &count, -1);
+ curnode = dom_get_elements_by_tag_name_ns_raw(
+ nodep, (char *) objmap->ns, (char *) objmap->local, &count, -1);
}
}
}
}
}
- ZVAL_INT(retval, count);
+ ZVAL_LONG(retval, count);
return SUCCESS;
}
@@ -104,7 +105,7 @@ Since:
PHP_FUNCTION(dom_nodelist_item)
{
zval *id;
- long index;
+ zend_long index;
int ret;
dom_object *intern;
xmlNodePtr itemnode = NULL;
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index dc63f1516d..b26608adcf 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 49ac4740a9..c25cbaba58 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -321,7 +321,7 @@ static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void
retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot TSRMLS_CC);
}
- STR_RELEASE(member_str);
+ zend_string_release(member_str);
return retval;
}
/* }}} */
@@ -352,7 +352,7 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
retval = std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC);
}
- STR_RELEASE(member_str);
+ zend_string_release(member_str);
return retval;
}
/* }}} */
@@ -374,7 +374,7 @@ void dom_write_property(zval *object, zval *member, zval *value, void **cache_sl
std_hnd->write_property(object, member, value, cache_slot TSRMLS_CC);
}
- STR_RELEASE(member_str);
+ zend_string_release(member_str);
}
/* }}} */
@@ -407,7 +407,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void
retval = std_hnd->has_property(object, member, check_empty, cache_slot TSRMLS_CC);
}
- STR_RELEASE(member_str);
+ zend_string_release(member_str);
return retval;
}
/* }}} */
@@ -440,7 +440,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
zend_hash_move_forward_ex(prop_handlers, &pos)) {
zval value;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
if (entry->read_func(obj, &value TSRMLS_CC) == FAILURE) {
continue;
@@ -619,13 +619,15 @@ PHP_MINIT_FUNCTION(dom)
memcpy(&dom_nnodemap_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
dom_nnodemap_object_handlers.free_obj = dom_nnodemap_objects_free_storage;
dom_nnodemap_object_handlers.dtor_obj = dom_nnodemap_object_dtor;
+ dom_nnodemap_object_handlers.read_dimension = dom_nodelist_read_dimension;
+ dom_nnodemap_object_handlers.has_dimension = dom_nodelist_has_dimension;
zend_hash_init(&classes, 0, NULL, NULL, 1);
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
- zend_declare_property_int(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);
REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
@@ -860,56 +862,56 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers);
#endif
- REGISTER_INT_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT);
#ifdef XML_GLOBAL_NAMESPACE
- REGISTER_INT_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
/* DOMException Codes */
- REGISTER_INT_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT);
php_libxml_register_export(dom_node_class_entry, php_dom_export_node);
@@ -1542,6 +1544,34 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
/* }}} end dom_get_nsdecl */
+zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv TSRMLS_DC) /* {{{ */
+{
+ zval offset_copy;
+
+ if (!offset) {
+ return NULL;
+ }
+
+ ZVAL_LONG(&offset_copy, zval_get_long(offset));
+
+ zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy);
+
+ return rv;
+} /* }}} end dom_nodelist_read_dimension */
+
+int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty TSRMLS_DC)
+{
+ zend_long offset = zval_get_long(member);
+
+ if (offset < 0) {
+ return 0;
+ } else {
+ zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0 TSRMLS_CC);
+
+ return length && offset < Z_LVAL_P(length);
+ }
+} /* }}} end dom_nodelist_has_dimension */
+
#endif /* HAVE_DOM */
/*
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index 628a19e978..02eb2d9509 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -126,6 +126,8 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce TSRMLS_DC);
+zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv TSRMLS_DC);
+int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty TSRMLS_DC);
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index 36b159cc6e..a42cc9508b 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,7 +54,8 @@ PHP_METHOD(domprocessinginstruction, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *name, *value = NULL;
- int name_len, value_len, name_valid;
+ size_t name_len, value_len;
+ int name_valid;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
@@ -126,7 +127,7 @@ int dom_processinginstruction_data_read(dom_object *obj, zval *retval TSRMLS_DC)
}
if ((content = xmlNodeGetContent(nodep)) != NULL) {
- ZVAL_STRING(retval, content);
+ ZVAL_STRING(retval, (char *) content);
xmlFree(content);
} else {
ZVAL_EMPTY_STRING(retval);
@@ -147,9 +148,9 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC
str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, str->val, str->len + 1);
+ xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
- STR_RELEASE(str);
+ zend_string_release(str);
return SUCCESS;
}
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
index 3d65a84bad..75680089a4 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
new file mode 100644
index 0000000000..e4eb6f724f
--- /dev/null
+++ b/ext/dom/tests/bug67949.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Bug #67949: DOMNodeList elements should be accessible through array notation
+--FILE--
+<?php
+
+$html = <<<HTML
+<div>data</div>
+<a href="test">hello world</a>
+HTML;
+$doc = new DOMDocument;
+$doc->loadHTML($html);
+
+$nodes = $doc->getElementsByTagName('div');
+
+echo "testing has_dimension\n";
+var_dump(isset($nodes[0]));
+var_dump(isset($nodes[1]));
+var_dump(isset($nodes[-1]));
+
+echo "testing property access\n";
+var_dump($nodes[0]->textContent);
+var_dump($nodes[1]->textContent);
+
+echo "testing offset not a long\n";
+$offset = ['test'];
+var_dump($offset);
+var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
+var_dump($offset);
+
+$something = 'test';
+$offset = &$something;
+
+var_dump($offset);
+var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
+var_dump($offset);
+
+$offset = 'test';
+var_dump($offset);
+var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
+var_dump($offset);
+
+echo "testing read_dimension with null offset\n";
+var_dump($nodes[][] = 1);
+
+echo "testing attribute access\n";
+$anchor = $doc->getElementsByTagName('a')[0];
+var_dump($anchor->attributes[0]->name);
+
+echo "==DONE==\n";
+
+--EXPECTF--
+testing has_dimension
+bool(true)
+bool(false)
+bool(false)
+testing property access
+string(4) "data"
+
+Notice: Trying to get property of non-object in %s on line %d
+NULL
+testing offset not a long
+array(1) {
+ [0]=>
+ string(4) "test"
+}
+
+Notice: Trying to get property of non-object in %s on line %d
+bool(false)
+NULL
+array(1) {
+ [0]=>
+ string(4) "test"
+}
+string(4) "test"
+bool(true)
+string(4) "data"
+string(4) "test"
+string(4) "test"
+bool(true)
+string(4) "data"
+string(4) "test"
+testing read_dimension with null offset
+NULL
+testing attribute access
+string(4) "href"
+==DONE==
+
diff --git a/ext/dom/tests/node_textcontent.phpt b/ext/dom/tests/node_textcontent.phpt
new file mode 100644
index 0000000000..a731a264aa
--- /dev/null
+++ b/ext/dom/tests/node_textcontent.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Testing reading and writing to DOMNode::textContent
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$html = <<<HTML
+<div id="test"><span>hi there</span></div>
+HTML;
+
+$text = '<p>hello world &trade;</p>';
+
+$dom = new DOMDocument('1.0', 'UTF-8');
+$dom->loadHTML($html);
+
+$node = $dom->getElementById('test');
+var_dump($node->textContent);
+$node->textContent = $text;
+var_dump($node->textContent == $text);
+
+var_dump($dom->saveHTML($node));
+
+?>
+--EXPECT--
+string(8) "hi there"
+bool(true)
+string(63) "<div id="test">&lt;p&gt;hello world &amp;trade;&lt;/p&gt;</div>"
+
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 66bdcec0e4..1cefa665aa 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -69,7 +69,7 @@ PHP_METHOD(domtext, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *value = NULL;
- int value_len;
+ size_t value_len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
@@ -126,7 +126,7 @@ int dom_text_whole_text_read(dom_object *obj, zval *retval TSRMLS_DC)
}
if (wholetext != NULL) {
- ZVAL_STRING(retval, wholetext);
+ ZVAL_STRING(retval, (char *) wholetext);
xmlFree(wholetext);
} else {
ZVAL_EMPTY_STRING(retval);
@@ -149,11 +149,11 @@ PHP_FUNCTION(dom_text_split_text)
xmlChar *second;
xmlNodePtr node;
xmlNodePtr nnode;
- php_int_t offset;
+ zend_long offset;
int length;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_text_class_entry, &offset) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) {
return;
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
index 5a437dc332..5267ee6f77 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
index 6bddff6e73..e0b8756aa8 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 49226c459c..9d5ffe8fb6 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -68,7 +68,8 @@ PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj);
#define NODE_GET_OBJ(__ptr, __id, __prtype, __intern) { \
__intern = Z_LIBXML_NODE_P(__id); \
if (__intern->node == NULL || !(__ptr = (__prtype)__intern->node->node)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", \
+ __intern->std.ce->name->val);\
RETURN_NULL();\
} \
}
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 8351946038..336365e342 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -186,7 +186,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
}
return;
}
- ZVAL_STRING(&fci.function_name, obj->stringval);
+ ZVAL_STRING(&fci.function_name, (char *) obj->stringval);
xmlXPathFreeObject(obj);
fci.symbol_table = NULL;
@@ -222,13 +222,13 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
} else {
zend_string *str = zval_get_string(&retval);
- valuePush(ctxt, xmlXPathNewString(str->val));
- STR_RELEASE(str);
+ valuePush(ctxt, xmlXPathNewString((xmlChar *) str->val));
+ zend_string_release(str);
}
zval_ptr_dtor(&retval);
}
}
- STR_RELEASE(callable);
+ zend_string_release(callable);
zval_dtor(&fci.function_name);
if (fci.param_count > 0) {
for (i = 0; i < nargs - 1; i++) {
@@ -319,7 +319,7 @@ PHP_FUNCTION(dom_xpath_register_ns)
{
zval *id;
xmlXPathContextPtr ctxp;
- int prefix_len, ns_uri_len;
+ size_t prefix_len, ns_uri_len;
dom_xpath_object *intern;
unsigned char *prefix, *ns_uri;
@@ -357,7 +357,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
xmlXPathContextPtr ctxp;
xmlNodePtr nodep = NULL;
xmlXPathObjectPtr xpathobjp;
- int expr_len, nsnbr = 0, xpath_type;
+ size_t expr_len, nsnbr = 0, xpath_type;
dom_xpath_object *intern;
dom_object *nodeobj;
char *expr;
@@ -412,7 +412,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
ctxp->namespaces = ns;
ctxp->nsNr = nsnbr;
- xpathobjp = xmlXPathEvalExpression(expr, ctxp);
+ xpathobjp = xmlXPathEvalExpression((xmlChar *) expr, ctxp);
ctxp->node = NULL;
if (ns != NULL) {
@@ -453,12 +453,12 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
nsparent = node->_private;
curns = xmlNewNs(NULL, node->name, NULL);
if (node->children) {
- curns->prefix = xmlStrdup((char *) node->children);
+ curns->prefix = xmlStrdup((xmlChar *) node->children);
}
if (node->children) {
- node = xmlNewDocNode(docp, NULL, (char *) node->children, node->name);
+ node = xmlNewDocNode(docp, NULL, (xmlChar *) node->children, node->name);
} else {
- node = xmlNewDocNode(docp, NULL, "xmlns", node->name);
+ node = xmlNewDocNode(docp, NULL, (xmlChar *) "xmlns", node->name);
}
node->type = XML_NAMESPACE_DECL;
node->parent = nsparent;
@@ -483,7 +483,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
break;
case XPATH_STRING:
- RETVAL_STRING(xpathobjp->stringval);
+ RETVAL_STRING((char *) xpathobjp->stringval);
break;
default:
@@ -524,10 +524,10 @@ PHP_FUNCTION(dom_xpath_register_php_functions)
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value));
while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) {
zend_string *str = zval_get_string(entry);
- ZVAL_INT(&new_string,1);
+ ZVAL_LONG(&new_string,1);
zend_hash_update(intern->registered_phpfunctions, str, &new_string);
zend_hash_move_forward(Z_ARRVAL_P(array_value));
- STR_RELEASE(str);
+ zend_string_release(str);
}
intern->registerPhpFunctions = 2;
RETURN_TRUE;
@@ -535,7 +535,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions)
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) {
intern = Z_XPATHOBJ_P(id);
- ZVAL_INT(&new_string, 1);
+ ZVAL_LONG(&new_string, 1);
zend_hash_update(intern->registered_phpfunctions, name, &new_string);
intern->registerPhpFunctions = 2;
} else {
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index e8c9555152..ca33700982 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -289,8 +289,8 @@ PHP_MINIT_FUNCTION(enchant)
{
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant_broker", module_number);
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant_dict", module_number);
- REGISTER_INT_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
@@ -422,11 +422,11 @@ PHP_FUNCTION(enchant_broker_set_dict_path)
{
zval *broker;
enchant_broker *pbroker;
- php_int_t dict_type;
+ zend_long dict_type;
char *value;
- int value_len;
+ size_t value_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris", &broker, &dict_type, &value, &value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &broker, &dict_type, &value, &value_len) == FAILURE) {
RETURN_FALSE;
}
@@ -462,10 +462,10 @@ PHP_FUNCTION(enchant_broker_get_dict_path)
{
zval *broker;
enchant_broker *pbroker;
- php_int_t dict_type;
+ zend_long dict_type;
char *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &broker, &dict_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &broker, &dict_type) == FAILURE) {
RETURN_FALSE;
}
@@ -535,7 +535,7 @@ PHP_FUNCTION(enchant_broker_request_dict)
enchant_dict *dict;
EnchantDict *d;
char *tag;
- int taglen;
+ size_t taglen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
@@ -583,7 +583,7 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
enchant_dict *dict;
EnchantDict *d;
char *pwl;
- int pwllen;
+ size_t pwllen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &broker, &pwl, &pwllen) == FAILURE) {
@@ -648,7 +648,7 @@ PHP_FUNCTION(enchant_broker_dict_exists)
{
zval *broker;
char *tag;
- int taglen;
+ size_t taglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
@@ -672,9 +672,9 @@ PHP_FUNCTION(enchant_broker_set_ordering)
{
zval *broker;
char *pordering;
- int porderinglen;
+ size_t porderinglen;
char *ptag;
- int ptaglen;
+ size_t ptaglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
@@ -713,7 +713,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
{
zval *dict, *sugg = NULL;
char *word;
- int wordlen;
+ size_t wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
@@ -759,7 +759,7 @@ PHP_FUNCTION(enchant_dict_check)
{
zval *dict;
char *word;
- int wordlen;
+ size_t wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
@@ -778,7 +778,7 @@ PHP_FUNCTION(enchant_dict_suggest)
{
zval *dict;
char *word;
- int wordlen;
+ size_t wordlen;
char **suggs;
enchant_dict *pdict;
int n_sugg;
@@ -811,7 +811,7 @@ PHP_FUNCTION(enchant_dict_add_to_personal)
{
zval *dict;
char *word;
- int wordlen;
+ size_t wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
@@ -830,7 +830,7 @@ PHP_FUNCTION(enchant_dict_add_to_session)
{
zval *dict;
char *word;
- int wordlen;
+ size_t wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
@@ -849,7 +849,7 @@ PHP_FUNCTION(enchant_dict_is_in_session)
{
zval *dict;
char *word;
- int wordlen;
+ size_t wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
@@ -871,7 +871,7 @@ PHP_FUNCTION(enchant_dict_store_replacement)
{
zval *dict;
char *mis, *cor;
- int mislen, corlen;
+ size_t mislen, corlen;
enchant_dict *pdict;
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index 3a4cbbbb85..c626fef5c7 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -294,7 +294,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
zval *regex, /* Regular expression */
*array = NULL; /* Optional register array */
char *findin; /* String to apply expression to */
- int findin_len;
+ size_t findin_len;
regex_t re;
regmatch_t *subs;
int err, match_len, string_len;
@@ -323,7 +323,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
} else {
/* we convert numbers to integers and treat them as a string */
if (Z_TYPE_P(regex) == IS_DOUBLE) {
- convert_to_int_ex(regex); /* get rid of decimal places */
+ convert_to_long_ex(regex); /* get rid of decimal places */
}
convert_to_string_ex(regex);
/* don't bother doing an extended regex with just a number */
@@ -379,7 +379,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
} else {
if (match_len == 0)
match_len = 1;
- RETVAL_INT(match_len);
+ RETVAL_LONG(match_len);
}
regfree(&re);
}
@@ -564,33 +564,33 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
}
if (Z_TYPE_P(arg_pattern) == IS_STRING) {
- if (Z_STRVAL_P(arg_pattern) && Z_STRSIZE_P(arg_pattern)) {
- pattern = STR_COPY(Z_STR_P(arg_pattern));
+ if (Z_STRVAL_P(arg_pattern) && Z_STRLEN_P(arg_pattern)) {
+ pattern = zend_string_copy(Z_STR_P(arg_pattern));
} else {
pattern = STR_EMPTY_ALLOC();
}
} else {
- convert_to_int_ex(arg_pattern);
- pattern = STR_ALLOC(1, 0);
- pattern->val[0] = (char) Z_IVAL_P(arg_pattern);
+ convert_to_long_ex(arg_pattern);
+ pattern = zend_string_alloc(1, 0);
+ pattern->val[0] = (char) Z_LVAL_P(arg_pattern);
pattern->val[1] = '\0';
}
if (Z_TYPE_P(arg_replace) == IS_STRING) {
- if (Z_STRVAL_P(arg_replace) && Z_STRSIZE_P(arg_replace)) {
- replace = STR_COPY(Z_STR_P(arg_replace));
+ if (Z_STRVAL_P(arg_replace) && Z_STRLEN_P(arg_replace)) {
+ replace = zend_string_copy(Z_STR_P(arg_replace));
} else {
replace = STR_EMPTY_ALLOC();
}
} else {
- convert_to_int_ex(arg_replace);
- replace = STR_ALLOC(1, 0);
- replace->val[0] = (char) Z_IVAL_P(arg_replace);
+ convert_to_long_ex(arg_replace);
+ replace = zend_string_alloc(1, 0);
+ replace->val[0] = (char) Z_LVAL_P(arg_replace);
replace->val[1] = '\0';
}
if (arg_string) {
- string = STR_COPY(arg_string);
+ string = zend_string_copy(arg_string);
} else {
string = STR_EMPTY_ALLOC();
}
@@ -604,9 +604,9 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
efree(ret);
}
- STR_RELEASE(string);
- STR_RELEASE(replace);
- STR_RELEASE(pattern);
+ zend_string_release(string);
+ zend_string_release(replace);
+ zend_string_release(pattern);
}
/* }}} */
@@ -630,14 +630,14 @@ PHP_FUNCTION(eregi_replace)
*/
static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
- php_int_t count = -1;
+ zend_long count = -1;
regex_t re;
regmatch_t subs[1];
char *spliton, *str, *strp, *endp;
- int spliton_len, str_len;
+ size_t spliton_len, str_len;
int err, size, copts = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) {
return;
}
@@ -733,7 +733,7 @@ PHP_FUNCTION(spliti)
PHP_EREG_API PHP_FUNCTION(sql_regcase)
{
char *string, *tmp;
- int string_len;
+ size_t string_len;
unsigned char c;
register int i, j;
diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h
index d34d19855f..f1c2676772 100644
--- a/ext/ereg/php_ereg.h
+++ b/ext/ereg/php_ereg.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
index bb83b89fc9..3fd5a663a1 100644
--- a/ext/ereg/php_regex.h
+++ b/ext/ereg/php_regex.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/ereg/regex/regex.dsp b/ext/ereg/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/ext/ereg/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ereg/regex/regex.dsw b/ext/ereg/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/ext/ereg/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 0108a84bc5..06e1dae41a 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -166,17 +166,17 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
ZEND_INI_MH(OnUpdateEncode)
{
- if (new_value && new_value_length) {
+ if (new_value && new_value->len) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
+ if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
&return_list, &return_size, 0 TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
return FAILURE;
}
efree(return_list);
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
ZEND_INI_MH(OnUpdateDecode)
@@ -184,14 +184,14 @@ ZEND_INI_MH(OnUpdateDecode)
if (new_value) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
+ if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
&return_list, &return_size, 0 TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
return FAILURE;
}
efree(return_list);
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
PHP_INI_BEGIN()
@@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif)
{
REGISTER_INI_ENTRIES();
if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) {
- REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
} else {
- REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
}
return SUCCESS;
}
@@ -2020,16 +2020,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
if (l>1) {
info_value = &info_data->value;
for (b=0;b<l;b++) {
- add_index_int(&array, b, (int)(info_value->s[b]));
+ add_index_long(&array, b, (int)(info_value->s[b]));
}
break;
}
case TAG_FMT_USHORT:
case TAG_FMT_ULONG:
if (l==1) {
- add_assoc_int(&tmpi, name, (int)info_value->u);
+ add_assoc_long(&tmpi, name, (int)info_value->u);
} else {
- add_index_int(&array, ap, (int)info_value->u);
+ add_index_long(&array, ap, (int)info_value->u);
}
break;
@@ -2046,16 +2046,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
if (l>1) {
info_value = &info_data->value;
for (b=0;b<l;b++) {
- add_index_int(&array, ap, (int)info_value->s[b]);
+ add_index_long(&array, ap, (int)info_value->s[b]);
}
break;
}
case TAG_FMT_SSHORT:
case TAG_FMT_SLONG:
if (l==1) {
- add_assoc_int(&tmpi, name, info_value->i);
+ add_assoc_long(&tmpi, name, info_value->i);
} else {
- add_index_int(&array, ap, info_value->i);
+ add_index_long(&array, ap, info_value->i);
}
break;
@@ -2334,10 +2334,10 @@ static char * exif_get_markername(int marker)
Get headername for index or false if not defined */
PHP_FUNCTION(exif_tagname)
{
- php_int_t tag;
+ zend_long tag;
char *szTemp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &tag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) {
return;
}
@@ -2413,11 +2413,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
data_ptr += 8;
break;
case TAG_FMT_SINGLE:
- memmove(data_ptr, &info_data->value.f, byte_count);
+ memmove(data_ptr, &info_value->f, 4);
data_ptr += 4;
break;
case TAG_FMT_DOUBLE:
- memmove(data_ptr, &info_data->value.d, byte_count);
+ memmove(data_ptr, &info_value->d, 8);
data_ptr += 8;
break;
}
@@ -3847,7 +3847,7 @@ static int exif_discard_imageinfo(image_info_type *ImageInfo)
static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC)
{
int ret;
- php_stat_t st;
+ zend_stat_t st;
zend_string *base;
/* Start with an empty image information structure. */
@@ -3884,7 +3884,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
base = php_basename(FileName, strlen(FileName), NULL, 0 TSRMLS_CC);
ImageInfo->FileName = estrndup(base->val, base->len);
- STR_RELEASE(base);
+ zend_string_release(base);
ImageInfo->read_thumbnail = read_thumbnail;
ImageInfo->read_all = read_all;
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
@@ -3912,7 +3912,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
PHP_FUNCTION(exif_read_data)
{
char *p_name, *p_sections_needed = NULL;
- int p_name_len, p_sections_needed_len = 0;
+ size_t p_name_len, p_sections_needed_len = 0;
zend_bool sub_arrays=0, read_thumbnail=0, read_all=0;
int i, ret, sections_needed=0;
@@ -4091,7 +4091,8 @@ PHP_FUNCTION(exif_thumbnail)
{
zval *p_width = 0, *p_height = 0, *p_imagetype = 0;
char *p_name;
- int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
+ size_t p_name_len;
+ int ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
memset(&ImageInfo, 0, sizeof(ImageInfo));
@@ -4129,12 +4130,12 @@ PHP_FUNCTION(exif_thumbnail)
}
zval_dtor(p_width);
zval_dtor(p_height);
- ZVAL_INT(p_width, ImageInfo.Thumbnail.width);
- ZVAL_INT(p_height, ImageInfo.Thumbnail.height);
+ ZVAL_LONG(p_width, ImageInfo.Thumbnail.width);
+ ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
}
if (arg_c >= 4) {
zval_dtor(p_imagetype);
- ZVAL_INT(p_imagetype, ImageInfo.Thumbnail.filetype);
+ ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
}
#ifdef EXIF_DEBUG
@@ -4154,7 +4155,7 @@ PHP_FUNCTION(exif_thumbnail)
PHP_FUNCTION(exif_imagetype)
{
char *imagefile;
- int imagefile_len;
+ size_t imagefile_len;
php_stream * stream;
int itype = 0;
@@ -4175,7 +4176,7 @@ PHP_FUNCTION(exif_imagetype)
if (itype == IMAGE_FILETYPE_UNKNOWN) {
RETURN_FALSE;
} else {
- ZVAL_INT(return_value, itype);
+ ZVAL_LONG(return_value, itype);
}
}
/* }}} */
diff --git a/ext/exif/exif.dsp b/ext/exif/exif.dsp
deleted file mode 100644
index 4a827338b2..0000000000
--- a/ext/exif/exif.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="exif" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=exif - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak" CFG="exif - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "exif - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "exif - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "exif - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_exif.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "exif - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_exif.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "exif - Win32 Release_TS"
-# Name "exif - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\exif.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_exif.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
index e0326752e6..8c2c207fa9 100644
--- a/ext/exif/php_exif.h
+++ b/ext/exif/php_exif.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/exif/tests/bug68113.jpg b/ext/exif/tests/bug68113.jpg
new file mode 100755
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/ext/exif/tests/bug68113.jpg
Binary files differ
diff --git a/ext/exif/tests/bug68113.phpt b/ext/exif/tests/bug68113.phpt
new file mode 100644
index 0000000000..0fa4c4aca8
--- /dev/null
+++ b/ext/exif/tests/bug68113.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #68113 (Heap corruption in exif_thumbnail())
+--SKIPIF--
+<?php
+extension_loaded("exif") or die("skip need exif");
+?>
+--FILE--
+<?php
+var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
+?>
+Done
+--EXPECTF--
+Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
+
+Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/ext_skel b/ext/ext_skel
index e6b01fd4fc..c0c398d15e 100755
--- a/ext/ext_skel
+++ b/ext/ext_skel
@@ -156,12 +156,12 @@ if test "\$PHP_$EXTNAME" != "no"; then
dnl PHP_CHECK_LIBRARY(\$LIBNAME,\$LIBSYMBOL,
dnl [
- dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/lib, ${EXTNAME}_SHARED_LIBADD)
+ dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/\$PHP_LIBDIR, ${EXTNAME}_SHARED_LIBADD)
dnl AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ])
dnl ],[
dnl AC_MSG_ERROR([wrong $extname lib version or lib not found])
dnl ],[
- dnl -L\$${EXTNAME}_DIR/lib -lm
+ dnl -L\$${EXTNAME}_DIR/\$PHP_LIBDIR -lm
dnl ])
dnl
dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD)
diff --git a/ext/ext_skel_win32.php b/ext/ext_skel_win32.php
index c04f037657..770c6f48bb 100644
--- a/ext/ext_skel_win32.php
+++ b/ext/ext_skel_win32.php
@@ -35,20 +35,6 @@ foreach($argv as $arg) {
}
}
-$fp = fopen("$skel/skeleton.dsp", "rb");
-if ($fp) {
- $dsp_file = fread($fp, filesize("$skel/skeleton.dsp"));
- fclose($fp);
-
- $dsp_file = str_replace("extname", $extname, $dsp_file);
- $dsp_file = str_replace("EXTNAME", strtoupper($extname), $dsp_file);
- $fp = fopen("$extname/$extname.dsp", "wb");
- if ($fp) {
- fwrite($fp, $dsp_file);
- fclose($fp);
- }
-}
-
$fp = fopen("$extname/$extname.php", "rb");
if ($fp) {
$php_file = fread($fp, filesize("$extname/$extname.php"));
@@ -62,4 +48,5 @@ if ($fp) {
}
}
-?> \ No newline at end of file
+?>
+
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index e2030c621d..6879926eca 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -44,7 +44,7 @@
/* {{{ macros and type definitions */
typedef struct _php_fileinfo {
- php_int_t options;
+ zend_long options;
struct magic_set *magic;
} php_fileinfo;
@@ -57,7 +57,7 @@ typedef struct _finfo_object {
} finfo_object;
#define FILEINFO_DECLARE_INIT_OBJECT(object) \
- zval *object = getThis();
+ zval *object = ZEND_IS_METHOD_CALL() ? getThis() : NULL;
static inline finfo_object *php_finfo_fetch_object(zend_object *obj) {
return (finfo_object *)((char*)(obj) - XtOffsetOf(finfo_object, zo));
@@ -176,7 +176,7 @@ zend_function_entry finfo_class_functions[] = {
#define FINFO_SET_OPTION(magic, options) \
if (magic_setflags(magic, options) == -1) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%pd' %d:%s", \
options, magic_errno(magic), magic_error(magic)); \
RETURN_FALSE; \
}
@@ -226,19 +226,19 @@ PHP_MINIT_FUNCTION(finfo)
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
- REGISTER_INT_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT);
-/* REGISTER_INT_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */
- REGISTER_INT_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT);
+/* REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */
+ REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
#ifdef MAGIC_PRESERVE_ATIME
- REGISTER_INT_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef MAGIC_RAW
- REGISTER_INT_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
#endif
return SUCCESS;
@@ -295,14 +295,14 @@ PHP_MINFO_FUNCTION(fileinfo)
Create a new fileinfo resource. */
PHP_FUNCTION(finfo_open)
{
- php_int_t options = MAGIC_NONE;
+ zend_long options = MAGIC_NONE;
char *file = NULL;
- int file_len = 0;
+ size_t file_len = 0;
php_fileinfo *finfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ip", &options, &file, &file_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lp", &options, &file, &file_len) == FAILURE) {
FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
@@ -339,7 +339,7 @@ PHP_FUNCTION(finfo_open)
if (finfo->magic == NULL) {
efree(finfo);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%pd'.", options);
FILEINFO_DESTROY_OBJECT(object);
RETURN_FALSE;
}
@@ -382,18 +382,18 @@ PHP_FUNCTION(finfo_close)
Set libmagic configuration options. */
PHP_FUNCTION(finfo_set_flags)
{
- php_int_t options;
+ zend_long options;
php_fileinfo *finfo;
zval *zfinfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
RETURN_FALSE;
}
FILEINFO_FROM_OBJECT(finfo, object);
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zfinfo, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zfinfo, &options) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo);
@@ -412,9 +412,9 @@ PHP_FUNCTION(finfo_set_flags)
static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mimetype_emu) /* {{{ */
{
- php_int_t options = 0;
+ zend_long options = 0;
char *ret_val = NULL, *buffer = NULL;
- int buffer_len;
+ size_t buffer_len;
php_fileinfo *finfo = NULL;
zval *zfinfo, *zcontext = NULL;
zval *what;
@@ -433,7 +433,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
switch (Z_TYPE_P(what)) {
case IS_STRING:
buffer = Z_STRVAL_P(what);
- buffer_len = Z_STRSIZE_P(what);
+ buffer_len = Z_STRLEN_P(what);
mode = FILEINFO_MODE_FILE;
break;
@@ -452,13 +452,13 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
goto common;
}
} else if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ir", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
RETURN_FALSE;
}
FILEINFO_FROM_OBJECT(finfo, object);
magic = finfo->magic;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ir", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo);
@@ -480,7 +480,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
case FILEINFO_MODE_STREAM:
{
php_stream *stream;
- php_off_t streampos;
+ zend_off_t streampos;
php_stream_from_zval_no_verify(stream, what);
if (!stream) {
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index b3b1f746d4..c1dc5aa1fa 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -1145,7 +1145,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
uint32_t i, j;
size_t files = 0, maxfiles = 0;
char **filearr = NULL;
- php_stat_t st;
+ zend_stat_t st;
struct magic_map *map;
struct magic_entry_set mset[MAGIC_SETS];
php_stream *dir;
@@ -1272,7 +1272,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
* the sign extension must have happened.
*/
case FILE_BYTE:
- v = (char) v;
+ v = (signed char) v;
break;
case FILE_SHORT:
case FILE_BESHORT:
@@ -2698,7 +2698,7 @@ internal_loaded:
if (NULL != fn) {
nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
entries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
- if ((php_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
+ if ((zend_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
file_error(ms, 0, "Size of `%s' %llu is not a multiple of %zu",
dbname, (unsigned long long)st.sb.st_size,
sizeof(struct magic));
@@ -2788,7 +2788,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
assert(nm + sizeof(ar) < m);
- if (php_stream_seek(stream,(php_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
+ if (php_stream_seek(stream,(zend_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
file_error(ms, errno, "error seeking `%s'", dbname);
goto out;
}
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
index 93cc231884..45ad6e3e57 100644
--- a/ext/fileinfo/libmagic/cdf.c
+++ b/ext/fileinfo/libmagic/cdf.c
@@ -291,11 +291,11 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
}
static ssize_t
-cdf_read(const cdf_info_t *info, php_off_t off, void *buf, size_t len)
+cdf_read(const cdf_info_t *info, zend_off_t off, void *buf, size_t len)
{
size_t siz = (size_t)off + len;
- if ((php_off_t)(off + len) != (php_off_t)siz) {
+ if ((zend_off_t)(off + len) != (zend_off_t)siz) {
errno = EINVAL;
return -1;
}
@@ -308,7 +308,7 @@ cdf_read(const cdf_info_t *info, php_off_t off, void *buf, size_t len)
if (info->i_fd == -1)
return -1;
- if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (php_off_t)-1)
+ if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (zend_off_t)-1)
return -1;
if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len)
@@ -323,7 +323,7 @@ cdf_read_header(const cdf_info_t *info, cdf_header_t *h)
char buf[512];
(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
- if (cdf_read(info, (php_off_t)0, buf, sizeof(buf)) == -1)
+ if (cdf_read(info, (zend_off_t)0, buf, sizeof(buf)) == -1)
return -1;
cdf_unpack_header(h, buf);
cdf_swap_header(h);
@@ -357,7 +357,7 @@ cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len,
size_t ss = CDF_SEC_SIZE(h);
size_t pos = CDF_SEC_POS(h, id);
assert(ss == len);
- return cdf_read(info, (php_off_t)pos, ((char *)buf) + offs, len);
+ return cdf_read(info, (zend_off_t)pos, ((char *)buf) + offs, len);
}
ssize_t
diff --git a/ext/fileinfo/libmagic/compress.c b/ext/fileinfo/libmagic/compress.c
index 613fc6a3d2..0da5a3e6ce 100644
--- a/ext/fileinfo/libmagic/compress.c
+++ b/ext/fileinfo/libmagic/compress.c
@@ -300,7 +300,7 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
return -1;
}
(void)close(tfd);
- if (FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -406,7 +406,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
(void) close(0);
if (fd != -1) {
(void) dup(fd);
- (void) FINFO_LSEEK_FUNC(0, (php_off_t)0, SEEK_SET);
+ (void) FINFO_LSEEK_FUNC(0, (zend_off_t)0, SEEK_SET);
} else {
(void) dup(fdin[0]);
(void) close(fdin[0]);
diff --git a/ext/fileinfo/libmagic/elfclass.h b/ext/fileinfo/libmagic/elfclass.h
index 889ff6263e..bfacceb88a 100644
--- a/ext/fileinfo/libmagic/elfclass.h
+++ b/ext/fileinfo/libmagic/elfclass.h
@@ -37,7 +37,7 @@
case ET_CORE:
flags |= FLAGS_IS_CORE;
if (dophn_core(ms, clazz, swap, fd,
- (php_off_t)elf_getu(swap, elfhdr.e_phoff),
+ (zend_off_t)elf_getu(swap, elfhdr.e_phoff),
elf_getu16(swap, elfhdr.e_phnum),
(size_t)elf_getu16(swap, elfhdr.e_phentsize),
fsize, &flags) == -1)
@@ -47,7 +47,7 @@
case ET_EXEC:
case ET_DYN:
if (dophn_exec(ms, clazz, swap, fd,
- (php_off_t)elf_getu(swap, elfhdr.e_phoff),
+ (zend_off_t)elf_getu(swap, elfhdr.e_phoff),
elf_getu16(swap, elfhdr.e_phnum),
(size_t)elf_getu16(swap, elfhdr.e_phentsize),
fsize, &flags, elf_getu16(swap, elfhdr.e_shnum))
@@ -56,7 +56,7 @@
/*FALLTHROUGH*/
case ET_REL:
if (doshn(ms, clazz, swap, fd,
- (php_off_t)elf_getu(swap, elfhdr.e_shoff),
+ (zend_off_t)elf_getu(swap, elfhdr.e_shoff),
elf_getu16(swap, elfhdr.e_shnum),
(size_t)elf_getu16(swap, elfhdr.e_shentsize),
fsize, &flags, elf_getu16(swap, elfhdr.e_machine),
diff --git a/ext/fileinfo/libmagic/file.h b/ext/fileinfo/libmagic/file.h
index 9a61d2ce49..0a5c19c54c 100644
--- a/ext/fileinfo/libmagic/file.h
+++ b/ext/fileinfo/libmagic/file.h
@@ -407,7 +407,6 @@ struct magic_set {
/* Type for Unicode characters */
typedef unsigned long unichar;
-struct stat;
#define FILE_T_LOCAL 1
#define FILE_T_WINDOWS 2
protected const char *file_fmttime(uint64_t, int, char *);
@@ -415,7 +414,7 @@ protected struct magic_set *file_ms_alloc(int);
protected void file_ms_free(struct magic_set *);
protected int file_buffer(struct magic_set *, php_stream *, const char *, const void *,
size_t);
-protected int file_fsmagic(struct magic_set *, const char *, struct stat *, php_stream *);
+protected int file_fsmagic(struct magic_set *, const char *, zend_stat_t *, php_stream *);
protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
protected int file_replace(struct magic_set *, const char *, const char *);
protected int file_printf(struct magic_set *, const char *, ...);
diff --git a/ext/fileinfo/libmagic/fsmagic.c b/ext/fileinfo/libmagic/fsmagic.c
index f945d06a8b..a7b420ff5d 100644
--- a/ext/fileinfo/libmagic/fsmagic.c
+++ b/ext/fileinfo/libmagic/fsmagic.c
@@ -90,7 +90,7 @@ handle_mime(struct magic_set *ms, int mime, const char *str)
}
protected int
-file_fsmagic(struct magic_set *ms, const char *fn, php_stat_t *sb, php_stream *stream)
+file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb, php_stream *stream)
{
int ret, did = 0;
int mime = ms->flags & MAGIC_MIME;
diff --git a/ext/fileinfo/libmagic/funcs.c b/ext/fileinfo/libmagic/funcs.c
index 3c9d387470..c7d9a7e4f1 100644
--- a/ext/fileinfo/libmagic/funcs.c
+++ b/ext/fileinfo/libmagic/funcs.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.68 2014/02/18 11:09:31 kim Exp $")
#endif /* lint */
#include "magic.h"
@@ -173,8 +173,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
const char *code_mime = "binary";
const char *type = "application/octet-stream";
const char *def = "data";
-
-
+ const char *ftype = NULL;
if (nb == 0) {
def = "empty";
@@ -187,7 +186,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
- &code, &code_mime, &type);
+ &code, &code_mime, &ftype);
}
#ifdef __EMX__
@@ -272,7 +271,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
if (looks_text == 0)
if ((m = file_ascmagic_with_encoding( ms, ubuf,
- nb, u8buf, ulen, code, type, looks_text))
+ nb, u8buf, ulen, code, ftype, looks_text))
!= 0) {
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr,
@@ -471,7 +470,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
strncpy(ms->o.buf, res->val, res->len);
ms->o.buf[res->len] = '\0';
- STR_RELEASE(res);
+ zend_string_release(res);
out:
(void)setlocale(LC_CTYPE, "");
diff --git a/ext/fileinfo/libmagic/magic.c b/ext/fileinfo/libmagic/magic.c
index ba66f0b681..7f5cff6a7b 100644
--- a/ext/fileinfo/libmagic/magic.c
+++ b/ext/fileinfo/libmagic/magic.c
@@ -81,7 +81,7 @@ FILE_RCSID("@(#)$File: magic.c,v 1.81 2013/11/29 15:42:51 christos Exp $")
#endif
private void close_and_restore(const struct magic_set *, const char *, int,
- const struct stat *);
+ const zend_stat_t *);
private int unreadable_info(struct magic_set *, mode_t, const char *);
#if 0
private const char* get_default_magic(void);
@@ -286,7 +286,7 @@ magic_list(struct magic_set *ms, const char *magicfile)
private void
close_and_restore(const struct magic_set *ms, const char *name, int fd,
- const struct stat *sb)
+ const zend_stat_t *sb)
{
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
@@ -350,7 +350,7 @@ file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
{
int rv = -1;
unsigned char *buf;
- struct stat sb;
+ zend_stat_t sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
int no_in_stream = 0;
TSRMLS_FETCH();
diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c
index ec316b6bbd..3b0aae54c1 100644
--- a/ext/fileinfo/libmagic/readelf.c
+++ b/ext/fileinfo/libmagic/readelf.c
@@ -42,13 +42,13 @@ FILE_RCSID("@(#)$File: readelf.c,v 1.99 2013/11/05 15:44:01 christos Exp $")
#include "magic.h"
#ifdef ELFCORE
-private int dophn_core(struct magic_set *, int, int, int, php_off_t, int, size_t,
- php_off_t, int *);
+private int dophn_core(struct magic_set *, int, int, int, zend_off_t, int, size_t,
+ zend_off_t, int *);
#endif
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
- php_off_t, int *, int);
+ zend_off_t, int *, int);
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
- php_off_t, int *, int);
+ zend_off_t, int *, int);
private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
int, size_t, int *);
@@ -144,7 +144,7 @@ getu64(int swap, uint64_t value)
#define xsh_size (size_t)(clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_size) \
: elf_getu64(swap, sh64.sh_size))
-#define xsh_offset (php_off_t)(clazz == ELFCLASS32 \
+#define xsh_offset (zend_off_t)(clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_offset) \
: elf_getu64(swap, sh64.sh_offset))
#define xsh_type (clazz == ELFCLASS32 \
@@ -162,13 +162,13 @@ getu64(int swap, uint64_t value)
#define xph_type (clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_type) \
: elf_getu32(swap, ph64.p_type))
-#define xph_offset (php_off_t)(clazz == ELFCLASS32 \
+#define xph_offset (zend_off_t)(clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_offset) \
: elf_getu64(swap, ph64.p_offset))
#define xph_align (size_t)((clazz == ELFCLASS32 \
- ? (php_off_t) (ph32.p_align ? \
+ ? (zend_off_t) (ph32.p_align ? \
elf_getu32(swap, ph32.p_align) : 4) \
- : (php_off_t) (ph64.p_align ? \
+ : (zend_off_t) (ph64.p_align ? \
elf_getu64(swap, ph64.p_align) : 4)))
#define xph_filesz (size_t)((clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_filesz) \
@@ -293,8 +293,8 @@ private const char os_style_names[][8] = {
#define FLAGS_IS_CORE 0x10
private int
-dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
- int num, size_t size, php_off_t fsize, int *flags)
+dophn_core(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off,
+ int num, size_t size, zend_off_t fsize, int *flags)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
@@ -312,7 +312,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
* Loop through all the program headers.
*/
for ( ; num; num--) {
- if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -334,7 +334,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -917,7 +917,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
Elf64_Shdr sh64;
int stripped = 1;
void *nbuf;
- php_off_t noff, coff, name_off;
+ zend_off_t noff, coff, name_off;
uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */
char name[50];
@@ -929,7 +929,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
}
for ( ; num; num--) {
- if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -959,8 +959,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
switch (xsh_type) {
case SHT_NOTE:
nbuf = emalloc((size_t)xsh_size);
- if ((noff = FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET)) ==
- (php_off_t)-1) {
+ if ((noff = FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET)) ==
+ (zend_off_t)-1) {
file_badread(ms);
efree(nbuf);
return -1;
@@ -974,7 +974,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
noff = 0;
for (;;) {
- if (noff >= (php_off_t)xsh_size)
+ if (noff >= (zend_off_t)xsh_size)
break;
noff = donote(ms, nbuf, (size_t)noff,
(size_t)xsh_size, clazz, swap, 4,
@@ -985,8 +985,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
efree(nbuf);
break;
case SHT_SUNW_cap:
- if (FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET) ==
- (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET) ==
+ (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -996,7 +996,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
Elf64_Cap cap64;
char cbuf[/*CONSTCOND*/
MAX(sizeof cap32, sizeof cap64)];
- if ((coff += xcap_sizeof) > (php_off_t)xsh_size)
+ if ((coff += xcap_sizeof) > (zend_off_t)xsh_size)
break;
if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) !=
(ssize_t)xcap_sizeof) {
@@ -1099,8 +1099,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
* otherwise it's statically linked.
*/
private int
-dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
- int num, size_t size, php_off_t fsize, int *flags, int sh_num)
+dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off,
+ int num, size_t size, zend_off_t fsize, int *flags, int sh_num)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
@@ -1117,7 +1117,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
}
for ( ; num; num--) {
- if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -1161,7 +1161,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off,
* This is a PT_NOTE section; loop through all the notes
* in the section.
*/
- if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) {
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) {
file_badseek(ms);
return -1;
}
@@ -1204,7 +1204,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
int clazz;
int swap;
struct stat st;
- php_off_t fsize;
+ zend_off_t fsize;
int flags = 0;
Elf32_Ehdr elf32hdr;
Elf64_Ehdr elf64hdr;
@@ -1227,7 +1227,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
/*
* If we cannot seek, it must be a pipe, socket or fifo.
*/
- if((FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) && (errno == ESPIPE))
+ if((FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) && (errno == ESPIPE))
fd = file_pipe2file(ms, fd, buf, nbytes);
if (fstat(fd, &st) == -1) {
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index b0e29c2b91..e626929c9e 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -366,13 +366,13 @@ check_fmt(struct magic_set *ms, struct magic *m)
return 0;
(void)setlocale(LC_CTYPE, "C");
- pattern = STR_INIT("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0);
+ pattern = zend_string_init("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0);
if ((pce = pcre_get_compiled_regex(pattern, &re_extra, &re_options TSRMLS_CC)) == NULL) {
rv = -1;
} else {
rv = !pcre_exec(pce, re_extra, m->desc, strlen(m->desc), 0, re_options, NULL, 0);
}
- STR_RELEASE(pattern);
+ zend_string_release(pattern);
(void)setlocale(LC_CTYPE, "");
return rv;
}
@@ -1887,7 +1887,7 @@ convert_libmagic_pattern(zval *pattern, char *val, int len, int options)
int i, j=0;
zend_string *t;
- t = STR_ALLOC(len * 2 + 4, 0);
+ t = zend_string_alloc(len * 2 + 4, 0);
t->val[j++] = '~';
@@ -1913,7 +1913,7 @@ convert_libmagic_pattern(zval *pattern, char *val, int len, int options)
t->val[j]='\0';
t->len = j;
- ZVAL_STR(pattern, t);
+ ZVAL_NEW_STR(pattern, t);
}
private int
@@ -2110,11 +2110,11 @@ magiccheck(struct magic_set *ms, struct magic *m)
/* Free haystack */
efree(haystack);
- if (Z_IVAL(retval) < 0) {
+ if (Z_LVAL(retval) < 0) {
zval_ptr_dtor(&subpats);
zval_ptr_dtor(&pattern);
return -1;
- } else if ((Z_IVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) {
+ } else if ((Z_LVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) {
/* Need to fetch global match which equals pmatch[0] */
zval *pzval;
HashTable *ht = Z_ARRVAL(subpats);
@@ -2156,16 +2156,16 @@ magiccheck(struct magic_set *ms, struct magic *m)
continue;
}
ZVAL_DUP(&offsetcopy, offset);
- convert_to_int(&offsetcopy);
+ convert_to_long(&offsetcopy);
pattern_offset = &offsetcopy;
} ZEND_HASH_FOREACH_END();
zval_dtor(&tmpcopy);
if ((pattern_match != NULL) && (pattern_offset != NULL)) {
- ms->search.s += Z_IVAL_P(pattern_offset); /* this is where the match starts */
- ms->search.offset += Z_IVAL_P(pattern_offset); /* this is where the match starts as size_t */
- ms->search.rm_len = Z_STRSIZE_P(pattern_match) /* This is the length of the matched pattern */;
+ ms->search.s += Z_LVAL_P(pattern_offset); /* this is where the match starts */
+ ms->search.offset += Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */
+ ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */;
v = 0;
zval_ptr_dtor(pattern_match);
diff --git a/ext/fileinfo/php_fileinfo.h b/ext/fileinfo/php_fileinfo.h
index 354ec7b284..d9c6c18c27 100644
--- a/ext/fileinfo/php_fileinfo.h
+++ b/ext/fileinfo/php_fileinfo.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/fileinfo/tests/finfo_buffer_basic.phpt b/ext/fileinfo/tests/finfo_buffer_basic.phpt
index d8dcfab7a0..0c3c641388 100644
--- a/ext/fileinfo/tests/finfo_buffer_basic.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_basic.phpt
@@ -48,7 +48,7 @@ string(15) "MIFF image data"
string(25) "RIFF (little-endian) data"
string(28) "text/plain; charset=us-ascii"
string(26) "text/plain; charset=ebcdic"
-string(22) "binary; charset=binary"
+string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
diff --git a/ext/fileinfo/tests/finfo_buffer_variation1.phpt b/ext/fileinfo/tests/finfo_buffer_variation1.phpt
index d9c9be03e3..4fdd2be272 100644
--- a/ext/fileinfo/tests/finfo_buffer_variation1.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_variation1.phpt
@@ -47,7 +47,7 @@ string(15) "MIFF image data"
string(25) "RIFF (little-endian) data"
string(28) "text/plain; charset=us-ascii"
string(26) "text/plain; charset=ebcdic"
-string(22) "binary; charset=binary"
+string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
diff --git a/ext/fileinfo/tests/precedural_finfo_in_method.phpt b/ext/fileinfo/tests/precedural_finfo_in_method.phpt
new file mode 100644
index 0000000000..8c30b8a197
--- /dev/null
+++ b/ext/fileinfo/tests/precedural_finfo_in_method.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Using procedural finfo API in a method
+--FILE--
+<?php
+
+class Test {
+ public function method() {
+ $finfo = finfo_open(FILEINFO_MIME);
+ var_dump(finfo_file($finfo, __FILE__));
+ }
+}
+
+$test = new Test;
+$test->method();
+
+?>
+--EXPECT--
+string(28) "text/plain; charset=us-ascii"
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
index 49410dbfe6..5a0ea0777d 100644
--- a/ext/filter/callback_filter.c
+++ b/ext/filter/callback_filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index 08e01bdabe..530dce6f53 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -77,7 +77,7 @@ static const filter_list_entry filter_list[] = {
#define PARSE_SESSION 6
#endif
-static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC);
+static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC);
static unsigned int php_sapi_filter_init(TSRMLS_D);
/* {{{ arginfo */
@@ -160,7 +160,7 @@ static PHP_INI_MH(UpdateDefaultFilter) /* {{{ */
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
for (i = 0; i < size; ++i) {
- if ((strcasecmp(new_value, filter_list[i].name) == 0)) {
+ if ((strcasecmp(new_value->val, filter_list[i].name) == 0)) {
IF_G(default_filter) = filter_list[i].id;
return SUCCESS;
}
@@ -178,7 +178,7 @@ static PHP_INI_MH(OnUpdateFlags)
if (!new_value) {
IF_G(default_filter_flags) = FILTER_FLAG_NO_ENCODE_QUOTES;
} else {
- IF_G(default_filter_flags) = atoi(new_value);
+ IF_G(default_filter_flags) = atoi(new_value->val);
}
return SUCCESS;
}
@@ -211,72 +211,72 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT);
sapi_register_input_filter(php_sapi_filter, php_sapi_filter_init TSRMLS_CC);
@@ -327,7 +327,7 @@ PHP_MINFO_FUNCTION(filter)
}
/* }}} */
-static filter_list_entry php_find_filter(php_int_t id) /* {{{ */
+static filter_list_entry php_find_filter(zend_long id) /* {{{ */
{
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
@@ -358,7 +358,7 @@ static unsigned int php_sapi_filter_init(TSRMLS_D)
return SUCCESS;
}
-static void php_zval_filter(zval *value, php_int_t filter, php_int_t flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
+static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
{
filter_list_entry filter_func;
@@ -402,7 +402,7 @@ static void php_zval_filter(zval *value, php_int_t filter, php_int_t flags, zval
}
/* }}} */
-static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC) /* {{{ */
+static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC) /* {{{ */
{
zval new_var, raw_var;
zval *array_ptr = NULL, *orig_array_ptr = NULL;
@@ -466,11 +466,11 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t v
if (retval) {
if (new_val_len) {
- *new_val_len = Z_STRSIZE(new_var);
+ *new_val_len = Z_STRLEN(new_var);
}
efree(*val);
- if (Z_STRSIZE(new_var)) {
- *val = estrndup(Z_STRVAL(new_var), Z_STRSIZE(new_var));
+ if (Z_STRLEN(new_var)) {
+ *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var));
} else {
*val = estrdup("");
}
@@ -481,7 +481,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t v
}
/* }}} */
-static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */
+static void php_zval_filter_recursive(zval *value, zend_long filter, zend_long flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */
{
if (Z_TYPE_P(value) == IS_ARRAY) {
zval *element;
@@ -491,7 +491,8 @@ static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t f
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(value), element) {
- SEPARATE_ZVAL_IF_NOT_REF(element);
+ ZVAL_DEREF(element);
+ SEPARATE_ZVAL_NOREF(element);
if (Z_TYPE_P(element) == IS_ARRAY) {
Z_ARRVAL_P(element)->u.v.nApplyCount++;
php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
@@ -506,7 +507,7 @@ static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t f
}
/* }}} */
-static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */
+static zval *php_filter_get_storage(zend_long arg TSRMLS_DC)/* {{{ */
{
zval *array_ptr = NULL;
@@ -523,17 +524,17 @@ static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */
break;
case PARSE_SERVER:
if (PG(auto_globals_jit)) {
- zend_string *name = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0);
+ zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(name TSRMLS_CC);
- STR_RELEASE(name);
+ zend_string_release(name);
}
array_ptr = &IF_G(server_array);
break;
case PARSE_ENV:
if (PG(auto_globals_jit)) {
- zend_string *name = STR_INIT("_ENV", sizeof("_ENV") - 1, 0);
+ zend_string *name = zend_string_init("_ENV", sizeof("_ENV") - 1, 0);
zend_is_auto_global(name TSRMLS_CC);
- STR_RELEASE(name);
+ zend_string_release(name);
}
array_ptr = &IF_G(env_array) ? &IF_G(env_array) : &PG(http_globals)[TRACK_VARS_ENV];
break;
@@ -556,11 +557,11 @@ static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */
*/
PHP_FUNCTION(filter_has_var)
{
- php_int_t arg;
+ zend_long arg;
zend_string *var;
zval *array_ptr = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS", &arg, &var) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &arg, &var) == FAILURE) {
RETURN_FALSE;
}
@@ -574,16 +575,14 @@ PHP_FUNCTION(filter_has_var)
}
/* }}} */
-static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args, const int copy, php_int_t filter_flags TSRMLS_DC) /* {{{ */
+static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args, const int copy, zend_long filter_flags TSRMLS_DC) /* {{{ */
{
zval *options = NULL;
zval *option;
char *charset = NULL;
if (filter_args && Z_TYPE_P(filter_args) != IS_ARRAY) {
- php_int_t lval;
-
- PHP_FILTER_GET_LONG_OPT(filter_args, lval);
+ zend_long lval = zval_get_long(filter_args);
if (filter != -1) { /* handler for array apply */
/* filter_args is the filter_flags */
@@ -597,11 +596,11 @@ static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args,
}
} else if (filter_args) {
if ((option = zend_hash_str_find(HASH_OF(filter_args), "filter", sizeof("filter") - 1)) != NULL) {
- PHP_FILTER_GET_LONG_OPT(option, filter);
+ filter = zval_get_long(option);
}
if ((option = zend_hash_str_find(HASH_OF(filter_args), "flags", sizeof("flags") - 1)) != NULL) {
- PHP_FILTER_GET_LONG_OPT(option, filter_flags);
+ filter_flags = zval_get_long(option);
if (!(filter_flags & FILTER_REQUIRE_ARRAY || filter_flags & FILTER_FORCE_ARRAY)) {
filter_flags |= FILTER_REQUIRE_SCALAR;
@@ -661,7 +660,6 @@ static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args,
static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zend_bool add_empty TSRMLS_DC) /* {{{ */
{
- php_uint_t index;
zend_string *arg_key;
zval *tmp, *arg_elm;
@@ -669,14 +667,14 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value,
zval_ptr_dtor(return_value);
ZVAL_DUP(return_value, input);
php_filter_call(return_value, FILTER_DEFAULT, NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC);
- } else if (Z_TYPE_P(op) == IS_INT) {
+ } else if (Z_TYPE_P(op) == IS_LONG) {
zval_ptr_dtor(return_value);
ZVAL_DUP(return_value, input);
- php_filter_call(return_value, Z_IVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC);
+ php_filter_call(return_value, Z_LVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC);
} else if (Z_TYPE_P(op) == IS_ARRAY) {
array_init(return_value);
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(op), index, arg_key, arg_elm) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(op), arg_key, arg_elm) {
if (arg_key == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric keys are not allowed in the definition array");
zval_ptr_dtor(return_value);
@@ -710,12 +708,12 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value,
*/
PHP_FUNCTION(filter_input)
{
- php_int_t fetch_from, filter = FILTER_DEFAULT;
+ zend_long fetch_from, filter = FILTER_DEFAULT;
zval *filter_args = NULL, *tmp;
zval *input = NULL;
zend_string *var;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS|iz", &fetch_from, &var, &filter, &filter_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS|lz", &fetch_from, &var, &filter, &filter_args) == FAILURE) {
return;
}
@@ -726,13 +724,13 @@ PHP_FUNCTION(filter_input)
input = php_filter_get_storage(fetch_from TSRMLS_CC);
if (!input || !HASH_OF(input) || (tmp = zend_hash_find(HASH_OF(input), var)) == NULL) {
- php_int_t filter_flags = 0;
+ zend_long filter_flags = 0;
zval *option, *opt, *def;
if (filter_args) {
- if (Z_TYPE_P(filter_args) == IS_INT) {
- filter_flags = Z_IVAL_P(filter_args);
+ if (Z_TYPE_P(filter_args) == IS_LONG) {
+ filter_flags = Z_LVAL_P(filter_args);
} else if (Z_TYPE_P(filter_args) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(filter_args), "flags", sizeof("flags") - 1)) != NULL) {
- PHP_FILTER_GET_LONG_OPT(option, filter_flags);
+ filter_flags = zval_get_long(option);
}
if (Z_TYPE_P(filter_args) == IS_ARRAY &&
(opt = zend_hash_str_find(HASH_OF(filter_args), "options", sizeof("options") - 1)) != NULL &&
@@ -766,10 +764,10 @@ PHP_FUNCTION(filter_input)
*/
PHP_FUNCTION(filter_var)
{
- php_int_t filter = FILTER_DEFAULT;
+ zend_long filter = FILTER_DEFAULT;
zval *filter_args = NULL, *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|iz", &data, &filter, &filter_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|lz", &data, &filter, &filter_args) == FAILURE) {
return;
}
@@ -788,28 +786,28 @@ PHP_FUNCTION(filter_var)
*/
PHP_FUNCTION(filter_input_array)
{
- php_int_t fetch_from;
+ zend_long fetch_from;
zval *array_input = NULL, *op = NULL;
zend_bool add_empty = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|zb", &fetch_from, &op, &add_empty) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|zb", &fetch_from, &op, &add_empty) == FAILURE) {
return;
}
- if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) {
+ if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) {
RETURN_FALSE;
}
array_input = php_filter_get_storage(fetch_from TSRMLS_CC);
if (!array_input || !HASH_OF(array_input)) {
- php_int_t filter_flags = 0;
+ zend_long filter_flags = 0;
zval *option;
if (op) {
- if (Z_TYPE_P(op) == IS_INT) {
- filter_flags = Z_IVAL_P(op);
+ if (Z_TYPE_P(op) == IS_LONG) {
+ filter_flags = Z_LVAL_P(op);
} else if (Z_TYPE_P(op) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(op), "flags", sizeof("flags") - 1)) != NULL) {
- PHP_FILTER_GET_LONG_OPT(option, filter_flags);
+ filter_flags = zval_get_long(option);
}
}
@@ -841,7 +839,7 @@ PHP_FUNCTION(filter_var_array)
return;
}
- if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) {
+ if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) {
RETURN_FALSE;
}
@@ -870,7 +868,8 @@ PHP_FUNCTION(filter_list)
* Returns the filter ID belonging to a named filter */
PHP_FUNCTION(filter_id)
{
- int i, filter_len;
+ int i;
+ size_t filter_len;
int size = sizeof(filter_list) / sizeof(filter_list_entry);
char *filter;
@@ -880,7 +879,7 @@ PHP_FUNCTION(filter_id)
for (i = 0; i < size; ++i) {
if (strcmp(filter_list[i].name, filter) == 0) {
- RETURN_INT(filter_list[i].id);
+ RETURN_LONG(filter_list[i].id);
}
}
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index 869b412d4e..b07b6ca534 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -117,17 +117,6 @@
} \
}
-#define PHP_FILTER_GET_LONG_OPT(zv, opt) { \
- if (Z_TYPE_P(zv) != IS_INT) { \
- zval ___tmp; \
- ZVAL_DUP(&___tmp, zv); \
- convert_to_int(&___tmp); \
- opt = Z_IVAL(___tmp); \
- } else { \
- opt = Z_IVAL_P(zv); \
- } \
-}
-
#endif /* FILTER_PRIVATE_H */
/*
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 5b2333343b..b7c0b49a85 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +41,7 @@
var_name##_set = 0; \
if (option_array) { \
if ((option_val = zend_hash_str_find(HASH_OF(option_array), option_name, sizeof(option_name) - 1)) != NULL) { \
- PHP_FILTER_GET_LONG_OPT(option_val, var_name); \
+ var_name = zval_get_long(option_val); \
var_name##_set = 1; \
} \
}
@@ -56,7 +56,7 @@
if ((option_val = zend_hash_str_find(HASH_OF(option_array), option_name, sizeof(option_name) - 1)) != NULL) { \
if (Z_TYPE_P(option_val) == IS_STRING) { \
var_name = Z_STRVAL_P(option_val); \
- var_name##_len = Z_STRSIZE_P(option_val); \
+ var_name##_len = Z_STRLEN_P(option_val); \
var_name##_set = 1; \
} \
} \
@@ -80,8 +80,8 @@
#define FORMAT_IPV4 4
#define FORMAT_IPV6 6
-static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
- php_int_t ctx_value;
+static int php_filter_parse_int(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
+ zend_long ctx_value;
int sign = 0, digit = 0;
const char *end = str + str_len;
@@ -106,8 +106,8 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t
return -1;
}
- if ((end - str > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */
- || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_ZEND_INT - 1) && *str > '2')) {
+ if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */
+ || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) {
/* overflow */
return -1;
}
@@ -115,9 +115,9 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t
while (str < end) {
if (*str >= '0' && *str <= '9') {
digit = (*(str++) - '0');
- if ( (!sign) && ctx_value <= (PHP_INT_MAX-digit)/10 ) {
+ if ( (!sign) && ctx_value <= (ZEND_LONG_MAX-digit)/10 ) {
ctx_value = (ctx_value * 10) + digit;
- } else if ( sign && ctx_value >= (PHP_INT_MIN+digit)/10) {
+ } else if ( sign && ctx_value >= (ZEND_LONG_MIN+digit)/10) {
ctx_value = (ctx_value * 10) - digit;
} else {
return -1;
@@ -132,16 +132,16 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t
}
/* }}} */
-static int php_filter_parse_octal(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
- php_uint_t ctx_value = 0;
+static int php_filter_parse_octal(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
+ zend_ulong ctx_value = 0;
const char *end = str + str_len;
while (str < end) {
if (*str >= '0' && *str <= '7') {
- php_uint_t n = ((*(str++)) - '0');
+ zend_ulong n = ((*(str++)) - '0');
- if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 8) ||
- ((ctx_value = ctx_value * 8) > ((php_uint_t)(~(php_int_t)0)) - n)) {
+ if ((ctx_value > ((zend_ulong)(~(zend_long)0)) / 8) ||
+ ((ctx_value = ctx_value * 8) > ((zend_ulong)(~(zend_long)0)) - n)) {
return -1;
}
ctx_value += n;
@@ -150,15 +150,15 @@ static int php_filter_parse_octal(const char *str, unsigned int str_len, php_int
}
}
- *ret = (php_int_t)ctx_value;
+ *ret = (zend_long)ctx_value;
return 1;
}
/* }}} */
-static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
- php_uint_t ctx_value = 0;
+static int php_filter_parse_hex(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
+ zend_ulong ctx_value = 0;
const char *end = str + str_len;
- php_uint_t n;
+ zend_ulong n;
while (str < end) {
if (*str >= '0' && *str <= '9') {
@@ -170,14 +170,14 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t
} else {
return -1;
}
- if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 16) ||
- ((ctx_value = ctx_value * 16) > ((php_uint_t)(~(php_int_t)0)) - n)) {
+ if ((ctx_value > ((zend_ulong)(~(zend_long)0)) / 16) ||
+ ((ctx_value = ctx_value * 16) > ((zend_ulong)(~(zend_long)0)) - n)) {
return -1;
}
ctx_value += n;
}
- *ret = (php_int_t)ctx_value;
+ *ret = (zend_long)ctx_value;
return 1;
}
/* }}} */
@@ -185,11 +185,11 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t
void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
zval *option_val;
- php_int_t min_range, max_range, option_flags;
+ zend_long min_range, max_range, option_flags;
int min_range_set, max_range_set;
int allow_octal = 0, allow_hex = 0;
int len, error = 0;
- php_int_t ctx_value;
+ zend_long ctx_value;
char *p;
/* Parse options */
@@ -197,7 +197,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
FETCH_LONG_OPTION(max_range, "max_range");
option_flags = flags;
- len = Z_STRSIZE_P(value);
+ len = Z_STRLEN_P(value);
if (len == 0) {
RETURN_VALIDATION_FAILED
@@ -241,7 +241,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
RETURN_VALIDATION_FAILED
} else {
zval_ptr_dtor(value);
- ZVAL_INT(value, ctx_value);
+ ZVAL_LONG(value, ctx_value);
return;
}
}
@@ -250,7 +250,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
char *str = Z_STRVAL_P(value);
- int len = Z_STRSIZE_P(value);
+ int len = Z_STRLEN_P(value);
int ret;
PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0);
@@ -327,12 +327,12 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
char dec_sep = '.';
char tsd_sep[3] = "',.";
- php_int_t lval;
+ zend_long lval;
double dval;
int first, n;
- len = Z_STRSIZE_P(value);
+ len = Z_STRLEN_P(value);
str = Z_STRVAL_P(value);
PHP_FILTER_TRIM_DEFAULT(str, len);
@@ -398,7 +398,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
*p = 0;
switch (is_numeric_string(num, p - num, &lval, &dval, 0)) {
- case IS_INT:
+ case IS_LONG:
zval_ptr_dtor(value);
ZVAL_DOUBLE(value, lval);
break;
@@ -422,7 +422,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
zval *option_val;
zend_string *regexp;
- php_int_t option_flags;
+ zend_long option_flags;
int regexp_set, option_flags_set;
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
@@ -443,7 +443,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (!re) {
RETURN_VALIDATION_FAILED
}
- matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3);
+ matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (matches < 0) {
@@ -455,16 +455,16 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
php_url *url;
- int old_len = Z_STRSIZE_P(value);
+ int old_len = Z_STRLEN_P(value);
php_filter_url(value, flags, option_array, charset TSRMLS_CC);
- if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRSIZE_P(value)) {
+ if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) {
RETURN_VALIDATION_FAILED
}
/* Use parse_url - if it returns false, we return NULL */
- url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value));
+ url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRLEN_P(value));
if (url == NULL) {
RETURN_VALIDATION_FAILED
@@ -543,18 +543,18 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
/* The maximum length of an e-mail address is 320 octets, per RFC 2821. */
- if (Z_STRSIZE_P(value) > 320) {
+ if (Z_STRLEN_P(value) > 320) {
RETURN_VALIDATION_FAILED
}
- sregexp = STR_INIT(regexp, sizeof(regexp) - 1, 0);
+ sregexp = zend_string_init(regexp, sizeof(regexp) - 1, 0);
re = pcre_get_compiled_regex(sregexp, &pcre_extra, &preg_options TSRMLS_CC);
if (!re) {
- STR_RELEASE(sregexp);
+ zend_string_release(sregexp);
RETURN_VALIDATION_FAILED
}
- STR_RELEASE(sregexp);
- matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3);
+ zend_string_release(sregexp);
+ matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (matches < 0) {
@@ -688,9 +688,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
int ip[4];
int mode;
- if (memchr(Z_STRVAL_P(value), ':', Z_STRSIZE_P(value))) {
+ if (memchr(Z_STRVAL_P(value), ':', Z_STRLEN_P(value))) {
mode = FORMAT_IPV6;
- } else if (memchr(Z_STRVAL_P(value), '.', Z_STRSIZE_P(value))) {
+ } else if (memchr(Z_STRVAL_P(value), '.', Z_STRLEN_P(value))) {
mode = FORMAT_IPV4;
} else {
RETURN_VALIDATION_FAILED
@@ -706,7 +706,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
switch (mode) {
case FORMAT_IPV4:
- if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRSIZE_P(value), ip)) {
+ if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRLEN_P(value), ip)) {
RETURN_VALIDATION_FAILED
}
@@ -738,18 +738,18 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
case FORMAT_IPV6:
{
int res = 0;
- res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRSIZE_P(value) TSRMLS_CC);
+ res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC);
if (res < 1) {
RETURN_VALIDATION_FAILED
}
/* Check flags */
if (flags & FILTER_FLAG_NO_PRIV_RANGE) {
- if (Z_STRSIZE_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) {
+ if (Z_STRLEN_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) {
RETURN_VALIDATION_FAILED
}
}
if (flags & FILTER_FLAG_NO_RES_RANGE) {
- switch (Z_STRSIZE_P(value)) {
+ switch (Z_STRLEN_P(value)) {
case 1: case 0:
break;
case 2:
@@ -763,7 +763,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
break;
default:
- if (Z_STRSIZE_P(value) >= 5) {
+ if (Z_STRLEN_P(value) >= 5) {
if (
!strncasecmp("fe8", Z_STRVAL_P(value), 3) ||
!strncasecmp("fe9", Z_STRVAL_P(value), 3) ||
@@ -774,10 +774,10 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
}
if (
- (Z_STRSIZE_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) ||
- (Z_STRSIZE_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) ||
- (Z_STRSIZE_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) ||
- (Z_STRSIZE_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8))
+ (Z_STRLEN_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) ||
+ (Z_STRLEN_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) ||
+ (Z_STRLEN_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) ||
+ (Z_STRLEN_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8))
) {
RETURN_VALIDATION_FAILED
}
@@ -792,11 +792,11 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
char *input = Z_STRVAL_P(value);
- int input_len = Z_STRSIZE_P(value);
+ int input_len = Z_STRLEN_P(value);
int tokens, length, i, offset, exp_separator_set, exp_separator_len;
char separator;
char *exp_separator;
- php_int_t ret = 0;
+ zend_long ret = 0;
zval *option_val;
FETCH_STRING_OPTION(exp_separator, "separator");
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
index 05eb78d885..126a0c6c8b 100644
--- a/ext/filter/php_filter.h
+++ b/ext/filter/php_filter.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -59,8 +59,8 @@ ZEND_BEGIN_MODULE_GLOBALS(filter)
zval env_array;
zval server_array;
zval session_array;
- php_int_t default_filter;
- php_int_t default_filter_flags;
+ zend_long default_filter;
+ zend_long default_filter_flags;
ZEND_END_MODULE_GLOBALS(filter)
#ifdef ZTS
@@ -70,7 +70,7 @@ ZEND_END_MODULE_GLOBALS(filter)
#endif
-#define PHP_INPUT_FILTER_PARAM_DECL zval *value, php_int_t flags, zval *option_array, char *charset TSRMLS_DC
+#define PHP_INPUT_FILTER_PARAM_DECL zval *value, zend_long flags, zval *option_array, char *charset TSRMLS_DC
void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL);
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 98c939f686..083b5382b6 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -20,7 +20,7 @@
#include "php_filter.h"
#include "filter_private.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* {{{ STRUCTS */
typedef unsigned long filter_map[256];
@@ -30,18 +30,18 @@ typedef unsigned long filter_map[256];
static void php_filter_encode_html(zval *value, const unsigned char *chars)
{
smart_str str = {0};
- int len = Z_STRSIZE_P(value);
+ int len = Z_STRLEN_P(value);
unsigned char *s = (unsigned char *)Z_STRVAL_P(value);
unsigned char *e = s + len;
- if (Z_STRSIZE_P(value) == 0) {
+ if (Z_STRLEN_P(value) == 0) {
return;
}
while (s < e) {
if (chars[*s]) {
smart_str_appendl(&str, "&#", 2);
- smart_str_append_unsigned(&str, (php_uint_t)*s);
+ smart_str_append_unsigned(&str, (zend_ulong)*s);
smart_str_appendc(&str, ';');
} else {
/* XXX: this needs to be optimized to work with blocks of 'safe' chars */
@@ -52,7 +52,7 @@ static void php_filter_encode_html(zval *value, const unsigned char *chars)
smart_str_0(&str);
zval_ptr_dtor(value);
- ZVAL_STR(value, str.s);
+ ZVAL_NEW_STR(value, str.s);
}
static const unsigned char hexchars[] = "0123456789ABCDEF";
@@ -87,10 +87,10 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
memset(tmp, 1, 32);
}
*/
- str = STR_ALLOC(3 * Z_STRSIZE_P(value), 0);
+ str = zend_string_alloc(3 * Z_STRLEN_P(value), 0);
p = str->val;
s = Z_STRVAL_P(value);
- e = s + Z_STRSIZE_P(value);
+ e = s + Z_STRLEN_P(value);
while (s < e) {
if (tmp[*s]) {
@@ -105,10 +105,10 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
*p = '\0';
str->len = p - (unsigned char *)str->val;
zval_ptr_dtor(value);
- ZVAL_STR(value, str);
+ ZVAL_NEW_STR(value, str);
}
-static void php_filter_strip(zval *value, php_int_t flags)
+static void php_filter_strip(zval *value, zend_long flags)
{
unsigned char *str;
int i, c;
@@ -120,9 +120,9 @@ static void php_filter_strip(zval *value, php_int_t flags)
}
str = (unsigned char *)Z_STRVAL_P(value);
- buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0);
+ buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
c = 0;
- for (i = 0; i < Z_STRSIZE_P(value); i++) {
+ for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
} else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
} else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) {
@@ -135,7 +135,7 @@ static void php_filter_strip(zval *value, php_int_t flags)
buf->val[c] = '\0';
buf->len = c;
zval_ptr_dtor(value);
- ZVAL_STR(value, buf);
+ ZVAL_NEW_STR(value, buf);
}
/* }}} */
@@ -162,9 +162,9 @@ static void filter_map_apply(zval *value, filter_map *map)
zend_string *buf;
str = (unsigned char *)Z_STRVAL_P(value);
- buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0);
+ buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0);
c = 0;
- for (i = 0; i < Z_STRSIZE_P(value); i++) {
+ for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((*map)[str[i]]) {
buf->val[c] = str[i];
++c;
@@ -174,7 +174,7 @@ static void filter_map_apply(zval *value, filter_map *map)
buf->val[c] = '\0';
buf->len = c;
zval_ptr_dtor(value);
- ZVAL_STR(value, buf);
+ ZVAL_NEW_STR(value, buf);
}
/* }}} */
@@ -184,8 +184,8 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
size_t new_len;
unsigned char enc[256] = {0};
- if (IS_INTERNED(Z_STR_P(value))) {
- ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRSIZE_P(value));
+ if (!Z_REFCOUNTED_P(value)) {
+ ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRLEN_P(value));
}
/* strip high/strip low ( see flags )*/
@@ -207,8 +207,8 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
php_filter_encode_html(value, enc);
/* strip tags, implicitly also removes \0 chars */
- new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), NULL, NULL, 0, 1);
- Z_STRSIZE_P(value) = new_len;
+ new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0, 1);
+ Z_STRLEN_P(value) = new_len;
if (new_len == 0) {
zval_dtor(value);
@@ -264,7 +264,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL)
} else {
quotes = ENT_NOQUOTES;
}
- buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC);
+ buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC);
zval_ptr_dtor(value);
ZVAL_STR(value, buf);
}
@@ -274,7 +274,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL)
void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL)
{
/* Only if no flags are set (optimization) */
- if (flags != 0 && Z_STRSIZE_P(value) > 0) {
+ if (flags != 0 && Z_STRLEN_P(value) > 0) {
unsigned char enc[256] = {0};
php_filter_strip(value, flags);
@@ -290,7 +290,7 @@ void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL)
}
php_filter_encode_html(value, enc);
- } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRSIZE_P(value) == 0) {
+ } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) {
zval_dtor(value);
ZVAL_NULL(value);
}
@@ -373,7 +373,7 @@ void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL)
zend_string *buf;
/* just call php_addslashes quotes */
- buf = php_addslashes(Z_STRVAL_P(value), Z_STRSIZE_P(value), 0 TSRMLS_CC);
+ buf = php_addslashes(Z_STRVAL_P(value), Z_STRLEN_P(value), 0 TSRMLS_CC);
zval_ptr_dtor(value);
ZVAL_STR(value, buf);
diff --git a/ext/filter/tests/filter_var_array_with_ref.phpt b/ext/filter/tests/filter_var_array_with_ref.phpt
new file mode 100644
index 0000000000..cd202edf4d
--- /dev/null
+++ b/ext/filter/tests/filter_var_array_with_ref.phpt
@@ -0,0 +1,23 @@
+--TEST--
+filter_var_array() on array with reference
+--FILE--
+<?php
+
+$array = ["123foo"];
+$array2 = [&$array];
+var_dump(filter_var_array($array2, FILTER_VALIDATE_INT));
+var_dump($array);
+
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ bool(false)
+ }
+}
+array(1) {
+ [0]=>
+ bool(false)
+}
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 330f6f09e0..a5341080b8 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -121,7 +121,7 @@ union ipbox {
/* {{{ ftp_open
*/
ftpbuf_t*
-ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC)
+ftp_open(const char *host, short port, zend_long timeout_sec TSRMLS_DC)
{
ftpbuf_t *ftp;
socklen_t size;
@@ -248,7 +248,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
{
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx = NULL;
- php_int_t ssl_ctx_options = SSL_OP_ALL;
+ zend_long ssl_ctx_options = SSL_OP_ALL;
#endif
if (ftp == NULL) {
return 0;
@@ -554,13 +554,13 @@ ftp_mkdir(ftpbuf_t *ftp, const char *dir)
}
/* copy out the dir from response */
if ((mkd = strchr(ftp->inbuf, '"')) == NULL) {
- return STR_INIT(dir, strlen(dir), 0);
+ return zend_string_init(dir, strlen(dir), 0);
}
if ((end = strrchr(++mkd, '"')) == NULL) {
return NULL;
}
*end = 0;
- ret = STR_INIT(mkd, end - mkd, 0);
+ ret = zend_string_init(mkd, end - mkd, 0);
*end = '"';
return ret;
@@ -616,7 +616,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
/* {{{ ftp_alloc
*/
int
-ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response)
+ftp_alloc(ftpbuf_t *ftp, const zend_long size, zend_string **response)
{
char buffer[64];
@@ -624,7 +624,7 @@ ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response)
return 0;
}
- snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
+ snprintf(buffer, sizeof(buffer) - 1, ZEND_LONG_FMT, size);
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
return 0;
@@ -635,7 +635,7 @@ ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response)
}
if (response) {
- *response = STR_INIT(ftp->inbuf, strlen(ftp->inbuf), 0);
+ *response = zend_string_init(ftp->inbuf, strlen(ftp->inbuf), 0);
}
if (ftp->resp < 200 || ftp->resp >= 300) {
@@ -791,7 +791,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
/* {{{ ftp_get
*/
int
-ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC)
+ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
size_t rcvd;
@@ -811,7 +811,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
ftp->data = data;
if (resumepos > 0) {
- snprintf(arg, sizeof(arg), "%ld", resumepos);
+ snprintf(arg, sizeof(arg), ZEND_LONG_FMT, resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -883,10 +883,10 @@ bail:
/* {{{ ftp_put
*/
int
-ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC)
+ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC)
{
databuf_t *data = NULL;
- php_int_t size;
+ zend_long size;
char *ptr;
int ch;
char arg[11];
@@ -903,7 +903,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, p
ftp->data = data;
if (startpos > 0) {
- snprintf(arg, sizeof(arg), "%ld", startpos);
+ snprintf(arg, sizeof(arg), ZEND_LONG_FMT, startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -960,7 +960,7 @@ bail:
/* {{{ ftp_size
*/
-php_int_t
+zend_long
ftp_size(ftpbuf_t *ftp, const char *path)
{
if (ftp == NULL) {
@@ -1227,7 +1227,7 @@ ftp_getresp(ftpbuf_t *ftp)
int
my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
{
- php_int_t size, sent;
+ zend_long size, sent;
int n;
size = len;
@@ -1493,7 +1493,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
#if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
- php_int_t ssl_ctx_options = SSL_OP_ALL;
+ zend_long ssl_ctx_options = SSL_OP_ALL;
#endif
if (data->fd != -1) {
@@ -1711,7 +1711,7 @@ bail:
/* {{{ ftp_nb_get
*/
int
-ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC)
+ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1729,7 +1729,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
}
if (resumepos>0) {
- snprintf(arg, sizeof(arg), "%ld", resumepos);
+ snprintf(arg, sizeof(arg), ZEND_LONG_FMT, resumepos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
@@ -1828,7 +1828,7 @@ bail:
/* {{{ ftp_nb_put
*/
int
-ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC)
+ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC)
{
databuf_t *data = NULL;
char arg[11];
@@ -1843,7 +1843,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
goto bail;
}
if (startpos > 0) {
- snprintf(arg, sizeof(arg), "%ld", startpos);
+ snprintf(arg, sizeof(arg), ZEND_LONG_FMT, startpos);
if (!ftp_putcmd(ftp, "REST", arg)) {
goto bail;
}
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index 9891a14e55..f2051fe195 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -69,7 +69,7 @@ typedef struct ftpbuf
ftptype_t type; /* current transfer type */
int pasv; /* 0=off; 1=pasv; 2=ready */
php_sockaddr_storage pasvaddr; /* passive mode address */
- php_int_t timeout_sec; /* User configureable timeout (seconds) */
+ zend_long timeout_sec; /* User configureable timeout (seconds) */
int autoseek; /* User configureable autoseek flag */
int nb; /* "nonblocking" transfer in progress */
@@ -93,7 +93,7 @@ typedef struct ftpbuf
/* open a FTP connection, returns ftpbuf (NULL on error)
* port is the ftp port in network byte order, or 0 for the default
*/
-ftpbuf_t* ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC);
+ftpbuf_t* ftp_open(const char *host, short port, zend_long timeout_sec TSRMLS_DC);
/* quits from the ftp session (it still needs to be closed)
* return true on success, false on error
@@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi
* however some servers will not accept STOR or APPE until ALLO is confirmed.
* If response is passed, it is estrdup()ed from ftp->inbuf and must be freed
* or assigned to a zval returned to the user */
-int ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response);
+int ftp_alloc(ftpbuf_t *ftp, const zend_long size, zend_string **response);
/* returns a NULL-terminated array of filenames in the given path
* or NULL on error. the return array must be freed (but don't
@@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
/* retrieves a file and saves its contents to outfp
* returns true on success, false on error
*/
-int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC);
+int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
-int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC);
+int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC);
/* returns the size of the given file, or -1 on error */
-php_int_t ftp_size(ftpbuf_t *ftp, const char *path);
+zend_long ftp_size(ftpbuf_t *ftp, const char *path);
/* returns the last modified time of the given file, or -1 on error */
time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
@@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
/* retrieves part of a file and saves its contents to outfp
* returns true on success, false on error
*/
-int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC);
+int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC);
/* stores the data from a file, socket, or process as a file on the remote server
* returns true on success, false on error
*/
-int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC);
+int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC);
/* continues a previous nb_(f)get command
*/
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index cb4cd37a00..32d8fb86e2 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -308,16 +308,16 @@ static void ftp_destructor_ftpbuf(zend_resource *rsrc TSRMLS_DC)
PHP_MINIT_FUNCTION(ftp)
{
le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number);
- REGISTER_INT_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
return SUCCESS;
}
@@ -343,11 +343,11 @@ PHP_FUNCTION(ftp_connect)
{
ftpbuf_t *ftp;
char *host;
- int host_len;
- php_int_t port = 0;
- php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT;
+ size_t host_len;
+ zend_long port = 0;
+ zend_long timeout_sec = FTP_DEFAULT_TIMEOUT;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
return;
}
@@ -379,11 +379,11 @@ PHP_FUNCTION(ftp_ssl_connect)
{
ftpbuf_t *ftp;
char *host;
- int host_len;
- php_int_t port = 0;
- php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT;
+ size_t host_len;
+ zend_long port = 0;
+ zend_long timeout_sec = FTP_DEFAULT_TIMEOUT;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
return;
}
@@ -414,7 +414,7 @@ PHP_FUNCTION(ftp_login)
zval *z_ftp;
ftpbuf_t *ftp;
char *user, *pass;
- int user_len, pass_len;
+ size_t user_len, pass_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &z_ftp, &user, &user_len, &pass, &pass_len) == FAILURE) {
return;
@@ -484,7 +484,7 @@ PHP_FUNCTION(ftp_chdir)
zval *z_ftp;
ftpbuf_t *ftp;
char *dir;
- int dir_len;
+ size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
return;
@@ -509,7 +509,7 @@ PHP_FUNCTION(ftp_exec)
zval *z_ftp;
ftpbuf_t *ftp;
char *cmd;
- int cmd_len;
+ size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
return;
@@ -534,7 +534,7 @@ PHP_FUNCTION(ftp_raw)
zval *z_ftp;
ftpbuf_t *ftp;
char *cmd;
- int cmd_len;
+ size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
return;
@@ -555,7 +555,7 @@ PHP_FUNCTION(ftp_mkdir)
ftpbuf_t *ftp;
char *dir;
zend_string *tmp;
- int dir_len;
+ size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
return;
@@ -580,7 +580,7 @@ PHP_FUNCTION(ftp_rmdir)
zval *z_ftp;
ftpbuf_t *ftp;
char *dir;
- int dir_len;
+ size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
return;
@@ -605,10 +605,10 @@ PHP_FUNCTION(ftp_chmod)
zval *z_ftp;
ftpbuf_t *ftp;
char *filename;
- int filename_len;
- php_int_t mode;
+ size_t filename_len;
+ zend_long mode;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rip", &z_ftp, &mode, &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) {
RETURN_FALSE;
}
@@ -619,7 +619,7 @@ PHP_FUNCTION(ftp_chmod)
RETURN_FALSE;
}
- RETURN_INT(mode);
+ RETURN_LONG(mode);
}
/* }}} */
@@ -629,10 +629,10 @@ PHP_FUNCTION(ftp_alloc)
{
zval *z_ftp, *zresponse = NULL;
ftpbuf_t *ftp;
- php_int_t size, ret;
+ zend_long size, ret;
zend_string *response = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &z_ftp, &size, &zresponse) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &z_ftp, &size, &zresponse) == FAILURE) {
RETURN_FALSE;
}
@@ -659,7 +659,7 @@ PHP_FUNCTION(ftp_nlist)
zval *z_ftp;
ftpbuf_t *ftp;
char **nlist, **ptr, *dir;
- int dir_len;
+ size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &dir, &dir_len) == FAILURE) {
return;
@@ -687,7 +687,7 @@ PHP_FUNCTION(ftp_rawlist)
zval *z_ftp;
ftpbuf_t *ftp;
char **llist, **ptr, *dir;
- int dir_len;
+ size_t dir_len;
zend_bool recursive = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &z_ftp, &dir, &dir_len, &recursive) == FAILURE) {
@@ -741,10 +741,10 @@ PHP_FUNCTION(ftp_fget)
ftptype_t xtype;
php_stream *stream;
char *file;
- int file_len;
- php_int_t mode, resumepos=0;
+ size_t file_len;
+ zend_long mode, resumepos=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
}
@@ -785,10 +785,10 @@ PHP_FUNCTION(ftp_nb_fget)
ftptype_t xtype;
php_stream *stream;
char *file;
- int file_len;
- php_int_t mode, resumepos=0, ret;
+ size_t file_len;
+ zend_long mode, resumepos=0, ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
return;
}
@@ -817,10 +817,10 @@ PHP_FUNCTION(ftp_nb_fget)
if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -855,10 +855,10 @@ PHP_FUNCTION(ftp_get)
ftptype_t xtype;
php_stream *outstream;
char *local, *remote;
- int local_len, remote_len;
- php_int_t mode, resumepos=0;
+ size_t local_len, remote_len;
+ zend_long mode, resumepos=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
return;
}
@@ -918,10 +918,11 @@ PHP_FUNCTION(ftp_nb_get)
ftptype_t xtype;
php_stream *outstream;
char *local, *remote;
- int local_len, remote_len, ret;
- php_int_t mode, resumepos=0;
+ size_t local_len, remote_len;
+ int ret;
+ zend_long mode, resumepos=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
return;
}
@@ -967,7 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
ftp->stream = NULL;
VCWD_UNLINK(local);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_INT(PHP_FTP_FAILED);
+ RETURN_LONG(PHP_FTP_FAILED);
}
if (ret == PHP_FTP_FINISHED){
@@ -975,7 +976,7 @@ PHP_FUNCTION(ftp_nb_get)
ftp->stream = NULL;
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -985,7 +986,7 @@ PHP_FUNCTION(ftp_nb_continue)
{
zval *z_ftp;
ftpbuf_t *ftp;
- php_int_t ret;
+ zend_long ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
return;
@@ -995,7 +996,7 @@ PHP_FUNCTION(ftp_nb_continue)
if (!ftp->nb) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue.");
- RETURN_INT(PHP_FTP_FAILED);
+ RETURN_LONG(PHP_FTP_FAILED);
}
if (ftp->direction) {
@@ -1013,7 +1014,7 @@ PHP_FUNCTION(ftp_nb_continue)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1024,12 +1025,12 @@ PHP_FUNCTION(ftp_fput)
zval *z_ftp, *z_file;
ftpbuf_t *ftp;
ftptype_t xtype;
- int remote_len;
- php_int_t mode, startpos=0;
+ size_t remote_len;
+ zend_long mode, startpos=0;
php_stream *stream;
char *remote;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
return;
}
@@ -1071,12 +1072,13 @@ PHP_FUNCTION(ftp_nb_fput)
zval *z_ftp, *z_file;
ftpbuf_t *ftp;
ftptype_t xtype;
- int remote_len, ret;
- php_int_t mode, startpos=0;
+ size_t remote_len;
+ int ret;
+ zend_long mode, startpos=0;
php_stream *stream;
char *remote;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
return;
}
@@ -1108,10 +1110,10 @@ PHP_FUNCTION(ftp_nb_fput)
if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == PHP_FTP_FAILED)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1124,11 +1126,11 @@ PHP_FUNCTION(ftp_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
- php_int_t remote_len, local_len;
- php_int_t mode, startpos=0;
+ size_t remote_len, local_len;
+ zend_long mode, startpos=0;
php_stream *instream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
return;
}
@@ -1177,11 +1179,11 @@ PHP_FUNCTION(ftp_nb_put)
ftpbuf_t *ftp;
ftptype_t xtype;
char *remote, *local;
- int remote_len, local_len;
- php_int_t mode, startpos=0, ret;
+ size_t remote_len, local_len;
+ zend_long mode, startpos=0, ret;
php_stream *instream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
return;
}
@@ -1225,7 +1227,7 @@ PHP_FUNCTION(ftp_nb_put)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1236,7 +1238,7 @@ PHP_FUNCTION(ftp_size)
zval *z_ftp;
ftpbuf_t *ftp;
char *file;
- int file_len;
+ size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &file, &file_len) == FAILURE) {
return;
@@ -1245,7 +1247,7 @@ PHP_FUNCTION(ftp_size)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
/* get file size */
- RETURN_INT(ftp_size(ftp, file));
+ RETURN_LONG(ftp_size(ftp, file));
}
/* }}} */
@@ -1256,7 +1258,7 @@ PHP_FUNCTION(ftp_mdtm)
zval *z_ftp;
ftpbuf_t *ftp;
char *file;
- int file_len;
+ size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &file, &file_len) == FAILURE) {
return;
@@ -1265,7 +1267,7 @@ PHP_FUNCTION(ftp_mdtm)
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
/* get file mod time */
- RETURN_INT(ftp_mdtm(ftp, file));
+ RETURN_LONG(ftp_mdtm(ftp, file));
}
/* }}} */
@@ -1276,7 +1278,7 @@ PHP_FUNCTION(ftp_rename)
zval *z_ftp;
ftpbuf_t *ftp;
char *src, *dest;
- int src_len, dest_len;
+ size_t src_len, dest_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &z_ftp, &src, &src_len, &dest, &dest_len) == FAILURE) {
return;
@@ -1301,7 +1303,7 @@ PHP_FUNCTION(ftp_delete)
zval *z_ftp;
ftpbuf_t *ftp;
char *file;
- int file_len;
+ size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) {
return;
@@ -1326,7 +1328,7 @@ PHP_FUNCTION(ftp_site)
zval *z_ftp;
ftpbuf_t *ftp;
char *cmd;
- int cmd_len;
+ size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
return;
@@ -1368,10 +1370,10 @@ PHP_FUNCTION(ftp_close)
PHP_FUNCTION(ftp_set_option)
{
zval *z_ftp, *z_value;
- php_int_t option;
+ zend_long option;
ftpbuf_t *ftp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_ftp, &option, &z_value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) {
return;
}
@@ -1379,16 +1381,16 @@ PHP_FUNCTION(ftp_set_option)
switch (option) {
case PHP_FTP_OPT_TIMEOUT_SEC:
- if (Z_TYPE_P(z_value) != IS_INT) {
+ if (Z_TYPE_P(z_value) != IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option TIMEOUT_SEC expects value of type long, %s given",
zend_zval_type_name(z_value));
RETURN_FALSE;
}
- if (Z_IVAL_P(z_value) <= 0) {
+ if (Z_LVAL_P(z_value) <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0");
RETURN_FALSE;
}
- ftp->timeout_sec = Z_IVAL_P(z_value);
+ ftp->timeout_sec = Z_LVAL_P(z_value);
RETURN_TRUE;
break;
case PHP_FTP_OPT_AUTOSEEK:
@@ -1401,7 +1403,7 @@ PHP_FUNCTION(ftp_set_option)
RETURN_TRUE;
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%ld'", option);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%pd'", option);
RETURN_FALSE;
break;
}
@@ -1413,10 +1415,10 @@ PHP_FUNCTION(ftp_set_option)
PHP_FUNCTION(ftp_get_option)
{
zval *z_ftp;
- php_int_t option;
+ zend_long option;
ftpbuf_t *ftp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &z_ftp, &option) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) {
return;
}
@@ -1424,13 +1426,13 @@ PHP_FUNCTION(ftp_get_option)
switch (option) {
case PHP_FTP_OPT_TIMEOUT_SEC:
- RETURN_INT(ftp->timeout_sec);
+ RETURN_LONG(ftp->timeout_sec);
break;
case PHP_FTP_OPT_AUTOSEEK:
RETURN_BOOL(ftp->autoseek);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%ld'", option);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%pd'", option);
RETURN_FALSE;
break;
}
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
index fffe6bf2f5..bd8de97483 100644
--- a/ext/ftp/php_ftp.h
+++ b/ext/ftp/php_ftp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b6fff4a12f..5a820860e6 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1142,93 +1142,93 @@ PHP_MINIT_FUNCTION(gd)
#endif
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
/* special colours for gd */
- REGISTER_INT_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT);
/* for imagefilledarc */
- REGISTER_INT_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
/* GD2 image format types */
- REGISTER_INT_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT);
#if defined(HAVE_GD_BUNDLED)
- REGISTER_INT_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
#else
- REGISTER_INT_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
#endif
/* Section Filters */
- REGISTER_INT_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT);
/* End Section Filters */
#ifdef GD_VERSION_STRING
@@ -1236,9 +1236,9 @@ PHP_MINIT_FUNCTION(gd)
#endif
#if defined(GD_MAJOR_VERSION) && defined(GD_MINOR_VERSION) && defined(GD_RELEASE_VERSION) && defined(GD_EXTRA_VERSION)
- REGISTER_INT_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("GD_EXTRA_VERSION", GD_EXTRA_VERSION, CONST_CS | CONST_PERSISTENT);
#endif
@@ -1250,13 +1250,13 @@ PHP_MINIT_FUNCTION(gd)
* /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup.
* as error, use the values for now...
*/
- REGISTER_INT_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT);
#endif
return SUCCESS;
@@ -1421,7 +1421,8 @@ PHP_FUNCTION(imageloadfont)
{
zval *ind;
char *file;
- int file_name, hdr_size = sizeof(gdFont) - sizeof(char *);
+ size_t file_name;
+ int hdr_size = sizeof(gdFont) - sizeof(char *);
int body_size, n = 0, b, i, body_size_check;
gdFontPtr font;
php_stream *stream;
@@ -1515,7 +1516,7 @@ PHP_FUNCTION(imageloadfont)
* that overlap with the old fonts (with indices 1-5). The first
* list index given out is always 1.
*/
- RETURN_INT(Z_RES_HANDLE_P(ind) + 5);
+ RETURN_LONG(Z_RES_HANDLE_P(ind) + 5);
}
/* }}} */
@@ -1538,14 +1539,7 @@ PHP_FUNCTION(imagesetstyle)
stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0);
ZEND_HASH_FOREACH_VAL(HASH_OF(styles), item) {
- if (Z_TYPE_P(item) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, item);
- convert_to_int(&lval);
- stylearr[index++] = Z_IVAL(lval);
- } else {
- stylearr[index++] = Z_IVAL_P(item);
- }
+ stylearr[index++] = zval_get_long(item);
} ZEND_HASH_FOREACH_END();
gdImageSetStyle(im, stylearr, index);
@@ -1560,10 +1554,10 @@ PHP_FUNCTION(imagesetstyle)
Create a new true color image */
PHP_FUNCTION(imagecreatetruecolor)
{
- php_int_t x_size, y_size;
+ zend_long x_size, y_size;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) {
return;
}
@@ -1605,10 +1599,10 @@ PHP_FUNCTION(imagetruecolortopalette)
{
zval *IM;
zend_bool dither;
- php_int_t ncolors;
+ zend_long ncolors;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbi", &IM, &dither, &ncolors) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbl", &IM, &dither, &ncolors) == FAILURE) {
return;
}
@@ -1689,10 +1683,10 @@ PHP_FUNCTION(imagecolormatch)
PHP_FUNCTION(imagesetthickness)
{
zval *IM;
- php_int_t thick;
+ zend_long thick;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &thick) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &thick) == FAILURE) {
return;
}
@@ -1709,10 +1703,10 @@ PHP_FUNCTION(imagesetthickness)
PHP_FUNCTION(imagefilledellipse)
{
zval *IM;
- php_int_t cx, cy, w, h, color;
+ zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
return;
}
@@ -1729,11 +1723,11 @@ PHP_FUNCTION(imagefilledellipse)
PHP_FUNCTION(imagefilledarc)
{
zval *IM;
- php_int_t cx, cy, w, h, ST, E, col, style;
+ zend_long cx, cy, w, h, ST, E, col, style;
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
return;
}
@@ -1798,10 +1792,10 @@ PHP_FUNCTION(imagesavealpha)
PHP_FUNCTION(imagelayereffect)
{
zval *IM;
- php_int_t effect;
+ zend_long effect;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &effect) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &effect) == FAILURE) {
return;
}
@@ -1817,11 +1811,11 @@ PHP_FUNCTION(imagelayereffect)
PHP_FUNCTION(imagecolorallocatealpha)
{
zval *IM;
- php_int_t red, green, blue, alpha;
+ zend_long red, green, blue, alpha;
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
RETURN_FALSE;
}
@@ -1830,7 +1824,7 @@ PHP_FUNCTION(imagecolorallocatealpha)
if (ct < 0) {
RETURN_FALSE;
}
- RETURN_INT((php_int_t)ct);
+ RETURN_LONG((zend_long)ct);
}
/* }}} */
@@ -1839,16 +1833,16 @@ PHP_FUNCTION(imagecolorallocatealpha)
PHP_FUNCTION(imagecolorresolvealpha)
{
zval *IM;
- php_int_t red, green, blue, alpha;
+ zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorResolveAlpha(im, red, green, blue, alpha));
+ RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha));
}
/* }}} */
@@ -1857,16 +1851,16 @@ PHP_FUNCTION(imagecolorresolvealpha)
PHP_FUNCTION(imagecolorclosestalpha)
{
zval *IM;
- php_int_t red, green, blue, alpha;
+ zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorClosestAlpha(im, red, green, blue, alpha));
+ RETURN_LONG(gdImageColorClosestAlpha(im, red, green, blue, alpha));
}
/* }}} */
@@ -1875,16 +1869,16 @@ PHP_FUNCTION(imagecolorclosestalpha)
PHP_FUNCTION(imagecolorexactalpha)
{
zval *IM;
- php_int_t red, green, blue, alpha;
+ zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorExactAlpha(im, red, green, blue, alpha));
+ RETURN_LONG(gdImageColorExactAlpha(im, red, green, blue, alpha));
}
/* }}} */
@@ -1893,11 +1887,11 @@ PHP_FUNCTION(imagecolorexactalpha)
PHP_FUNCTION(imagecopyresampled)
{
zval *SIM, *DIM;
- php_int_t SX, SY, SW, SH, DX, DY, DW, DH;
+ zend_long SX, SY, SW, SH, DX, DY, DW, DH;
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
return;
}
@@ -1925,7 +1919,7 @@ PHP_FUNCTION(imagecopyresampled)
PHP_FUNCTION(imagegrabwindow)
{
HWND window;
- php_int_t client_area = 0;
+ zend_long client_area = 0;
RECT rc = {0};
RECT rc_win = {0};
int Width, Height;
@@ -1934,12 +1928,12 @@ PHP_FUNCTION(imagegrabwindow)
HBITMAP memBM;
HBITMAP hOld;
HINSTANCE handle;
- php_int_t lwindow_handle;
+ zend_long lwindow_handle;
typedef BOOL (WINAPI *tPrintWindow)(HWND, HDC,UINT);
tPrintWindow pPrintWindow = 0;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &lwindow_handle, &client_area) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &lwindow_handle, &client_area) == FAILURE) {
RETURN_FALSE;
}
@@ -2076,10 +2070,10 @@ PHP_FUNCTION(imagerotate)
zval *SIM;
gdImagePtr im_dst, im_src;
double degrees;
- php_int_t color;
- php_int_t ignoretransparent = 0;
+ zend_long color;
+ zend_long ignoretransparent = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdi|i", &SIM, &degrees, &color, &ignoretransparent) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdl|l", &SIM, &degrees, &color, &ignoretransparent) == FAILURE) {
RETURN_FALSE;
}
@@ -2139,10 +2133,10 @@ PHP_FUNCTION(imagesetbrush)
Create a new image */
PHP_FUNCTION(imagecreate)
{
- php_int_t x_size, y_size;
+ zend_long x_size, y_size;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) {
return;
}
@@ -2182,7 +2176,7 @@ PHP_FUNCTION(imagetypes)
return;
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -2251,7 +2245,7 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct
gdImagePtr im;
gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtxEx(Z_STRSIZE_P(data), Z_STRVAL_P(data), 0);
+ io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0);
if (!io_ctx) {
return NULL;
@@ -2284,7 +2278,7 @@ PHP_FUNCTION(imagecreatefromstring)
}
convert_to_string_ex(data);
- if (Z_STRSIZE_P(data) < 8) {
+ if (Z_STRLEN_P(data) < 8) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string or invalid image");
RETURN_FALSE;
}
@@ -2343,8 +2337,8 @@ PHP_FUNCTION(imagecreatefromstring)
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)())
{
char *file;
- int file_len;
- php_int_t srcx, srcy, width, height;
+ size_t file_len;
+ zend_long srcx, srcy, width, height;
gdImagePtr im = NULL;
php_stream *stream;
FILE * fp = NULL;
@@ -2353,7 +2347,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
#endif
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "siiii", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
return;
}
if (width < 1 || height < 1) {
@@ -2395,7 +2389,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
io_ctx = gdNewDynamicCtxEx(buff->len, pstr, 0);
if (!io_ctx) {
pefree(pstr, 1);
- STR_RELEASE(buff);
+ zend_string_release(buff);
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
goto out_err;
}
@@ -2407,7 +2401,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
}
io_ctx->gd_free(io_ctx);
pefree(pstr, 1);
- STR_RELEASE(buff);
+ zend_string_release(buff);
}
else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) {
/* try and force the stream to be FILE* */
@@ -2551,18 +2545,19 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
{
zval *imgind;
char *file = NULL;
- php_int_t quality = 0, type = 0;
+ zend_long quality = 0, type = 0;
gdImagePtr im;
char *fn = NULL;
FILE *fp;
- int file_len = 0, argc = ZEND_NUM_ARGS();
+ size_t file_len = 0;
+ int argc = ZEND_NUM_ARGS();
int q = -1, i, t = 1;
/* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */
/* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */
/* The quality parameter for gd2 stands for chunk size */
- if (zend_parse_parameters(argc TSRMLS_CC, "r|pii", &imgind, &file, &file_len, &quality, &type) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) {
return;
}
@@ -2794,11 +2789,11 @@ PHP_FUNCTION(imagedestroy)
PHP_FUNCTION(imagecolorallocate)
{
zval *IM;
- php_int_t red, green, blue;
+ zend_long red, green, blue;
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) {
return;
}
@@ -2808,7 +2803,7 @@ PHP_FUNCTION(imagecolorallocate)
if (ct < 0) {
RETURN_FALSE;
}
- RETURN_INT(ct);
+ RETURN_LONG(ct);
}
/* }}} */
@@ -2835,10 +2830,10 @@ PHP_FUNCTION(imagepalettecopy)
PHP_FUNCTION(imagecolorat)
{
zval *IM;
- php_int_t x, y;
+ zend_long x, y;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &IM, &x, &y) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &IM, &x, &y) == FAILURE) {
return;
}
@@ -2846,16 +2841,16 @@ PHP_FUNCTION(imagecolorat)
if (gdImageTrueColor(im)) {
if (im->tpixels && gdImageBoundsSafe(im, x, y)) {
- RETURN_INT(gdImageTrueColorPixel(im, x, y));
+ RETURN_LONG(gdImageTrueColorPixel(im, x, y));
} else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%pd,%pd is out of bounds", x, y);
RETURN_FALSE;
}
} else {
if (im->pixels && gdImageBoundsSafe(im, x, y)) {
- RETURN_INT(im->pixels[y][x]);
+ RETURN_LONG(im->pixels[y][x]);
} else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%pd,%pd is out of bounds", x, y);
RETURN_FALSE;
}
}
@@ -2867,16 +2862,16 @@ PHP_FUNCTION(imagecolorat)
PHP_FUNCTION(imagecolorclosest)
{
zval *IM;
- php_int_t red, green, blue;
+ zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorClosest(im, red, green, blue));
+ RETURN_LONG(gdImageColorClosest(im, red, green, blue));
}
/* }}} */
@@ -2885,16 +2880,16 @@ PHP_FUNCTION(imagecolorclosest)
PHP_FUNCTION(imagecolorclosesthwb)
{
zval *IM;
- php_int_t red, green, blue;
+ zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorClosestHWB(im, red, green, blue));
+ RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue));
}
/* }}} */
@@ -2903,11 +2898,11 @@ PHP_FUNCTION(imagecolorclosesthwb)
PHP_FUNCTION(imagecolordeallocate)
{
zval *IM;
- php_int_t index;
+ zend_long index;
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) {
return;
}
@@ -2935,16 +2930,16 @@ PHP_FUNCTION(imagecolordeallocate)
PHP_FUNCTION(imagecolorresolve)
{
zval *IM;
- php_int_t red, green, blue;
+ zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorResolve(im, red, green, blue));
+ RETURN_LONG(gdImageColorResolve(im, red, green, blue));
}
/* }}} */
@@ -2953,16 +2948,16 @@ PHP_FUNCTION(imagecolorresolve)
PHP_FUNCTION(imagecolorexact)
{
zval *IM;
- php_int_t red, green, blue;
+ zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorExact(im, red, green, blue));
+ RETURN_LONG(gdImageColorExact(im, red, green, blue));
}
/* }}} */
@@ -2971,11 +2966,11 @@ PHP_FUNCTION(imagecolorexact)
PHP_FUNCTION(imagecolorset)
{
zval *IM;
- php_int_t color, red, green, blue, alpha = 0;
+ zend_long color, red, green, blue, alpha = 0;
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) {
return;
}
@@ -2999,11 +2994,11 @@ PHP_FUNCTION(imagecolorset)
PHP_FUNCTION(imagecolorsforindex)
{
zval *IM;
- php_int_t index;
+ zend_long index;
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) {
return;
}
@@ -3014,10 +3009,10 @@ PHP_FUNCTION(imagecolorsforindex)
if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) {
array_init(return_value);
- add_assoc_int(return_value,"red", gdImageRed(im,col));
- add_assoc_int(return_value,"green", gdImageGreen(im,col));
- add_assoc_int(return_value,"blue", gdImageBlue(im,col));
- add_assoc_int(return_value,"alpha", gdImageAlpha(im,col));
+ add_assoc_long(return_value,"red", gdImageRed(im,col));
+ add_assoc_long(return_value,"green", gdImageGreen(im,col));
+ add_assoc_long(return_value,"blue", gdImageBlue(im,col));
+ add_assoc_long(return_value,"alpha", gdImageAlpha(im,col));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col);
RETURN_FALSE;
@@ -3073,10 +3068,10 @@ PHP_FUNCTION(imagegammacorrect)
PHP_FUNCTION(imagesetpixel)
{
zval *IM;
- php_int_t x, y, col;
+ zend_long x, y, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) {
return;
}
@@ -3091,10 +3086,10 @@ PHP_FUNCTION(imagesetpixel)
PHP_FUNCTION(imageline)
{
zval *IM;
- php_int_t x1, y1, x2, y2, col;
+ zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
@@ -3117,10 +3112,10 @@ PHP_FUNCTION(imageline)
PHP_FUNCTION(imagedashedline)
{
zval *IM;
- php_int_t x1, y1, x2, y2, col;
+ zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
@@ -3135,10 +3130,10 @@ PHP_FUNCTION(imagedashedline)
PHP_FUNCTION(imagerectangle)
{
zval *IM;
- php_int_t x1, y1, x2, y2, col;
+ zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
@@ -3153,10 +3148,10 @@ PHP_FUNCTION(imagerectangle)
PHP_FUNCTION(imagefilledrectangle)
{
zval *IM;
- php_int_t x1, y1, x2, y2, col;
+ zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
return;
}
@@ -3171,11 +3166,11 @@ PHP_FUNCTION(imagefilledrectangle)
PHP_FUNCTION(imagearc)
{
zval *IM;
- php_int_t cx, cy, w, h, ST, E, col;
+ zend_long cx, cy, w, h, ST, E, col;
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
return;
}
@@ -3201,10 +3196,10 @@ PHP_FUNCTION(imagearc)
PHP_FUNCTION(imageellipse)
{
zval *IM;
- php_int_t cx, cy, w, h, color;
+ zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
return;
}
@@ -3220,10 +3215,10 @@ PHP_FUNCTION(imageellipse)
PHP_FUNCTION(imagefilltoborder)
{
zval *IM;
- php_int_t x, y, border, col;
+ zend_long x, y, border, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &x, &y, &border, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &x, &y, &border, &col) == FAILURE) {
return;
}
@@ -3238,10 +3233,10 @@ PHP_FUNCTION(imagefilltoborder)
PHP_FUNCTION(imagefill)
{
zval *IM;
- php_int_t x, y, col;
+ zend_long x, y, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) {
return;
}
@@ -3264,7 +3259,7 @@ PHP_FUNCTION(imagecolorstotal)
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageColorsTotal(im));
+ RETURN_LONG(gdImageColorsTotal(im));
}
/* }}} */
@@ -3273,11 +3268,11 @@ PHP_FUNCTION(imagecolorstotal)
PHP_FUNCTION(imagecolortransparent)
{
zval *IM;
- php_int_t COL = 0;
+ zend_long COL = 0;
gdImagePtr im;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &COL) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &COL) == FAILURE) {
return;
}
@@ -3287,7 +3282,7 @@ PHP_FUNCTION(imagecolortransparent)
gdImageColorTransparent(im, COL);
}
- RETURN_INT(gdImageGetTransparent(im));
+ RETURN_LONG(gdImageGetTransparent(im));
}
/* }}} */
@@ -3297,10 +3292,10 @@ PHP_FUNCTION(imageinterlace)
{
zval *IM;
int argc = ZEND_NUM_ARGS();
- php_int_t INT = 0;
+ zend_long INT = 0;
gdImagePtr im;
- if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &INT) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &INT) == FAILURE) {
return;
}
@@ -3310,7 +3305,7 @@ PHP_FUNCTION(imageinterlace)
gdImageInterlace(im, INT);
}
- RETURN_INT(gdImageGetInterlaced(im));
+ RETURN_LONG(gdImageGetInterlaced(im));
}
/* }}} */
@@ -3321,13 +3316,13 @@ PHP_FUNCTION(imageinterlace)
static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
{
zval *IM, *POINTS;
- php_int_t NPOINTS, COL;
+ zend_long NPOINTS, COL;
zval *var = NULL;
gdImagePtr im;
gdPointPtr points;
int npoints, col, nelem, i;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "raii", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rall", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
return;
}
@@ -3354,24 +3349,10 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
for (i = 0; i < npoints; i++) {
if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2))) != NULL) {
- if (Z_TYPE_P(var) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, var);
- convert_to_int(&lval);
- points[i].x = Z_IVAL(lval);
- } else {
- points[i].x = Z_IVAL_P(var);
- }
+ points[i].x = zval_get_long(var);
}
if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2) + 1)) != NULL) {
- if (Z_TYPE_P(var) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, var);
- convert_to_int(&lval);
- points[i].y = Z_IVAL(lval);
- } else {
- points[i].y = Z_IVAL_P(var);
- }
+ points[i].y = zval_get_long(var);
}
}
@@ -3449,15 +3430,15 @@ static gdFontPtr php_find_gd_font(int size TSRMLS_DC)
*/
static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
{
- php_int_t SIZE;
+ zend_long SIZE;
gdFontPtr font;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &SIZE) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &SIZE) == FAILURE) {
return;
}
font = php_find_gd_font(SIZE TSRMLS_CC);
- RETURN_INT(arg ? font->h : font->w);
+ RETURN_LONG(arg ? font->h : font->w);
}
/* }}} */
@@ -3512,15 +3493,15 @@ static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, i
static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
zval *IM;
- php_int_t SIZE, X, Y, COL;
+ zend_long SIZE, X, Y, COL;
char *C;
- int C_len;
+ size_t C_len;
gdImagePtr im;
int ch = 0, col, x, y, size, i, l = 0;
unsigned char *str = NULL;
gdFontPtr font;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiisi", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllsl", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
return;
}
@@ -3607,11 +3588,11 @@ PHP_FUNCTION(imagestringup)
PHP_FUNCTION(imagecopy)
{
zval *SIM, *DIM;
- php_int_t SX, SY, SW, SH, DX, DY;
+ zend_long SX, SY, SW, SH, DX, DY;
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
return;
}
@@ -3635,11 +3616,11 @@ PHP_FUNCTION(imagecopy)
PHP_FUNCTION(imagecopymerge)
{
zval *SIM, *DIM;
- php_int_t SX, SY, SW, SH, DX, DY, PCT;
+ zend_long SX, SY, SW, SH, DX, DY, PCT;
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
return;
}
@@ -3664,11 +3645,11 @@ PHP_FUNCTION(imagecopymerge)
PHP_FUNCTION(imagecopymergegray)
{
zval *SIM, *DIM;
- php_int_t SX, SY, SW, SH, DX, DY, PCT;
+ zend_long SX, SY, SW, SH, DX, DY, PCT;
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
return;
}
@@ -3693,11 +3674,11 @@ PHP_FUNCTION(imagecopymergegray)
PHP_FUNCTION(imagecopyresized)
{
zval *SIM, *DIM;
- php_int_t SX, SY, SW, SH, DX, DY, DW, DH;
+ zend_long SX, SY, SW, SH, DX, DY, DW, DH;
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
return;
}
@@ -3736,7 +3717,7 @@ PHP_FUNCTION(imagesx)
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageSX(im));
+ RETURN_LONG(gdImageSX(im));
}
/* }}} */
@@ -3753,7 +3734,7 @@ PHP_FUNCTION(imagesy)
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- RETURN_INT(gdImageSY(im));
+ RETURN_LONG(gdImageSY(im));
}
/* }}} */
@@ -3804,8 +3785,9 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
{
zval *IM, *EXT = NULL;
gdImagePtr im=NULL;
- php_int_t col = -1, x = -1, y = -1;
- int str_len, fontname_len, i, brect[8];
+ zend_long col = -1, x = -1, y = -1;
+ size_t str_len, fontname_len;
+ int i, brect[8];
double ptsize, angle;
char *str = NULL, *fontname = NULL;
char *error = NULL;
@@ -3821,7 +3803,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
} else {
if (argc < 8 || argc > ((extended) ? 9 : 8)) {
ZEND_WRONG_PARAM_COUNT();
- } else if (zend_parse_parameters(argc TSRMLS_CC, "rddiiiss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
+ } else if (zend_parse_parameters(argc TSRMLS_CC, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
@@ -3833,7 +3815,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
if (extended && EXT) { /* parse extended info */
zval *item;
zend_string *key;
- php_uint_t num_key;
+ zend_ulong num_key;
/* walk the assoc array */
ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(EXT), num_key, key, item) {
@@ -3841,9 +3823,8 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
continue;
}
if (strcmp("linespacing", key->val) == 0) {
- convert_to_double_ex(item);
strex.flags |= gdFTEX_LINESPACE;
- strex.linespacing = Z_DVAL_P(item);
+ strex.linespacing = zval_get_double(item);
}
} ZEND_HASH_FOREACH_END();
}
@@ -3878,7 +3859,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
/* return array with the text's bounding box */
for (i = 0; i < 8; i++) {
- add_next_index_int(return_value, brect[i]);
+ add_next_index_long(return_value, brect[i]);
}
}
/* }}} */
@@ -3914,7 +3895,7 @@ PHP_FUNCTION(imagepsloadfont)
char *file;
int file_len, f_ind, *font;
#ifdef PHP_WIN32
- struct stat st;
+ zend_stat_t st;
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
@@ -3994,7 +3975,7 @@ PHP_FUNCTION(imagepscopyfont)
nf_ind->extend = 1;
l_ind = zend_list_insert(nf_ind, le_ps_font TSRMLS_CC);
- RETURN_INT(l_ind);
+ RETURN_LONG(l_ind);
}
*/
/* }}} */
@@ -4022,7 +4003,7 @@ PHP_FUNCTION(imagepsencodefont)
{
zval *fnt;
char *enc, **enc_vector;
- int enc_len, *f_ind;
+ size_t enc_len, *f_ind;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &fnt, &enc, &enc_len) == FAILURE) {
return;
@@ -4105,7 +4086,7 @@ PHP_FUNCTION(imagepstext)
{
zval *img, *fnt;
int i, j;
- php_int_t _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0;
+ zend_long _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0;
int *f_ind;
int h_lines, v_lines, c_ind;
int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl;
@@ -4121,7 +4102,7 @@ PHP_FUNCTION(imagepstext)
char *str;
int str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsriiiii|iidi", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrlllll|lldl", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) {
return;
}
@@ -4135,12 +4116,12 @@ PHP_FUNCTION(imagepstext)
/* Ensure that the provided colors are valid */
if (_fg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Foreground color index %ld out of range", _fg);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Foreground color index %pd out of range", _fg);
RETURN_FALSE;
}
if (_bg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Background color index %ld out of range", _bg);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Background color index %pd out of range", _bg);
RETURN_FALSE;
}
@@ -4174,7 +4155,7 @@ PHP_FUNCTION(imagepstext)
T1_AASetLevel(T1_AA_HIGH);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value %ld as number of steps for antialiasing", aa_steps);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value %pd as number of steps for antialiasing", aa_steps);
RETURN_FALSE;
}
@@ -4231,10 +4212,10 @@ PHP_FUNCTION(imagepstext)
array_init(return_value);
- add_next_index_int(return_value, str_img->metrics.leftSideBearing);
- add_next_index_int(return_value, str_img->metrics.descent);
- add_next_index_int(return_value, str_img->metrics.rightSideBearing);
- add_next_index_int(return_value, str_img->metrics.ascent);
+ add_next_index_long(return_value, str_img->metrics.leftSideBearing);
+ add_next_index_long(return_value, str_img->metrics.descent);
+ add_next_index_long(return_value, str_img->metrics.rightSideBearing);
+ add_next_index_long(return_value, str_img->metrics.ascent);
}
/* }}} */
@@ -4243,7 +4224,7 @@ PHP_FUNCTION(imagepstext)
PHP_FUNCTION(imagepsbbox)
{
zval *fnt;
- php_int_t sz = 0, sp = 0, wd = 0;
+ zend_long sz = 0, sp = 0, wd = 0;
char *str;
int i, space = 0, add_width = 0, char_width, amount_kern;
int cur_x, cur_y, dx, dy;
@@ -4258,7 +4239,7 @@ PHP_FUNCTION(imagepsbbox)
ZEND_WRONG_PARAM_COUNT();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sri|iid", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
return;
}
@@ -4330,10 +4311,10 @@ PHP_FUNCTION(imagepsbbox)
/*
printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
*/
- add_next_index_int(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000));
- add_next_index_int(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000));
- add_next_index_int(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000));
- add_next_index_int(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000));
+ add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000));
+ add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000));
+ add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000));
+ add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000));
}
/* }}} */
#endif
@@ -4422,8 +4403,8 @@ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold
static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
{
char *f_org, *f_dest;
- int f_org_len, f_dest_len;
- php_int_t height, width, threshold;
+ size_t f_org_len, f_dest_len;
+ zend_long height, width, threshold;
gdImagePtr im_org, im_dest, im_tmp;
char *fn_org = NULL;
char *fn_dest = NULL;
@@ -4437,10 +4418,10 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
int x, y;
float x_ratio, y_ratio;
#ifdef HAVE_GD_JPG
- php_int_t ignore_warning;
+ zend_long ignore_warning;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppiii", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) {
return;
}
@@ -4635,9 +4616,9 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
{
zval *SIM;
gdImagePtr im_src;
- php_int_t brightness, tmp;
+ zend_long brightness, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &SIM, &tmp, &brightness) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) {
RETURN_FALSE;
}
@@ -4658,9 +4639,9 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
{
zval *SIM;
gdImagePtr im_src;
- php_int_t contrast, tmp;
+ zend_long contrast, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &SIM, &tmp, &contrast) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) {
RETURN_FALSE;
}
@@ -4681,10 +4662,10 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
{
zval *SIM;
gdImagePtr im_src;
- php_int_t r,g,b,tmp;
- php_int_t a = 0;
+ zend_long r,g,b,tmp;
+ zend_long a = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
RETURN_FALSE;
}
@@ -4759,11 +4740,11 @@ static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
{
zval *SIM;
- php_int_t tmp;
+ zend_long tmp;
gdImagePtr im_src;
double weight;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rid", &SIM, &tmp, &weight) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) {
RETURN_FALSE;
}
@@ -4784,10 +4765,10 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS)
{
zval *IM;
gdImagePtr im;
- php_int_t tmp, blocksize;
+ zend_long tmp, blocksize;
zend_bool mode = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii|b", &IM, &tmp, &blocksize, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) {
RETURN_FALSE;
}
@@ -4811,7 +4792,7 @@ PHP_FUNCTION(imagefilter)
zval *tmp;
typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS);
- php_int_t filtertype;
+ zend_long filtertype;
image_filter filters[] =
{
php_image_filter_negate ,
@@ -4830,7 +4811,7 @@ PHP_FUNCTION(imagefilter)
if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) {
WRONG_PARAM_COUNT;
- } else if (zend_parse_parameters(2 TSRMLS_CC, "ri", &tmp, &filtertype) == FAILURE) {
+ } else if (zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) {
return;
}
@@ -4871,15 +4852,8 @@ PHP_FUNCTION(imageconvolution)
}
for (j=0; j<3; j++) {
- if ((var2 = zend_hash_index_find(Z_ARRVAL_P(var), (j))) != NULL) {
- if (Z_TYPE_P(var2) != IS_DOUBLE) {
- zval dval;
- ZVAL_COPY(&dval, var2);
- convert_to_double(&dval);
- matrix[i][j] = (float)Z_DVAL(dval);
- } else {
- matrix[i][j] = (float)Z_DVAL_P(var2);
- }
+ if ((var2 = zend_hash_index_find(Z_ARRVAL_P(var), j)) != NULL) {
+ matrix[i][j] = (float) zval_get_double(var2);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have a 3x3 matrix");
RETURN_FALSE;
@@ -4903,10 +4877,10 @@ PHP_FUNCTION(imageconvolution)
PHP_FUNCTION(imageflip)
{
zval *IM;
- php_int_t mode;
+ zend_long mode;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &mode) == FAILURE) {
return;
}
@@ -4972,56 +4946,28 @@ PHP_FUNCTION(imagecrop)
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") -1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.x = Z_IVAL(lval);
- } else {
- rect.x = Z_IVAL_P(tmp);
- }
+ rect.x = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.y = Z_IVAL(lval);
- } else {
- rect.y = Z_IVAL_P(tmp);
- }
+ rect.y = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.width = Z_IVAL(lval);
- } else {
- rect.width = Z_IVAL_P(tmp);
- }
+ rect.width = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.height = Z_IVAL(lval);
- } else {
- rect.height = Z_IVAL_P(tmp);
- }
+ rect.height = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height");
RETURN_FALSE;
@@ -5042,13 +4988,13 @@ PHP_FUNCTION(imagecrop)
PHP_FUNCTION(imagecropauto)
{
zval *IM;
- php_int_t mode = -1;
- php_int_t color = -1;
+ zend_long mode = -1;
+ zend_long color = -1;
double threshold = 0.5f;
gdImagePtr im;
gdImagePtr im_crop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|idi", &IM, &mode, &threshold, &color) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ldl", &IM, &mode, &threshold, &color) == FAILURE) {
return;
}
@@ -5093,18 +5039,30 @@ PHP_FUNCTION(imagescale)
gdImagePtr im;
gdImagePtr im_scaled = NULL;
int new_width, new_height;
- php_int_t tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
+ zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
gdInterpolationMethod method;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|ii", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
return;
}
method = tmp_m;
- new_width = tmp_w;
- new_height = tmp_h;
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+ if (tmp_h < 0) {
+ /* preserve ratio */
+ long src_x, src_y;
+
+ src_x = gdImageSX(im);
+ src_y = gdImageSY(im);
+ if (src_x) {
+ tmp_h = tmp_w * src_y / src_x;
+ }
+ }
+
+ new_width = tmp_w;
+ new_height = tmp_h;
+
if (gdImageSetInterpolationMethod(im, method)) {
im_scaled = gdImageScale(im, new_width, new_height);
}
@@ -5147,19 +5105,14 @@ PHP_FUNCTION(imageaffine)
for (i = 0; i < nelems; i++) {
if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) {
switch (Z_TYPE_P(zval_affine_elem)) {
- case IS_INT:
- affine[i] = Z_IVAL_P(zval_affine_elem);
+ case IS_LONG:
+ affine[i] = Z_LVAL_P(zval_affine_elem);
break;
case IS_DOUBLE:
affine[i] = Z_DVAL_P(zval_affine_elem);
break;
case IS_STRING:
- {
- zval dval;
- ZVAL_COPY(&dval, zval_affine_elem);
- convert_to_double(&dval);
- affine[i] = Z_DVAL(dval);
- }
+ affine[i] = zval_get_double(zval_affine_elem);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type for element %i", i);
@@ -5170,56 +5123,28 @@ PHP_FUNCTION(imageaffine)
if (z_rect != NULL) {
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.x = Z_IVAL(lval);
- } else {
- rect.x = Z_IVAL_P(tmp);
- }
+ rect.x = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.y = Z_IVAL(lval);
- } else {
- rect.y = Z_IVAL_P(tmp);
- }
+ rect.y = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.width = Z_IVAL(lval);
- } else {
- rect.width = Z_IVAL_P(tmp);
- }
+ rect.width = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- zval lval;
- ZVAL_COPY(&lval, tmp);
- convert_to_int(&lval);
- rect.height = Z_IVAL(lval);
- } else {
- rect.height = Z_IVAL_P(tmp);
- }
+ rect.height = zval_get_long(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height");
RETURN_FALSE;
@@ -5250,12 +5175,12 @@ PHP_FUNCTION(imageaffine)
PHP_FUNCTION(imageaffinematrixget)
{
double affine[6];
- php_int_t type;
+ zend_long type;
zval *options = NULL;
zval *tmp;
int res = GD_FALSE, i;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z", &type, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &type, &options) == FAILURE) {
return;
}
@@ -5268,28 +5193,14 @@ PHP_FUNCTION(imageaffinematrixget)
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(options), "x", sizeof("x") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_DOUBLE) {
- zval dval;
- ZVAL_COPY(&dval, tmp);
- convert_to_double(&dval);
- x = Z_DVAL(dval);
- } else {
- x = Z_DVAL_P(tmp);
- }
+ x = zval_get_double(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position");
RETURN_FALSE;
}
if ((tmp = zend_hash_str_find(HASH_OF(options), "y", sizeof("y") - 1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_DOUBLE) {
- zval dval;
- ZVAL_COPY(&dval, tmp);
- convert_to_double(&dval);
- y = Z_DVAL(dval);
- } else {
- y = Z_DVAL_P(tmp);
- }
+ y = zval_get_double(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position");
RETURN_FALSE;
@@ -5312,8 +5223,8 @@ PHP_FUNCTION(imageaffinematrixget)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number is expected as option");
RETURN_FALSE;
}
- convert_to_double_ex(options);
- angle = Z_DVAL_P(options);
+
+ angle = zval_get_double(options);
if (type == GD_AFFINE_SHEAR_HORIZONTAL) {
res = gdAffineShearHorizontal(affine, angle);
@@ -5365,19 +5276,14 @@ PHP_FUNCTION(imageaffinematrixconcat)
for (i = 0; i < 6; i++) {
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
- case IS_INT:
- m1[i] = Z_IVAL_P(tmp);
+ case IS_LONG:
+ m1[i] = Z_LVAL_P(tmp);
break;
case IS_DOUBLE:
m1[i] = Z_DVAL_P(tmp);
break;
case IS_STRING:
- {
- zval dval;
- ZVAL_COPY(&dval, tmp);
- convert_to_double(&dval);
- m1[i] = Z_DVAL(dval);
- }
+ m1[i] = zval_get_double(tmp);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type for element %i", i);
@@ -5386,19 +5292,14 @@ PHP_FUNCTION(imageaffinematrixconcat)
}
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
- case IS_INT:
- m2[i] = Z_IVAL_P(tmp);
+ case IS_LONG:
+ m2[i] = Z_LVAL_P(tmp);
break;
case IS_DOUBLE:
m2[i] = Z_DVAL_P(tmp);
break;
case IS_STRING:
- {
- zval dval;
- ZVAL_COPY(&dval, tmp);
- convert_to_double(&dval);
- m2[i] = Z_DVAL(dval);
- }
+ m2[i] = zval_get_double(tmp);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type for element %i", i);
@@ -5423,9 +5324,9 @@ PHP_FUNCTION(imagesetinterpolation)
{
zval *IM;
gdImagePtr im;
- php_int_t method = GD_BILINEAR_FIXED;
+ zend_long method = GD_BILINEAR_FIXED;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &IM, &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &IM, &method) == FAILURE) {
return;
}
diff --git a/ext/gd/gd.dsp b/ext/gd/gd.dsp
deleted file mode 100644
index d7207562f8..0000000000
--- a/ext/gd/gd.dsp
+++ /dev/null
@@ -1,600 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gd - Win32 Release_TS GD2
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak" CFG="gd - Win32 Release_TS GD2"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gd - Win32 Release_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - Win32 Debug_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Release_TS_GD2_bundled"
-# PROP BASE Intermediate_Dir "gd___Win32_Release_TS_GD2_bundled"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php5ts.lib freetype2.lib libjpeg.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\zlib\Release"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Debug_TS_GD2_bundled"
-# PROP BASE Intermediate_Dir "gd___Win32_Debug_TS_GD2_bundled"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib libjpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php5ts_debug.lib libpng.lib zlib.lib libjpeg.lib freetype2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd2.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\zlib\Debug"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "gd - Win32 Release_TS GD2"
-# Name "gd - Win32 Debug_TS GD2"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\gdcache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gd.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libgd"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter "*.c"
-# Begin Source File
-
-SOURCE=.\libgd\gd.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd2copypal.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_arc_f_buggy.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gd.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gd2.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gif_in.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_gif_out.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_dp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_file.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io_ss.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_jpeg.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_png.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_ss.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_topal.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_wbmp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdcache.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontg.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontl.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontmb.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfonts.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontt.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdft.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdhelpers.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdkanji.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdtables.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdxpm.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\wbmp.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\xbm.c
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP Intermediate_Dir "Release_TS_bundled"
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP Intermediate_Dir "Debug_TS_bundled"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter "*.h"
-# Begin Source File
-
-SOURCE=.\libgd\gd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gd_io.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdcache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontmb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfonts.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdfontt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\gdhelpers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\jisx0208.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libgd\wbmp.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index da6cdef8e3..0b79cb6f0d 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -78,8 +78,8 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
{
zval *imgind;
char *file = NULL;
- int file_len = 0;
- php_int_t quality, basefilter;
+ size_t file_len = 0;
+ zend_long quality, basefilter;
gdImagePtr im;
int argc = ZEND_NUM_ARGS();
int q = -1, i;
@@ -93,7 +93,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
* from imagey<type>().
*/
if (image_type == PHP_GDIMG_TYPE_XBM) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ii", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
return;
}
} else {
@@ -103,7 +103,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
* PHP_GDIMG_TYPE_WBM
* PHP_GDIMG_TYPE_WEBP
* */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ii", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
return;
}
}
diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c
index d6fdd7d086..5a7d016ee8 100644
--- a/ext/gd/libgd/xbm.c
+++ b/ext/gd/libgd/xbm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
index 1f32a8f9b1..7510b2425d 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/gd/tests/bug48801_1.phpt b/ext/gd/tests/bug48801_1.phpt
index 11af80cd4b..0ab6d7cdd9 100644
--- a/ext/gd/tests/bug48801_1.phpt
+++ b/ext/gd/tests/bug48801_1.phpt
@@ -20,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
?>
--EXPECTF--
(-1, 15)
-(156, 15)
-(156, -48)
+(15%d, 15)
+(15%d, -48)
(-1, -48)
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
new file mode 100644
index 0000000000..49affefb96
--- /dev/null
+++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Testing null byte injection in imagegd2
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagegd2 TEST\n";
+imagegd2($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagegd2 TEST
+
+Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt
new file mode 100644
index 0000000000..a423a551fd
--- /dev/null
+++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Testing null byte injection in imagegd
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagegd TEST\n";
+imagegd($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagegd TEST
+
+Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt
new file mode 100644
index 0000000000..c3d0c30175
--- /dev/null
+++ b/ext/gd/tests/imagegif_nullbyte_injection.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Testing null byte injection in imagegif
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--SKIPIF--
+<?php
+$support = gd_info();
+if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
+ print 'skip gif support not available';
+}
+?>
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagegif TEST\n";
+imagegif($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagegif TEST
+
+Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
new file mode 100644
index 0000000000..9c52355011
--- /dev/null
+++ b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Testing null byte injection in imagejpeg
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--SKIPIF--
+<?php
+$support = gd_info();
+if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
+ print 'skip jpeg support not available';
+}
+?>
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagejpeg TEST\n";
+imagejpeg($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagejpeg TEST
+
+Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt
new file mode 100644
index 0000000000..13949dca0d
--- /dev/null
+++ b/ext/gd/tests/imagepng_nullbyte_injection.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Testing null byte injection in imagepng
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--SKIPIF--
+<?php
+$support = gd_info();
+if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
+ print 'skip png support not available';
+}
+?>
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagepng TEST\n";
+imagepng($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagepng TEST
+
+Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
new file mode 100644
index 0000000000..f199626389
--- /dev/null
+++ b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Testing null byte injection in imagewbmp
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--SKIPIF--
+<?php
+$support = gd_info();
+if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
+ print 'skip wbmp support not available';
+}
+?>
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagewbmp TEST\n";
+imagewbmp($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagewbmp TEST
+
+Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
new file mode 100644
index 0000000000..3bd632591b
--- /dev/null
+++ b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Testing null byte injection in imagewebp
+--CLEAN--
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+rmdir($tempdir);
+--SKIPIF--
+<?php
+$support = gd_info();
+if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
+ print 'skip webp support not available';
+}
+?>
+--FILE--
+<?php
+$image = imagecreate(1,1);// 1px image
+
+
+$tempdir = sys_get_temp_dir(). '/php-gdtest';
+if (!file_exists($tempdir) && !is_dir($tempdir)) {
+ mkdir ($tempdir, 0777, true);
+}
+
+$userinput = "1\0"; // from post or get data
+$temp = $tempdir. "/test" . $userinput .".tmp";
+
+echo "\nimagewebp TEST\n";
+imagewebp($image, $temp);
+var_dump(file_exists($tempdir. "/test1"));
+var_dump(file_exists($tempdir. "/test1.tmp"));
+foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
+
+--EXPECTF--
+imagewbmp TEST
+
+Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
index 59b9661481..938997a4a6 100644
--- a/ext/gettext/gettext.c
+++ b/ext/gettext/gettext.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -162,7 +162,7 @@ PHP_MINFO_FUNCTION(php_gettext)
PHP_NAMED_FUNCTION(zif_textdomain)
{
char *domain, *domain_name, *retval;
- int domain_len;
+ size_t domain_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &domain, &domain_len) == FAILURE) {
return;
@@ -187,7 +187,7 @@ PHP_NAMED_FUNCTION(zif_textdomain)
PHP_NAMED_FUNCTION(zif_gettext)
{
char *msgid, *msgstr;
- int msgid_len;
+ size_t msgid_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &msgid, &msgid_len) == FAILURE) {
return;
@@ -205,7 +205,7 @@ PHP_NAMED_FUNCTION(zif_gettext)
PHP_NAMED_FUNCTION(zif_dgettext)
{
char *domain, *msgid, *msgstr;
- int domain_len, msgid_len;
+ size_t domain_len, msgid_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &domain, &domain_len, &msgid, &msgid_len) == FAILURE) {
return;
@@ -225,10 +225,10 @@ PHP_NAMED_FUNCTION(zif_dgettext)
PHP_NAMED_FUNCTION(zif_dcgettext)
{
char *domain, *msgid, *msgstr;
- int domain_len, msgid_len;
- php_int_t category;
+ size_t domain_len, msgid_len;
+ zend_long category;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) {
return;
}
@@ -246,7 +246,7 @@ PHP_NAMED_FUNCTION(zif_dcgettext)
PHP_NAMED_FUNCTION(zif_bindtextdomain)
{
char *domain, *dir;
- int domain_len, dir_len;
+ size_t domain_len, dir_len;
char *retval, dir_name[MAXPATHLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &domain, &domain_len, &dir, &dir_len) == FAILURE) {
@@ -280,10 +280,10 @@ PHP_NAMED_FUNCTION(zif_bindtextdomain)
PHP_NAMED_FUNCTION(zif_ngettext)
{
char *msgid1, *msgid2, *msgstr;
- int msgid1_len, msgid2_len;
- php_int_t count;
+ size_t msgid1_len, msgid2_len;
+ zend_long count;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) {
return;
}
@@ -304,10 +304,10 @@ PHP_NAMED_FUNCTION(zif_ngettext)
PHP_NAMED_FUNCTION(zif_dngettext)
{
char *domain, *msgid1, *msgid2, *msgstr = NULL;
- int domain_len, msgid1_len, msgid2_len;
- php_int_t count;
+ size_t domain_len, msgid1_len, msgid2_len;
+ zend_long count;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi", &domain, &domain_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl", &domain, &domain_len,
&msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) {
return;
}
@@ -330,12 +330,12 @@ PHP_NAMED_FUNCTION(zif_dngettext)
PHP_NAMED_FUNCTION(zif_dcngettext)
{
char *domain, *msgid1, *msgid2, *msgstr = NULL;
- int domain_len, msgid1_len, msgid2_len;
- php_int_t count, category;
+ size_t domain_len, msgid1_len, msgid2_len;
+ zend_long count, category;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssii", &domain, &domain_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssll", &domain, &domain_len,
&msgid1, &msgid1_len, &msgid2, &msgid2_len, &count, &category) == FAILURE) {
return;
}
@@ -360,7 +360,7 @@ PHP_NAMED_FUNCTION(zif_dcngettext)
PHP_NAMED_FUNCTION(zif_bind_textdomain_codeset)
{
char *domain, *codeset, *retval = NULL;
- int domain_len, codeset_len;
+ size_t domain_len, codeset_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &domain, &domain_len, &codeset, &codeset_len) == FAILURE) {
return;
diff --git a/ext/gettext/gettext.dsp b/ext/gettext/gettext.dsp
deleted file mode 100644
index 79ea194854..0000000000
--- a/ext/gettext/gettext.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gettext" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gettext - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak" CFG="gettext - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gettext - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gettext - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gettext - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /D HAVE_BIND_TEXTDOMAIN_CODESET=1 /D HAVE_NGETTEXT=1 /D HAVE_DNGETTEXT=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php5ts.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "gettext - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D HAVE_NGETTEXT=1 /D HAVE_DNGETTEXT=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /D HAVE_BIND_TEXTDOMAIN_CODESET=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-# ADD LINK32 php5ts_debug.lib libintl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "gettext - Win32 Release_TS"
-# Name "gettext - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gettext.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_gettext.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
index f990d32af5..ab4f5fc764 100644
--- a/ext/gettext/php_gettext.h
+++ b/ext/gettext/php_gettext.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/gmp/bug67917.phpt b/ext/gmp/bug67917.phpt
new file mode 100644
index 0000000000..93d46cbb66
--- /dev/null
+++ b/ext/gmp/bug67917.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #67917: Using GMP objects with overloaded operators can cause memory exhaustion
+--FILE--
+<?php
+
+$mem1 = memory_get_usage();
+for ($i = 0; $i < 1000; $i++) {
+ $gmp = gmp_init(42);
+ $gmp <<= 1;
+}
+$mem2 = memory_get_usage();
+
+var_dump($mem2 - $mem1 < 100000);
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/gmp/config.m4 b/ext/gmp/config.m4
index 2140aaf701..0388d548cf 100644
--- a/ext/gmp/config.m4
+++ b/ext/gmp/config.m4
@@ -1,7 +1,3 @@
-dnl
-dnl $Id$
-dnl
-
PHP_ARG_WITH(gmp, for GNU MP support,
[ --with-gmp[=DIR] Include GNU MP support])
@@ -15,14 +11,9 @@ if test "$PHP_GMP" != "no"; then
AC_MSG_ERROR(Unable to locate gmp.h)
fi
- PHP_CHECK_LIBRARY(gmp, __gmp_randinit_lc_2exp_size,
+ PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
[],[
- PHP_CHECK_LIBRARY(gmp, gmp_randinit_lc_2exp_size,
- [],[
- AC_MSG_ERROR([GNU MP Library version 4.1.2 or greater required.])
- ],[
- -L$GMP_DIR/$PHP_LIBDIR
- ])
+ AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
],[
-L$GMP_DIR/$PHP_LIBDIR
])
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 8a89451178..de294049c4 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,7 +25,7 @@
#include "php_gmp.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str_public.h"
+#include "zend_smart_str_public.h"
#include "zend_exceptions.h"
#if HAVE_GMP
@@ -43,6 +43,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1)
ZEND_ARG_INFO(0, base)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_import, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_INFO(0, word_size)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_export, 0, 0, 1)
+ ZEND_ARG_INFO(0, gmpnumber)
+ ZEND_ARG_INFO(0, word_size)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_intval, 0, 0, 1)
ZEND_ARG_INFO(0, gmpnumber)
ZEND_END_ARG_INFO()
@@ -92,6 +104,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0)
ZEND_ARG_INFO(0, limiter)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_bits, 0, 0, 1)
+ ZEND_ARG_INFO(0, bits)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_range, 0, 0, 2)
+ ZEND_ARG_INFO(0, min)
+ ZEND_ARG_INFO(0, max)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_setbit, 0, 0, 2)
ZEND_ARG_INFO(0, a)
ZEND_ARG_INFO(0, index)
@@ -117,6 +138,8 @@ static ZEND_GINIT_FUNCTION(gmp);
*/
const zend_function_entry gmp_functions[] = {
ZEND_FE(gmp_init, arginfo_gmp_init)
+ ZEND_FE(gmp_import, arginfo_gmp_import)
+ ZEND_FE(gmp_export, arginfo_gmp_export)
ZEND_FE(gmp_intval, arginfo_gmp_intval)
ZEND_FE(gmp_strval, arginfo_gmp_strval)
ZEND_FE(gmp_add, arginfo_gmp_binary)
@@ -147,6 +170,8 @@ const zend_function_entry gmp_functions[] = {
ZEND_FE(gmp_cmp, arginfo_gmp_binary)
ZEND_FE(gmp_sign, arginfo_gmp_unary)
ZEND_FE(gmp_random, arginfo_gmp_random)
+ ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits)
+ ZEND_FE(gmp_random_range, arginfo_gmp_random_range)
ZEND_FE(gmp_and, arginfo_gmp_binary)
ZEND_FE(gmp_or, arginfo_gmp_binary)
ZEND_FE(gmp_com, arginfo_gmp_unary)
@@ -204,16 +229,13 @@ typedef struct _gmp_temp {
#define GMP_ROUND_PLUSINF 1
#define GMP_ROUND_MINUSINF 2
-#define GMP_42_OR_NEWER \
- ((__GNU_MP_VERSION >= 5) || (__GNU_MP_VERSION >= 4 && __GNU_MP_VERSION_MINOR >= 2))
+#define GMP_MSW_FIRST (1 << 0)
+#define GMP_LSW_FIRST (1 << 1)
+#define GMP_LITTLE_ENDIAN (1 << 2)
+#define GMP_BIG_ENDIAN (1 << 3)
+#define GMP_NATIVE_ENDIAN (1 << 4)
-/* The maximum base for input and output conversions is 62 from GMP 4.2
- * onwards. */
-#if GMP_42_OR_NEWER
-# define MAX_BASE 62
-#else
-# define MAX_BASE 36
-#endif
+#define GMP_MAX_BASE 62
#define IS_GMP(zval) \
(Z_TYPE_P(zval) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zval), gmp_ce TSRMLS_CC))
@@ -298,11 +320,11 @@ if (IS_GMP(zval)) { \
#define INIT_GMP_RETVAL(gmpnumber) \
gmp_create(return_value, &gmpnumber TSRMLS_CC)
-static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base);
-static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC);
+static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base);
+static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC);
static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC);
-/*
+/*
* The gmp_*_op functions provide an implementation for several common types
* of GMP functions. The gmp_zval_(unary|binary)_*_op functions have to be manually
* passed zvals to work on, whereas the gmp_(unary|binary)_*_op macros already
@@ -311,14 +333,14 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC);
typedef void (*gmp_unary_op_t)(mpz_ptr, mpz_srcptr);
typedef int (*gmp_unary_opl_t)(mpz_srcptr);
-typedef void (*gmp_unary_ui_op_t)(mpz_ptr, php_uint_t);
+typedef void (*gmp_unary_ui_op_t)(mpz_ptr, gmp_ulong);
typedef void (*gmp_binary_op_t)(mpz_ptr, mpz_srcptr, mpz_srcptr);
typedef int (*gmp_binary_opl_t)(mpz_srcptr, mpz_srcptr);
-typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, php_uint_t);
+typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, gmp_ulong);
typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, php_uint_t);
+typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, gmp_ulong);
static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC);
static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int check_b_zero TSRMLS_DC);
@@ -407,9 +429,9 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /*
gmpnum = GET_GMP_FROM_ZVAL(readobj);
gmp_strval(writeobj, gmpnum, 10);
return SUCCESS;
- case IS_INT:
+ case IS_LONG:
gmpnum = GET_GMP_FROM_ZVAL(readobj);
- ZVAL_INT(writeobj, mpz_get_si(gmpnum));
+ ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
return SUCCESS;
case IS_DOUBLE:
gmpnum = GET_GMP_FROM_ZVAL(readobj);
@@ -452,7 +474,7 @@ static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */
/* }}} */
static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2 TSRMLS_DC) {
- php_int_t shift = zval_get_int(op2);
+ zend_long shift = zval_get_long(op2);
if (shift < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shift cannot be negative");
@@ -463,7 +485,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva
FETCH_GMP_ZVAL(gmpnum_op, op1, temp);
INIT_GMP_RETVAL(gmpnum_result);
- op(gmpnum_result, gmpnum_op, (php_uint_t) shift);
+ op(gmpnum_result, gmpnum_op, (gmp_ulong) shift);
FREE_GMP_TEMP(temp);
}
}
@@ -482,7 +504,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva
gmp_zval_unary_op(result, op1, op TSRMLS_CC); \
return SUCCESS;
-static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
+static int gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
switch (opcode) {
case ZEND_ADD:
@@ -519,17 +541,37 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op
}
/* }}} */
+static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
+{
+ zval op1_copy;
+ int retval;
+
+ if (result == op1) {
+ ZVAL_COPY_VALUE(&op1_copy, op1);
+ op1 = &op1_copy;
+ }
+
+ retval = gmp_do_operation_ex(opcode, result, op1, op2 TSRMLS_CC);
+
+ if (retval == SUCCESS && op1 == &op1_copy) {
+ zval_dtor(op1);
+ }
+
+ return retval;
+}
+/* }}} */
+
static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
gmp_cmp(result, op1, op2 TSRMLS_CC);
if (Z_TYPE_P(result) == IS_FALSE) {
- ZVAL_INT(result, 1);
+ ZVAL_LONG(result, 1);
}
return SUCCESS;
}
/* }}} */
-static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
+static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */
{
mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(object);
smart_str buf = {0};
@@ -550,13 +592,13 @@ static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_le
PHP_VAR_SERIALIZE_DESTROY(serialize_data);
*buffer = (unsigned char *) estrndup(buf.s->val, buf.s->len);
*buf_len = buf.s->len;
- STR_RELEASE(buf.s);
+ zend_string_release(buf.s);
return SUCCESS;
}
/* }}} */
-static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
+static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
{
mpz_ptr gmpnum;
const unsigned char *p, *max;
@@ -631,14 +673,20 @@ ZEND_MINIT_FUNCTION(gmp)
gmp_object_handlers.do_operation = gmp_do_operation;
gmp_object_handlers.compare = gmp_compare;
- REGISTER_INT_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT);
#ifdef mpir_version
REGISTER_STRING_CONSTANT("GMP_MPIR_VERSION", (char *)mpir_version, CONST_CS | CONST_PERSISTENT);
#endif
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_MSW_FIRST", GMP_MSW_FIRST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_LSW_FIRST", GMP_LSW_FIRST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_LITTLE_ENDIAN", GMP_LITTLE_ENDIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_BIG_ENDIAN", GMP_BIG_ENDIAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GMP_NATIVE_ENDIAN", GMP_NATIVE_ENDIAN, CONST_CS | CONST_PERSISTENT);
+
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
return SUCCESS;
@@ -676,33 +724,31 @@ ZEND_MODULE_INFO_D(gmp)
/* {{{ convert_to_gmp
* Convert zval to be gmp number */
-static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC)
+static int convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base TSRMLS_DC)
{
switch (Z_TYPE_P(val)) {
- case IS_INT:
+ case IS_LONG:
case IS_FALSE:
case IS_TRUE: {
- mpz_set_si(gmpnumber, zval_get_int(val));
+ mpz_set_si(gmpnumber, zval_get_long(val));
return SUCCESS;
}
case IS_STRING: {
char *numstr = Z_STRVAL_P(val);
- int skip_lead = 0;
+ zend_bool skip_lead = 0;
int ret;
- if (Z_STRSIZE_P(val) > 2) {
- if (numstr[0] == '0') {
- if (numstr[1] == 'x' || numstr[1] == 'X') {
- base = 16;
- skip_lead = 1;
- } else if (base != 16 && (numstr[1] == 'b' || numstr[1] == 'B')) {
- base = 2;
- skip_lead = 1;
- }
+ if (Z_STRLEN_P(val) > 2 && numstr[0] == '0') {
+ if ((base == 0 || base == 16) && (numstr[1] == 'x' || numstr[1] == 'X')) {
+ base = 16;
+ skip_lead = 1;
+ } else if ((base == 0 || base == 2) && (numstr[1] == 'b' || numstr[1] == 'B')) {
+ base = 2;
+ skip_lead = 1;
}
}
- ret = mpz_set_str(gmpnumber, (skip_lead ? &numstr[2] : numstr), base);
+ ret = mpz_set_str(gmpnumber, (skip_lead ? &numstr[2] : numstr), (int) base);
if (-1 == ret) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Unable to convert variable to GMP - string is not an integer");
@@ -719,9 +765,9 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC)
}
/* }}} */
-static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */
+static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base) /* {{{ */
{
- int num_len;
+ size_t num_len;
zend_string *str;
num_len = mpz_sizeinbase(gmpnum, abs(base));
@@ -729,7 +775,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */
num_len++;
}
- str = STR_ALLOC(num_len, 0);
+ str = zend_string_alloc(num_len, 0);
mpz_get_str(str->val, base, gmpnum);
/*
@@ -746,7 +792,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */
str->val[str->len] = '\0';
}
- ZVAL_STR(result, str);
+ ZVAL_NEW_STR(result, str);
}
/* }}} */
@@ -755,11 +801,11 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* {
mpz_ptr gmpnum_a, gmpnum_b;
gmp_temp_t temp_a, temp_b;
zend_bool use_si = 0;
- php_int_t res;
+ zend_long res;
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- if (Z_TYPE_P(b_arg) == IS_INT) {
+ if (Z_TYPE_P(b_arg) == IS_LONG) {
use_si = 1;
temp_b.is_used = 0;
} else {
@@ -767,30 +813,30 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* {
}
if (use_si) {
- res = mpz_cmp_si(gmpnum_a, Z_IVAL_P(b_arg));
+ res = mpz_cmp_si(gmpnum_a, Z_LVAL_P(b_arg));
} else {
res = mpz_cmp(gmpnum_a, gmpnum_b);
}
FREE_GMP_TEMP(temp_a);
FREE_GMP_TEMP(temp_b);
-
- RETURN_INT(res);
+
+ RETURN_LONG(res);
}
/* }}} */
/* {{{ gmp_zval_binary_ui_op
Execute GMP binary operation.
*/
-static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC)
+static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC)
{
mpz_ptr gmpnum_a, gmpnum_b, gmpnum_result;
int use_ui = 0;
gmp_temp_t temp_a, temp_b;
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
-
- if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) {
+
+ if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
use_ui = 1;
temp_b.is_used = 0;
} else {
@@ -800,7 +846,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *
if (check_b_zero) {
int b_is_zero = 0;
if (use_ui) {
- b_is_zero = (Z_IVAL_P(b_arg) == 0);
+ b_is_zero = (Z_LVAL_P(b_arg) == 0);
} else {
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
}
@@ -816,7 +862,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *
INIT_GMP_RETVAL(gmpnum_result);
if (use_ui) {
- gmp_ui_op(gmpnum_result, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg));
+ gmp_ui_op(gmpnum_result, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
} else {
gmp_op(gmpnum_result, gmpnum_a, gmpnum_b);
}
@@ -838,7 +884,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) {
+ if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) {
/* use _ui function */
use_ui = 1;
temp_b.is_used = 0;
@@ -849,7 +895,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval
if (check_b_zero) {
int b_is_zero = 0;
if (use_ui) {
- b_is_zero = (Z_IVAL_P(b_arg) == 0);
+ b_is_zero = (Z_LVAL_P(b_arg) == 0);
} else {
b_is_zero = !mpz_cmp_ui(gmpnum_b, 0);
}
@@ -870,7 +916,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval
add_next_index_zval(return_value, &result2);
if (use_ui) {
- gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg));
+ gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (gmp_ulong) Z_LVAL_P(b_arg));
} else {
gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b);
}
@@ -889,7 +935,7 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &a_arg, &b_arg) == FAILURE){
return;
}
-
+
gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op, check_b_zero TSRMLS_CC);
}
/* }}} */
@@ -898,11 +944,11 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
/* {{{ gmp_zval_unary_op
*/
-static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
+static inline void gmp_zval_unary_op(zval *return_value, zval *a_arg, gmp_unary_op_t gmp_op TSRMLS_DC)
{
mpz_ptr gmpnum_a, gmpnum_result;
gmp_temp_t temp_a;
-
+
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
INIT_GMP_RETVAL(gmpnum_result);
@@ -919,7 +965,7 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una
mpz_ptr gmpnum_result;
INIT_GMP_RETVAL(gmpnum_result);
- gmp_op(gmpnum_result, zval_get_int(a_arg));
+ gmp_op(gmpnum_result, zval_get_long(a_arg));
}
/* }}} */
@@ -947,7 +993,7 @@ static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gm
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
return;
}
-
+
gmp_zval_unary_op(return_value, a_arg, gmp_op TSRMLS_CC);
}
/* }}} */
@@ -963,9 +1009,9 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
return;
}
-
+
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETVAL_INT(gmp_op(gmpnum_a));
+ RETVAL_LONG(gmp_op(gmpnum_a));
FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -985,7 +1031,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a);
- RETVAL_INT(gmp_op(gmpnum_a, gmpnum_b));
+ RETVAL_LONG(gmp_op(gmpnum_a, gmpnum_b));
FREE_GMP_TEMP(temp_a);
FREE_GMP_TEMP(temp_b);
@@ -998,14 +1044,14 @@ ZEND_FUNCTION(gmp_init)
{
zval *number_arg;
mpz_ptr gmpnumber;
- php_int_t base = 0;
+ zend_long base = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &number_arg, &base) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &number_arg, &base) == FAILURE) {
return;
}
- if (base && (base < 2 || base > MAX_BASE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld (should be between 2 and %d)", base, MAX_BASE);
+ if (base && (base < 2 || base > GMP_MAX_BASE)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d)", base, GMP_MAX_BASE);
RETURN_FALSE;
}
@@ -1017,6 +1063,118 @@ ZEND_FUNCTION(gmp_init)
}
/* }}} */
+int gmp_import_export_validate(zend_long size, zend_long options, int *order, int *endian TSRMLS_DC)
+{
+ if (size < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Word size must be positive, %pd given", size);
+ return FAILURE;
+ }
+
+ switch (options & (GMP_LSW_FIRST | GMP_MSW_FIRST)) {
+ case GMP_LSW_FIRST:
+ *order = -1;
+ break;
+ case GMP_MSW_FIRST:
+ case 0: /* default */
+ *order = 1;
+ break;
+ default:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Invalid options: Conflicting word orders");
+ return FAILURE;
+ }
+
+ switch (options & (GMP_LITTLE_ENDIAN | GMP_BIG_ENDIAN | GMP_NATIVE_ENDIAN)) {
+ case GMP_LITTLE_ENDIAN:
+ *endian = -1;
+ break;
+ case GMP_BIG_ENDIAN:
+ *endian = 1;
+ break;
+ case GMP_NATIVE_ENDIAN:
+ case 0: /* default */
+ *endian = 0;
+ break;
+ default:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Invalid options: Conflicting word endianness");
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+/* {{{ proto GMP gmp_import(string data [, int word_size = 1, int options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN])
+ Imports a GMP number from a binary string */
+ZEND_FUNCTION(gmp_import)
+{
+ char *data;
+ size_t data_len;
+ zend_long size = 1;
+ zend_long options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN;
+ int order, endian;
+ mpz_ptr gmpnumber;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &data, &data_len, &size, &options) == FAILURE) {
+ return;
+ }
+
+ if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ if ((data_len % size) != 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Input length must be a multiple of word size");
+ RETURN_FALSE;
+ }
+
+ INIT_GMP_RETVAL(gmpnumber);
+
+ mpz_import(gmpnumber, data_len / size, order, size, endian, 0, data);
+}
+/* }}} */
+
+/* {{{ proto string gmp_export(GMP gmpnumber [, int word_size = 1, int options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN])
+ Exports a GMP number to a binary string */
+ZEND_FUNCTION(gmp_export)
+{
+ zval *gmpnumber_arg;
+ zend_long size = 1;
+ zend_long options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN;
+ int order, endian;
+ mpz_ptr gmpnumber;
+ gmp_temp_t temp_a;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &gmpnumber_arg, &size, &options) == FAILURE) {
+ return;
+ }
+
+ if (gmp_import_export_validate(size, options, &order, &endian TSRMLS_CC) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ FETCH_GMP_ZVAL(gmpnumber, gmpnumber_arg, temp_a);
+
+ if (mpz_sgn(gmpnumber) == 0) {
+ RETURN_EMPTY_STRING();
+ } else {
+ size_t bits_per_word = size * 8;
+ size_t count = (mpz_sizeinbase(gmpnumber, 2) + bits_per_word - 1) / bits_per_word;
+ size_t out_len = count * size;
+
+ zend_string *out_string = zend_string_alloc(out_len, 0);
+ mpz_export(out_string->val, NULL, order, size, endian, 0, gmpnumber);
+ out_string->val[out_len] = '\0';
+
+ RETURN_STR(out_string);
+ }
+
+ FREE_GMP_TEMP(temp_a);
+}
+/* }}} */
+
/* {{{ proto int gmp_intval(mixed gmpnumber)
Gets signed long value of GMP number */
ZEND_FUNCTION(gmp_intval)
@@ -1026,11 +1184,11 @@ ZEND_FUNCTION(gmp_intval)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &gmpnumber_arg) == FAILURE){
return;
}
-
+
if (IS_GMP(gmpnumber_arg)) {
- RETVAL_INT(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg)));
+ RETVAL_LONG(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg)));
} else {
- RETVAL_INT(zval_get_int(gmpnumber_arg));
+ RETVAL_LONG(zval_get_long(gmpnumber_arg));
}
}
/* }}} */
@@ -1040,23 +1198,18 @@ ZEND_FUNCTION(gmp_intval)
ZEND_FUNCTION(gmp_strval)
{
zval *gmpnumber_arg;
- php_int_t base = 10;
+ zend_long base = 10;
mpz_ptr gmpnum;
gmp_temp_t temp_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &base) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &base) == FAILURE) {
return;
}
-#if MAX_BASE == 62
- /* Although the maximum base in general in GMP >= 4.2 is 62, mpz_get_str()
+ /* Although the maximum base in general in GMP is 62, mpz_get_str()
* is explicitly limited to -36 when dealing with negative bases. */
- if ((base < 2 && base > -2) || base > MAX_BASE || base < -36) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld (should be between 2 and %d or -2 and -36)", base, MAX_BASE);
-#else
- if (base < 2 || base > MAX_BASE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld (should be between 2 and %d)", base, MAX_BASE);
-#endif
+ if ((base < 2 && base > -2) || base > GMP_MAX_BASE || base < -36) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d or -2 and -36)", base, GMP_MAX_BASE);
RETURN_FALSE;
}
@@ -1097,9 +1250,9 @@ ZEND_FUNCTION(gmp_mul)
ZEND_FUNCTION(gmp_div_qr)
{
zval *a_arg, *b_arg;
- php_int_t round = GMP_ROUND_ZERO;
+ zend_long round = GMP_ROUND_ZERO;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
return;
}
@@ -1125,9 +1278,9 @@ ZEND_FUNCTION(gmp_div_qr)
ZEND_FUNCTION(gmp_div_r)
{
zval *a_arg, *b_arg;
- php_int_t round = GMP_ROUND_ZERO;
+ zend_long round = GMP_ROUND_ZERO;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
return;
}
@@ -1153,9 +1306,9 @@ ZEND_FUNCTION(gmp_div_r)
ZEND_FUNCTION(gmp_div_q)
{
zval *a_arg, *b_arg;
- php_int_t round = GMP_ROUND_ZERO;
+ zend_long round = GMP_ROUND_ZERO;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
return;
}
@@ -1173,7 +1326,7 @@ ZEND_FUNCTION(gmp_div_q)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid rounding mode");
RETURN_FALSE;
}
-
+
}
/* }}} */
@@ -1226,7 +1379,7 @@ ZEND_FUNCTION(gmp_fact)
RETURN_FALSE;
}
} else {
- if (zval_get_int(a_arg) < 0) {
+ if (zval_get_long(a_arg) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
RETURN_FALSE;
}
@@ -1243,9 +1396,9 @@ ZEND_FUNCTION(gmp_pow)
zval *base_arg;
mpz_ptr gmpnum_result, gmpnum_base;
gmp_temp_t temp_base;
- php_int_t exp;
+ zend_long exp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &base_arg, &exp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &base_arg, &exp) == FAILURE) {
return;
}
@@ -1253,10 +1406,10 @@ ZEND_FUNCTION(gmp_pow)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Negative exponent not supported");
RETURN_FALSE;
}
-
+
INIT_GMP_RETVAL(gmpnum_result);
- if (Z_TYPE_P(base_arg) == IS_INT && Z_IVAL_P(base_arg) >= 0) {
- mpz_ui_pow_ui(gmpnum_result, Z_IVAL_P(base_arg), exp);
+ if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) {
+ mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp);
} else {
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
mpz_pow_ui(gmpnum_result, gmpnum_base, exp);
@@ -1280,7 +1433,7 @@ ZEND_FUNCTION(gmp_powm)
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
- if (Z_TYPE_P(exp_arg) == IS_INT && Z_IVAL_P(exp_arg) >= 0) {
+ if (Z_TYPE_P(exp_arg) == IS_LONG && Z_LVAL_P(exp_arg) >= 0) {
use_ui = 1;
temp_exp.is_used = 0;
} else {
@@ -1295,17 +1448,16 @@ ZEND_FUNCTION(gmp_powm)
FETCH_GMP_ZVAL_DEP_DEP(gmpnum_mod, mod_arg, temp_mod, temp_exp, temp_base);
if (!mpz_cmp_ui(gmpnum_mod, 0)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modulus may not be zero");
FREE_GMP_TEMP(temp_base);
- if (use_ui) {
- FREE_GMP_TEMP(temp_exp);
- }
+ FREE_GMP_TEMP(temp_exp);
FREE_GMP_TEMP(temp_mod);
RETURN_FALSE;
}
INIT_GMP_RETVAL(gmpnum_result);
if (use_ui) {
- mpz_powm_ui(gmpnum_result, gmpnum_base, (php_uint_t) Z_IVAL_P(exp_arg), gmpnum_mod);
+ mpz_powm_ui(gmpnum_result, gmpnum_base, (zend_ulong) Z_LVAL_P(exp_arg), gmpnum_mod);
} else {
mpz_powm(gmpnum_result, gmpnum_base, gmpnum_exp, gmpnum_mod);
FREE_GMP_TEMP(temp_exp);
@@ -1327,14 +1479,14 @@ ZEND_FUNCTION(gmp_sqrt)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a_arg) == FAILURE){
return;
}
-
+
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
if (mpz_sgn(gmpnum_a) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0");
FREE_GMP_TEMP(temp_a);
RETURN_FALSE;
- }
+ }
INIT_GMP_RETVAL(gmpnum_result);
mpz_sqrt(gmpnum_result, gmpnum_a);
@@ -1380,11 +1532,11 @@ ZEND_FUNCTION(gmp_sqrtrem)
ZEND_FUNCTION(gmp_root)
{
zval *a_arg;
- php_int_t nth;
+ zend_long nth;
mpz_ptr gmpnum_a, gmpnum_result;
gmp_temp_t temp_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) {
return;
}
@@ -1402,7 +1554,7 @@ ZEND_FUNCTION(gmp_root)
}
INIT_GMP_RETVAL(gmpnum_result);
- mpz_root(gmpnum_result, gmpnum_a, (unsigned long) nth);
+ mpz_root(gmpnum_result, gmpnum_a, (gmp_ulong) nth);
FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1412,12 +1564,12 @@ ZEND_FUNCTION(gmp_root)
ZEND_FUNCTION(gmp_rootrem)
{
zval *a_arg;
- php_int_t nth;
+ zend_long nth;
mpz_ptr gmpnum_a, gmpnum_result1, gmpnum_result2;
gmp_temp_t temp_a;
zval result1, result2;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) {
return;
}
@@ -1441,15 +1593,8 @@ ZEND_FUNCTION(gmp_rootrem)
add_next_index_zval(return_value, &result1);
add_next_index_zval(return_value, &result2);
-#if GMP_42_OR_NEWER
- mpz_rootrem(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) nth);
-#else
- mpz_root(gmpnum_result1, gmpnum_a, (unsigned long) nth);
- mpz_pow_ui(gmpnum_result2, gmpnum_result1, (unsigned long) nth);
- mpz_sub(gmpnum_result2, gmpnum_a, gmpnum_result2);
- mpz_abs(gmpnum_result2, gmpnum_result2);
-#endif
-
+ mpz_rootrem(gmpnum_result1, gmpnum_result2, gmpnum_a, (gmp_ulong) nth);
+
FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1479,16 +1624,16 @@ ZEND_FUNCTION(gmp_prob_prime)
{
zval *gmpnumber_arg;
mpz_ptr gmpnum_a;
- php_int_t reps = 10;
+ zend_long reps = 10;
gmp_temp_t temp_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &reps) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &reps) == FAILURE) {
return;
}
FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a);
- RETVAL_INT(mpz_probab_prime_p(gmpnum_a, reps));
+ RETVAL_LONG(mpz_probab_prime_p(gmpnum_a, reps));
FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1604,33 +1749,37 @@ ZEND_FUNCTION(gmp_sign)
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETVAL_INT(mpz_sgn(gmpnum_a));
+ RETVAL_LONG(mpz_sgn(gmpnum_a));
FREE_GMP_TEMP(temp_a);
}
/* }}} */
+static void gmp_init_random(TSRMLS_D)
+{
+ if (!GMPG(rand_initialized)) {
+ /* Initialize */
+ gmp_randinit_mt(GMPG(rand_state));
+ /* Seed */
+ gmp_randseed_ui(GMPG(rand_state), GENERATE_SEED());
+
+ GMPG(rand_initialized) = 1;
+ }
+}
+
/* {{{ proto GMP gmp_random([int limiter])
Gets random number */
ZEND_FUNCTION(gmp_random)
{
- php_int_t limiter = 20;
+ zend_long limiter = 20;
mpz_ptr gmpnum_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &limiter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limiter) == FAILURE) {
return;
}
INIT_GMP_RETVAL(gmpnum_result);
+ gmp_init_random(TSRMLS_C);
- if (!GMPG(rand_initialized)) {
- /* Initialize */
- gmp_randinit_lc_2exp_size(GMPG(rand_state), 32L);
-
- /* Seed */
- gmp_randseed_ui(GMPG(rand_state), GENERATE_SEED());
-
- GMPG(rand_initialized) = 1;
- }
#ifdef GMP_LIMB_BITS
mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS);
#else
@@ -1639,6 +1788,91 @@ ZEND_FUNCTION(gmp_random)
}
/* }}} */
+/* {{{ proto GMP gmp_random_bits(int bits)
+ Gets a random number in the range 0 to (2 ** n) - 1 */
+ZEND_FUNCTION(gmp_random_bits)
+{
+ long bits;
+ mpz_ptr gmpnum_result;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &bits) == FAILURE) {
+ return;
+ }
+
+ if (bits <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The number of bits must be positive");
+ RETURN_FALSE;
+ }
+
+ INIT_GMP_RETVAL(gmpnum_result);
+ gmp_init_random(TSRMLS_C);
+
+ mpz_urandomb(gmpnum_result, GMPG(rand_state), bits);
+}
+/* }}} */
+
+/* {{{ proto GMP gmp_random_range(mixed min, mixed max)
+ Gets a random number in the range min to max */
+ZEND_FUNCTION(gmp_random_range)
+{
+ zval *min_arg, *max_arg;
+ mpz_ptr gmpnum_min, gmpnum_max, gmpnum_result;
+ gmp_temp_t temp_a, temp_b;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &min_arg, &max_arg) == FAILURE) {
+ return;
+ }
+
+ gmp_init_random(TSRMLS_C);
+
+ FETCH_GMP_ZVAL(gmpnum_max, max_arg, temp_a);
+
+ if (Z_TYPE_P(min_arg) == IS_LONG && Z_LVAL_P(min_arg) >= 0) {
+ if (mpz_cmp_ui(gmpnum_max, Z_LVAL_P(min_arg)) <= 0) {
+ FREE_GMP_TEMP(temp_a);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The minimum value must be less than the maximum value");
+ RETURN_FALSE;
+ }
+
+ INIT_GMP_RETVAL(gmpnum_result);
+
+ if (Z_LVAL_P(min_arg)) {
+ mpz_sub_ui(gmpnum_max, gmpnum_max, Z_LVAL_P(min_arg));
+ }
+
+ mpz_add_ui(gmpnum_max, gmpnum_max, 1);
+ mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_max);
+
+ if (Z_LVAL_P(min_arg)) {
+ mpz_add_ui(gmpnum_result, gmpnum_result, Z_LVAL_P(min_arg));
+ }
+
+ FREE_GMP_TEMP(temp_a);
+
+ }
+ else {
+ FETCH_GMP_ZVAL_DEP(gmpnum_min, min_arg, temp_b, temp_a);
+
+ if (mpz_cmp(gmpnum_max, gmpnum_min) <= 0) {
+ FREE_GMP_TEMP(temp_b);
+ FREE_GMP_TEMP(temp_a);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The minimum value must be less than the maximum value");
+ RETURN_FALSE;
+ }
+
+ INIT_GMP_RETVAL(gmpnum_result);
+
+ mpz_sub(gmpnum_max, gmpnum_max, gmpnum_min);
+ mpz_add_ui(gmpnum_max, gmpnum_max, 1);
+ mpz_urandomm(gmpnum_result, GMPG(rand_state), gmpnum_max);
+ mpz_add(gmpnum_result, gmpnum_result, gmpnum_min);
+
+ FREE_GMP_TEMP(temp_b);
+ FREE_GMP_TEMP(temp_a);
+ }
+}
+/* }}} */
+
/* {{{ proto GMP gmp_and(mixed a, mixed b)
Calculates logical AND of a and b */
ZEND_FUNCTION(gmp_and)
@@ -1684,17 +1918,17 @@ ZEND_FUNCTION(gmp_xor)
ZEND_FUNCTION(gmp_setbit)
{
zval *a_arg;
- php_int_t index;
+ zend_long index;
zend_bool set = 1;
mpz_ptr gmpnum_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi|b", &a_arg, gmp_ce, &index, &set) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) {
return;
}
if (index < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero");
- return;
+ RETURN_FALSE;
}
gmpnum_a = GET_GMP_FROM_ZVAL(a_arg);
@@ -1712,16 +1946,16 @@ ZEND_FUNCTION(gmp_setbit)
ZEND_FUNCTION(gmp_clrbit)
{
zval *a_arg;
- php_int_t index;
+ zend_long index;
mpz_ptr gmpnum_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &a_arg, gmp_ce, &index) == FAILURE){
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &a_arg, gmp_ce, &index) == FAILURE){
return;
}
if (index < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero");
- return;
+ RETURN_FALSE;
}
gmpnum_a = GET_GMP_FROM_ZVAL(a_arg);
@@ -1734,11 +1968,11 @@ ZEND_FUNCTION(gmp_clrbit)
ZEND_FUNCTION(gmp_testbit)
{
zval *a_arg;
- php_int_t index;
+ zend_long index;
mpz_ptr gmpnum_a;
gmp_temp_t temp_a;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &index) == FAILURE){
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &index) == FAILURE){
return;
}
@@ -1776,9 +2010,9 @@ ZEND_FUNCTION(gmp_scan0)
zval *a_arg;
mpz_ptr gmpnum_a;
gmp_temp_t temp_a;
- php_int_t start;
+ zend_long start;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){
return;
}
@@ -1789,7 +2023,7 @@ ZEND_FUNCTION(gmp_scan0)
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETVAL_INT(mpz_scan0(gmpnum_a, start));
+ RETVAL_LONG(mpz_scan0(gmpnum_a, start));
FREE_GMP_TEMP(temp_a);
}
/* }}} */
@@ -1801,9 +2035,9 @@ ZEND_FUNCTION(gmp_scan1)
zval *a_arg;
mpz_ptr gmpnum_a;
gmp_temp_t temp_a;
- php_int_t start;
+ zend_long start;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){
return;
}
@@ -1814,7 +2048,7 @@ ZEND_FUNCTION(gmp_scan1)
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
- RETVAL_INT(mpz_scan1(gmpnum_a, start));
+ RETVAL_LONG(mpz_scan1(gmpnum_a, start));
FREE_GMP_TEMP(temp_a);
}
/* }}} */
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 05bd56fa91..f9bc0f3269 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -31,6 +31,8 @@ ZEND_MODULE_DEACTIVATE_D(gmp);
ZEND_MODULE_INFO_D(gmp);
ZEND_FUNCTION(gmp_init);
+ZEND_FUNCTION(gmp_import);
+ZEND_FUNCTION(gmp_export);
ZEND_FUNCTION(gmp_intval);
ZEND_FUNCTION(gmp_strval);
ZEND_FUNCTION(gmp_add);
@@ -64,6 +66,8 @@ ZEND_FUNCTION(gmp_or);
ZEND_FUNCTION(gmp_com);
ZEND_FUNCTION(gmp_xor);
ZEND_FUNCTION(gmp_random);
+ZEND_FUNCTION(gmp_random_bits);
+ZEND_FUNCTION(gmp_random_range);
ZEND_FUNCTION(gmp_setbit);
ZEND_FUNCTION(gmp_clrbit);
ZEND_FUNCTION(gmp_scan0);
@@ -73,6 +77,15 @@ ZEND_FUNCTION(gmp_popcount);
ZEND_FUNCTION(gmp_hamdist);
ZEND_FUNCTION(gmp_nextprime);
+/* GMP and MPIR use different datatypes on different platforms */
+#ifdef PHP_WIN32
+typedef zend_long gmp_long;
+typedef zend_ulong gmp_ulong;
+#else
+typedef long gmp_long;
+typedef unsigned long gmp_ulong;
+#endif
+
ZEND_BEGIN_MODULE_GLOBALS(gmp)
zend_bool rand_initialized;
gmp_randstate_t rand_state;
diff --git a/ext/gmp/tests/001.phpt b/ext/gmp/tests/001.phpt
deleted file mode 100644
index 5126f73142..0000000000
--- a/ext/gmp/tests/001.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Check for gmp presence
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---FILE--
-<?php
-echo "gmp extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php5/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-gmp extension is available
diff --git a/ext/gmp/tests/bug50175.phpt b/ext/gmp/tests/bug50175.phpt
new file mode 100644
index 0000000000..0998e029c3
--- /dev/null
+++ b/ext/gmp/tests/bug50175.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #50175: gmp_init() results 0 on given base and number starting with 0x or 0b
+--FILE--
+<?php
+
+var_dump(gmp_init('0bcd', 16));
+var_dump(gmp_init('0xyz', 36));
+
+?>
+--EXPECTF--
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(4) "3021"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(5) "44027"
+}
diff --git a/ext/gmp/tests/bug50283.phpt b/ext/gmp/tests/bug50283.phpt
index 13eef54804..561cd3d68c 100644
--- a/ext/gmp/tests/bug50283.phpt
+++ b/ext/gmp/tests/bug50283.phpt
@@ -2,7 +2,6 @@
Feature Request #50283 (allow base in gmp_strval to use full range: 2 to 62, and -2 to -36)
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
-<?php if (version_compare(GMP_VERSION, "4.2.0", "<")) print "skip"; ?>
--FILE--
<?php
$a = gmp_init("0x41682179fbf5");
diff --git a/ext/gmp/tests/013.phpt b/ext/gmp/tests/gmp_abs.phpt
index bb35891f2a..bb35891f2a 100644
--- a/ext/gmp/tests/013.phpt
+++ b/ext/gmp/tests/gmp_abs.phpt
diff --git a/ext/gmp/tests/029.phpt b/ext/gmp/tests/gmp_and.phpt
index 9bc401031b..9bc401031b 100644
--- a/ext/gmp/tests/029.phpt
+++ b/ext/gmp/tests/gmp_and.phpt
diff --git a/ext/gmp/tests/034.phpt b/ext/gmp/tests/gmp_clrbit.phpt
index 079d5d669f..0aab89dd37 100644
--- a/ext/gmp/tests/034.phpt
+++ b/ext/gmp/tests/gmp_clrbit.phpt
@@ -10,7 +10,7 @@ gmp_clrbit($n, 0);
var_dump(gmp_strval($n));
$n = gmp_init(-1);
-gmp_clrbit($n, -1);
+var_dump(gmp_clrbit($n, -1));
var_dump(gmp_strval($n));
$n = gmp_init("1000000");
@@ -35,10 +35,11 @@ gmp_clrbit();
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
string(1) "0"
Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d
+bool(false)
string(2) "-1"
Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d
diff --git a/ext/gmp/tests/026.phpt b/ext/gmp/tests/gmp_cmp.phpt
index 83e7910d1e..83e7910d1e 100644
--- a/ext/gmp/tests/026.phpt
+++ b/ext/gmp/tests/gmp_cmp.phpt
diff --git a/ext/gmp/tests/031.phpt b/ext/gmp/tests/gmp_com.phpt
index 1e0c1b4694..1e0c1b4694 100644
--- a/ext/gmp/tests/031.phpt
+++ b/ext/gmp/tests/gmp_com.phpt
diff --git a/ext/gmp/tests/009.phpt b/ext/gmp/tests/gmp_div_q.phpt
index 3b75a48e18..3b75a48e18 100644
--- a/ext/gmp/tests/009.phpt
+++ b/ext/gmp/tests/gmp_div_q.phpt
diff --git a/ext/gmp/tests/007.phpt b/ext/gmp/tests/gmp_div_qr.phpt
index e391c121f8..90099249db 100644
--- a/ext/gmp/tests/007.phpt
+++ b/ext/gmp/tests/gmp_div_qr.phpt
@@ -10,11 +10,13 @@ var_dump(gmp_div_qr(""));
var_dump(gmp_div_qr(0,1));
var_dump(gmp_div_qr(1,0));
+var_dump(gmp_div_qr(gmp_init(1), gmp_init(0)));
var_dump(gmp_div_qr(12653,23482734));
var_dump(gmp_div_qr(12653,23482734, 10));
var_dump(gmp_div_qr(1123123,123));
var_dump(gmp_div_qr(1123123,123, 1));
var_dump(gmp_div_qr(1123123,123, 2));
+var_dump(gmp_div_qr(gmp_init(1123123), gmp_init(123)));
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_ZERO));
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_PLUSINF));
var_dump(gmp_div_qr(1123123,123, GMP_ROUND_MINUSINF));
@@ -47,6 +49,9 @@ array(2) {
Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
bool(false)
+
+Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
+bool(false)
array(2) {
[0]=>
object(GMP)#%d (1) {
@@ -114,6 +119,18 @@ array(2) {
[0]=>
object(GMP)#%d (1) {
["num"]=>
+ string(4) "9131"
+ }
+ [1]=>
+ object(GMP)#%d (1) {
+ ["num"]=>
+ string(2) "10"
+ }
+}
+array(2) {
+ [0]=>
+ object(GMP)#%d (1) {
+ ["num"]=>
string(4) "9132"
}
[1]=>
diff --git a/ext/gmp/tests/008.phpt b/ext/gmp/tests/gmp_div_r.phpt
index c1874c86f9..c1874c86f9 100644
--- a/ext/gmp/tests/008.phpt
+++ b/ext/gmp/tests/gmp_div_r.phpt
diff --git a/ext/gmp/tests/011.phpt b/ext/gmp/tests/gmp_divexact.phpt
index a42c1b6b4e..a42c1b6b4e 100644
--- a/ext/gmp/tests/011.phpt
+++ b/ext/gmp/tests/gmp_divexact.phpt
diff --git a/ext/gmp/tests/gmp_export.phpt b/ext/gmp/tests/gmp_export.phpt
new file mode 100644
index 0000000000..fbc8901cfc
--- /dev/null
+++ b/ext/gmp/tests/gmp_export.phpt
@@ -0,0 +1,80 @@
+--TEST--
+gmp_export() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) echo "skip"; ?>
+--FILE--
+<?php
+
+// Tests taken from GMPs own test suite.
+
+// format is [output, size, options, expected]
+$export = [
+ ['0',1,GMP_BIG_ENDIAN,''],
+ ['0',2,GMP_BIG_ENDIAN,''],
+ ['0',3,GMP_BIG_ENDIAN,''],
+ ['12345678',1,GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',4,GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',1,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
+ ['12345678',4,GMP_LITTLE_ENDIAN,'78563412'],
+ ['12345678',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
+ ['123456789ABC',2,GMP_BIG_ENDIAN,'123456789abc'],
+ ['123456789ABC',2,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9abc56781234'],
+ ['123456789ABC',2,GMP_LITTLE_ENDIAN,'34127856bc9a'],
+ ['123456789ABC',2,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'bc9a78563412'],
+ ['112233445566778899AABBCC',4,GMP_BIG_ENDIAN,'112233445566778899aabbcc'],
+ ['112233445566778899AABBCC',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'99aabbcc5566778811223344'],
+ ['112233445566778899AABBCC',4,GMP_LITTLE_ENDIAN,'4433221188776655ccbbaa99'],
+ ['112233445566778899AABBCC',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'ccbbaa998877665544332211'],
+ ['100120023003400450056006700780089009A00AB00BC00C',8,GMP_BIG_ENDIAN,'100120023003400450056006700780089009a00ab00bc00c'],
+ ['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9009a00ab00bc00c50056006700780081001200230034004'],
+ ['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LITTLE_ENDIAN,'044003300220011008800770066005500cc00bb00aa00990'],
+ ['100120023003400450056006700780089009A00AB00BC00C',8,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'0cc00bb00aa0099008800770066005500440033002200110']
+];
+
+$passed = true;
+foreach ($export as $k => $test) {
+ $gmp = gmp_init($test[0], 16);
+ $str = gmp_export($gmp, $test[1], $test[2]);
+ if (is_string($str)) {
+ $result = bin2hex($str);
+ if ($result !== $test[3]) {
+ echo "$k: '$result' !== '{$test[3]}'\n";
+ $passed = false;
+ }
+ } else {
+ $type = gettype($str);
+ echo "$k: $type !== '{$test[3]}'\n";
+ }
+}
+
+var_dump($passed);
+
+// Invalid arguments (zpp failure)
+var_dump(gmp_export());
+
+// Invalid word sizes
+var_dump(gmp_export(123, -1));
+var_dump(gmp_export(123, 0));
+
+// Invalid options
+var_dump(gmp_export(123, 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
+var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
+
+--EXPECTF--
+bool(true)
+
+Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gmp_export(): Word size must be positive, -1 given in %s on line %d
+bool(false)
+
+Warning: gmp_export(): Word size must be positive, 0 given in %s on line %d
+bool(false)
+
+Warning: gmp_export(): Invalid options: Conflicting word orders in %s on line %d
+bool(false)
+
+Warning: gmp_export(): Invalid options: Conflicting word endianness in %s on line %d
+bool(false)
diff --git a/ext/gmp/tests/014.phpt b/ext/gmp/tests/gmp_fact.phpt
index 6afccaf936..6afccaf936 100644
--- a/ext/gmp/tests/014.phpt
+++ b/ext/gmp/tests/gmp_fact.phpt
diff --git a/ext/gmp/tests/021.phpt b/ext/gmp/tests/gmp_gcd.phpt
index 275f0bca35..275f0bca35 100644
--- a/ext/gmp/tests/021.phpt
+++ b/ext/gmp/tests/gmp_gcd.phpt
diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/gmp_gcdext.phpt
index 469aa3013d..469aa3013d 100644
--- a/ext/gmp/tests/022.phpt
+++ b/ext/gmp/tests/gmp_gcdext.phpt
diff --git a/ext/gmp/tests/036.phpt b/ext/gmp/tests/gmp_hamdist.phpt
index c21e03ccb2..c21e03ccb2 100644
--- a/ext/gmp/tests/036.phpt
+++ b/ext/gmp/tests/gmp_hamdist.phpt
diff --git a/ext/gmp/tests/gmp_import.phpt b/ext/gmp/tests/gmp_import.phpt
new file mode 100644
index 0000000000..b7ae6600ed
--- /dev/null
+++ b/ext/gmp/tests/gmp_import.phpt
@@ -0,0 +1,91 @@
+--TEST--
+gmp_import() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) echo "skip"; ?>
+--FILE--
+<?php
+
+// Tests taken from GMPs own test suite.
+
+// format is [expected, size, options, input]
+$import = [
+ ['0',1,GMP_BIG_ENDIAN,''],
+ ['12345678',1,GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',4,GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'12345678'],
+ ['12345678',1,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
+ ['12345678',4,GMP_LITTLE_ENDIAN,'78563412'],
+ ['12345678',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'78563412'],
+ ['123456789abc',2,GMP_BIG_ENDIAN,'123456789abc'],
+ ['123456789abc',2,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9abc56781234'],
+ ['123456789abc',2,GMP_LITTLE_ENDIAN,'34127856bc9a'],
+ ['123456789abc',2,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'bc9a78563412'],
+ ['112233445566778899aabbcc',4,GMP_BIG_ENDIAN,'112233445566778899aabbcc'],
+ ['112233445566778899aabbcc',4,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'99aabbcc5566778811223344'],
+ ['112233445566778899aabbcc',4,GMP_LITTLE_ENDIAN,'4433221188776655ccbbaa99'],
+ ['112233445566778899aabbcc',4,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'ccbbaa998877665544332211'],
+ ['100120023003400450056006700780089009a00ab00bc00c',8,GMP_BIG_ENDIAN,'100120023003400450056006700780089009a00ab00bc00c'],
+ ['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LSW_FIRST | GMP_BIG_ENDIAN,'9009a00ab00bc00c50056006700780081001200230034004'],
+ ['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LITTLE_ENDIAN,'044003300220011008800770066005500cc00bb00aa00990'],
+ ['100120023003400450056006700780089009a00ab00bc00c',8,GMP_LSW_FIRST | GMP_LITTLE_ENDIAN,'0cc00bb00aa0099008800770066005500440033002200110']
+];
+
+$passed = true;
+foreach ($import as $k => $test) {
+ $gmp = gmp_import(hex2bin($test[3]), $test[1], $test[2]);
+ if ($gmp instanceof GMP) {
+ $result = gmp_strval($gmp, 16);
+ if ($result !== $test[0]) {
+ echo "$k: '$result' !== '{$test[0]}'\n";
+ $passed = false;
+ }
+ } else {
+ $type = gettype($gmp);
+ echo "$k: $type !== '{$test[0]}'\n";
+ }
+}
+
+var_dump($passed);
+
+// Invalid arguments (zpp failure)
+var_dump(gmp_import());
+
+// Invalid word sizes
+var_dump(gmp_import('a', -1));
+var_dump(gmp_import('a', 0));
+
+// Invalid data lengths
+var_dump(gmp_import('a', 2));
+var_dump(gmp_import('aa', 3));
+var_dump(gmp_import(str_repeat('a', 100), 64));
+
+// Invalid options
+var_dump(gmp_import('a', 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
+var_dump(gmp_import('a', 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
+
+--EXPECTF--
+bool(true)
+
+Warning: gmp_import() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gmp_import(): Word size must be positive, -1 given in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Word size must be positive, 0 given in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Input length must be a multiple of word size in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Invalid options: Conflicting word orders in %s on line %d
+bool(false)
+
+Warning: gmp_import(): Invalid options: Conflicting word endianness in %s on line %d
+bool(false)
diff --git a/ext/gmp/tests/040.phpt b/ext/gmp/tests/gmp_init.phpt
index 29640ba704..29640ba704 100644
--- a/ext/gmp/tests/040.phpt
+++ b/ext/gmp/tests/gmp_init.phpt
diff --git a/ext/gmp/tests/004.phpt b/ext/gmp/tests/gmp_intval.phpt
index 088dd08fd8..088dd08fd8 100644
--- a/ext/gmp/tests/004.phpt
+++ b/ext/gmp/tests/gmp_intval.phpt
diff --git a/ext/gmp/tests/023.phpt b/ext/gmp/tests/gmp_invert.phpt
index 81a90fe16a..81a90fe16a 100644
--- a/ext/gmp/tests/023.phpt
+++ b/ext/gmp/tests/gmp_invert.phpt
diff --git a/ext/gmp/tests/024.phpt b/ext/gmp/tests/gmp_jacobi.phpt
index 04ddba4f08..04ddba4f08 100644
--- a/ext/gmp/tests/024.phpt
+++ b/ext/gmp/tests/gmp_jacobi.phpt
diff --git a/ext/gmp/tests/025.phpt b/ext/gmp/tests/gmp_legendre.phpt
index 6dde34e1e7..6dde34e1e7 100644
--- a/ext/gmp/tests/025.phpt
+++ b/ext/gmp/tests/gmp_legendre.phpt
diff --git a/ext/gmp/tests/010.phpt b/ext/gmp/tests/gmp_mod.phpt
index 12e7cad2b3..12e7cad2b3 100644
--- a/ext/gmp/tests/010.phpt
+++ b/ext/gmp/tests/gmp_mod.phpt
diff --git a/ext/gmp/tests/012.phpt b/ext/gmp/tests/gmp_neg.phpt
index 8ca3471cb8..8ca3471cb8 100644
--- a/ext/gmp/tests/012.phpt
+++ b/ext/gmp/tests/gmp_neg.phpt
diff --git a/ext/gmp/tests/030.phpt b/ext/gmp/tests/gmp_or.phpt
index 035f070bd7..035f070bd7 100644
--- a/ext/gmp/tests/030.phpt
+++ b/ext/gmp/tests/gmp_or.phpt
diff --git a/ext/gmp/tests/019.phpt b/ext/gmp/tests/gmp_perfect_square.phpt
index aa596ba9cd..aa596ba9cd 100644
--- a/ext/gmp/tests/019.phpt
+++ b/ext/gmp/tests/gmp_perfect_square.phpt
diff --git a/ext/gmp/tests/gmp_php_int_max.phpt b/ext/gmp/tests/gmp_php_int_max.phpt
new file mode 100644
index 0000000000..1f680a1490
--- /dev/null
+++ b/ext/gmp/tests/gmp_php_int_max.phpt
@@ -0,0 +1,29 @@
+--TEST--
+PHP_INT_MAX tests
+--SKIPIF--
+<?php
+if (!extension_loaded("gmp")) print "skip";
+if (PHP_INT_SIZE != 8) print "skip";
+?>
+--FILE--
+<?php
+
+var_dump(gmp_mul(PHP_INT_MAX, PHP_INT_MAX));
+var_dump(gmp_add(PHP_INT_MAX, PHP_INT_MAX));
+var_dump(gmp_mul(PHP_INT_MAX, PHP_INT_MIN));
+?>
+DONE
+--EXPECTF--
+object(GMP)#%d (%d) {
+ ["num"]=>
+ string(38) "85070591730234615847396907784232501249"
+}
+object(GMP)#%d (%d) {
+ ["num"]=>
+ string(20) "18446744073709551614"
+}
+object(GMP)#%d (%d) {
+ ["num"]=>
+ string(39) "-85070591730234615856620279821087277056"
+}
+DONE
diff --git a/ext/gmp/tests/035.phpt b/ext/gmp/tests/gmp_popcount.phpt
index 4b45a04481..4b45a04481 100644
--- a/ext/gmp/tests/035.phpt
+++ b/ext/gmp/tests/gmp_popcount.phpt
diff --git a/ext/gmp/tests/015.phpt b/ext/gmp/tests/gmp_pow.phpt
index e17ecc7bad..e17ecc7bad 100644
--- a/ext/gmp/tests/015.phpt
+++ b/ext/gmp/tests/gmp_pow.phpt
diff --git a/ext/gmp/tests/016.phpt b/ext/gmp/tests/gmp_pown.phpt
index 8a0b34458f..f5857b6995 100644
--- a/ext/gmp/tests/016.phpt
+++ b/ext/gmp/tests/gmp_pown.phpt
@@ -19,6 +19,9 @@ var_dump(gmp_strval(gmp_powm($n,$e,1000)));
$m = gmp_init(900);
var_dump(gmp_strval(gmp_powm($n,$e,$m)));
+var_dump(gmp_powm(5, 11, 0));
+var_dump(gmp_powm(5, "11", gmp_init(0)));
+
var_dump(gmp_powm(array(),$e,$m));
var_dump(gmp_powm($n,array(),$m));
var_dump(gmp_powm($n,$e,array()));
@@ -46,6 +49,12 @@ string(3) "331"
string(3) "171"
string(3) "371"
+Warning: gmp_powm(): Modulus may not be zero in %s on line %d
+bool(false)
+
+Warning: gmp_powm(): Modulus may not be zero in %s on line %d
+bool(false)
+
Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/020.phpt b/ext/gmp/tests/gmp_prob_prime.phpt
index f8f3e6921c..f8f3e6921c 100644
--- a/ext/gmp/tests/020.phpt
+++ b/ext/gmp/tests/gmp_prob_prime.phpt
diff --git a/ext/gmp/tests/028.phpt b/ext/gmp/tests/gmp_random.phpt
index 3a876aa60c..3a876aa60c 100644
--- a/ext/gmp/tests/028.phpt
+++ b/ext/gmp/tests/gmp_random.phpt
diff --git a/ext/gmp/tests/gmp_random_bits.phpt b/ext/gmp/tests/gmp_random_bits.phpt
new file mode 100644
index 0000000000..21d493cdb6
--- /dev/null
+++ b/ext/gmp/tests/gmp_random_bits.phpt
@@ -0,0 +1,45 @@
+--TEST--
+gmp_random_bits() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gmp_random_bits());
+var_dump(gmp_random_bits(0));
+var_dump(gmp_random_bits(-1));
+
+// If these error the test fails.
+gmp_random_bits(1);
+gmp_random_bits(1024);
+
+// 2 seconds to make sure the numbers stay in range
+$start = microtime(true);
+$limit = (2 ** 30) - 1;
+while (1) {
+ for ($i = 0; $i < 5000; $i++) {
+ $result = gmp_random_bits(30);
+ if ($result < 0 || $result > $limit) {
+ print "RANGE VIOLATION\n";
+ var_dump($result);
+ break 2;
+ }
+ }
+
+ if (microtime(true) - $start > 2) {
+ break;
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: gmp_random_bits() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gmp_random_bits(): The number of bits must be positive in %s on line %d
+bool(false)
+
+Warning: gmp_random_bits(): The number of bits must be positive in %s on line %d
+bool(false)
+Done
diff --git a/ext/gmp/tests/gmp_random_range.phpt b/ext/gmp/tests/gmp_random_range.phpt
new file mode 100644
index 0000000000..a8e7c4a9c1
--- /dev/null
+++ b/ext/gmp/tests/gmp_random_range.phpt
@@ -0,0 +1,81 @@
+--TEST--
+gmp_random_range() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--FILE--
+<?php
+
+$minusTen = gmp_init(-1);
+$plusTen = gmp_init(1);
+$zero = gmp_init(0);
+
+var_dump(gmp_random_range());
+var_dump(gmp_random_range(10));
+var_dump(gmp_random_range(10, -10));
+
+var_dump(gmp_random_range($plusTen, $minusTen));
+var_dump(gmp_random_range($plusTen, $zero));
+
+// If these error the test fails.
+gmp_random_range(0, 10);
+gmp_random_range(1, 10);
+gmp_random_range(-1, 10);
+gmp_random_range(-10, 0);
+gmp_random_range(-10, -1);
+
+gmp_random_range(0, $plusTen);
+gmp_random_range(1, $plusTen);
+gmp_random_range(-1, $plusTen);
+
+gmp_random_range($zero, $plusTen);
+gmp_random_range($minusTen, $plusTen);
+
+// 2 seconds to make sure the numbers stay in range
+$start = microtime(true);
+while (1) {
+ for ($i = 0; $i < 5000; $i++) {
+ $result = gmp_random_range(0, 1000);
+ if ($result < 0 || $result > 1000) {
+ print "RANGE VIOLATION 1\n";
+ var_dump($result);
+ break 2;
+ }
+
+ $result = gmp_random_range(-1000, 0);
+ if ($result < -1000 || $result > 0) {
+ print "RANGE VIOLATION 2\n";
+ var_dump($result);
+ break 2;
+ }
+
+ $result = gmp_random_range(-500, 500);
+ if ($result < -500 || $result > 500) {
+ print "RANGE VIOLATION 3\n";
+ var_dump($result);
+ break 2;
+ }
+ }
+
+ if (microtime(true) - $start > 2) {
+ break;
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: gmp_random_range() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: gmp_random_range() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d
+bool(false)
+
+Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d
+bool(false)
+
+Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d
+bool(false)
+Done
diff --git a/ext/gmp/tests/041.phpt b/ext/gmp/tests/gmp_remroot.phpt
index 6e6d959288..4a3539d87c 100644
--- a/ext/gmp/tests/041.phpt
+++ b/ext/gmp/tests/gmp_remroot.phpt
@@ -1,21 +1,11 @@
--TEST--
-gmp_root() and gmp_rootrem() basic tests
+gmp_rootrem() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
-var_dump(gmp_root(1000, 3));
-var_dump(gmp_root(100, 3));
-var_dump(gmp_root(-100, 3));
-
-var_dump(gmp_root(1000, 4));
-var_dump(gmp_root(100, 4));
-var_dump(gmp_root(-100, 4));
-
-var_dump(gmp_root(0, 3));
-var_dump(gmp_root(100, 0));
-var_dump(gmp_root(100, -3));
+var_dump(gmp_rootrem());
var_dump(gmp_rootrem(1000, 3));
var_dump(gmp_rootrem(100, 3));
@@ -31,39 +21,8 @@ var_dump(gmp_rootrem(100, -3));
?>
--EXPECTF--
-object(GMP)#%d (1) {
- ["num"]=>
- string(2) "10"
-}
-object(GMP)#%d (1) {
- ["num"]=>
- string(1) "4"
-}
-object(GMP)#%d (1) {
- ["num"]=>
- string(2) "-4"
-}
-object(GMP)#%d (1) {
- ["num"]=>
- string(1) "5"
-}
-object(GMP)#%d (1) {
- ["num"]=>
- string(1) "3"
-}
-
-Warning: gmp_root(): Can't take even root of negative number in %s on line %d
-bool(false)
-object(GMP)#%d (1) {
- ["num"]=>
- string(1) "0"
-}
-
-Warning: gmp_root(): The root must be positive in %s on line %d
-bool(false)
-
-Warning: gmp_root(): The root must be positive in %s on line %d
-bool(false)
+Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
array(2) {
[0]=>
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_root.phpt b/ext/gmp/tests/gmp_root.phpt
new file mode 100644
index 0000000000..70faf27051
--- /dev/null
+++ b/ext/gmp/tests/gmp_root.phpt
@@ -0,0 +1,58 @@
+--TEST--
+gmp_root() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gmp_root());
+
+var_dump(gmp_root(1000, 3));
+var_dump(gmp_root(100, 3));
+var_dump(gmp_root(-100, 3));
+
+var_dump(gmp_root(1000, 4));
+var_dump(gmp_root(100, 4));
+var_dump(gmp_root(-100, 4));
+
+var_dump(gmp_root(0, 3));
+var_dump(gmp_root(100, 0));
+var_dump(gmp_root(100, -3));
+
+?>
+--EXPECTF--
+Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(2) "10"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(1) "4"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(2) "-4"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(1) "5"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(1) "3"
+}
+
+Warning: gmp_root(): Can't take even root of negative number in %s on line %d
+bool(false)
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(1) "0"
+}
+
+Warning: gmp_root(): The root must be positive in %s on line %d
+bool(false)
+
+Warning: gmp_root(): The root must be positive in %s on line %d
+bool(false)
diff --git a/ext/gmp/tests/037.phpt b/ext/gmp/tests/gmp_scan0.phpt
index 2a87a968a2..2a87a968a2 100644
--- a/ext/gmp/tests/037.phpt
+++ b/ext/gmp/tests/gmp_scan0.phpt
diff --git a/ext/gmp/tests/038.phpt b/ext/gmp/tests/gmp_scan1.phpt
index 7ebce9be7d..7ebce9be7d 100644
--- a/ext/gmp/tests/038.phpt
+++ b/ext/gmp/tests/gmp_scan1.phpt
diff --git a/ext/gmp/tests/033.phpt b/ext/gmp/tests/gmp_setbit.phpt
index 99848959d5..2eac23db0e 100644
--- a/ext/gmp/tests/033.phpt
+++ b/ext/gmp/tests/gmp_setbit.phpt
@@ -10,7 +10,7 @@ gmp_setbit($n, 10, -1);
var_dump(gmp_strval($n));
$n = gmp_init(5);
-gmp_setbit($n, -20, 0);
+var_dump(gmp_setbit($n, -20, 0));
var_dump(gmp_strval($n));
$n = gmp_init(5);
@@ -41,10 +41,11 @@ gmp_setbit($a,array());
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
string(2) "-1"
Warning: gmp_setbit(): Index must be greater than or equal to zero in %s on line %d
+bool(false)
string(1) "5"
string(1) "1"
string(1) "7"
diff --git a/ext/gmp/tests/027.phpt b/ext/gmp/tests/gmp_sign.phpt
index 1efdc28c6f..1efdc28c6f 100644
--- a/ext/gmp/tests/027.phpt
+++ b/ext/gmp/tests/gmp_sign.phpt
diff --git a/ext/gmp/tests/017.phpt b/ext/gmp/tests/gmp_sqrt.phpt
index d90f538213..d90f538213 100644
--- a/ext/gmp/tests/017.phpt
+++ b/ext/gmp/tests/gmp_sqrt.phpt
diff --git a/ext/gmp/tests/018.phpt b/ext/gmp/tests/gmp_sqrtrem.phpt
index 2fca463daa..2fca463daa 100644
--- a/ext/gmp/tests/018.phpt
+++ b/ext/gmp/tests/gmp_sqrtrem.phpt
diff --git a/ext/gmp/tests/005.phpt b/ext/gmp/tests/gmp_strval.phpt
index 79fd73ecf8..79fd73ecf8 100644
--- a/ext/gmp/tests/005.phpt
+++ b/ext/gmp/tests/gmp_strval.phpt
diff --git a/ext/gmp/tests/006.phpt b/ext/gmp/tests/gmp_sub.phpt
index e1d9df67db..e1d9df67db 100644
--- a/ext/gmp/tests/006.phpt
+++ b/ext/gmp/tests/gmp_sub.phpt
diff --git a/ext/gmp/tests/039.phpt b/ext/gmp/tests/gmp_testbit.phpt
index 399c511370..ab40abed7f 100644
--- a/ext/gmp/tests/039.phpt
+++ b/ext/gmp/tests/gmp_testbit.phpt
@@ -5,6 +5,8 @@ gmp_testbit() basic tests
--FILE--
<?php
+var_dump(gmp_testbit());
+
$n = gmp_init(0);
var_dump(gmp_testbit($n, -10));
var_dump(gmp_testbit($n, 0));
@@ -38,6 +40,9 @@ var_dump(gmp_strval($n));
echo "Done\n";
?>
--EXPECTF--
+Warning: gmp_testbit() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
bool(false)
bool(false)
diff --git a/ext/gmp/tests/032.phpt b/ext/gmp/tests/gmp_xor.phpt
index 2b0d29a620..2b0d29a620 100644
--- a/ext/gmp/tests/032.phpt
+++ b/ext/gmp/tests/gmp_xor.phpt
diff --git a/ext/gmp/tests/overloading.phpt b/ext/gmp/tests/overloading.phpt
index 0d8f5cfedb..3520f58bdc 100644
--- a/ext/gmp/tests/overloading.phpt
+++ b/ext/gmp/tests/overloading.phpt
@@ -16,6 +16,10 @@ var_dump($a - $b);
var_dump($a - 17);
var_dump(42 - $b);
+var_dump($a * $b);
+var_dump($a * 17);
+var_dump(42 * $b);
+
var_dump($a / $b);
var_dump($a / 17);
var_dump(42 / $b);
@@ -26,7 +30,9 @@ var_dump($a % 17);
var_dump(42 % $b);
var_dump($a % 0);
-// sl, sr
+var_dump($a ** $b);
+var_dump($a ** 17);
+var_dump(42 ** $b);
var_dump($a | $b);
var_dump($a | 17);
@@ -47,6 +53,9 @@ var_dump(42 << $b);
var_dump($a >> 2);
var_dump(-$a >> 2);
+var_dump($a << -1);
+var_dump($a >> -1);
+
var_dump(~$a);
var_dump(-$a);
var_dump(+$a);
@@ -83,9 +92,14 @@ var_dump(--$a);
var_dump($a--);
var_dump($a);
-$x = gmp_init(3);
-$y = gmp_init(2);
-var_dump($x ** $y);
+// Test operator that was not overloaded
+
+var_dump($a . $b);
+var_dump($a . '17');
+var_dump('42' . $b);
+
+$a .= '17';
+var_dump($a);
?>
--EXPECTF--
@@ -115,6 +129,18 @@ object(GMP)#%d (1) {
}
object(GMP)#%d (1) {
["num"]=>
+ string(3) "714"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(3) "714"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(3) "714"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
string(1) "2"
}
object(GMP)#%d (1) {
@@ -145,6 +171,18 @@ Warning: main(): Zero operand not allowed in %s on line %d
bool(false)
object(GMP)#%d (1) {
["num"]=>
+ string(28) "3937657486715347520027492352"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(28) "3937657486715347520027492352"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
+ string(28) "3937657486715347520027492352"
+}
+object(GMP)#%d (1) {
+ ["num"]=>
string(2) "59"
}
object(GMP)#%d (1) {
@@ -199,6 +237,12 @@ object(GMP)#%d (1) {
["num"]=>
string(3) "-11"
}
+
+Warning: main(): Shift cannot be negative in %s on line %d
+bool(false)
+
+Warning: main(): Shift cannot be negative in %s on line %d
+bool(false)
object(GMP)#%d (1) {
["num"]=>
string(3) "-43"
@@ -260,7 +304,7 @@ object(GMP)#%d (1) {
["num"]=>
string(2) "42"
}
-object(GMP)#%d (1) {
- ["num"]=>
- string(1) "9"
-}
+string(4) "4217"
+string(4) "4217"
+string(4) "4217"
+string(4) "4217"
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 07e63d3f65..406f074da3 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -86,7 +86,7 @@ static struct mhash_bc_entry mhash_to_hash[MHASH_NUM_ALGOS] = {
/* Hash Registry Access */
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len) /* {{{ */
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, size_t algo_len) /* {{{ */
{
char *lower = zend_str_tolower_dup(algo, algo_len);
php_hash_ops *ops = zend_hash_str_find_ptr(&php_hash_hashtable, lower, algo_len);
@@ -120,7 +120,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
{
zend_string *digest;
char *algo, *data;
- int algo_len, data_len;
+ size_t algo_len, data_len;
zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
@@ -161,7 +161,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
ops->hash_update(context, (unsigned char *) data, data_len);
}
- digest = STR_ALLOC(ops->digest_size, 0);
+ digest = zend_string_alloc(ops->digest_size, 0);
ops->hash_final((unsigned char *) digest->val, context);
efree(context);
@@ -169,11 +169,11 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
digest->val[ops->digest_size] = 0;
RETURN_STR(digest);
} else {
- zend_string *hex_digest = STR_SAFE_ALLOC(ops->digest_size, 2, 0, 0);
+ zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
hex_digest->val[2 * ops->digest_size] = 0;
- STR_RELEASE(digest);
+ zend_string_release(digest);
RETURN_STR(hex_digest);
}
}
@@ -211,7 +211,7 @@ static inline void php_hash_string_xor(unsigned char *out, const unsigned char *
}
}
-static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *ops, void *context, const unsigned char *key, const int key_len) {
+static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *ops, void *context, const unsigned char *key, const size_t key_len) {
memset(K, 0, ops->block_size);
if (key_len > ops->block_size) {
/* Reduce the key first */
@@ -225,7 +225,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *
php_hash_string_xor_char(K, K, 0x36, ops->block_size);
}
-static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const php_int_t data_size) {
+static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const zend_long data_size) {
ops->hash_init(context);
ops->hash_update(context, key, ops->block_size);
ops->hash_update(context, data, data_size);
@@ -237,7 +237,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
zend_string *digest;
char *algo, *data, *key;
unsigned char *K;
- int algo_len, data_len, key_len;
+ size_t algo_len, data_len, key_len;
zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
@@ -264,7 +264,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
context = emalloc(ops->context_size);
K = emalloc(ops->block_size);
- digest = STR_ALLOC(ops->digest_size, 0);
+ digest = zend_string_alloc(ops->digest_size, 0);
php_hash_hmac_prep_key(K, ops, context, (unsigned char *) key, key_len);
@@ -287,7 +287,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
php_hash_hmac_round((unsigned char *) digest->val, ops, context, K, (unsigned char *) digest->val, ops->digest_size);
/* Zero the key */
- memset(K, 0, ops->block_size);
+ ZEND_SECURE_ZERO(K, ops->block_size);
efree(K);
efree(context);
@@ -295,11 +295,11 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
digest->val[ops->digest_size] = 0;
RETURN_STR(digest);
} else {
- zend_string *hex_digest = STR_SAFE_ALLOC(ops->digest_size, 2, 0, 0);
+ zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
hex_digest->val[2 * ops->digest_size] = 0;
- STR_RELEASE(digest);
+ zend_string_release(digest);
RETURN_STR(hex_digest);
}
}
@@ -329,13 +329,14 @@ Initialize a hashing context */
PHP_FUNCTION(hash_init)
{
char *algo, *key = NULL;
- int algo_len, key_len = 0, argc = ZEND_NUM_ARGS();
- php_int_t options = 0;
+ size_t algo_len, key_len = 0;
+ int argc = ZEND_NUM_ARGS();
+ zend_long options = 0;
void *context;
const php_hash_ops *ops;
php_hash_data *hash;
- if (zend_parse_parameters(argc TSRMLS_CC, "s|is", &algo, &algo_len, &options, &key, &key_len) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, &options, &key, &key_len) == FAILURE) {
return;
}
@@ -396,7 +397,7 @@ PHP_FUNCTION(hash_update)
zval *zhash;
php_hash_data *hash;
char *data;
- int data_len;
+ size_t data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &zhash, &data, &data_len) == FAILURE) {
return;
@@ -417,9 +418,9 @@ PHP_FUNCTION(hash_update_stream)
zval *zhash, *zstream;
php_hash_data *hash;
php_stream *stream = NULL;
- php_int_t length = -1, didread = 0;
+ zend_long length = -1, didread = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &zhash, &zstream, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zhash, &zstream, &length) == FAILURE) {
return;
}
@@ -428,7 +429,7 @@ PHP_FUNCTION(hash_update_stream)
while (length) {
char buf[1024];
- php_int_t n, toread = 1024;
+ zend_long n, toread = 1024;
if (length > 0 && toread > length) {
toread = length;
@@ -436,14 +437,14 @@ PHP_FUNCTION(hash_update_stream)
if ((n = php_stream_read(stream, buf, toread)) <= 0) {
/* Nada mas */
- RETURN_INT(didread);
+ RETURN_LONG(didread);
}
hash->ops->hash_update(hash->context, (unsigned char *) buf, n);
length -= n;
didread += n;
}
- RETURN_INT(didread);
+ RETURN_LONG(didread);
}
/* }}} */
@@ -456,7 +457,7 @@ PHP_FUNCTION(hash_update_file)
php_stream_context *context;
php_stream *stream;
char *filename, buf[1024];
- int filename_len, n;
+ size_t filename_len, n;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
return;
@@ -497,7 +498,7 @@ PHP_FUNCTION(hash_final)
ZEND_FETCH_RESOURCE(hash, php_hash_data*, zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
digest_len = hash->ops->digest_size;
- digest = STR_ALLOC(digest_len, 0);
+ digest = zend_string_alloc(digest_len, 0);
hash->ops->hash_final((unsigned char *) digest->val, hash->context);
if (hash->options & PHP_HASH_HMAC) {
int i;
@@ -514,7 +515,7 @@ PHP_FUNCTION(hash_final)
hash->ops->hash_final((unsigned char *) digest->val, hash->context);
/* Zero the key */
- memset(hash->key, 0, hash->ops->block_size);
+ ZEND_SECURE_ZERO(hash->key, hash->ops->block_size);
efree(hash->key);
hash->key = NULL;
}
@@ -534,11 +535,11 @@ PHP_FUNCTION(hash_final)
if (raw_output) {
RETURN_STR(digest);
} else {
- zend_string *hex_digest = STR_SAFE_ALLOC(digest_len, 2, 0, 0);
+ zend_string *hex_digest = zend_string_safe_alloc(digest_len, 2, 0, 0);
php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, digest_len);
hex_digest->val[2 * digest_len] = 0;
- STR_RELEASE(digest);
+ zend_string_release(digest);
RETURN_STR(hex_digest);
}
}
@@ -589,7 +590,7 @@ PHP_FUNCTION(hash_algos)
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&php_hash_hashtable, str) {
- add_next_index_str(return_value, STR_COPY(str));
+ add_next_index_str(return_value, zend_string_copy(str));
} ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -602,13 +603,13 @@ PHP_FUNCTION(hash_pbkdf2)
zend_string *returnval;
char *algo, *salt, *pass = NULL;
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL;
- php_int_t loops, i, j, algo_len, pass_len, iterations, length = 0, digest_length = 0;
- int salt_len = 0;
+ zend_long loops, i, j, iterations, digest_length = 0, length = 0;
+ size_t algo_len, pass_len, salt_len = 0;
zend_bool raw_output = 0;
const php_hash_ops *ops;
void *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|ib", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
return;
}
@@ -619,17 +620,17 @@ PHP_FUNCTION(hash_pbkdf2)
}
if (iterations <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: " ZEND_INT_FMT, iterations);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations);
RETURN_FALSE;
}
if (length < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: " ZEND_INT_FMT, length);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
RETURN_FALSE;
}
if (salt_len > INT_MAX - 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %d supplied", salt_len);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %zd supplied", salt_len);
RETURN_FALSE;
}
@@ -655,10 +656,10 @@ PHP_FUNCTION(hash_pbkdf2)
}
digest_length = length;
if (!raw_output) {
- digest_length = (php_int_t) ceil((float) length / 2.0);
+ digest_length = (zend_long) ceil((float) length / 2.0);
}
- loops = (php_int_t) ceil((float) digest_length / (float) ops->digest_size);
+ loops = (zend_long) ceil((float) digest_length / (float) ops->digest_size);
result = safe_emalloc(loops, ops->digest_size, 0);
@@ -674,7 +675,7 @@ PHP_FUNCTION(hash_pbkdf2)
computed_salt[salt_len + 2] = (unsigned char) ((i & 0xFF00) >> 8);
computed_salt[salt_len + 3] = (unsigned char) (i & 0xFF);
- php_hash_hmac_round(digest, ops, context, K1, computed_salt, (php_int_t) salt_len + 4);
+ php_hash_hmac_round(digest, ops, context, K1, computed_salt, (zend_long) salt_len + 4);
php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size);
/* } */
@@ -697,9 +698,9 @@ PHP_FUNCTION(hash_pbkdf2)
memcpy(result + ((i - 1) * ops->digest_size), temp, ops->digest_size);
}
/* Zero potentially sensitive variables */
- memset(K1, 0, ops->block_size);
- memset(K2, 0, ops->block_size);
- memset(computed_salt, 0, salt_len + 4);
+ ZEND_SECURE_ZERO(K1, ops->block_size);
+ ZEND_SECURE_ZERO(K2, ops->block_size);
+ ZEND_SECURE_ZERO(computed_salt, salt_len + 4);
efree(K1);
efree(K2);
efree(computed_salt);
@@ -707,7 +708,7 @@ PHP_FUNCTION(hash_pbkdf2)
efree(digest);
efree(temp);
- returnval = STR_ALLOC(length, 0);
+ returnval = zend_string_alloc(length, 0);
if (raw_output) {
memcpy(returnval->val, result, length);
} else {
@@ -743,7 +744,7 @@ PHP_FUNCTION(hash_equals)
RETURN_FALSE;
}
- if (Z_STRSIZE_P(known_zval) != Z_STRSIZE_P(user_zval)) {
+ if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) {
RETURN_FALSE;
}
@@ -751,7 +752,7 @@ PHP_FUNCTION(hash_equals)
user_str = Z_STRVAL_P(user_zval);
/* This is security sensitive code. Do not optimize this for speed. */
- for (j = 0; j < Z_STRSIZE_P(known_zval); j++) {
+ for (j = 0; j < Z_STRLEN_P(known_zval); j++) {
result |= known_str[j] ^ user_str[j];
}
@@ -819,7 +820,7 @@ static void mhash_init(INIT_FUNC_ARGS)
}
len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name));
- zend_register_int_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
+ zend_register_long_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
}
zend_register_internal_module(&mhash_module_entry TSRMLS_CC);
}
@@ -829,15 +830,15 @@ static void mhash_init(INIT_FUNC_ARGS)
PHP_FUNCTION(mhash)
{
zval *z_algorithm;
- php_int_t algorithm;
+ zend_long algorithm;
if (zend_parse_parameters(1 TSRMLS_CC, "z", &z_algorithm) == FAILURE) {
return;
}
SEPARATE_ZVAL(z_algorithm);
- convert_to_int_ex(z_algorithm);
- algorithm = Z_IVAL_P(z_algorithm);
+ convert_to_long_ex(z_algorithm);
+ algorithm = Z_LVAL_P(z_algorithm);
/* need to convert the first parameter from int constant to string algorithm name */
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
@@ -861,9 +862,9 @@ PHP_FUNCTION(mhash)
Gets the name of hash */
PHP_FUNCTION(mhash_get_hash_name)
{
- php_int_t algorithm;
+ zend_long algorithm;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) {
return;
}
@@ -884,7 +885,7 @@ PHP_FUNCTION(mhash_count)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- RETURN_INT(MHASH_NUM_ALGOS - 1);
+ RETURN_LONG(MHASH_NUM_ALGOS - 1);
}
/* }}} */
@@ -892,9 +893,9 @@ PHP_FUNCTION(mhash_count)
Gets the block size of hash */
PHP_FUNCTION(mhash_get_block_size)
{
- php_int_t algorithm;
+ zend_long algorithm;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) {
return;
}
RETVAL_FALSE;
@@ -904,7 +905,7 @@ PHP_FUNCTION(mhash_get_block_size)
if (algorithm_lookup.mhash_name) {
const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name));
if (ops) {
- RETVAL_INT(ops->digest_size);
+ RETVAL_LONG(ops->digest_size);
}
}
}
@@ -917,13 +918,13 @@ PHP_FUNCTION(mhash_get_block_size)
Generates a key using hash functions */
PHP_FUNCTION(mhash_keygen_s2k)
{
- php_int_t algorithm, l_bytes;
+ zend_long algorithm, l_bytes;
int bytes;
char *password, *salt;
- int password_len, salt_len;
+ size_t password_len, salt_len;
char padded_salt[SALT_SIZE];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "issi", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) {
return;
}
@@ -974,7 +975,7 @@ PHP_FUNCTION(mhash_keygen_s2k)
}
RETVAL_STRINGL(key, bytes);
- memset(key, 0, bytes);
+ ZEND_SECURE_ZERO(key, bytes);
efree(digest);
efree(context);
efree(key);
@@ -1044,7 +1045,7 @@ PHP_MINIT_FUNCTION(hash)
PHP_HASH_HAVAL_REGISTER(5,224);
PHP_HASH_HAVAL_REGISTER(5,256);
- REGISTER_INT_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT);
#ifdef PHP_MHASH_BC
mhash_init(INIT_FUNC_ARGS_PASSTHRU);
diff --git a/ext/hash/hash_adler32.c b/ext/hash/hash_adler32.c
index af5ff82de0..22ab2f29ac 100644
--- a/ext/hash/hash_adler32.c
+++ b/ext/hash/hash_adler32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/hash_crc32.c b/ext/hash/hash_crc32.c
index 7e748df559..7e9a78e4a6 100644
--- a/ext/hash/hash_crc32.c
+++ b/ext/hash/hash_crc32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/hash_fnv.c b/ext/hash/hash_fnv.c
index 1c92478259..8433678ba9 100644
--- a/ext/hash/hash_fnv.c
+++ b/ext/hash/hash_fnv.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index bda9579830..9fb8f2a5fb 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -281,7 +281,7 @@ PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *inp
}
memcpy(context->buffer, input + i, r);
- memset(&context->buffer[r], 0, 32 - r);
+ ZEND_SECURE_ZERO(&context->buffer[r], 32 - r);
context->length = r;
}
}
@@ -306,7 +306,7 @@ PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context)
digest[j + 3] = (unsigned char) ((context->state[i] >> 24) & 0xff);
}
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
const php_hash_ops php_hash_gost_ops = {
diff --git a/ext/hash/hash_haval.c b/ext/hash/hash_haval.c
index 32437cecdf..bc62954e6f 100644
--- a/ext/hash/hash_haval.c
+++ b/ext/hash/hash_haval.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -169,7 +169,7 @@ static void PHP_3HAVALTransform(php_hash_uint32 state[8], const unsigned char bl
}
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -206,7 +206,7 @@ static void PHP_4HAVALTransform(php_hash_uint32 state[8], const unsigned char bl
}
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -245,7 +245,7 @@ static void PHP_5HAVALTransform(php_hash_uint32 state[8], const unsigned char bl
}
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -368,7 +368,7 @@ PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -422,7 +422,7 @@ PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -462,7 +462,7 @@ PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -503,7 +503,7 @@ PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -537,7 +537,7 @@ PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * conte
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
diff --git a/ext/hash/hash_joaat.c b/ext/hash/hash_joaat.c
index cfeab863de..84f65b7609 100644
--- a/ext/hash/hash_joaat.c
+++ b/ext/hash/hash_joaat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/hash_md.c b/ext/hash/hash_md.c
index ebd357d2f7..98891f3b77 100644
--- a/ext/hash/hash_md.c
+++ b/ext/hash/hash_md.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -106,7 +106,7 @@ PHP_HASH_API void make_digest(char *md5str, unsigned char *digest)
PHP_NAMED_FUNCTION(php_if_md5)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_bool raw_output = 0;
char md5str[33];
PHP_MD5_CTX context;
@@ -344,7 +344,7 @@ PHP_HASH_API void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -437,7 +437,7 @@ const unsigned char block[64];
state[3] += d;
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -602,7 +602,7 @@ PHP_HASH_API void PHP_MD4Final(unsigned char digest[16], PHP_MD4_CTX * context)
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
diff --git a/ext/hash/hash_ripemd.c b/ext/hash/hash_ripemd.c
index 16fbd12b18..740cb78220 100644
--- a/ext/hash/hash_ripemd.c
+++ b/ext/hash/hash_ripemd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -244,7 +244,7 @@ static void RIPEMD128Transform(php_hash_uint32 state[4], const unsigned char blo
state[0] = tmp;
tmp = 0;
- memset(x, 0, sizeof(x));
+ ZEND_SECURE_ZERO(x, sizeof(x));
}
/* }}} */
@@ -342,7 +342,7 @@ static void RIPEMD256Transform(php_hash_uint32 state[8], const unsigned char blo
state[7] += dd;
tmp = 0;
- memset(x, 0, sizeof(x));
+ ZEND_SECURE_ZERO(x, sizeof(x));
}
/* }}} */
@@ -441,7 +441,7 @@ static void RIPEMD160Transform(php_hash_uint32 state[5], const unsigned char blo
state[0] = tmp;
tmp = 0;
- memset(x, 0, sizeof(x));
+ ZEND_SECURE_ZERO(x, sizeof(x));
}
/* }}} */
@@ -549,7 +549,7 @@ static void RIPEMD320Transform(php_hash_uint32 state[10], const unsigned char bl
state[9] += ee;
tmp = 0;
- memset(x, 0, sizeof(x));
+ ZEND_SECURE_ZERO(x, sizeof(x));
}
/* }}} */
@@ -650,7 +650,7 @@ PHP_HASH_API void PHP_RIPEMD128Final(unsigned char digest[16], PHP_RIPEMD128_CTX
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -687,7 +687,7 @@ PHP_HASH_API void PHP_RIPEMD256Final(unsigned char digest[32], PHP_RIPEMD256_CTX
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -724,7 +724,7 @@ PHP_HASH_API void PHP_RIPEMD160Final(unsigned char digest[20], PHP_RIPEMD160_CTX
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -761,7 +761,7 @@ PHP_HASH_API void PHP_RIPEMD320Final(unsigned char digest[40], PHP_RIPEMD320_CTX
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
diff --git a/ext/hash/hash_sha.c b/ext/hash/hash_sha.c
index f39567e6dd..003f05a774 100644
--- a/ext/hash/hash_sha.c
+++ b/ext/hash/hash_sha.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -89,7 +89,7 @@ PHP_HASH_API void make_sha1_digest(char *sha1str, unsigned char *digest)
PHP_FUNCTION(sha1)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_bool raw_output = 0;
char sha1str[41];
PHP_SHA1_CTX context;
@@ -321,7 +321,7 @@ static void SHA1Transform(php_hash_uint32 state[5], const unsigned char block[64
state[4] += e;
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -400,7 +400,7 @@ PHP_HASH_API void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -511,7 +511,7 @@ static void SHA256Transform(php_hash_uint32 state[8], const unsigned char block[
state[7] += h;
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -607,7 +607,7 @@ PHP_HASH_API void PHP_SHA224Final(unsigned char digest[28], PHP_SHA224_CTX * con
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -684,7 +684,7 @@ PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * con
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -821,7 +821,7 @@ static void SHA512Transform(php_hash_uint64 state[8], const unsigned char block[
state[7] += h;
/* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
+ ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
}
/* }}} */
@@ -906,7 +906,7 @@ PHP_HASH_API void PHP_SHA384Final(unsigned char digest[48], PHP_SHA384_CTX * con
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
@@ -1020,7 +1020,7 @@ PHP_HASH_API void PHP_SHA512Final(unsigned char digest[64], PHP_SHA512_CTX * con
/* Zeroize sensitive information.
*/
- memset((unsigned char*) context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
}
/* }}} */
diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index 2cf37998ad..c35fee3c29 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -166,7 +166,7 @@ PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char
}
memcpy(context->buffer, input + i, r);
- memset(&context->buffer[r], 0, 32 - r);
+ ZEND_SECURE_ZERO(&context->buffer[r], 32 - r);
context->length = r;
}
}
@@ -190,7 +190,7 @@ PHP_HASH_API void PHP_SNEFRUFinal(unsigned char digest[32], PHP_SNEFRU_CTX *cont
digest[j + 3] = (unsigned char) (context->state[i] & 0xff);
}
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
const php_hash_ops php_hash_snefru_ops = {
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 78f932a745..78f42b3ec7 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -207,7 +207,7 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
i = 64 - context->length;
memcpy(&context->buffer[context->length], input, i);
tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
- memset(context->buffer, 0, 64);
+ ZEND_SECURE_ZERO(context->buffer, 64);
context->passed += 512;
}
@@ -216,7 +216,7 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
context->passed += 512;
}
- memset(&context->buffer[r], 0, 64-r);
+ ZEND_SECURE_ZERO(&context->buffer[r], 64-r);
memcpy(context->buffer, &input[i], r);
context->length = r;
}
@@ -226,21 +226,21 @@ PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *con
{
TigerFinalize(context);
TigerDigest(digest, 16, context);
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context)
{
TigerFinalize(context);
TigerDigest(digest, 20, context);
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context)
{
TigerFinalize(context);
TigerDigest(digest, 24, context);
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
#define PHP_HASH_TIGER_OPS(p, b) \
diff --git a/ext/hash/hash_whirlpool.c b/ext/hash/hash_whirlpool.c
index ca41e523d0..b20dc82c17 100644
--- a/ext/hash/hash_whirlpool.c
+++ b/ext/hash/hash_whirlpool.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -263,8 +263,8 @@ static void WhirlpoolTransform(PHP_WHIRLPOOL_CTX *context)
context->state[5] ^= state[5] ^ block[5];
context->state[6] ^= state[6] ^ block[6];
context->state[7] ^= state[7] ^ block[7];
-
- memset(state, 0, sizeof(state));
+
+ ZEND_SECURE_ZERO(state, sizeof(state));
}
PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *context)
@@ -430,7 +430,7 @@ PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char digest[64], PHP_WHIRLPOOL_CTX
digest += 8;
}
- memset(context, 0, sizeof(*context));
+ ZEND_SECURE_ZERO(context, sizeof(*context));
}
const php_hash_ops php_hash_whirlpool_ops = {
diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h
index e8c1543055..0fd0490f61 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -55,7 +55,7 @@ typedef struct _php_hash_data {
const php_hash_ops *ops;
void *context;
- php_int_t options;
+ zend_long options;
unsigned char *key;
} php_hash_data;
@@ -138,7 +138,7 @@ PHP_FUNCTION(hash_algos);
PHP_FUNCTION(hash_pbkdf2);
PHP_FUNCTION(hash_equals);
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, size_t algo_len);
PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops);
PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context);
diff --git a/ext/hash/php_hash_adler32.h b/ext/hash/php_hash_adler32.h
index ca78b38a13..73ef1067a1 100644
--- a/ext/hash/php_hash_adler32.h
+++ b/ext/hash/php_hash_adler32.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_crc32.h b/ext/hash/php_hash_crc32.h
index cc61243c30..fbd39e93df 100644
--- a/ext/hash/php_hash_crc32.h
+++ b/ext/hash/php_hash_crc32.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_crc32_tables.h b/ext/hash/php_hash_crc32_tables.h
index 30f5602287..889e4f667f 100644
--- a/ext/hash/php_hash_crc32_tables.h
+++ b/ext/hash/php_hash_crc32_tables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_fnv.h b/ext/hash/php_hash_fnv.h
index 10023fc618..40005f2ead 100644
--- a/ext/hash/php_hash_fnv.h
+++ b/ext/hash/php_hash_fnv.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h
index cd3f9cfe90..f1fda06c72 100644
--- a/ext/hash/php_hash_gost.h
+++ b/ext/hash/php_hash_gost.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_haval.h b/ext/hash/php_hash_haval.h
index 4a37815daf..1fafe5742e 100644
--- a/ext/hash/php_hash_haval.h
+++ b/ext/hash/php_hash_haval.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_joaat.h b/ext/hash/php_hash_joaat.h
index 494e7eb09a..d722efcae6 100644
--- a/ext/hash/php_hash_joaat.h
+++ b/ext/hash/php_hash_joaat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_md.h b/ext/hash/php_hash_md.h
index 473abee66c..cfb696a323 100644
--- a/ext/hash/php_hash_md.h
+++ b/ext/hash/php_hash_md.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_ripemd.h b/ext/hash/php_hash_ripemd.h
index b564b3a17c..8eae0107b3 100644
--- a/ext/hash/php_hash_ripemd.h
+++ b/ext/hash/php_hash_ripemd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h
index bd24fb0974..6517619f17 100644
--- a/ext/hash/php_hash_sha.h
+++ b/ext/hash/php_hash_sha.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_snefru.h b/ext/hash/php_hash_snefru.h
index 214edb1982..d36e34df47 100644
--- a/ext/hash/php_hash_snefru.h
+++ b/ext/hash/php_hash_snefru.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_snefru_tables.h b/ext/hash/php_hash_snefru_tables.h
index ef92453031..89fae8bd69 100644
--- a/ext/hash/php_hash_snefru_tables.h
+++ b/ext/hash/php_hash_snefru_tables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_tiger.h b/ext/hash/php_hash_tiger.h
index fd602d6819..f8d6a738d7 100644
--- a/ext/hash/php_hash_tiger.h
+++ b/ext/hash/php_hash_tiger.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_tiger_tables.h b/ext/hash/php_hash_tiger_tables.h
index f3e726f80c..3cf9846803 100644
--- a/ext/hash/php_hash_tiger_tables.h
+++ b/ext/hash/php_hash_tiger_tables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_whirlpool.h b/ext/hash/php_hash_whirlpool.h
index d28b1d927c..15882c6a07 100644
--- a/ext/hash/php_hash_whirlpool.h
+++ b/ext/hash/php_hash_whirlpool.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/hash/php_hash_whirlpool_tables.h b/ext/hash/php_hash_whirlpool_tables.h
index 4951636003..4599f82444 100644
--- a/ext/hash/php_hash_whirlpool_tables.h
+++ b/ext/hash/php_hash_whirlpool_tables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 6eb0fc0701..d425f6cf1e 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -55,12 +55,12 @@
#undef iconv
#endif
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/base64.h"
#include "ext/standard/quot_print.h"
#define _php_iconv_memequal(a, b, c) \
- ((c) == sizeof(php_uint_t) ? *((php_uint_t *)(a)) == *((php_uint_t *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0))
+ ((c) == sizeof(zend_ulong) ? *((zend_ulong *)(a)) == *((zend_ulong *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0))
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)
@@ -196,13 +196,13 @@ static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd
static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, const char *in_charset TSRMLS_DC);
-static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc);
+static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_t nbytes, const char *enc);
-static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc);
+static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, zend_long offset, zend_long len, const char *enc);
-static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, php_int_t offset, const char *enc);
+static php_iconv_err_t _php_iconv_strpos(size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, zend_long offset, const char *enc);
-static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc);
+static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc);
static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode);
@@ -223,39 +223,39 @@ static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
static PHP_INI_MH(OnUpdateInputEncoding)
{
- if (new_value_length >= ICONV_CSNMAXLEN) {
+ if (new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.input_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
static PHP_INI_MH(OnUpdateOutputEncoding)
{
- if(new_value_length >= ICONV_CSNMAXLEN) {
+ if(new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.output_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
static PHP_INI_MH(OnUpdateInternalEncoding)
{
- if(new_value_length >= ICONV_CSNMAXLEN) {
+ if(new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.internal_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
@@ -300,8 +300,8 @@ PHP_MINIT_FUNCTION(miconv)
#endif
REGISTER_STRING_CONSTANT("ICONV_VERSION", version, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT);
if (php_iconv_stream_filter_register_factory(TSRMLS_C) != PHP_ICONV_ERR_SUCCESS) {
return FAILURE;
@@ -326,31 +326,15 @@ PHP_MSHUTDOWN_FUNCTION(miconv)
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(miconv)
{
- char *iconv_impl;
- char *version = "unknown";
+ zval *iconv_impl, *iconv_ver;
-#ifdef PHP_ICONV_IMPL
- iconv_impl = PHP_ICONV_IMPL;
-#elif HAVE_LIBICONV
- iconv_impl = "libiconv";
- {
- static char buf[16];
- snprintf(buf, sizeof(buf), "%d.%d",
- ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f));
- version = buf;
- }
-#elif defined(NETWARE)
- iconv_impl = "Novell";
- version = "OS built-in";
-#else
- iconv_impl = "unknown";
- version = (char *)gnu_get_libc_version();
-#endif
+ iconv_impl = zend_get_constant_str("ICONV_IMPL", sizeof("ICONV_IMPL")-1 TSRMLS_CC);
+ iconv_ver = zend_get_constant_str("ICONV_VERSION", sizeof("ICONV_VERSION")-1 TSRMLS_CC);
php_info_print_table_start();
php_info_print_table_row(2, "iconv support", "enabled");
- php_info_print_table_row(2, "iconv implementation", iconv_impl);
- php_info_print_table_row(2, "iconv library version", version);
+ php_info_print_table_row(2, "iconv implementation", Z_STRVAL_P(iconv_impl));
+ php_info_print_table_row(2, "iconv library version", Z_STRVAL_P(iconv_ver));
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -431,13 +415,13 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
}
if (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) {
- php_int_t len;
+ size_t len;
char *p = strstr(get_output_encoding(TSRMLS_C), "//");
if (p) {
- len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, (php_size_t)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C));
+ len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, (size_t)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C));
} else {
- len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C));
+ len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C));
}
if (content_type && SUCCESS == sapi_add_header(content_type, len, 0)) {
SG(sapi_headers).send_default_content_type = 0;
@@ -453,7 +437,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
if (out) {
output_context->out.data = estrndup(out->val, out->len);
output_context->out.used = out->len;
- STR_FREE(out);
+ zend_string_free(out);
} else {
output_context->out.data = NULL;
output_context->out.used = 0;
@@ -478,10 +462,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
if (in_p != NULL) {
while (in_left > 0) {
out_left = buf_growth - out_left;
- {
- size_t newlen;
- smart_str_alloc((d), out_left, 0);
- }
+ smart_str_alloc(d, out_left, 0);
out_p = (d)->s->val + (d)->s->len;
@@ -515,10 +496,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
} else {
for (;;) {
out_left = buf_growth - out_left;
- {
- size_t newlen;
- smart_str_alloc((d), out_left, 0);
- }
+ smart_str_alloc(d, out_left, 0);
out_p = (d)->s->val + (d)->s->len;
@@ -580,7 +558,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
return PHP_ICONV_ERR_UNKNOWN;
}
- out_buffer = STR_ALLOC(out_size, 0);
+ out_buffer = zend_string_alloc(out_size, 0);
out_p = out_buffer->val;
#ifdef NETWARE
@@ -591,13 +569,13 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
&out_p, &out_left);
if (result == (size_t)(-1)) {
- STR_FREE(out_buffer);
+ zend_string_free(out_buffer);
return PHP_ICONV_ERR_UNKNOWN;
}
if (out_left < 8) {
size_t pos = out_p - out_buffer->val;
- out_buffer = STR_REALLOC(out_buffer, out_size + 8, 0);
+ out_buffer = zend_string_realloc(out_buffer, out_size + 8, 0);
out_p = out_buffer->val + pos;
out_size += 7;
out_left += 7;
@@ -607,7 +585,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
result = iconv(cd, NULL, NULL, &out_p, &out_left);
if (result == (size_t)(-1)) {
- STR_FREE(out_buffer);
+ zend_string_free(out_buffer);
return PHP_ICONV_ERR_UNKNOWN;
}
@@ -645,7 +623,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
out_left = in_len + 32; /* Avoid realloc() most cases */
out_size = 0;
bsz = out_left;
- out_buf = STR_ALLOC(bsz, 0);
+ out_buf = zend_string_alloc(bsz, 0);
out_p = out_buf->val;
while (in_left > 0) {
@@ -656,7 +634,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
/* converted string is longer than out buffer */
bsz += in_len;
- out_buf = STR_REALLOC(out_buf, bsz, 0);
+ out_buf = zend_string_realloc(out_buf, bsz, 0);
out_p = out_buf->val;
out_p += out_size;
out_left = bsz - out_size;
@@ -678,7 +656,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
if (errno == E2BIG) {
bsz += 16;
- out_buf = STR_REALLOC(out_buf, bsz, 0);
+ out_buf = zend_string_realloc(out_buf, bsz, 0);
out_p = out_buf->val;
out_p += out_size;
out_left = bsz - out_size;
@@ -708,7 +686,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
default:
/* other error */
retval = PHP_ICONV_ERR_UNKNOWN;
- STR_FREE(out_buf);
+ zend_string_free(out_buf);
return PHP_ICONV_ERR_UNKNOWN;
}
}
@@ -721,7 +699,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
/* }}} */
/* {{{ _php_iconv_strlen() */
-static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc)
+static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_t nbytes, const char *enc)
{
char buf[GENERIC_SUPERSET_NBYTES*2];
@@ -735,9 +713,9 @@ static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, s
char *out_p;
size_t out_left;
- php_size_t cnt;
+ size_t cnt;
- *pretval = (php_size_t)-1;
+ *pretval = (size_t)-1;
cd = iconv_open(GENERIC_SUPERSET_NAME, enc);
@@ -806,7 +784,7 @@ static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, s
/* {{{ _php_iconv_substr() */
static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
- const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc)
+ const char *str, size_t nbytes, zend_long offset, zend_long len, const char *enc)
{
char buf[GENERIC_SUPERSET_NBYTES];
@@ -820,8 +798,8 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
char *out_p;
size_t out_left;
- php_size_t cnt;
- php_int_t total_len;
+ size_t cnt;
+ size_t total_len;
err = _php_iconv_strlen(&total_len, str, nbytes, enc);
if (err != PHP_ICONV_ERR_SUCCESS) {
@@ -840,16 +818,16 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
}
}
- if(len > total_len) {
+ if((size_t)len > total_len) {
len = total_len;
}
- if (offset >= total_len) {
+ if ((size_t)offset >= total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
- if ((offset + len) > total_len ) {
+ if ((size_t)(offset + len) > total_len ) {
/* trying to compute the length */
len = total_len - offset;
}
@@ -890,7 +868,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
}
}
- if ((php_int_t)cnt >= offset) {
+ if ((zend_long)cnt >= offset) {
if (cd2 == (iconv_t)NULL) {
cd2 = iconv_open(enc, GENERIC_SUPERSET_NAME);
@@ -951,10 +929,10 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
/* }}} */
/* {{{ _php_iconv_strpos() */
-static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
+static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
const char *haystk, size_t haystk_nbytes,
const char *ndl, size_t ndl_nbytes,
- php_int_t offset, const char *enc)
+ zend_long offset, const char *enc)
{
char buf[GENERIC_SUPERSET_NBYTES];
@@ -968,21 +946,21 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
char *out_p;
size_t out_left;
- php_size_t cnt;
+ size_t cnt;
zend_string *ndl_buf;
const char *ndl_buf_p;
size_t ndl_buf_left;
- php_size_t match_ofs;
+ size_t match_ofs;
- *pretval = (php_size_t)-1;
+ *pretval = (size_t)-1;
err = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc);
if (err != PHP_ICONV_ERR_SUCCESS) {
if (ndl_buf != NULL) {
- STR_FREE(ndl_buf);
+ zend_string_free(ndl_buf);
}
return err;
}
@@ -991,7 +969,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
if (cd == (iconv_t)(-1)) {
if (ndl_buf != NULL) {
- STR_FREE(ndl_buf);
+ zend_string_free(ndl_buf);
}
#if ICONV_SUPPORTS_ERRNO
if (errno == EINVAL) {
@@ -1006,7 +984,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
ndl_buf_p = ndl_buf->val;
ndl_buf_left = ndl_buf->len;
- match_ofs = (php_size_t)-1;
+ match_ofs = (size_t)-1;
for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) {
size_t prev_in_left;
@@ -1039,9 +1017,9 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
}
}
if (offset >= 0) {
- if (cnt >= (php_size_t)offset) {
+ if (cnt >= (size_t)offset) {
if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {
- if (match_ofs == (php_size_t)-1) {
+ if (match_ofs == (size_t)-1) {
match_ofs = cnt;
}
ndl_buf_p += GENERIC_SUPERSET_NBYTES;
@@ -1051,11 +1029,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
break;
}
} else {
- php_size_t i, j, lim;
+ size_t i, j, lim;
i = 0;
j = GENERIC_SUPERSET_NBYTES;
- lim = (php_size_t)(ndl_buf_p - ndl_buf->val);
+ lim = (size_t)(ndl_buf_p - ndl_buf->val);
while (j < lim) {
if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i],
@@ -1074,7 +1052,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
ndl_buf_p = &ndl_buf->val[i];
ndl_buf_left = ndl_buf->len - i;
} else {
- match_ofs = (php_size_t)-1;
+ match_ofs = (size_t)-1;
ndl_buf_p = ndl_buf->val;
ndl_buf_left = ndl_buf->len;
}
@@ -1082,7 +1060,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
}
} else {
if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {
- if (match_ofs == (php_size_t)-1) {
+ if (match_ofs == (size_t)-1) {
match_ofs = cnt;
}
ndl_buf_p += GENERIC_SUPERSET_NBYTES;
@@ -1094,11 +1072,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
match_ofs = -1;
}
} else {
- php_size_t i, j, lim;
+ size_t i, j, lim;
i = 0;
j = GENERIC_SUPERSET_NBYTES;
- lim = (php_size_t)(ndl_buf_p - ndl_buf->val);
+ lim = (size_t)(ndl_buf_p - ndl_buf->val);
while (j < lim) {
if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i],
@@ -1117,7 +1095,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
ndl_buf_p = &ndl_buf->val[i];
ndl_buf_left = ndl_buf->len - i;
} else {
- match_ofs = (php_size_t)-1;
+ match_ofs = (size_t)-1;
ndl_buf_p = ndl_buf->val;
ndl_buf_left = ndl_buf->len;
}
@@ -1126,7 +1104,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
}
if (ndl_buf) {
- STR_FREE(ndl_buf);
+ zend_string_free(ndl_buf);
}
iconv_close(cd);
@@ -1136,11 +1114,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval,
/* }}} */
/* {{{ _php_iconv_mime_encode() */
-static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc)
+static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc)
{
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
- php_size_t char_cnt = 0;
+ size_t char_cnt = 0;
size_t out_charset_len;
size_t lfchars_len;
char *buf = NULL;
@@ -1335,7 +1313,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
smart_str_appendl(pretval, "?=", sizeof("?=") - 1);
char_cnt -= 2;
- STR_RELEASE(encoded);
+ zend_string_release(encoded);
encoded = NULL;
} break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */
@@ -1454,7 +1432,7 @@ out:
iconv_close(cd_pl);
}
if (encoded != NULL) {
- STR_RELEASE(encoded);
+ zend_string_release(encoded);
}
if (buf != NULL) {
efree(buf);
@@ -1836,7 +1814,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
}
err = _php_iconv_appendl(pretval, decoded_text->val, decoded_text->len, cd);
- STR_RELEASE(decoded_text);
+ zend_string_release(decoded_text);
if (err != PHP_ICONV_ERR_SUCCESS) {
if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {
@@ -2034,12 +2012,12 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset,
PHP_FUNCTION(iconv_strlen)
{
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
+ size_t charset_len = 0;
zend_string *str;
php_iconv_err_t err;
- php_size_t retval;
+ size_t retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|s",
&str, &charset, &charset_len) == FAILURE) {
@@ -2054,7 +2032,7 @@ PHP_FUNCTION(iconv_strlen)
err = _php_iconv_strlen(&retval, str->val, str->len, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
if (err == PHP_ICONV_ERR_SUCCESS) {
- RETVAL_INT(retval);
+ RETVAL_LONG(retval);
} else {
RETVAL_FALSE;
}
@@ -2066,15 +2044,15 @@ PHP_FUNCTION(iconv_strlen)
PHP_FUNCTION(iconv_substr)
{
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
+ size_t charset_len = 0;
zend_string *str;
- php_int_t offset, length = 0;
+ zend_long offset, length = 0;
php_iconv_err_t err;
smart_str retval = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|is",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|ls",
&str, &offset, &length,
&charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -2092,7 +2070,7 @@ PHP_FUNCTION(iconv_substr)
err = _php_iconv_substr(&retval, str->val, str->len, offset, length, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
- if (err == PHP_ICONV_ERR_SUCCESS && str->val != NULL && retval.s != NULL) {
+ if (err == PHP_ICONV_ERR_SUCCESS && str->val[0] != '\0' && retval.s != NULL) {
RETURN_STR(retval.s);
}
smart_str_free(&retval);
@@ -2105,16 +2083,16 @@ PHP_FUNCTION(iconv_substr)
PHP_FUNCTION(iconv_strpos)
{
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
+ size_t charset_len = 0;
zend_string *haystk;
zend_string *ndl;
- php_int_t offset = 0;
+ zend_long offset = 0;
php_iconv_err_t err;
- php_size_t retval;
+ size_t retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|is",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ls",
&haystk, &ndl,
&offset, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -2138,8 +2116,8 @@ PHP_FUNCTION(iconv_strpos)
offset, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
- if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) {
- RETVAL_INT((php_int_t)retval);
+ if (err == PHP_ICONV_ERR_SUCCESS && retval != (size_t)-1) {
+ RETVAL_LONG((zend_long)retval);
} else {
RETVAL_FALSE;
}
@@ -2151,13 +2129,13 @@ PHP_FUNCTION(iconv_strpos)
PHP_FUNCTION(iconv_strrpos)
{
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
+ size_t charset_len = 0;
zend_string *haystk;
zend_string *ndl;
php_iconv_err_t err;
- php_size_t retval;
+ size_t retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|s",
&haystk, &ndl,
@@ -2178,8 +2156,8 @@ PHP_FUNCTION(iconv_strrpos)
-1, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
- if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) {
- RETVAL_INT((php_int_t)retval);
+ if (err == PHP_ICONV_ERR_SUCCESS && retval != (size_t)-1) {
+ RETVAL_LONG((zend_long)retval);
} else {
RETVAL_FALSE;
}
@@ -2199,7 +2177,7 @@ PHP_FUNCTION(iconv_mime_encode)
const char *in_charset = get_internal_encoding(TSRMLS_C);
const char *out_charset = in_charset;
- php_int_t line_len = 76;
+ zend_long line_len = 76;
const char *lfchars = "\r\n";
php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
@@ -2214,7 +2192,7 @@ PHP_FUNCTION(iconv_mime_encode)
zval *pzval;
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) {
- if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) {
+ if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) {
switch (Z_STRVAL_P(pzval)[0]) {
case 'B': case 'b':
scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
@@ -2228,24 +2206,24 @@ PHP_FUNCTION(iconv_mime_encode)
}
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL) {
- if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) {
+ if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
- if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) {
+ if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) {
in_charset = Z_STRVAL_P(pzval);
}
}
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL) {
- if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) {
+ if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
- if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) {
+ if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) {
out_charset = Z_STRVAL_P(pzval);
}
}
@@ -2253,13 +2231,13 @@ PHP_FUNCTION(iconv_mime_encode)
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-length", sizeof("line-length") - 1)) != NULL) {
zval val;
- if (Z_TYPE_P(pzval) != IS_INT) {
+ if (Z_TYPE_P(pzval) != IS_LONG) {
ZVAL_DUP(&val, pzval);
- convert_to_int(&val);
+ convert_to_long(&val);
pzval = &val;
}
- line_len = Z_IVAL_P(pzval);
+ line_len = Z_LVAL_P(pzval);
}
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) {
@@ -2304,14 +2282,14 @@ PHP_FUNCTION(iconv_mime_decode)
{
zend_string *encoded_str;
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
- php_int_t mode = 0;
+ size_t charset_len = 0;
+ zend_long mode = 0;
smart_str retval = {0};
php_iconv_err_t err;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -2344,14 +2322,14 @@ PHP_FUNCTION(iconv_mime_decode_headers)
{
zend_string *encoded_str;
char *charset = get_internal_encoding(TSRMLS_C);
- int charset_len = 0;
- php_int_t mode = 0;
+ size_t charset_len = 0;
+ zend_long mode = 0;
char *enc_str_tmp;
- php_size_t enc_str_len_tmp;
+ size_t enc_str_len_tmp;
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -2423,7 +2401,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
}
}
enc_str_len_tmp -= next_pos - enc_str_tmp;
- enc_str_tmp = next_pos;
+ enc_str_tmp = (char *)next_pos;
smart_str_free(&decoded_header);
}
@@ -2442,7 +2420,7 @@ PHP_NAMED_FUNCTION(php_if_iconv)
{
char *in_charset, *out_charset;
zend_string *in_buffer;
- int in_charset_len = 0, out_charset_len = 0;
+ size_t in_charset_len = 0, out_charset_len = 0;
php_iconv_err_t err;
zend_string *out_buffer;
@@ -2461,7 +2439,7 @@ PHP_NAMED_FUNCTION(php_if_iconv)
RETVAL_STR(out_buffer);
} else {
if (out_buffer != NULL) {
- STR_FREE(out_buffer);
+ zend_string_free(out_buffer);
}
RETURN_FALSE;
}
@@ -2472,30 +2450,31 @@ PHP_NAMED_FUNCTION(php_if_iconv)
Sets internal encoding and output encoding for ob_iconv_handler() */
PHP_FUNCTION(iconv_set_encoding)
{
- char *type, *charset;
- int type_len, charset_len = 0, retval;
+ char *type;
+ zend_string *charset;
+ size_t type_len, retval;
zend_string *name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sS", &type, &type_len, &charset) == FAILURE)
return;
- if (charset_len >= ICONV_CSNMAXLEN) {
+ if (charset->len >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
if(!strcasecmp("input_encoding", type)) {
- name = STR_INIT("iconv.input_encoding", sizeof("iconv.input_encoding") - 1, 0);
+ name = zend_string_init("iconv.input_encoding", sizeof("iconv.input_encoding") - 1, 0);
} else if(!strcasecmp("output_encoding", type)) {
- name = STR_INIT("iconv.output_encoding", sizeof("iconv.output_encoding") - 1, 0);
+ name = zend_string_init("iconv.output_encoding", sizeof("iconv.output_encoding") - 1, 0);
} else if(!strcasecmp("internal_encoding", type)) {
- name = STR_INIT("iconv.internal_encoding", sizeof("iconv.internal_encoding") - 1, 0);
+ name = zend_string_init("iconv.internal_encoding", sizeof("iconv.internal_encoding") - 1, 0);
} else {
RETURN_FALSE;
}
- retval = zend_alter_ini_entry(name, charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(name);
+ retval = zend_alter_ini_entry(name, charset, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(name);
if (retval == SUCCESS) {
RETURN_TRUE;
@@ -2510,7 +2489,7 @@ PHP_FUNCTION(iconv_set_encoding)
PHP_FUNCTION(iconv_get_encoding)
{
char *type = "all";
- php_size_t type_len = sizeof("all")-1;
+ size_t type_len = sizeof("all")-1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE)
return;
@@ -2776,7 +2755,7 @@ static int php_iconv_stream_filter_append_bucket(
prev_ocnt = ocnt;
}
- if (out_buf_size - ocnt > 0) {
+ if (out_buf_size > ocnt) {
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
goto out_failure;
}
diff --git a/ext/iconv/iconv.dsp b/ext/iconv/iconv.dsp
deleted file mode 100644
index 2d66cf00ab..0000000000
--- a/ext/iconv/iconv.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="iconv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=iconv - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak" CFG="iconv - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "iconv - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "iconv - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "iconv - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "ICONV_SUPPORTS_ERRNO" /D "HAVE_LIBICONV" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "iconv - Win32 Release_TS"
-# Name "iconv - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\iconv.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_iconv.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 76e6758588..1a8330ae24 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/imap/imap.dsp b/ext/imap/imap.dsp
deleted file mode 100644
index ef05d49f20..0000000000
--- a/ext/imap/imap.dsp
+++ /dev/null
@@ -1,176 +0,0 @@
-# Microsoft Developer Studio Project File - Name="imap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=imap - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak" CFG="imap - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "imap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "imap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5nts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /out:"Release/php_imap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5nts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_imap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "ZTS" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_imap.dll" /pdbtype:sept /libpath:"..\..\..\\" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\imap\c-client" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /D HAVE_IMAP2001=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib wsock32.lib winmm.lib cclient.lib Secur32.lib CertIdl.Lib /nologo /dll /machine:I386 /nodefaultlib:"LIBCMT" /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\imap"
-# SUBTRACT LINK32 /nodefaultlib
-
-!ENDIF
-
-# Begin Target
-
-# Name "imap - Win32 Release"
-# Name "imap - Win32 Debug"
-# Name "imap - Win32 Debug_TS"
-# Name "imap - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_imap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\sendmail.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_imap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\sendmail.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\IMAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 6e33e463ae..8dc56c5223 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -40,7 +40,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/pcre/php_pcre.h"
#ifdef ERROR
@@ -770,12 +770,12 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
if (strncmp(qlist->name, "STORAGE", 7) == 0)
{
/* this is to add backwards compatibility */
- add_assoc_int_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage);
- add_assoc_int_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit);
+ add_assoc_long_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage);
+ add_assoc_long_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit);
}
- add_assoc_int_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage);
- add_assoc_int_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit);
+ add_assoc_long_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage);
+ add_assoc_long_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit);
add_assoc_zval_ex(return_value, qlist->name, strlen(qlist->name), &t_map);
}
}
@@ -864,7 +864,7 @@ PHP_MINIT_FUNCTION(imap)
#endif
/* lets allow NIL */
- REGISTER_INT_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
/* plug in our gets */
mail_parameters(NIL, SET_GETS, (void *) NIL);
@@ -876,30 +876,30 @@ PHP_MINIT_FUNCTION(imap)
mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) FG(default_socket_timeout));
/* timeout constants */
- REGISTER_INT_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS);
/* Open Options */
- REGISTER_INT_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS);
/* debug protocol negotiations */
- REGISTER_INT_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS);
/* read-only open */
- REGISTER_INT_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS);
/* anonymous open of newsgroup */
- REGISTER_INT_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS);
/* short (elt-only) caching */
- REGISTER_INT_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS);
/* don't pass up events (internal use) */
- REGISTER_INT_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS);
/* return driver prototype */
- REGISTER_INT_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS);
/* half-open (IMAP connect but no select) */
- REGISTER_INT_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
/* silently expunge recycle stream */
- REGISTER_INT_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
/* don't do non-secure authentication */
/*
@@ -910,111 +910,111 @@ PHP_MINIT_FUNCTION(imap)
options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of
this file
*/
- REGISTER_INT_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
/* expunge silently */
/* Fetch options */
- REGISTER_INT_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS);
/* argument is a UID */
- REGISTER_INT_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS);
/* peek at data */
- REGISTER_INT_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS);
/* NOT flag for header lines fetch */
- REGISTER_INT_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS);
/* text can be internal strings */
- REGISTER_INT_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS);
/* IMAP prefetch text when fetching header */
/* Flagging options */
- REGISTER_INT_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS);
/* argument is a UID sequence */
- REGISTER_INT_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS);
/* don't return results */
- REGISTER_INT_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS);
/* set vs. clear */
/* Copy options */
- REGISTER_INT_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS);
/* argument is a UID sequence */
- REGISTER_INT_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS);
/* delete from source after copying */
/* Search/sort options */
- REGISTER_INT_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS);
/* return UID */
- REGISTER_INT_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS);
/* free search program after finished */
- REGISTER_INT_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS);
/* no search prefetching */
- REGISTER_INT_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS);
/* free sort program after finished */
- REGISTER_INT_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS);
/* don't do server-based sort */
/* Status options */
- REGISTER_INT_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS);
/* number of messages */
- REGISTER_INT_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS);
/* number of recent messages */
- REGISTER_INT_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS);
/* number of unseen messages */
- REGISTER_INT_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS);
/* next UID to be assigned */
- REGISTER_INT_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS);
/* UID validity value */
- REGISTER_INT_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS);
/* get all status information */
/* Bits for mm_list() and mm_lsub() */
- REGISTER_INT_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS);
#ifdef LATT_REFERRAL
- REGISTER_INT_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef LATT_HASCHILDREN
- REGISTER_INT_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef LATT_HASNOCHILDREN
- REGISTER_INT_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS);
#endif
/* Sort functions */
- REGISTER_INT_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS);
/* date */
- REGISTER_INT_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS);
/* arrival date */
- REGISTER_INT_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS);
/* from */
- REGISTER_INT_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS);
/* subject */
- REGISTER_INT_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS);
/* to */
- REGISTER_INT_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS);
/* cc */
- REGISTER_INT_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS);
/* size */
- REGISTER_INT_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS);
/*
TYPETEXT unformatted text
TYPEMULTIPART multiple part
@@ -1027,12 +1027,12 @@ PHP_MINIT_FUNCTION(imap)
TYPEOTHER unknown
*/
- REGISTER_INT_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS);
/*
ENC7BIT 7 bit SMTP semantic data
ENC8BIT 8 bit SMTP semantic data
@@ -1042,9 +1042,9 @@ PHP_MINIT_FUNCTION(imap)
ENCOTHER unknown
*/
- REGISTER_INT_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS);
/*
GC_ELT message cache elements
GC_ENV ENVELOPEs and BODYs
@@ -1173,7 +1173,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if ((disabled_auth_method = zend_hash_str_find(HASH_OF(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) {
switch (Z_TYPE_P(disabled_auth_method)) {
case IS_STRING:
- if (Z_STRSIZE_P(disabled_auth_method) > 1) {
+ if (Z_STRLEN_P(disabled_auth_method) > 1) {
mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(disabled_auth_method));
}
break;
@@ -1189,7 +1189,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
for (i = 0; i < nelems; i++) {
if ((z_auth_method = zend_hash_index_find(Z_ARRVAL_P(disabled_auth_method), i)) != NULL) {
if (Z_TYPE_P(z_auth_method) == IS_STRING) {
- if (Z_STRSIZE_P(z_auth_method) > 1) {
+ if (Z_STRLEN_P(z_auth_method) > 1) {
mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(z_auth_method));
}
} else {
@@ -1199,7 +1199,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
break;
- case IS_INT:
+ case IS_LONG:
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings");
break;
@@ -1326,20 +1326,20 @@ PHP_FUNCTION(imap_append)
return;
}
- regex = STR_INIT("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0);
+ regex = zend_string_init("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0);
if (internal_date) {
/* Make sure the given internal_date string matches the RFC specifiedformat */
if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC))== NULL) {
- STR_FREE(regex);
+ zend_string_free(regex);
RETURN_FALSE;
}
- STR_FREE(regex);
+ zend_string_free(regex);
php_pcre_match_impl(pce, internal_date, internal_date_len, return_value, subpats, global,
0, regex_flags, start_offset TSRMLS_CC);
- if (!Z_IVAL_P(return_value)) {
+ if (!Z_LVAL_P(return_value)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
internal_date = NULL;
}
@@ -1370,7 +1370,7 @@ PHP_FUNCTION(imap_num_msg)
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
- RETURN_INT(imap_le_struct->imap_stream->nmsgs);
+ RETURN_LONG(imap_le_struct->imap_stream->nmsgs);
}
/* }}} */
@@ -1404,7 +1404,7 @@ PHP_FUNCTION(imap_num_recent)
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
- RETURN_INT(imap_le_struct->imap_stream->recent);
+ RETURN_LONG(imap_le_struct->imap_stream->recent);
}
/* }}} */
@@ -1906,7 +1906,7 @@ PHP_FUNCTION(imap_list_full)
while (cur != NIL) {
object_init(&mboxob);
add_property_string(&mboxob, "name", (char*)cur->LTEXT);
- add_property_int(&mboxob, "attributes", cur->attributes);
+ add_property_long(&mboxob, "attributes", cur->attributes);
#ifdef IMAP41
delim[0] = (char)cur->delimiter;
delim[1] = 0;
@@ -1981,8 +1981,8 @@ PHP_FUNCTION(imap_check)
add_property_string(return_value, "Date", date);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox);
- add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent);
+ add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
+ add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
} else {
RETURN_FALSE;
}
@@ -2101,7 +2101,7 @@ PHP_FUNCTION(imap_headerinfo)
snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size);
add_property_string(return_value, "Size", dummy);
- add_property_int(return_value, "udate", mail_longdate(cache));
+ add_property_long(return_value, "udate", mail_longdate(cache));
if (en->from && fromlength) {
fulladdress[0] = 0x00;
@@ -2211,7 +2211,7 @@ PHP_FUNCTION(imap_lsub_full)
while (cur != NIL) {
object_init(&mboxob);
add_property_string(&mboxob, "name", (char*)cur->LTEXT);
- add_property_int(&mboxob, "attributes", cur->attributes);
+ add_property_long(&mboxob, "attributes", cur->attributes);
#ifdef IMAP41
delim[0] = (char)cur->delimiter;
delim[1] = 0;
@@ -2424,7 +2424,7 @@ PHP_FUNCTION(imap_savebody)
switch (Z_TYPE_P(out))
{
- case IS_INT:
+ case IS_LONG:
case IS_RESOURCE:
close_stream = 0;
php_stream_from_zval(writer, out);
@@ -2581,15 +2581,15 @@ PHP_FUNCTION(imap_mailboxmsginfo)
}
msize = msize + cache->rfc822_size;
}
- add_property_int(return_value, "Unread", unreadmsg);
- add_property_int(return_value, "Deleted", deletedmsg);
- add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_int(return_value, "Size", msize);
+ add_property_long(return_value, "Unread", unreadmsg);
+ add_property_long(return_value, "Deleted", deletedmsg);
+ add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
+ add_property_long(return_value, "Size", msize);
rfc822_date(date);
add_property_string(return_value, "Date", date);
add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name);
add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox);
- add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent);
+ add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
}
/* }}} */
@@ -2929,7 +2929,7 @@ PHP_FUNCTION(imap_utf7_encode)
}
/* allocate output buffer */
- out = STR_ALLOC(outlen, 0);
+ out = zend_string_alloc(outlen, 0);
/* encode input string */
outp = (unsigned char*)out->val;
@@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_sort)
array_init(return_value);
if (slst != NIL && slst != 0) {
for (sl = slst; *sl; sl++) {
- add_next_index_int(return_value, *sl);
+ add_next_index_long(return_value, *sl);
}
fs_give ((void **) &slst);
}
@@ -3193,7 +3193,7 @@ PHP_FUNCTION(imap_uid)
RETURN_FALSE;
}
- RETURN_INT(mail_uid(imap_le_struct->imap_stream, msgno));
+ RETURN_LONG(mail_uid(imap_le_struct->imap_stream, msgno));
}
/* }}} */
@@ -3211,7 +3211,7 @@ PHP_FUNCTION(imap_msgno)
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
- RETURN_INT(mail_msgno(imap_le_struct->imap_stream, msgno));
+ RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno));
}
/* }}} */
@@ -3234,21 +3234,21 @@ PHP_FUNCTION(imap_status)
object_init(return_value);
if (mail_status(imap_le_struct->imap_stream, mbx, flags)) {
- add_property_int(return_value, "flags", IMAPG(status_flags));
+ add_property_long(return_value, "flags", IMAPG(status_flags));
if (IMAPG(status_flags) & SA_MESSAGES) {
- add_property_int(return_value, "messages", IMAPG(status_messages));
+ add_property_long(return_value, "messages", IMAPG(status_messages));
}
if (IMAPG(status_flags) & SA_RECENT) {
- add_property_int(return_value, "recent", IMAPG(status_recent));
+ add_property_long(return_value, "recent", IMAPG(status_recent));
}
if (IMAPG(status_flags) & SA_UNSEEN) {
- add_property_int(return_value, "unseen", IMAPG(status_unseen));
+ add_property_long(return_value, "unseen", IMAPG(status_unseen));
}
if (IMAPG(status_flags) & SA_UIDNEXT) {
- add_property_int(return_value, "uidnext", IMAPG(status_uidnext));
+ add_property_long(return_value, "uidnext", IMAPG(status_uidnext));
}
if (IMAPG(status_flags) & SA_UIDVALIDITY) {
- add_property_int(return_value, "uidvalidity", IMAPG(status_uidvalidity));
+ add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity));
}
} else {
RETURN_FALSE;
@@ -3288,49 +3288,49 @@ PHP_FUNCTION(imap_bodystruct)
RETURN_FALSE;
}
if (body->type <= TYPEMAX) {
- add_property_int(return_value, "type", body->type);
+ add_property_long(return_value, "type", body->type);
}
if (body->encoding <= ENCMAX) {
- add_property_int(return_value, "encoding", body->encoding);
+ add_property_long(return_value, "encoding", body->encoding);
}
if (body->subtype) {
- add_property_int(return_value, "ifsubtype", 1);
+ add_property_long(return_value, "ifsubtype", 1);
add_property_string(return_value, "subtype", body->subtype);
} else {
- add_property_int(return_value, "ifsubtype", 0);
+ add_property_long(return_value, "ifsubtype", 0);
}
if (body->description) {
- add_property_int(return_value, "ifdescription", 1);
+ add_property_long(return_value, "ifdescription", 1);
add_property_string(return_value, "description", body->description);
} else {
- add_property_int(return_value, "ifdescription", 0);
+ add_property_long(return_value, "ifdescription", 0);
}
if (body->id) {
- add_property_int(return_value, "ifid", 1);
+ add_property_long(return_value, "ifid", 1);
add_property_string(return_value, "id", body->id);
} else {
- add_property_int(return_value, "ifid", 0);
+ add_property_long(return_value, "ifid", 0);
}
if (body->size.lines) {
- add_property_int(return_value, "lines", body->size.lines);
+ add_property_long(return_value, "lines", body->size.lines);
}
if (body->size.bytes) {
- add_property_int(return_value, "bytes", body->size.bytes);
+ add_property_long(return_value, "bytes", body->size.bytes);
}
#ifdef IMAP41
if (body->disposition.type) {
- add_property_int(return_value, "ifdisposition", 1);
+ add_property_long(return_value, "ifdisposition", 1);
add_property_string(return_value, "disposition", body->disposition.type);
} else {
- add_property_int(return_value, "ifdisposition", 0);
+ add_property_long(return_value, "ifdisposition", 0);
}
if (body->disposition.parameter) {
dpar = body->disposition.parameter;
- add_property_int(return_value, "ifdparameters", 1);
+ add_property_long(return_value, "ifdparameters", 1);
array_init(&dparametres);
do {
object_init(&dparam);
@@ -3340,12 +3340,12 @@ PHP_FUNCTION(imap_bodystruct)
} while ((dpar = dpar->next));
add_assoc_object(return_value, "dparameters", &dparametres TSRMLS_CC);
} else {
- add_property_int(return_value, "ifdparameters", 0);
+ add_property_long(return_value, "ifdparameters", 0);
}
#endif
if ((par = body->parameter)) {
- add_property_int(return_value, "ifparameters", 1);
+ add_property_long(return_value, "ifparameters", 1);
array_init(&parametres);
do {
@@ -3361,7 +3361,7 @@ PHP_FUNCTION(imap_bodystruct)
} while ((par = par->next));
} else {
object_init(&parametres);
- add_property_int(return_value, "ifparameters", 0);
+ add_property_long(return_value, "ifparameters", 0);
}
add_assoc_object(return_value, "parameters", &parametres TSRMLS_CC);
}
@@ -3436,16 +3436,16 @@ PHP_FUNCTION(imap_fetch_overview)
if (env->in_reply_to) {
add_property_string(&myoverview, "in_reply_to", env->in_reply_to);
}
- add_property_int(&myoverview, "size", elt->rfc822_size);
- add_property_int(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i));
- add_property_int(&myoverview, "msgno", i);
- add_property_int(&myoverview, "recent", elt->recent);
- add_property_int(&myoverview, "flagged", elt->flagged);
- add_property_int(&myoverview, "answered", elt->answered);
- add_property_int(&myoverview, "deleted", elt->deleted);
- add_property_int(&myoverview, "seen", elt->seen);
- add_property_int(&myoverview, "draft", elt->draft);
- add_property_int(&myoverview, "udate", mail_longdate(elt));
+ add_property_long(&myoverview, "size", elt->rfc822_size);
+ add_property_long(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i));
+ add_property_long(&myoverview, "msgno", i);
+ add_property_long(&myoverview, "recent", elt->recent);
+ add_property_long(&myoverview, "flagged", elt->flagged);
+ add_property_long(&myoverview, "answered", elt->answered);
+ add_property_long(&myoverview, "deleted", elt->deleted);
+ add_property_long(&myoverview, "seen", elt->seen);
+ add_property_long(&myoverview, "draft", elt->draft);
+ add_property_long(&myoverview, "udate", mail_longdate(elt));
add_next_index_object(return_value, &myoverview TSRMLS_CC);
}
}
@@ -3474,7 +3474,7 @@ PHP_FUNCTION(imap_mail_compose)
}
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
- str_copy = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); \
+ str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \
rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
efree(str_copy);
@@ -3530,9 +3530,9 @@ PHP_FUNCTION(imap_mail_compose)
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
custom_headers_param = mail_newbody_parameter();
convert_to_string_ex(env_data);
- custom_headers_param->value = (char *) fs_get(Z_STRSIZE_P(env_data) + 1);
+ custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1);
custom_headers_param->attribute = NULL;
- memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRSIZE_P(env_data) + 1);
+ memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1);
custom_headers_param->next = tmp_param;
tmp_param = custom_headers_param;
} ZEND_HASH_FOREACH_END();
@@ -3553,12 +3553,12 @@ PHP_FUNCTION(imap_mail_compose)
topbod = bod;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->type = (short) Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->type = (short) Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->encoding = (short) Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->encoding = (short) Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3575,8 +3575,8 @@ PHP_FUNCTION(imap_mail_compose)
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(key->val);
convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1);
+ disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
tmp_param = disp_param;
} ZEND_HASH_FOREACH_END();
@@ -3597,8 +3597,8 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1);
+ bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
+ memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
@@ -3607,8 +3607,8 @@ PHP_FUNCTION(imap_mail_compose)
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(key->val);
convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1);
+ disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
tmp_param = disp_param;
} ZEND_HASH_FOREACH_END();
@@ -3617,21 +3617,21 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
- bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1);
- bod->contents.text.size = Z_STRSIZE_P(pvalue);
+ bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
+ memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
+ bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->size.lines = Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->size.lines = Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->size.bytes = Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->size.bytes = Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -3640,8 +3640,8 @@ PHP_FUNCTION(imap_mail_compose)
} else if (Z_TYPE_P(data) == IS_ARRAY) {
short type = -1;
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- type = (short) Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ type = (short) Z_LVAL_P(pvalue);
}
if (!toppart) {
@@ -3660,14 +3660,14 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->encoding = (short) Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->encoding = (short) Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
tmp_param = mail_newbody_parameter();
- tmp_param->value = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1);
- memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1);
+ tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
+ memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
tmp_param->attribute = cpystr("CHARSET");
tmp_param->next = bod->parameter;
bod->parameter = tmp_param;
@@ -3679,8 +3679,8 @@ PHP_FUNCTION(imap_mail_compose)
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(key->val);
convert_to_string_ex(disp_data);
- disp_param->value = (char *)fs_get(Z_STRSIZE_P(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1);
+ disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
tmp_param = disp_param;
} ZEND_HASH_FOREACH_END();
@@ -3701,8 +3701,8 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1);
+ bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
+ memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
@@ -3711,8 +3711,8 @@ PHP_FUNCTION(imap_mail_compose)
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(key->val);
convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1);
+ disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
+ memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
tmp_param = disp_param;
} ZEND_HASH_FOREACH_END();
@@ -3721,21 +3721,21 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
convert_to_string_ex(pvalue);
- bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1);
- bod->contents.text.size = Z_STRSIZE_P(pvalue);
+ bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
+ memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
+ bod->contents.text.size = Z_STRLEN_P(pvalue);
} else {
bod->contents.text.data = fs_get(1);
memcpy(bod->contents.text.data, "", 1);
bod->contents.text.size = 0;
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->size.lines = Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->size.lines = Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) {
- convert_to_int_ex(pvalue);
- bod->size.bytes = Z_IVAL_P(pvalue);
+ convert_to_long_ex(pvalue);
+ bod->size.bytes = Z_LVAL_P(pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
@@ -4101,7 +4101,7 @@ PHP_FUNCTION(imap_search)
cur = IMAPG(imap_messages);
while (cur != NIL) {
- add_next_index_int(return_value, cur->msgid);
+ add_next_index_long(return_value, cur->msgid);
cur = cur->next;
}
mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail));
@@ -4390,7 +4390,7 @@ static zend_string* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC)
}
address[0] = 0;
rfc822_write_address(address, addresslist);
- return STR_INIT(address, strlen(address), 0);
+ return zend_string_init(address, strlen(address), 0);
}
/* }}} */
#endif
@@ -4513,53 +4513,53 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
PART *part;
if (body->type <= TYPEMAX) {
- add_property_int(arg, "type", body->type);
+ add_property_long(arg, "type", body->type);
}
if (body->encoding <= ENCMAX) {
- add_property_int(arg, "encoding", body->encoding);
+ add_property_long(arg, "encoding", body->encoding);
}
if (body->subtype) {
- add_property_int(arg, "ifsubtype", 1);
+ add_property_long(arg, "ifsubtype", 1);
add_property_string(arg, "subtype", body->subtype);
} else {
- add_property_int(arg, "ifsubtype", 0);
+ add_property_long(arg, "ifsubtype", 0);
}
if (body->description) {
- add_property_int(arg, "ifdescription", 1);
+ add_property_long(arg, "ifdescription", 1);
add_property_string(arg, "description", body->description);
} else {
- add_property_int(arg, "ifdescription", 0);
+ add_property_long(arg, "ifdescription", 0);
}
if (body->id) {
- add_property_int(arg, "ifid", 1);
+ add_property_long(arg, "ifid", 1);
add_property_string(arg, "id", body->id);
} else {
- add_property_int(arg, "ifid", 0);
+ add_property_long(arg, "ifid", 0);
}
if (body->size.lines) {
- add_property_int(arg, "lines", body->size.lines);
+ add_property_long(arg, "lines", body->size.lines);
}
if (body->size.bytes) {
- add_property_int(arg, "bytes", body->size.bytes);
+ add_property_long(arg, "bytes", body->size.bytes);
}
#ifdef IMAP41
if (body->disposition.type) {
- add_property_int(arg, "ifdisposition", 1);
+ add_property_long(arg, "ifdisposition", 1);
add_property_string(arg, "disposition", body->disposition.type);
} else {
- add_property_int(arg, "ifdisposition", 0);
+ add_property_long(arg, "ifdisposition", 0);
}
if (body->disposition.parameter) {
dpar = body->disposition.parameter;
- add_property_int(arg, "ifdparameters", 1);
+ add_property_long(arg, "ifdparameters", 1);
array_init(&dparametres);
do {
object_init(&dparam);
@@ -4569,12 +4569,12 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
} while ((dpar = dpar->next));
add_assoc_object(arg, "dparameters", &dparametres TSRMLS_CC);
} else {
- add_property_int(arg, "ifdparameters", 0);
+ add_property_long(arg, "ifdparameters", 0);
}
#endif
if ((par = body->parameter)) {
- add_property_int(arg, "ifparameters", 1);
+ add_property_long(arg, "ifparameters", 1);
array_init(&parametres);
do {
@@ -4590,7 +4590,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC)
} while ((par = par->next));
} else {
object_init(&parametres);
- add_property_int(arg, "ifparameters", 0);
+ add_property_long(arg, "ifparameters", 0);
}
add_assoc_object(arg, "parameters", &parametres TSRMLS_CC);
@@ -4627,24 +4627,24 @@ static void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes
/* define "#.num" */
snprintf(buf, 25, "%ld.num", thisNode);
- add_assoc_int(tree, buf, cur->num);
+ add_assoc_long(tree, buf, cur->num);
snprintf(buf, 25, "%ld.next", thisNode);
if(cur->next) {
(*numNodes)++;
- add_assoc_int(tree, buf, *numNodes);
+ add_assoc_long(tree, buf, *numNodes);
build_thread_tree_helper(cur->next, tree, numNodes, buf);
} else { /* "null pointer" */
- add_assoc_int(tree, buf, 0);
+ add_assoc_long(tree, buf, 0);
}
snprintf(buf, 25, "%ld.branch", thisNode);
if(cur->branch) {
(*numNodes)++;
- add_assoc_int(tree, buf, *numNodes);
+ add_assoc_long(tree, buf, *numNodes);
build_thread_tree_helper(cur->branch, tree, numNodes, buf);
} else { /* "null pointer" */
- add_assoc_int(tree, buf, 0);
+ add_assoc_long(tree, buf, 0);
}
}
/* }}} */
@@ -4733,7 +4733,7 @@ PHP_FUNCTION(imap_timeout)
}
timeout = (long) mail_parameters(NIL, timeout_type, NIL);
- RETURN_INT(timeout);
+ RETURN_LONG(timeout);
} else if (timeout >= 0) {
switch (ttype) {
case 1:
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
index a823326cca..6f18181b53 100644
--- a/ext/imap/php_imap.h
+++ b/ext/imap/php_imap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c
index 13265c7745..6ac44ffeb0 100644
--- a/ext/interbase/ibase_blobs.c
+++ b/ext/interbase/ibase_blobs.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -135,7 +135,7 @@ int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob TSRMLS_DC) /* {{{
convert_to_string_ex(string_arg);
- for (rem_cnt = Z_STRSIZE_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) {
+ for (rem_cnt = Z_STRLEN_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) {
chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt;
@@ -239,7 +239,7 @@ PHP_FUNCTION(ibase_blob_create)
PHP_FUNCTION(ibase_blob_open)
{
char *blob_id;
- int blob_id_len;
+ size_t blob_id_len;
zval *link = NULL;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
@@ -337,9 +337,9 @@ PHP_FUNCTION(ibase_blob_get)
RETURN_FALSE;
}
- convert_to_int_ex(len_arg);
+ convert_to_long_ex(len_arg);
- if (_php_ibase_blob_get(return_value, ib_blob, Z_IVAL_P(len_arg) TSRMLS_CC) != SUCCESS) {
+ if (_php_ibase_blob_get(return_value, ib_blob, Z_LVAL_P(len_arg) TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
}
}
@@ -406,7 +406,7 @@ PHP_FUNCTION(ibase_blob_cancel)
PHP_FUNCTION(ibase_blob_info)
{
char *blob_id;
- int blob_id_len;
+ size_t blob_id_len;
zval *link = NULL;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
@@ -460,14 +460,14 @@ PHP_FUNCTION(ibase_blob_info)
array_init(return_value);
- add_index_int(return_value, 0, bl_info.total_length);
- add_assoc_int(return_value, "length", bl_info.total_length);
+ add_index_long(return_value, 0, bl_info.total_length);
+ add_assoc_long(return_value, "length", bl_info.total_length);
- add_index_int(return_value, 1, bl_info.num_segments);
- add_assoc_int(return_value, "numseg", bl_info.num_segments);
+ add_index_long(return_value, 1, bl_info.num_segments);
+ add_assoc_long(return_value, "numseg", bl_info.num_segments);
- add_index_int(return_value, 2, bl_info.max_segment);
- add_assoc_int(return_value, "maxseg", bl_info.max_segment);
+ add_index_long(return_value, 2, bl_info.max_segment);
+ add_assoc_long(return_value, "maxseg", bl_info.max_segment);
add_index_bool(return_value, 3, bl_info.bl_stream);
add_assoc_bool(return_value, "stream", bl_info.bl_stream);
@@ -482,7 +482,7 @@ PHP_FUNCTION(ibase_blob_info)
PHP_FUNCTION(ibase_blob_echo)
{
char *blob_id;
- int blob_id_len;
+ size_t blob_id_len;
zval *link = NULL;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c
index f8eb3b8521..5a64b31c75 100644
--- a/ext/interbase/ibase_events.c
+++ b/ext/interbase/ibase_events.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -178,7 +178,7 @@ PHP_FUNCTION(ibase_wait_event)
isc_event_counts(occurred_event, buffer_size, event_buffer, result_buffer);
for (i = 0; i < event_count; ++i) {
if (occurred_event[i]) {
- zend_string *result = STR_INIT(events[i], strlen(events[i]), 0);
+ zend_string *result = zend_string_init(events[i], strlen(events[i]), 0);
_php_ibase_event_free(event_buffer,result_buffer);
efree(args);
RETURN_STR(result);
@@ -297,8 +297,8 @@ PHP_FUNCTION(ibase_set_event_handler)
RETURN_FALSE;
}
- convert_to_int_ex(&args[0]);
- link_res_id = Z_IVAL(args[0]);
+ convert_to_long_ex(&args[0]);
+ link_res_id = Z_LVAL(args[0]);
} else {
/* callback, event_1 [, ... event_15]
@@ -319,10 +319,10 @@ PHP_FUNCTION(ibase_set_event_handler)
/* get the callback */
if (!zend_is_callable(cb_arg, 0, &cb_name TSRMLS_CC)) {
_php_ibase_module_error("Callback argument %s is not a callable function" TSRMLS_CC, cb_name->val);
- STR_RELEASE(cb_name);
+ zend_string_release(cb_name);
RETURN_FALSE;
}
- STR_RELEASE(cb_name);
+ zend_string_release(cb_name);
/* allocate the event resource */
event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0);
diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c
index 13306c78eb..2cd2ada65f 100644
--- a/ext/interbase/ibase_query.c
+++ b/ext/interbase/ibase_query.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,8 +29,8 @@
#include "php_interbase.h"
#include "php_ibase_includes.h"
-#define ISC_INT_MIN INT_MIN
-#define ISC_INT_MAX INT_MAX
+#define ISC_LONG_MIN INT_MIN
+#define ISC_LONG_MAX INT_MAX
#define QUERY_RESULT 1
#define EXECUTE_RESULT 2
@@ -498,7 +498,7 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, /
*(short*) buf = (short) l;
break;
case SQL_LONG:
- if (l > ISC_INT_MAX || l < ISC_INT_MIN) {
+ if (l > ISC_LONG_MAX || l < ISC_LONG_MIN) {
_php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC);
return FAILURE;
}
@@ -534,27 +534,27 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, /
ISC_INT64 l;
case SQL_SHORT:
- convert_to_int(val);
- if (Z_IVAL_P(val) > SHRT_MAX || Z_IVAL_P(val) < SHRT_MIN) {
+ convert_to_long(val);
+ if (Z_LVAL_P(val) > SHRT_MAX || Z_LVAL_P(val) < SHRT_MIN) {
_php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC);
return FAILURE;
}
- *(short *) buf = (short) Z_IVAL_P(val);
+ *(short *) buf = (short) Z_LVAL_P(val);
break;
case SQL_LONG:
- convert_to_int(val);
+ convert_to_long(val);
#if (SIZEOF_LONG > 4)
- if (Z_IVAL_P(val) > ISC_INT_MAX || Z_IVAL_P(val) < ISC_INT_MIN) {
+ if (Z_LVAL_P(val) > ISC_LONG_MAX || Z_LVAL_P(val) < ISC_LONG_MIN) {
_php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC);
return FAILURE;
}
#endif
- *(ISC_LONG *) buf = (ISC_LONG) Z_IVAL_P(val);
+ *(ISC_LONG *) buf = (ISC_LONG) Z_LVAL_P(val);
break;
case SQL_INT64:
#if (SIZEOF_LONG >= 8)
- convert_to_int(val);
- *(long *) buf = Z_IVAL_P(val);
+ convert_to_long(val);
+ *(long *) buf = Z_LVAL_P(val);
#else
convert_to_string(val);
if (!sscanf(Z_STRVAL_P(val), "%" LL_MASK "d", &l)) {
@@ -664,7 +664,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */
case SQL_TIMESTAMP:
case SQL_TYPE_DATE:
case SQL_TYPE_TIME:
- force_null = (Z_STRSIZE_P(b_var) == 0);
+ force_null = (Z_STRLEN_P(b_var) == 0);
}
if (! force_null) break;
@@ -689,9 +689,9 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */
case SQL_TIMESTAMP:
case SQL_TYPE_DATE:
case SQL_TYPE_TIME:
- if (Z_TYPE_P(b_var) == IS_INT) {
+ if (Z_TYPE_P(b_var) == IS_LONG) {
struct tm *res;
- res = php_gmtime_r(&Z_IVAL_P(b_var), &t);
+ res = php_gmtime_r(&Z_LVAL_P(b_var), &t);
if (!res) {
return FAILURE;
}
@@ -734,7 +734,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */
convert_to_string(b_var);
- if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN ||
+ if (Z_STRLEN_P(b_var) != BLOB_ID_LEN ||
!_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) {
ibase_blob ib_blob = { NULL, BLOB_INPUT };
@@ -762,7 +762,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */
if (Z_TYPE_P(b_var) != IS_ARRAY) {
convert_to_string(b_var);
- if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN ||
+ if (Z_STRLEN_P(b_var) != BLOB_ID_LEN ||
!_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) {
_php_ibase_module_error("Parameter %d: invalid array ID" TSRMLS_CC,i+1);
@@ -799,7 +799,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */
/* we end up here if none of the switch cases handled the field */
convert_to_string(b_var);
var->sqldata = Z_STRVAL_P(b_var);
- var->sqllen = Z_STRSIZE_P(b_var);
+ var->sqllen = Z_STRLEN_P(b_var);
var->sqltype = SQL_TEXT;
} /* for */
return rv;
@@ -1022,7 +1022,7 @@ static int _php_ibase_exec(INTERNAL_FUNCTION_PARAMETERS, ibase_result **ib_resul
if (!ib_query->out_sqlda) { /* no result set is being returned */
if (affected_rows) {
- RETVAL_INT(affected_rows);
+ RETVAL_LONG(affected_rows);
} else {
RETVAL_TRUE;
}
@@ -1228,7 +1228,7 @@ PHP_FUNCTION(ibase_affected_rows)
trans = ib_link->tr_list->trans;
}
}
- RETURN_INT(trans->affected_rows);
+ RETURN_LONG(trans->affected_rows);
}
/* }}} */
@@ -1281,7 +1281,7 @@ PHP_FUNCTION(ibase_num_rows)
while (result[i] != isc_info_end && i < result_size) {
short len = (short)isc_vax_integer(&result[i+1],2);
if (result[i] == isc_info_req_select_count) {
- RETURN_INT(isc_vax_integer(&result[i+3],len));
+ RETURN_LONG(isc_vax_integer(&result[i+3],len));
}
i += len+3;
}
@@ -1354,7 +1354,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{
n = *(ISC_LONG *) data;
_sql_long:
if (scale == 0) {
- ZVAL_INT(val,n);
+ ZVAL_LONG(val,n);
} else {
long f = (long) scales[-scale];
@@ -1396,7 +1396,7 @@ format_date_time:
t.tm_zone = tzname[0];
#endif
if (flag & PHP_IBASE_UNIXTIME) {
- ZVAL_INT(val, mktime(&t));
+ ZVAL_LONG(val, mktime(&t));
} else {
#if HAVE_STRFTIME
l = strftime(string_data, sizeof(string_data), format, &t);
@@ -1463,7 +1463,7 @@ static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_siz
if (ib_array->ar_desc.array_desc_dtype == blr_varying ||
ib_array->ar_desc.array_desc_dtype == blr_varying2) {
- Z_STRSIZE_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval));
+ Z_STRLEN_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval));
}
}
return SUCCESS;
@@ -1735,7 +1735,7 @@ PHP_FUNCTION(ibase_prepare)
zval *link_arg, *trans_arg;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
- int query_len, trans_res_id = 0;
+ size_t query_len, trans_res_id = 0;
ibase_query *ib_query;
char *query;
@@ -1904,9 +1904,9 @@ PHP_FUNCTION(ibase_num_fields)
}
if (sqlda == NULL) {
- RETURN_INT(0);
+ RETURN_LONG(0);
} else {
- RETURN_INT(sqlda->sqld);
+ RETURN_LONG(sqlda->sqld);
}
}
/* }}} */
@@ -2055,9 +2055,9 @@ PHP_FUNCTION(ibase_num_params)
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query);
if (ib_query->in_sqlda == NULL) {
- RETURN_INT(0);
+ RETURN_LONG(0);
} else {
- RETURN_INT(ib_query->in_sqlda->sqld);
+ RETURN_LONG(ib_query->in_sqlda->sqld);
}
}
/* }}} */
diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c
index a38ebcdf73..c068c8d56b 100644
--- a/ext/interbase/ibase_service.c
+++ b/ext/interbase/ibase_service.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -67,67 +67,67 @@ void php_ibase_service_minit(INIT_FUNC_ARGS) /* {{{ */
"interbase service manager handle", module_number);
/* backup options */
- REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT);
/* restore options */
- REGISTER_INT_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT);
/* manage options */
- REGISTER_INT_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT);
/* repair options */
- REGISTER_INT_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT);
/* db info arguments */
- REGISTER_INT_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT);
/* server info arguments */
- REGISTER_INT_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT);
}
/* }}} */
@@ -208,7 +208,7 @@ PHP_FUNCTION(ibase_delete_user)
Connect to the service manager */
PHP_FUNCTION(ibase_service_attach)
{
- int hlen, ulen, plen, spb_len;
+ size_t hlen, ulen, plen, spb_len;
ibase_service *svm;
char buf[128], *host, *user, *pass, *loc;
isc_svc_handle handle = NULL;
@@ -343,12 +343,12 @@ query_loop:
int len;
case isc_spb_num_att:
- add_assoc_int(return_value, "attachments", isc_vax_integer(result,4));
+ add_assoc_long(return_value, "attachments", isc_vax_integer(result,4));
result += 4;
break;
case isc_spb_num_db:
- add_assoc_int(return_value, "databases", isc_vax_integer(result,4));
+ add_assoc_long(return_value, "databases", isc_vax_integer(result,4));
result += 4;
break;
@@ -398,12 +398,12 @@ query_loop:
break;
case isc_spb_sec_userid:
- add_assoc_int(&user, "user_id", isc_vax_integer(result, 4));
+ add_assoc_long(&user, "user_id", isc_vax_integer(result, 4));
result += 4;
break;
case isc_spb_sec_groupid:
- add_assoc_int(&user, "group_id", isc_vax_integer(result, 4));
+ add_assoc_long(&user, "group_id", isc_vax_integer(result, 4));
result += 4;
break;
}
@@ -425,7 +425,7 @@ static void _php_ibase_backup_restore(INTERNAL_FUNCTION_PARAMETERS, char operati
*/
zval *res;
char *db, *bk, buf[200];
- int dblen, bklen, spb_len;
+ size_t dblen, bklen, spb_len;
long opts = 0;
zend_bool verbose = 0;
ibase_service *svm;
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index 13513cefc6..59c4a0fa42 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -495,7 +495,7 @@ PHP_FUNCTION(ibase_errcode)
}
if (IBG(sql_code) != 0) {
- RETURN_INT(IBG(sql_code));
+ RETURN_LONG(IBG(sql_code));
}
RETURN_FALSE;
}
@@ -735,23 +735,23 @@ PHP_MINIT_FUNCTION(ibase)
le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, LE_PLINK, module_number);
le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, LE_TRANS, module_number);
- REGISTER_INT_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */
- REGISTER_INT_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */
+ REGISTER_LONG_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT);
/* transactions */
- REGISTER_INT_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT);
php_ibase_query_minit(INIT_FUNC_ARGS_PASSTHRU);
php_ibase_blobs_minit(INIT_FUNC_ARGS_PASSTHRU);
@@ -1194,8 +1194,8 @@ PHP_FUNCTION(ibase_trans)
tpb_len = 0;
- convert_to_int_ex(&args[i]);
- trans_argl = Z_IVAL(args[i]);
+ convert_to_long_ex(&args[i]);
+ trans_argl = Z_LVAL(args[i]);
if (trans_argl != PHP_IBASE_DEFAULT) {
last_tpb[tpb_len++] = isc_tpb_version3;
@@ -1425,7 +1425,7 @@ PHP_FUNCTION(ibase_gen_id)
{
zval *link = NULL;
char query[128], *generator;
- int gen_len;
+ size_t gen_len;
long inc = 1;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
@@ -1475,7 +1475,7 @@ PHP_FUNCTION(ibase_gen_id)
RETURN_STRINGL(res, l, 0);
}
#endif
- RETURN_INT((long)result);
+ RETURN_LONG((long)result);
}
/* }}} */
diff --git a/ext/interbase/interbase.dsp b/ext/interbase/interbase.dsp
deleted file mode 100644
index c151deb40c..0000000000
--- a/ext/interbase/interbase.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="interbase" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=interbase - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak" CFG="interbase - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "interbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "interbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "interbase"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "interbase - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib php5ts_debug.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib gds32_ms.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_interbase.dll" /pdbtype:sept /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "interbase - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_interbase.dll" /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "interbase - Win32 Debug_TS"
-# Name "interbase - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ibase_blobs.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ibase_events.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ibase_query.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ibase_service.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\interbase.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_interbase.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\interbase.rc
-# ADD BASE RSC /l 0x413
-# ADD RSC /l 0x413 /i "..\..\main" /i "..\..\win32" /d "PHP_H"
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/interbase/php_ibase_includes.h b/ext/interbase/php_ibase_includes.h
index 72eb0702a6..8e80505c17 100644
--- a/ext/interbase/php_ibase_includes.h
+++ b/ext/interbase/php_ibase_includes.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,8 +35,7 @@
#define IB_STATUS (IBG(status))
-/* XXX ZEND_DEBUG_ is misleading, it should be something like IBASE_DEBUG. */
-#ifdef ZEND_DEBUG_
+#ifdef IBASE_DEBUG
#define IBDEBUG(a) php_printf("::: %s (%d)\n", a, __LINE__);
#endif
diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c
index d37e077240..4b47fbcfb6 100644
--- a/ext/interbase/php_ibase_udf.c
+++ b/ext/interbase/php_ibase_udf.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -84,7 +84,7 @@
*
* gcc -shared `php-config --includes` `php-config --ldflags` \
* `php-config --libs` -o php_ibase_udf.so php_ibase_udf.c \
-* /usr/lib/libphp5.a
+* /usr/lib/libphp7.a
*
* If you use the super server, you should also link against the embedded
* library, but be sure to enable thread safety, as the super server is
@@ -231,7 +231,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
case dtype_short:
if (argv[i]->dsc_scale == 0) {
- ZVAL_INT(&args[i], *(short*)argv[i]->dsc_address);
+ ZVAL_LONG(&args[i], *(short*)argv[i]->dsc_address);
} else {
ZVAL_DOUBLE(&args[i],
((double)*(short*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]);
@@ -240,7 +240,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
case dtype_long:
if (argv[i]->dsc_scale == 0) {
- ZVAL_INT(&args[i], *(ISC_LONG*)argv[i]->dsc_address);
+ ZVAL_LONG(&args[i], *(ISC_LONG*)argv[i]->dsc_address);
} else {
ZVAL_DOUBLE(&args[i],
((double)*(ISC_LONG*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]);
@@ -251,7 +251,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
l = *(ISC_INT64*)argv[i]->dsc_address;
if (argv[i]->dsc_scale == 0 && l <= LONG_MAX && l >= LONG_MIN) {
- ZVAL_INT(&args[i], (long)l);
+ ZVAL_LONG(&args[i], (long)l);
} else {
ZVAL_DOUBLE(&args[i], ((double)l)/scales[-argv[i]->dsc_scale]);
}
@@ -307,9 +307,9 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
/* return whatever type we got back from the callback: let DB handle conversion */
switch (Z_TYPE(return_value)) {
- case IS_INT:
+ case IS_LONG:
r->dsc_dtype = dtype_long;
- *(long*)r->dsc_address = Z_IVAL(return_value);
+ *(long*)r->dsc_address = Z_LVAL(return_value);
r->dsc_length = sizeof(long);
break;
@@ -329,7 +329,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv)
case IS_STRING:
r->dsc_dtype = dtype_varying;
memcpy(res->vary_string, Z_STRVAL(return_value),
- (res->vary_length = min(r->dsc_length-2,Z_STRSIZE(return_value))));
+ (res->vary_length = min(r->dsc_length-2,Z_STRLEN(return_value))));
r->dsc_length = res->vary_length+2;
break;
}
@@ -404,4 +404,3 @@ void udf_call_php8(char *name, PARAMDSC *r, PARAMDSC *arg1, PARAMDSC *arg2, PARA
PARAMDSC *args[8] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
call_php(name, r, 8, args);
}
-
diff --git a/ext/interbase/php_interbase.h b/ext/interbase/php_interbase.h
index 0518b586f9..c8afc8df8f 100644
--- a/ext/interbase/php_interbase.h
+++ b/ext/interbase/php_interbase.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 7c06af792c..715a866111 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -121,7 +121,7 @@ static zend_object *BreakIterator_clone_obj(zval *object TSRMLS_DC)
"Could not clone BreakIterator", 0 TSRMLS_CC);
err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig) TSRMLS_CC);
zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC);
- STR_FREE(err_msg);
+ zend_string_free(err_msg);
} else {
bio_new->biter = new_biter;
ZVAL_COPY(&bio_new->text, &bio_orig->text);
@@ -338,36 +338,36 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D)
zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1,
zend_ce_traversable);
- zend_declare_class_constant_int(BreakIterator_ce_ptr,
+ zend_declare_class_constant_long(BreakIterator_ce_ptr,
"DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC );
/* Declare constants that are defined in the C header */
-#define BREAKITER_DECL_INT_CONST(name) \
- zend_declare_class_constant_int(BreakIterator_ce_ptr, #name, \
+#define BREAKITER_DECL_LONG_CONST(name) \
+ zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \
sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC)
- BREAKITER_DECL_INT_CONST(WORD_NONE);
- BREAKITER_DECL_INT_CONST(WORD_NONE_LIMIT);
- BREAKITER_DECL_INT_CONST(WORD_NUMBER);
- BREAKITER_DECL_INT_CONST(WORD_NUMBER_LIMIT);
- BREAKITER_DECL_INT_CONST(WORD_LETTER);
- BREAKITER_DECL_INT_CONST(WORD_LETTER_LIMIT);
- BREAKITER_DECL_INT_CONST(WORD_KANA);
- BREAKITER_DECL_INT_CONST(WORD_KANA_LIMIT);
- BREAKITER_DECL_INT_CONST(WORD_IDEO);
- BREAKITER_DECL_INT_CONST(WORD_IDEO_LIMIT);
-
- BREAKITER_DECL_INT_CONST(LINE_SOFT);
- BREAKITER_DECL_INT_CONST(LINE_SOFT_LIMIT);
- BREAKITER_DECL_INT_CONST(LINE_HARD);
- BREAKITER_DECL_INT_CONST(LINE_HARD_LIMIT);
-
- BREAKITER_DECL_INT_CONST(SENTENCE_TERM);
- BREAKITER_DECL_INT_CONST(SENTENCE_TERM_LIMIT);
- BREAKITER_DECL_INT_CONST(SENTENCE_SEP);
- BREAKITER_DECL_INT_CONST(SENTENCE_SEP_LIMIT);
-
-#undef BREAKITER_DECL_INT_CONST
+ BREAKITER_DECL_LONG_CONST(WORD_NONE);
+ BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT);
+ BREAKITER_DECL_LONG_CONST(WORD_NUMBER);
+ BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT);
+ BREAKITER_DECL_LONG_CONST(WORD_LETTER);
+ BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT);
+ BREAKITER_DECL_LONG_CONST(WORD_KANA);
+ BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT);
+ BREAKITER_DECL_LONG_CONST(WORD_IDEO);
+ BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT);
+
+ BREAKITER_DECL_LONG_CONST(LINE_SOFT);
+ BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT);
+ BREAKITER_DECL_LONG_CONST(LINE_HARD);
+ BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT);
+
+ BREAKITER_DECL_LONG_CONST(SENTENCE_TERM);
+ BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT);
+ BREAKITER_DECL_LONG_CONST(SENTENCE_SEP);
+ BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT);
+
+#undef BREAKITER_DECL_LONG_CONST
/* Create and register 'RuleBasedBreakIterator' class. */
diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h
index 0cf213f260..6333003981 100644
--- a/ext/intl/breakiterator/breakiterator_class.h
+++ b/ext/intl/breakiterator/breakiterator_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index c04e33e11b..19de7bce34 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -67,7 +67,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
int32_t pos = biter->next();
if (pos != BreakIterator::DONE) {
- ZVAL_INT(&zoi_iter->current, (php_int_t)pos);
+ ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
} //else we've reached the end of the enum, nothing more is required
}
@@ -77,7 +77,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC)
zoi_with_current *zoi_iter = (zoi_with_current*)iter;
int32_t pos = biter->first();
- ZVAL_INT(&zoi_iter->current, (php_int_t)pos);
+ ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
}
static zend_object_iterator_funcs breakiterator_iterator_funcs = {
@@ -137,7 +137,7 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC
static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{
/* the actual work is done in move_forward and rewind */
- ZVAL_INT(key, iter->index);
+ ZVAL_LONG(key, iter->index);
}
static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC)
@@ -168,14 +168,14 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_
* No need to do anything, the engine increments ->index */
const char *s = Z_STRVAL(bio->text);
- int32_t slen = Z_STRSIZE(bio->text);
+ int32_t slen = Z_STRLEN(bio->text);
zend_string *res;
if (next == BreakIterator::DONE) {
next = slen;
}
assert(next <= slen && next >= cur);
- res = STR_ALLOC(next - cur, 0);
+ res = zend_string_alloc(next - cur, 0);
memcpy(res->val, &s[cur], res->len);
res->val[res->len] = '\0';
@@ -315,7 +315,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D)
IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method;
#define PARTSITER_DECL_LONG_CONST(name) \
- zend_declare_class_constant_int(IntlPartsIterator_ce_ptr, #name, \
+ zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \
sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC)
PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL);
diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h
index a955f3a8e7..764f4f4426 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.h
+++ b/ext/intl/breakiterator/breakiterator_iterators.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index a8c32cc8d4..1153340e14 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -46,7 +46,7 @@ static void _breakiter_factory(const char *func_name,
{
BreakIterator *biter;
const char *locale_str = NULL;
- int dummy;
+ size_t dummy;
char *msg;
UErrorCode status = UErrorCode();
intl_error_reset(NULL TSRMLS_CC);
@@ -149,7 +149,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text)
U_CFUNC PHP_FUNCTION(breakiter_set_text)
{
char *text;
- int text_len;
+ size_t text_len;
UText *ut = NULL;
zval *textzv;
BREAKITER_METHOD_INIT_VARS;
@@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32(
int32_t res = (bio->biter->*func)();
- RETURN_INT((php_int_t)res);
+ RETURN_LONG((zend_long)res);
}
static void _breakiter_int32_ret_int32(
@@ -217,11 +217,11 @@ static void _breakiter_int32_ret_int32(
INTERNAL_FUNCTION_PARAMETERS)
{
char *msg;
- php_int_t arg;
+ zend_long arg;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) {
spprintf(&msg, 0, "%s: bad arguments", func_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC);
efree(msg);
@@ -240,7 +240,7 @@ static void _breakiter_int32_ret_int32(
int32_t res = (bio->biter->*func)((int32_t)arg);
- RETURN_INT((php_int_t)res);
+ RETURN_LONG((zend_long)res);
}
U_CFUNC PHP_FUNCTION(breakiter_first)
@@ -308,7 +308,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current)
int32_t res = bio->biter->current();
- RETURN_INT((php_int_t)res);
+ RETURN_LONG((zend_long)res);
}
U_CFUNC PHP_FUNCTION(breakiter_following)
@@ -327,11 +327,11 @@ U_CFUNC PHP_FUNCTION(breakiter_preceding)
U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
{
- php_int_t offset;
+ zend_long offset;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
&offset) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_is_boundary: bad arguments", 0 TSRMLS_CC);
@@ -349,16 +349,16 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
UBool res = bio->biter->isBoundary((int32_t)offset);
- RETURN_BOOL((php_int_t)res);
+ RETURN_BOOL((zend_long)res);
}
U_CFUNC PHP_FUNCTION(breakiter_get_locale)
{
- php_int_t locale_type;
+ zend_long locale_type;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &locale_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_get_locale: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -382,11 +382,11 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale)
U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator)
{
- php_int_t key_type = 0;
+ zend_long key_type = 0;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &key_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -422,7 +422,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code)
if (bio == NULL)
RETURN_FALSE;
- RETURN_INT((php_int_t)BREAKITER_ERROR_CODE(bio));
+ RETURN_LONG((zend_long)BREAKITER_ERROR_CODE(bio));
}
U_CFUNC PHP_FUNCTION(breakiter_get_error_message)
diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h
index bc9ce80105..cffe767c55 100644
--- a/ext/intl/breakiterator/breakiterator_methods.h
+++ b/ext/intl/breakiterator/breakiterator_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp
index 142cc28342..723cfd5022 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.cpp
+++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -22,7 +22,7 @@
//copied from cmemory.h, which is not public
typedef union {
- php_int_t t1;
+ zend_long t1;
double t2;
void *t3;
} UAlignedMemory;
diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h
index 933347b859..0c9b8cc9a5 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.h
+++ b/ext/intl/breakiterator/codepointiterator_internal.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp
index a12924afef..d7fe359712 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.cpp
+++ b/ext/intl/breakiterator/codepointiterator_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -40,5 +40,5 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
BREAKITER_METHOD_FETCH_OBJECT;
- RETURN_INT(fetch_cpbi(bio)->getLastCodePoint());
+ RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint());
}
diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h
index ad3b710fc8..92f255d704 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.h
+++ b/ext/intl/breakiterator/codepointiterator_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 5755b0adb8..d3b36291b2 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,7 +33,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
{
zval *object = getThis();
char *rules;
- int rules_len;
+ size_t rules_len;
zend_bool compiled = 0;
UErrorCode status = U_ZERO_ERROR;
intl_error_reset(NULL TSRMLS_CC);
@@ -151,7 +151,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status)
BREAKITER_METHOD_FETCH_OBJECT;
- RETURN_INT(fetch_rbbi(bio)->getRuleStatus());
+ RETURN_LONG(fetch_rbbi(bio)->getRuleStatus());
}
U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
@@ -189,7 +189,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
array_init_size(return_value, num_rules);
for (int32_t i = 0; i < num_rules; i++) {
- add_next_index_int(return_value, rules[i]);
+ add_next_index_long(return_value, rules[i]);
}
delete[] rules;
}
@@ -218,7 +218,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
RETURN_FALSE;
}
- zend_string *ret_rules = STR_ALLOC(rules_len, 0);
+ zend_string *ret_rules = zend_string_alloc(rules_len, 0);
memcpy(ret_rules->val, rules, rules_len);
ret_rules->val[rules_len] = '\0';
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
index 861ca4253f..3a9209c479 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index af4f53907f..7273b1d277 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -102,7 +102,7 @@ static zend_object *Calendar_clone_obj(zval *object TSRMLS_DC)
"Could not clone IntlCalendar", 0 TSRMLS_CC);
err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig) TSRMLS_CC);
zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC);
- STR_FREE(err_msg);
+ zend_string_free(err_msg);
} else {
co_new->ucal = newCalendar;
}
@@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
const char *name = debug_info_fields[i].name;
int32_t res = cal->get(debug_info_fields[i].field, uec);
if (U_SUCCESS(uec)) {
- add_assoc_int(&zfields, name, (php_int_t)res);
+ add_assoc_long(&zfields, name, (zend_long)res);
} else {
add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec)));
}
@@ -489,57 +489,57 @@ void calendar_register_IntlCalendar_class(TSRMLS_D)
}
/* Declare 'IntlCalendar' class constants */
-#define CALENDAR_DECL_INT_CONST(name, val) \
- zend_declare_class_constant_int(Calendar_ce_ptr, name, sizeof(name) - 1, \
+#define CALENDAR_DECL_LONG_CONST(name, val) \
+ zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \
val TSRMLS_CC)
- CALENDAR_DECL_INT_CONST("FIELD_ERA", UCAL_ERA);
- CALENDAR_DECL_INT_CONST("FIELD_YEAR", UCAL_YEAR);
- CALENDAR_DECL_INT_CONST("FIELD_MONTH", UCAL_MONTH);
- CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR);
- CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH);
- CALENDAR_DECL_INT_CONST("FIELD_DATE", UCAL_DATE);
- CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR);
- CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK);
- CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH);
- CALENDAR_DECL_INT_CONST("FIELD_AM_PM", UCAL_AM_PM);
- CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR);
- CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY);
- CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR);
- CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY);
- CALENDAR_DECL_INT_CONST("FIELD_MINUTE", UCAL_MINUTE);
- CALENDAR_DECL_INT_CONST("FIELD_SECOND", UCAL_SECOND);
- CALENDAR_DECL_INT_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND);
- CALENDAR_DECL_INT_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET);
- CALENDAR_DECL_INT_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET);
- CALENDAR_DECL_INT_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY);
- CALENDAR_DECL_INT_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL);
- CALENDAR_DECL_INT_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR);
- CALENDAR_DECL_INT_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY);
- CALENDAR_DECL_INT_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY);
- CALENDAR_DECL_INT_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH);
- CALENDAR_DECL_INT_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT);
- CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH);
-
- CALENDAR_DECL_INT_CONST("DOW_SUNDAY", UCAL_SUNDAY);
- CALENDAR_DECL_INT_CONST("DOW_MONDAY", UCAL_MONDAY);
- CALENDAR_DECL_INT_CONST("DOW_TUESDAY", UCAL_TUESDAY);
- CALENDAR_DECL_INT_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY);
- CALENDAR_DECL_INT_CONST("DOW_THURSDAY", UCAL_THURSDAY);
- CALENDAR_DECL_INT_CONST("DOW_FRIDAY", UCAL_FRIDAY);
- CALENDAR_DECL_INT_CONST("DOW_SATURDAY", UCAL_SATURDAY);
+ CALENDAR_DECL_LONG_CONST("FIELD_ERA", UCAL_ERA);
+ CALENDAR_DECL_LONG_CONST("FIELD_YEAR", UCAL_YEAR);
+ CALENDAR_DECL_LONG_CONST("FIELD_MONTH", UCAL_MONTH);
+ CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR);
+ CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH);
+ CALENDAR_DECL_LONG_CONST("FIELD_DATE", UCAL_DATE);
+ CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR);
+ CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK);
+ CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH);
+ CALENDAR_DECL_LONG_CONST("FIELD_AM_PM", UCAL_AM_PM);
+ CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR);
+ CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY);
+ CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR);
+ CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY);
+ CALENDAR_DECL_LONG_CONST("FIELD_MINUTE", UCAL_MINUTE);
+ CALENDAR_DECL_LONG_CONST("FIELD_SECOND", UCAL_SECOND);
+ CALENDAR_DECL_LONG_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND);
+ CALENDAR_DECL_LONG_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET);
+ CALENDAR_DECL_LONG_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET);
+ CALENDAR_DECL_LONG_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY);
+ CALENDAR_DECL_LONG_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL);
+ CALENDAR_DECL_LONG_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR);
+ CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY);
+ CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY);
+ CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH);
+ CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT);
+ CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH);
+
+ CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_MONDAY", UCAL_MONDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_TUESDAY", UCAL_TUESDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_THURSDAY", UCAL_THURSDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY);
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
- CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY);
- CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND);
- CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET);
- CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE);
+ CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY);
+ CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND);
+ CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET);
+ CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE);
#endif
#if U_ICU_VERSION_MAJOR_NUM >= 49
- CALENDAR_DECL_INT_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST);
- CALENDAR_DECL_INT_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST);
- CALENDAR_DECL_INT_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID);
+ CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST);
+ CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST);
+ CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID);
#endif
}
/* }}} */
diff --git a/ext/intl/calendar/calendar_class.h b/ext/intl/calendar/calendar_class.h
index 2e7fbd2172..47f991f118 100644
--- a/ext/intl/calendar/calendar_class.h
+++ b/ext/intl/calendar/calendar_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index 23fb376604..eaa1930e42 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -51,7 +51,7 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance)
{
zval *zv_timezone = NULL;
const char *locale_str = NULL;
- int dummy;
+ size_t dummy;
TimeZone *timeZone;
UErrorCode status = U_ZERO_ERROR;
intl_error_reset(NULL TSRMLS_CC);
@@ -143,7 +143,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
UErrorCode status = U_ZERO_ERROR;
char *key,
*locale;
- int key_len,
+ size_t key_len,
locale_len;
zend_bool commonly_used;
intl_error_reset(NULL TSRMLS_CC);
@@ -219,12 +219,12 @@ static void _php_intlcal_field_uec_ret_in32t_method(
const char *method_name,
INTERNAL_FUNCTION_PARAMETERS)
{
- php_int_t field;
+ zend_long field;
char *message;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
spprintf(&message, 0, "%s: bad arguments", method_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
efree(message);
@@ -244,7 +244,7 @@ static void _php_intlcal_field_uec_ret_in32t_method(
(UCalendarDateFields)field, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
U_CFUNC PHP_FUNCTION(intlcal_get)
@@ -295,12 +295,12 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time)
U_CFUNC PHP_FUNCTION(intlcal_add)
{
- php_int_t field,
+ zend_long field,
amount;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oii", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) {
+ "Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_add: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -399,7 +399,7 @@ U_CFUNC PHP_FUNCTION(intlcal_before)
U_CFUNC PHP_FUNCTION(intlcal_set)
{
- php_int_t arg1, arg2, arg3, arg4, arg5, arg6;
+ zend_long arg1, arg2, arg3, arg4, arg5, arg6;
zval args_a[7] = {0},
*args = args_a;
int i;
@@ -423,7 +423,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
if (variant == 4 ||
zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oii|iiii", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4,
+ "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4,
&arg5, &arg6) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set: bad arguments", 0 TSRMLS_CC);
@@ -431,7 +431,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
}
for (i = 0; i < variant; i++) {
- if (Z_IVAL(args[i]) < INT32_MIN || Z_IVAL(args[i]) > INT32_MAX) {
+ if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set: at least one of the arguments has an absolute "
"value that is too large", 0 TSRMLS_CC);
@@ -462,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
U_CFUNC PHP_FUNCTION(intlcal_roll)
{
- php_int_t field,
+ zend_long field,
value;
zval args_a[3] = {0},
*args = args_a;
@@ -488,7 +488,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll)
}
bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0;
} else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oii", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
+ "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_roll: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -524,7 +524,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear)
{
zval args_a[2] = {0},
*args = &args_a[0];
- php_int_t field;
+ zend_long field;
int variant;
CALENDAR_METHOD_INIT_VARS;
@@ -547,7 +547,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear)
}
variant = 0;
} else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- getThis(), "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) {
+ getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_clear: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -572,12 +572,12 @@ U_CFUNC PHP_FUNCTION(intlcal_clear)
U_CFUNC PHP_FUNCTION(intlcal_field_difference)
{
- php_int_t field;
+ zend_long field;
double when;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Odi", &object, Calendar_ce_ptr, &when, &field) == FAILURE) {
+ "Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_field_difference: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -596,7 +596,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference)
INTL_METHOD_CHECK_STATUS(co,
"intlcal_field_difference: Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
U_CFUNC PHP_FUNCTION(intlcal_get_actual_maximum)
@@ -614,11 +614,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_actual_minimum)
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
{
- php_uint_t dow;
+ zend_ulong dow;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_get_day_of_week_type: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -637,7 +637,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
INTL_METHOD_CHECK_STATUS(co,
"intlcal_get_day_of_week_type: Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
#endif
@@ -658,7 +658,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)
INTL_METHOD_CHECK_STATUS(co,
"intlcal_get_first_day_of_week: Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
static void _php_intlcal_field_ret_in32t_method(
@@ -666,12 +666,12 @@ static void _php_intlcal_field_ret_in32t_method(
const char *method_name,
INTERNAL_FUNCTION_PARAMETERS)
{
- php_int_t field;
+ zend_long field;
char *message;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
spprintf(&message, 0, "%s: bad arguments", method_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
efree(message);
@@ -690,7 +690,7 @@ static void _php_intlcal_field_ret_in32t_method(
int32_t result = (co->ucal->*func)((UCalendarDateFields)field);
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
U_CFUNC PHP_FUNCTION(intlcal_get_greatest_minimum)
@@ -707,11 +707,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_least_maximum)
U_CFUNC PHP_FUNCTION(intlcal_get_locale)
{
- php_int_t locale_type;
+ zend_long locale_type;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &locale_type) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_get_locale: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -756,7 +756,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week)
INTL_METHOD_CHECK_STATUS(co,
"intlcal_get_first_day_of_week: Call to ICU method has failed");
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
U_CFUNC PHP_FUNCTION(intlcal_get_minimum)
@@ -807,11 +807,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type)
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
{
- php_int_t dow;
+ zend_long dow;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_get_weekend_transition: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -830,7 +830,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
INTL_METHOD_CHECK_STATUS(co, "intlcal_get_weekend_transition: "
"Error calling ICU method");
- RETURN_INT((php_int_t)res);
+ RETURN_LONG((zend_long)res);
}
#endif
@@ -898,11 +898,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient)
U_CFUNC PHP_FUNCTION(intlcal_is_set)
{
- php_int_t field;
+ zend_long field;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_is_set: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -953,11 +953,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week)
{
- php_int_t dow;
+ zend_long dow;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set_first_day_of_week: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -997,11 +997,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient)
U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week)
{
- php_int_t num_days;
+ zend_long num_days;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -1064,7 +1064,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option)
CALENDAR_METHOD_FETCH_OBJECT;
- RETURN_INT(co->ucal->getRepeatedWallTimeOption());
+ RETURN_LONG(co->ucal->getRepeatedWallTimeOption());
}
U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option)
@@ -1080,16 +1080,16 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option)
CALENDAR_METHOD_FETCH_OBJECT;
- RETURN_INT(co->ucal->getSkippedWallTimeOption());
+ RETURN_LONG(co->ucal->getSkippedWallTimeOption());
}
U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option)
{
- php_int_t option;
+ zend_long option;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -1110,11 +1110,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option)
U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option)
{
- php_int_t option;
+ zend_long option;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) {
+ "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -1144,7 +1144,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
zv_timestamp;
php_date_obj *datetime;
char *locale_str = NULL;
- int locale_str_len;
+ size_t locale_str_len;
TimeZone *timeZone;
UErrorCode status = U_ZERO_ERROR;
Calendar *cal;
@@ -1179,7 +1179,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
}
zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
- if (Z_TYPE(zv_timestamp) != IS_INT) {
+ if (Z_TYPE(zv_timestamp) != IS_LONG) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_from_date_time: bad DateTime; call to "
"DateTime::getTimestamp() failed", 0 TSRMLS_CC);
@@ -1209,7 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
"error creating ICU Calendar object", 0 TSRMLS_CC);
goto error;
}
- cal->setTime(((UDate)Z_IVAL(zv_timestamp)) * 1000., status);
+ cal->setTime(((UDate)Z_LVAL(zv_timestamp)) * 1000., status);
if (U_FAILURE(status)) {
/* time zone was adopted by cal; should not be deleted here */
delete cal;
@@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code)
if (co == NULL)
RETURN_FALSE;
- RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co));
+ RETURN_LONG((zend_long)CALENDAR_ERROR_CODE(co));
}
U_CFUNC PHP_FUNCTION(intlcal_get_error_message)
diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h
index dfd0bbeeaf..838917cac3 100644
--- a/ext/intl/calendar/calendar_methods.h
+++ b/ext/intl/calendar/calendar_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index 09ad390b96..b0c8a964f6 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -42,8 +42,8 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
zval args_a[6] = {0},
*args = &args_a[0];
char *locale = NULL;
- int locale_len;
- php_int_t largs[6];
+ size_t locale_len;
+ zend_long largs[6];
UErrorCode status = U_ZERO_ERROR;
int variant;
intl_error_reset(NULL TSRMLS_CC);
@@ -242,11 +242,11 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change)
U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
{
- php_int_t year;
+ zend_long year;
CALENDAR_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Oi", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
+ "Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlgregcal_is_leap_year: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
diff --git a/ext/intl/calendar/gregoriancalendar_methods.h b/ext/intl/calendar/gregoriancalendar_methods.h
index f911752cc7..659566427c 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.h
+++ b/ext/intl/calendar/gregoriancalendar_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c
index 08da6d3831..07dc6385c8 100644
--- a/ext/intl/collator/collator.c
+++ b/ext/intl/collator/collator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -38,9 +38,9 @@ void collator_register_constants( INIT_FUNC_ARGS )
return;
}
- #define COLLATOR_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
- #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC );
- #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
+ #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC );
+ #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
/* UColAttributeValue constants */
COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT );
diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h
index 96e7aa097b..ea0071b179 100644
--- a/ext/intl/collator/collator.h
+++ b/ext/intl/collator/collator.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c
index a0a4bf8df3..8d879de8f7 100644
--- a/ext/intl/collator/collator_attr.c
+++ b/ext/intl/collator/collator_attr.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,12 +33,12 @@
*/
PHP_FUNCTION( collator_get_attribute )
{
- php_int_t attribute, value;
+ zend_long attribute, value;
COLLATOR_METHOD_INIT_VARS
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
&object, Collator_ce_ptr, &attribute ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -53,7 +53,7 @@ PHP_FUNCTION( collator_get_attribute )
value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) );
COLLATOR_CHECK_STATUS( co, "Error getting attribute value" );
- RETURN_INT( value );
+ RETURN_LONG( value );
}
/* }}} */
@@ -64,12 +64,12 @@ PHP_FUNCTION( collator_get_attribute )
*/
PHP_FUNCTION( collator_set_attribute )
{
- php_int_t attribute, value;
+ zend_long attribute, value;
COLLATOR_METHOD_INIT_VARS
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
&object, Collator_ce_ptr, &attribute, &value ) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -112,7 +112,7 @@ PHP_FUNCTION( collator_get_strength )
COLLATOR_METHOD_FETCH_OBJECT;
/* Get current strength and return it. */
- RETURN_INT( ucol_getStrength( co->ucoll ) );
+ RETURN_LONG( ucol_getStrength( co->ucoll ) );
}
/* }}} */
@@ -123,12 +123,12 @@ PHP_FUNCTION( collator_get_strength )
*/
PHP_FUNCTION( collator_set_strength )
{
- php_int_t strength;
+ zend_long strength;
COLLATOR_METHOD_INIT_VARS
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
&object, Collator_ce_ptr, &strength ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h
index 85636cc486..b86365ff5e 100644
--- a/ext/intl/collator/collator_attr.h
+++ b/ext/intl/collator/collator_attr.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 25a3ac8909..fd3f08e359 100644
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h
index 8410e96646..f9d2cedf88 100644
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index 497061e157..d27ff32ebd 100644
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,8 +33,8 @@ PHP_FUNCTION( collator_compare )
{
char* str1 = NULL;
char* str2 = NULL;
- int str1_len = 0;
- int str2_len = 0;
+ size_t str1_len = 0;
+ size_t str2_len = 0;
UChar* ustr1 = NULL;
UChar* ustr2 = NULL;
@@ -119,7 +119,7 @@ PHP_FUNCTION( collator_compare )
efree( ustr2 );
/* Return result of the comparison. */
- RETURN_INT( result );
+ RETURN_LONG( result );
}
/* }}} */
diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h
index 4e38b79309..cca9ca29b1 100644
--- a/ext/intl/collator/collator_compare.h
+++ b/ext/intl/collator/collator_compare.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index 89224d0341..bc279b25f7 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -41,7 +41,7 @@
/* {{{ collator_convert_hash_item_from_utf8_to_utf16 */
static void collator_convert_hash_item_from_utf8_to_utf16(
- HashTable* hash, zval *hashData, zend_string *hashKey, php_uint_t hashIndex,
+ HashTable* hash, zval *hashData, zend_string *hashKey, zend_ulong hashIndex,
UErrorCode* status )
{
const char* old_val;
@@ -55,7 +55,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16(
return;
old_val = Z_STRVAL_P( hashData );
- old_val_len = Z_STRSIZE_P( hashData );
+ old_val_len = Z_STRLEN_P( hashData );
/* Convert it from UTF-8 to UTF-16LE and save the result to new_val[_len]. */
intl_convert_utf8_to_utf16( &new_val, &new_val_len, old_val, old_val_len, status );
@@ -67,13 +67,13 @@ static void collator_convert_hash_item_from_utf8_to_utf16(
//???
efree(new_val);
/* hack to fix use of initialized value */
- Z_STRSIZE(znew_val) = Z_STRSIZE(znew_val) - UBYTES(1);
+ Z_STRLEN(znew_val) = Z_STRLEN(znew_val) - UBYTES(1);
if( hashKey)
{
zend_hash_update( hash, hashKey, &znew_val);
}
- else /* hashKeyType == HASH_KEY_IS_INT */
+ else /* hashKeyType == HASH_KEY_IS_LONG */
{
zend_hash_index_update( hash, hashIndex, &znew_val);
}
@@ -82,7 +82,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16(
/* {{{ collator_convert_hash_item_from_utf16_to_utf8 */
static void collator_convert_hash_item_from_utf16_to_utf8(
- HashTable* hash, zval * hashData, zend_string* hashKey, php_uint_t hashIndex,
+ HashTable* hash, zval * hashData, zend_string* hashKey, zend_ulong hashIndex,
UErrorCode* status )
{
const char* old_val;
@@ -96,7 +96,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
return;
old_val = Z_STRVAL_P( hashData );
- old_val_len = Z_STRSIZE_P( hashData );
+ old_val_len = Z_STRLEN_P( hashData );
/* Convert it from UTF-16LE to UTF-8 and save the result to new_val[_len]. */
intl_convert_utf16_to_utf8( &new_val, &new_val_len,
@@ -113,7 +113,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
{
zend_hash_update( hash, hashKey, &znew_val);
}
- else /* hashKeyType == HASH_KEY_IS_INT */
+ else /* hashKeyType == HASH_KEY_IS_LONG */
{
zend_hash_index_update( hash, hashIndex, &znew_val);
}
@@ -125,7 +125,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8(
*/
void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* status )
{
- php_uint_t hashIndex;
+ zend_ulong hashIndex;
zval *hashData;
zend_string *hashKey;
@@ -144,7 +144,7 @@ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* stat
*/
void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* status )
{
- php_uint_t hashIndex;
+ zend_ulong hashIndex;
zend_string *hashKey;
zval *hashData;
@@ -176,7 +176,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv )
/* Convert to utf8 then. */
intl_convert_utf16_to_utf8( &str, &str_len,
- (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRSIZE_P(utf16_zval) ), &status );
+ (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRLEN_P(utf16_zval) ), &status );
if( U_FAILURE( status ) )
php_error( E_WARNING, "Error converting utf16 to utf8 in collator_convert_zval_utf16_to_utf8()" );
@@ -207,7 +207,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv )
/* Convert the string to UTF-16. */
intl_convert_utf8_to_utf16(
&ustr, &ustr_len,
- Z_STRVAL_P( utf8_zval ), Z_STRSIZE_P( utf8_zval ),
+ Z_STRVAL_P( utf8_zval ), Z_STRLEN_P( utf8_zval ),
&status );
if( U_FAILURE( status ) )
php_error( E_WARNING, "Error casting object to string in collator_convert_zstr_utf8_to_utf16()" );
@@ -282,7 +282,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv TSRMLS_DC )
/* Convert the string to UTF-16. */
intl_convert_utf8_to_utf16(
&ustr, &ustr_len,
- Z_STRVAL_P( zstr ), Z_STRSIZE_P( zstr ),
+ Z_STRVAL_P( zstr ), Z_STRLEN_P( zstr ),
&status );
if( U_FAILURE( status ) )
php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" );
@@ -320,7 +320,7 @@ zval* collator_convert_string_to_number( zval* str, zval *rv )
zval_ptr_dtor( num );
num = rv;
- ZVAL_INT( num, 0 );
+ ZVAL_LONG( num, 0 );
}
return num;
@@ -338,9 +338,9 @@ zval* collator_convert_string_to_number( zval* str, zval *rv )
zval* collator_convert_string_to_double( zval* str, zval *rv )
{
zval* num = collator_convert_string_to_number( str, rv );
- if( Z_TYPE_P(num) == IS_INT )
+ if( Z_TYPE_P(num) == IS_LONG )
{
- ZVAL_DOUBLE( num, Z_IVAL_P( num ) );
+ ZVAL_DOUBLE( num, Z_LVAL_P( num ) );
}
return num;
@@ -359,7 +359,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv )
zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv )
{
int is_numeric = 0;
- php_int_t lval = 0;
+ zend_long lval = 0;
double dval = 0;
if( Z_TYPE_P( str ) != IS_STRING )
@@ -367,10 +367,10 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv )
COLLATOR_CONVERT_RETURN_FAILED( str );
}
- if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRSIZE_P(str) ), &lval, &dval, 1 ) ) )
+ if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) )
{
- if( is_numeric == IS_INT ) {
- ZVAL_INT(rv, lval);
+ if( is_numeric == IS_LONG ) {
+ ZVAL_LONG(rv, lval);
}
if( is_numeric == IS_DOUBLE )
ZVAL_DOUBLE(rv, dval);
diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h
index 7e169d559e..bf116bdfd8 100644
--- a/ext/intl/collator/collator_convert.h
+++ b/ext/intl/collator/collator_convert.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c
index 5801a68d0d..3c59f218e6 100644
--- a/ext/intl/collator/collator_create.c
+++ b/ext/intl/collator/collator_create.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,7 +28,7 @@
static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
- int locale_len = 0;
+ size_t locale_len = 0;
zval* object;
Collator_object* co;
diff --git a/ext/intl/collator/collator_create.h b/ext/intl/collator/collator_create.h
index b740e82d68..b5e9489e3d 100644
--- a/ext/intl/collator/collator_create.h
+++ b/ext/intl/collator/collator_create.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c
index acfa43c498..fb8886ef64 100644
--- a/ext/intl/collator/collator_error.c
+++ b/ext/intl/collator/collator_error.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -48,7 +48,7 @@ PHP_FUNCTION( collator_get_error_code )
RETURN_FALSE;
/* Return collator's last error code. */
- RETURN_INT( COLLATOR_ERROR_CODE( co ) );
+ RETURN_LONG( COLLATOR_ERROR_CODE( co ) );
}
/* }}} */
diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h
index b2f44ea2a3..3c8c10a043 100644
--- a/ext/intl/collator/collator_error.h
+++ b/ext/intl/collator/collator_error.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c
index f92133e3d5..a93cd962f3 100644
--- a/ext/intl/collator/collator_is_numeric.c
+++ b/ext/intl/collator/collator_is_numeric.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -125,15 +125,15 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */
*
* Ignores `locale' stuff.
*/
-static php_int_t collator_u_strtol(nptr, endptr, base)
+static zend_long collator_u_strtol(nptr, endptr, base)
const UChar *nptr;
UChar **endptr;
register int base;
{
register const UChar *s = nptr;
- register php_uint_t acc;
+ register zend_ulong acc;
register UChar c;
- register php_uint_t cutoff;
+ register zend_ulong cutoff;
register int neg = 0, any, cutlim;
if (s == NULL) {
@@ -184,9 +184,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base)
* Set any if any `digits' consumed; make it negative to indicate
* overflow.
*/
- cutoff = neg ? -(php_uint_t)PHP_INT_MIN : PHP_INT_MAX;
- cutlim = cutoff % (php_uint_t)base;
- cutoff /= (php_uint_t)base;
+ cutoff = neg ? -(zend_ulong)ZEND_LONG_MIN : ZEND_LONG_MAX;
+ cutlim = cutoff % (zend_ulong)base;
+ cutoff /= (zend_ulong)base;
for (acc = 0, any = 0;; c = *s++) {
if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/)
c -= 0x30 /*'0'*/;
@@ -208,7 +208,7 @@ static php_int_t collator_u_strtol(nptr, endptr, base)
}
}
if (any < 0) {
- acc = neg ? PHP_INT_MIN : PHP_INT_MAX;
+ acc = neg ? ZEND_LONG_MIN : ZEND_LONG_MAX;
errno = ERANGE;
} else if (neg)
acc = -acc;
@@ -222,9 +222,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base)
/* {{{ collator_is_numeric]
* Taken from PHP6:is_numeric_unicode()
*/
-zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors )
+zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors )
{
- php_int_t local_lval;
+ zend_long local_lval;
double local_dval;
UChar *end_ptr_long, *end_ptr_double;
int conv_base=10;
@@ -245,7 +245,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double
if (lval) {
*lval = local_lval;
}
- return IS_INT;
+ return IS_LONG;
} else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.' && *str != '-') { /* ignore partial string matches */
return 0;
}
@@ -288,7 +288,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double
return IS_DOUBLE;
} else if (end_ptr_long && lval) {
*lval = local_lval;
- return IS_INT;
+ return IS_LONG;
}
}
return 0;
diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h
index bd5ccfdd26..5ede4fa922 100644
--- a/ext/intl/collator/collator_is_numeric.h
+++ b/ext/intl/collator/collator_is_numeric.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -21,6 +21,6 @@
#include <php.h>
#include <unicode/uchar.h>
-zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors );
+zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors );
#endif // COLLATOR_IS_NUMERIC_H
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index 786719c131..76f154bb7c 100644
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,13 +33,13 @@
*/
PHP_FUNCTION( collator_get_locale )
{
- php_int_t type = 0;
+ zend_long type = 0;
char* locale_name = NULL;
COLLATOR_METHOD_INIT_VARS
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
&object, Collator_ce_ptr, &type ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h
index bda90cd3b9..b2f837b49a 100644
--- a/ext/intl/collator/collator_locale.h
+++ b/ext/intl/collator/collator_locale.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index 1d9c955fda..4fd7c4597e 100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -27,7 +27,7 @@
#include "intl_convert.h"
#if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED)
-typedef php_int_t ptrdiff_t;
+typedef zend_long ptrdiff_t;
#endif
/**
@@ -80,10 +80,10 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2
}
/* Compare the strings using ICU. */
- ZVAL_INT(result, ucol_strcoll(
+ ZVAL_LONG(result, ucol_strcoll(
co->ucoll,
- INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p),
- INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) ));
+ INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p),
+ INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) ));
}
else
{
@@ -190,10 +190,10 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM
co = Z_INTL_COLLATOR_P(&INTL_G(current_collator));
/* Compare the strings using ICU. */
- ZVAL_INT(result, ucol_strcoll(
+ ZVAL_LONG(result, ucol_strcoll(
co->ucoll,
- INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p),
- INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) ));
+ INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p),
+ INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) ));
zval_ptr_dtor( str1_p );
zval_ptr_dtor( str2_p );
@@ -203,7 +203,7 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM
/* }}} */
/* {{{ collator_compare_func
- * Taken from PHP5 source (array_data_compare).
+ * Taken from PHP7 source (array_data_compare).
*/
static int collator_compare_func( const void* a, const void* b TSRMLS_DC )
{
@@ -232,11 +232,11 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC )
return 0;
}
- convert_to_int(&result);
+ convert_to_long(&result);
- if( Z_IVAL(result) < 0 )
+ if( Z_LVAL(result) < 0 )
return -1;
- else if( Z_IVAL(result) > 0 )
+ else if( Z_LVAL(result) > 0 )
return 1;
return 0;
@@ -258,7 +258,7 @@ static int collator_cmp_sort_keys( const void *p1, const void *p2 TSRMLS_DC )
/* {{{ collator_get_compare_function
* Choose compare function according to sort flags.
*/
-static collator_compare_func_t collator_get_compare_function( const php_int_t sort_flags )
+static collator_compare_func_t collator_get_compare_function( const zend_long sort_flags )
{
collator_compare_func_t func;
@@ -290,12 +290,12 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS )
zval saved_collator;
zval* array = NULL;
HashTable* hash = NULL;
- php_int_t sort_flags = COLLATOR_SORT_REGULAR;
+ zend_long sort_flags = COLLATOR_SORT_REGULAR;
COLLATOR_METHOD_INIT_VARS
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|l",
&object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -424,7 +424,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
/* Process string values only. */
if( Z_TYPE_P( hashData ) == IS_STRING )
{
- intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRSIZE_P( hashData ), COLLATOR_ERROR_CODE_P( co ) );
+ intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRLEN_P( hashData ), COLLATOR_ERROR_CODE_P( co ) );
if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) )
{
@@ -536,7 +536,7 @@ PHP_FUNCTION( collator_asort )
PHP_FUNCTION( collator_get_sort_key )
{
char* str = NULL;
- int str_len = 0;
+ size_t str_len = 0;
UChar* ustr = NULL;
int ustr_len = 0;
uint8_t* key = NULL;
diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h
index a990cdf089..b5cb017a8c 100644
--- a/ext/intl/collator/collator_sort.h
+++ b/ext/intl/collator/collator_sort.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp
index 885d08cd2c..23dc342080 100644
--- a/ext/intl/common/common_date.cpp
+++ b/ext/intl/common/common_date.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -127,7 +127,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
if (millis) {
ZVAL_STRING(&zfuncname, "getTimestamp");
if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC)
- != SUCCESS || Z_TYPE(retval) != IS_INT) {
+ != SUCCESS || Z_TYPE(retval) != IS_LONG) {
spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the "
"object", func);
intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR,
@@ -137,7 +137,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
return FAILURE;
}
- *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval);
+ *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval);
zval_ptr_dtor(&zfuncname);
}
@@ -174,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC)
{
double rv = NAN;
- php_int_t lv;
+ zend_long lv;
int type;
char *message;
@@ -184,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS
switch (Z_TYPE_P(z)) {
case IS_STRING:
- type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0);
+ type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0);
if (type == IS_DOUBLE) {
rv *= U_MILLIS_PER_SECOND;
- } else if (type == IS_INT) {
+ } else if (type == IS_LONG) {
rv = U_MILLIS_PER_SECOND * (double)lv;
} else {
spprintf(&message, 0, "%s: string '%s' is not numeric, "
@@ -198,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS
efree(message);
}
break;
- case IS_INT:
- rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z);
+ case IS_LONG:
+ rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z);
break;
case IS_DOUBLE:
rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z);
diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h
index d2396cbf5a..e8ab66f40d 100644
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index cfe46ce75a..952b39edca 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -238,7 +238,7 @@ static PHP_METHOD(IntlIterator, key)
if (ii->iterator->funcs->get_current_key) {
ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC);
} else {
- RETURN_INT(ii->iterator->index);
+ RETURN_LONG(ii->iterator->index);
}
}
diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h
index 2b6d1790d9..af46a47751 100644
--- a/ext/intl/common/common_enum.h
+++ b/ext/intl/common/common_enum.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c
index 126c9cc35b..524bb94327 100644
--- a/ext/intl/common/common_error.c
+++ b/ext/intl/common/common_error.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,7 +28,7 @@
*/
PHP_FUNCTION( intl_get_error_code )
{
- RETURN_INT( intl_error_get_code( NULL TSRMLS_CC ) );
+ RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) );
}
/* }}} */
@@ -48,10 +48,10 @@ PHP_FUNCTION( intl_get_error_message )
*/
PHP_FUNCTION( intl_is_failure )
{
- php_int_t err_code;
+ zend_long err_code;
/* Parse parameters. */
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
&err_code ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -70,10 +70,10 @@ PHP_FUNCTION( intl_is_failure )
*/
PHP_FUNCTION( intl_error_name )
{
- php_int_t err_code;
+ zend_long err_code;
/* Parse parameters. */
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
&err_code ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -91,7 +91,7 @@ PHP_FUNCTION( intl_error_name )
*/
void intl_expose_icu_error_codes( INIT_FUNC_ARGS )
{
- #define INTL_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
/* Warnings */
INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING );
diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h
index 8716222124..46a26793ee 100644
--- a/ext/intl/common/common_error.h
+++ b/ext/intl/common/common_error.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 95f49d94cb..b27652aa9a 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -45,7 +45,7 @@ static zend_object_handlers php_converter_object_handlers;
#define CONV_GET(pzv) (Z_INTL_CONVERTER_P((pzv)))
#define THROW_UFAILURE(obj, fname, error) php_converter_throw_failure(obj, error TSRMLS_CC, \
- fname "() returned error %ld: %s", (long)error, u_errorName(error))
+ fname "() returned error " ZEND_LONG_FMT ": %s", (zend_long)error, u_errorName(error))
/* {{{ php_converter_throw_failure */
static inline void php_converter_throw_failure(php_converter_object *objval, UErrorCode error TSRMLS_DC, const char *format, ...) {
@@ -62,10 +62,10 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr
/* }}} */
/* {{{ php_converter_default_callback */
-static void php_converter_default_callback(zval *return_value, zval *zobj, php_int_t reason, zval *error TSRMLS_DC) {
+static void php_converter_default_callback(zval *return_value, zval *zobj, zend_long reason, zval *error TSRMLS_DC) {
ZVAL_DEREF(error);
zval_dtor(error);
- ZVAL_INT(error, U_ZERO_ERROR);
+ ZVAL_LONG(error, U_ZERO_ERROR);
/* Basic functionality so children can call parent::toUCallback() */
switch (reason) {
case UCNV_UNASSIGNED:
@@ -81,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i
chars[0] = 0x1A;
chars[1] = 0;
chars_len = 1;
- ZVAL_INT(error, U_INVALID_STATE_ERROR);
+ ZVAL_LONG(error, U_INVALID_STATE_ERROR);
RETVAL_STRINGL(chars, chars_len);
return;
}
@@ -99,7 +99,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i
chars[0] = 0x1A;
chars[1] = 0;
chars_len = 1;
- ZVAL_INT(error, uerror);
+ ZVAL_LONG(error, uerror);
}
RETVAL_STRINGL(chars, chars_len);
}
@@ -117,10 +117,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_toUCallback_arginfo, 0, ZEND_RETURN_VALUE,
ZEND_ARG_INFO(1, error)
ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, toUCallback) {
- php_int_t reason;
+ zend_long reason;
zval *source, *codeUnits, *error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz",
&reason, &source, &codeUnits, &error) == FAILURE) {
return;
}
@@ -139,10 +139,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_fromUCallback_arginfo, 0, ZEND_RETURN_VALUE
ZEND_ARG_INFO(1, error)
ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, fromUCallback) {
- php_int_t reason;
+ zend_long reason;
zval *source, *codePoint, *error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz",
&reason, &source, &codePoint, &error) == FAILURE) {
return;
}
@@ -152,9 +152,9 @@ static PHP_METHOD(UConverter, fromUCallback) {
/* }}} */
/* {{{ php_converter_check_limits */
-static inline zend_bool php_converter_check_limits(php_converter_object *objval, php_int_t available, php_int_t needed TSRMLS_DC) {
+static inline zend_bool php_converter_check_limits(php_converter_object *objval, zend_long available, zend_long needed TSRMLS_DC) {
if (available < needed) {
- php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %ld bytes needed, %ld available", needed, available);
+ php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %pd bytes needed, %pd available", needed, available);
return 0;
}
return 1;
@@ -169,9 +169,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
case IS_NULL:
/* Code unit is being skipped */
return;
- case IS_INT:
+ case IS_LONG:
{
- php_int_t lval = Z_IVAL_P(val);
+ zend_long lval = Z_LVAL_P(val);
if ((lval < 0) || (lval > 0x10FFFF)) {
php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval);
return;
@@ -194,7 +194,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
case IS_STRING:
{
const char *strval = Z_STRVAL_P(val);
- int i = 0, strlen = Z_STRSIZE_P(val);
+ int i = 0, strlen = Z_STRLEN_P(val);
while((i != strlen) && TARGET_CHECK(args, 1)) {
UChar c;
@@ -233,10 +233,10 @@ static void php_converter_to_u_callback(const void *context,
TSRMLS_D = objval->tsrm_ls;
#endif
- ZVAL_INT(&zargs[0], reason);
+ ZVAL_LONG(&zargs[0], reason);
ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source);
ZVAL_STRINGL(&zargs[2], codeUnits, length);
- ZVAL_INT(&zargs[3], *pErrorCode);
+ ZVAL_LONG(&zargs[3], *pErrorCode);
objval->to_cb.param_count = 4;
objval->to_cb.params = zargs;
@@ -250,10 +250,10 @@ static void php_converter_to_u_callback(const void *context,
zval_ptr_dtor(&retval);
}
- if (Z_TYPE(zargs[3]) == IS_INT) {
- *pErrorCode = Z_IVAL(zargs[3]);
- } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) {
- *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3]));
+ if (Z_TYPE(zargs[3]) == IS_LONG) {
+ *pErrorCode = Z_LVAL(zargs[3]);
+ } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) {
+ *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3]));
}
zval_ptr_dtor(&zargs[0]);
@@ -269,14 +269,14 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni
case IS_NULL:
/* Ignore */
return;
- case IS_INT:
+ case IS_LONG:
if (TARGET_CHECK(args, 1)) {
- *(args->target++) = Z_IVAL_P(val);
+ *(args->target++) = Z_LVAL_P(val);
}
return;
case IS_STRING:
{
- int vallen = Z_STRSIZE_P(val);
+ int vallen = Z_STRLEN_P(val);
if (TARGET_CHECK(args, vallen)) {
memcpy(args->target, Z_STRVAL_P(val), vallen);
args->target += vallen;
@@ -312,16 +312,16 @@ static void php_converter_from_u_callback(const void *context,
TSRMLS_D = objval->tsrm_ls;
#endif
- ZVAL_INT(&zargs[0], reason);
+ ZVAL_LONG(&zargs[0], reason);
array_init(&zargs[1]);
i = 0;
while (i < length) {
UChar32 c;
U16_NEXT(codeUnits, i, length, c);
- add_next_index_int(&zargs[1], c);
+ add_next_index_long(&zargs[1], c);
}
- ZVAL_INT(&zargs[2], codePoint);
- ZVAL_INT(&zargs[3], *pErrorCode);
+ ZVAL_LONG(&zargs[2], codePoint);
+ ZVAL_LONG(&zargs[3], *pErrorCode);
objval->from_cb.param_count = 4;
objval->from_cb.params = zargs;
@@ -335,10 +335,10 @@ static void php_converter_from_u_callback(const void *context,
zval_ptr_dtor(&retval);
}
- if (Z_TYPE(zargs[3]) == IS_INT) {
- *pErrorCode = Z_IVAL(zargs[3]);
- } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) {
- *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3]));
+ if (Z_TYPE(zargs[3]) == IS_LONG) {
+ *pErrorCode = Z_LVAL(zargs[3]);
+ } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) {
+ *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3]));
}
zval_ptr_dtor(&zargs[0]);
@@ -422,7 +422,7 @@ ZEND_END_ARG_INFO();
static void php_converter_do_set_encoding(UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) {
php_converter_object *objval = CONV_GET(getThis());
char *enc;
- int enc_len;
+ size_t enc_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &enc, &enc_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bad arguments, "
@@ -512,7 +512,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter *
RETURN_FALSE;
}
- RETURN_INT(t);
+ RETURN_LONG(t);
}
/* }}} */
@@ -562,9 +562,9 @@ ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, __construct) {
php_converter_object *objval = CONV_GET(getThis());
char *src = "utf-8";
- int src_len = sizeof("utf-8") - 1;
+ size_t src_len = sizeof("utf-8") - 1;
char *dest = src;
- int dest_len = src_len;
+ size_t dest_len = src_len;
intl_error_reset(NULL TSRMLS_CC);
@@ -590,7 +590,8 @@ ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, setSubstChars) {
php_converter_object *objval = CONV_GET(getThis());
char *chars;
- int chars_len, ret = 1;
+ size_t chars_len;
+ int ret = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &chars, &chars_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -731,9 +732,9 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_reasontext_arginfo, 0, ZEND_RETURN_VALUE, 0
ZEND_ARG_INFO(0, reason)
ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, reasonText) {
- php_int_t reason;
+ zend_long reason;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &reason) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &reason) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::reasonText(): bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -748,7 +749,7 @@ static PHP_METHOD(UConverter, reasonText) {
UCNV_REASON_CASE(CLOSE)
UCNV_REASON_CASE(CLONE)
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown UConverterCallbackReason: %ld", reason);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown UConverterCallbackReason: %pd", reason);
RETURN_FALSE;
}
}
@@ -763,7 +764,8 @@ ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, convert) {
php_converter_object *objval = CONV_GET(getThis());
char *str, *dest;
- int str_len, dest_len;
+ size_t str_len;
+ int32_t dest_len;
zend_bool reverse = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b",
@@ -799,7 +801,7 @@ ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, transcode) {
char *str, *src, *dest;
- int str_len, src_len, dest_len;
+ size_t str_len, src_len, dest_len;
zval *options = NULL;
UConverter *src_cnv = NULL, *dest_cnv = NULL;
@@ -824,13 +826,13 @@ static PHP_METHOD(UConverter, transcode) {
(tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING) {
error = U_ZERO_ERROR;
- ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error);
+ ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error);
}
if (U_SUCCESS(error) &&
(tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING) {
error = U_ZERO_ERROR;
- ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error);
+ ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error);
}
}
@@ -871,7 +873,7 @@ static PHP_METHOD(UConverter, getErrorCode) {
RETURN_FALSE;
}
- RETURN_INT(intl_error_get_code(&(objval->error) TSRMLS_CC));
+ RETURN_LONG(intl_error_get_code(&(objval->error) TSRMLS_CC));
}
/* }}} */
@@ -924,7 +926,7 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_getaliases_arginfo, 0, ZEND_RETURN_VALUE, 0
ZEND_END_ARG_INFO();
static PHP_METHOD(UConverter, getAliases) {
char *name;
- int name_len;
+ size_t name_len;
UErrorCode error = U_ZERO_ERROR;
uint16_t i, count;
@@ -1081,7 +1083,7 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) {
err_msg = intl_error_get_message(&oldobj->error TSRMLS_CC);
zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC);
- STR_RELEASE(err_msg);
+ zend_string_release(err_msg);
return retval;
}
@@ -1098,8 +1100,8 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) {
}
/* }}} */
-#define CONV_REASON_CONST(v) zend_declare_class_constant_int(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC)
-#define CONV_TYPE_CONST(v) zend_declare_class_constant_int(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC)
+#define CONV_REASON_CONST(v) zend_declare_class_constant_long(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC)
+#define CONV_TYPE_CONST(v) zend_declare_class_constant_long(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC)
/* {{{ php_converter_minit */
int php_converter_minit(INIT_FUNC_ARGS) {
diff --git a/ext/intl/converter/converter.h b/ext/intl/converter/converter.h
index bd316fcf98..520c7c6c86 100644
--- a/ext/intl/converter/converter.h
+++ b/ext/intl/converter/converter.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c
index c51b33144b..ffa606a9cd 100644
--- a/ext/intl/dateformat/dateformat.c
+++ b/ext/intl/dateformat/dateformat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -34,11 +34,11 @@ void dateformat_register_constants( INIT_FUNC_ARGS )
return;
}
- #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
- #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC );
- #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
+ #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC );
+ #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
- #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC );
+ #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC );
/* UDateFormatStyle constants */
DATEFORMATTER_EXPOSE_CLASS_CONST( FULL );
@@ -85,7 +85,7 @@ PHP_FUNCTION( datefmt_get_error_code )
dfo = Z_INTL_DATEFORMATTER_P( object );
/* Return formatter's last error code. */
- RETURN_INT( INTL_DATA_ERROR_CODE(dfo) );
+ RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) );
}
/* }}} */
diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h
index f11918b79f..6139b67951 100644
--- a/ext/intl/dateformat/dateformat.h
+++ b/ext/intl/dateformat/dateformat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c
index 0ee5412a90..314ae730c7 100644
--- a/ext/intl/dateformat/dateformat_attr.c
+++ b/ext/intl/dateformat/dateformat_attr.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -48,7 +48,7 @@ PHP_FUNCTION( datefmt_get_datetype )
INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." );
- RETURN_INT(dfo->date_type );
+ RETURN_LONG(dfo->date_type );
}
/* }}} */
@@ -74,7 +74,7 @@ PHP_FUNCTION( datefmt_get_timetype )
INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." );
- RETURN_INT(dfo->time_type );
+ RETURN_LONG(dfo->time_type );
}
/* }}} */
@@ -128,7 +128,7 @@ PHP_FUNCTION( datefmt_get_pattern )
PHP_FUNCTION( datefmt_set_pattern )
{
char* value = NULL;
- int value_len = 0;
+ size_t value_len = 0;
int slength = 0;
UChar* svalue = NULL;
zend_bool is_pattern_localized =FALSE;
@@ -170,12 +170,12 @@ PHP_FUNCTION( datefmt_set_pattern )
PHP_FUNCTION( datefmt_get_locale )
{
char *loc;
- php_int_t loc_type =ULOC_ACTUAL_LOCALE;
+ zend_long loc_type =ULOC_ACTUAL_LOCALE;
DATE_FORMAT_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l",
&object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h
index 6fe82a6e00..e7013a9e2a 100644
--- a/ext/intl/dateformat/dateformat_attr.h
+++ b/ext/intl/dateformat/dateformat_attr.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp
index 4446922252..71b136c6c1 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.cpp
+++ b/ext/intl/dateformat/dateformat_attrcpp.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -160,7 +160,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar)
RETURN_FALSE;
}
- RETURN_INT(dfo->calendar);
+ RETURN_LONG(dfo->calendar);
}
/* }}} */
@@ -220,7 +220,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar)
DATE_FORMAT_METHOD_FETCH_OBJECT;
Calendar *cal;
- php_int_t cal_type;
+ zend_long cal_type;
bool cal_owned;
Locale locale = Locale::createFromName(dfo->requested_locale);
// getting the actual locale from the DateFormat is not enough
diff --git a/ext/intl/dateformat/dateformat_attrcpp.h b/ext/intl/dateformat/dateformat_attrcpp.h
index 408232f940..54536f21fa 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.h
+++ b/ext/intl/dateformat/dateformat_attrcpp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index 4c46a7d694..0d93338ecd 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h
index a3eb4b9839..ebd057022e 100644
--- a/ext/intl/dateformat/dateformat_class.h
+++ b/ext/intl/dateformat/dateformat_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp
index 5242c5f5ac..4a272aa45f 100644
--- a/ext/intl/dateformat/dateformat_create.cpp
+++ b/ext/intl/dateformat/dateformat_create.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -41,19 +41,19 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
zval *object;
const char *locale_str;
- int locale_len = 0;
+ size_t locale_len = 0;
Locale locale;
- php_int_t date_type = 0;
- php_int_t time_type = 0;
+ zend_long date_type = 0;
+ zend_long time_type = 0;
zval *calendar_zv = NULL;
Calendar *calendar = NULL;
- php_int_t calendar_type;
+ zend_long calendar_type;
bool calendar_owned;
zval *timezone_zv = NULL;
TimeZone *timezone = NULL;
bool explicit_tz;
char* pattern_str = NULL;
- int pattern_str_len = 0;
+ size_t pattern_str_len = 0;
UChar* svalue = NULL; /* UTF-16 pattern_str */
int slength = 0;
IntlDateFormatter_object* dfo;
@@ -61,7 +61,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
intl_error_reset(NULL TSRMLS_CC);
object = return_value;
/* Parse parameters. */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|zzs",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|zzs",
&locale_str, &locale_len, &date_type, &time_type, &timezone_zv,
&calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: "
diff --git a/ext/intl/dateformat/dateformat_create.h b/ext/intl/dateformat/dateformat_create.h
index 47e67c2f45..c6e2d0feb8 100644
--- a/ext/intl/dateformat/dateformat_create.h
+++ b/ext/intl/dateformat/dateformat_create.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c
index 33451e1c51..509e91b617 100644
--- a/ext/intl/dateformat/dateformat_data.c
+++ b/ext/intl/dateformat/dateformat_data.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h
index cde9e363c9..a49da7dc89 100644
--- a/ext/intl/dateformat/dateformat_data.h
+++ b/ext/intl/dateformat/dateformat_data.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c
index 9ec012c570..d11eb2df24 100644
--- a/ext/intl/dateformat/dateformat_format.c
+++ b/ext/intl/dateformat/dateformat_format.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -71,21 +71,21 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo,
}
if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) {
- if(Z_TYPE_P(ele_value) != IS_INT) {
+ if(Z_TYPE_P(ele_value) != IS_LONG) {
spprintf(&message, 0, "datefmt_format: parameter array contains "
"a non-integer element for key '%s'", key_name);
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
efree(message);
} else {
- if (Z_IVAL_P(ele_value) > INT32_MAX ||
- Z_IVAL_P(ele_value) < INT32_MIN) {
- spprintf(&message, 0, "datefmt_format: value %ld is out of "
+ if (Z_LVAL_P(ele_value) > INT32_MAX ||
+ Z_LVAL_P(ele_value) < INT32_MIN) {
+ spprintf(&message, 0, "datefmt_format: value %pd is out of "
"bounds for a 32-bit integer in key '%s'",
- Z_IVAL_P(ele_value), key_name);
+ Z_LVAL_P(ele_value), key_name);
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
efree(message);
} else {
- result = Z_IVAL_P(ele_value);
+ result = Z_LVAL_P(ele_value);
}
}
}
diff --git a/ext/intl/dateformat/dateformat_format.h b/ext/intl/dateformat/dateformat_format.h
index 49f34c6892..02b773f991 100644
--- a/ext/intl/dateformat/dateformat_format.h
+++ b/ext/intl/dateformat/dateformat_format.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
index 58d9af2772..b552ed7529 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -46,10 +46,10 @@ static const DateFormat::EStyle valid_styles[] = {
};
static bool valid_format(zval *z) {
- if (Z_TYPE_P(z) == IS_INT) {
- php_int_t lval = Z_IVAL_P(z);
+ if (Z_TYPE_P(z) == IS_LONG) {
+ zend_long lval = Z_LVAL_P(z);
for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) {
- if ((php_int_t)valid_styles[i] == lval) {
+ if ((zend_long)valid_styles[i] == lval) {
return true;
}
}
@@ -63,7 +63,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
zval *object,
*format = NULL;
const char *locale_str = NULL;
- int locale_len;
+ size_t locale_len;
bool pattern = false;
UDate date;
TimeZone *timeZone = NULL;
@@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
"element of the array) is not valid", 0 TSRMLS_CC);
RETURN_FALSE;
}
- dateStyle = (DateFormat::EStyle)Z_IVAL_P(z);
+ dateStyle = (DateFormat::EStyle)Z_LVAL_P(z);
zend_hash_move_forward_ex(ht, &pos);
z = zend_hash_get_current_data_ex(ht, &pos);
@@ -113,18 +113,18 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
"second element of the array) is not valid", 0 TSRMLS_CC);
RETURN_FALSE;
}
- timeStyle = (DateFormat::EStyle)Z_IVAL_P(z);
- } else if (Z_TYPE_P(format) == IS_INT) {
+ timeStyle = (DateFormat::EStyle)Z_LVAL_P(z);
+ } else if (Z_TYPE_P(format) == IS_LONG) {
if (!valid_format(format)) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"datefmt_format_object: the date/time format type is invalid",
0 TSRMLS_CC);
RETURN_FALSE;
}
- dateStyle = timeStyle = (DateFormat::EStyle)Z_IVAL_P(format);
+ dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format);
} else {
convert_to_string_ex(format);
- if (Z_STRSIZE_P(format) == 0) {
+ if (Z_STRLEN_P(format) == 0) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"datefmt_format_object: the format is empty", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
if (pattern) {
df = new SimpleDateFormat(
- UnicodeString(Z_STRVAL_P(format), Z_STRSIZE_P(format),
+ UnicodeString(Z_STRVAL_P(format), Z_STRLEN_P(format),
UnicodeString::kInvariant),
Locale::createFromName(locale_str),
status);
diff --git a/ext/intl/dateformat/dateformat_format_object.h b/ext/intl/dateformat/dateformat_format_object.h
index d80ea87e0f..f92296cd59 100644
--- a/ext/intl/dateformat/dateformat_format_object.h
+++ b/ext/intl/dateformat/dateformat_format_object.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp
index 680df46f42..b3f134a4f1 100644
--- a/ext/intl/dateformat/dateformat_helpers.cpp
+++ b/ext/intl/dateformat/dateformat_helpers.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,7 +33,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
const char *func_name,
intl_error *err,
Calendar*& cal,
- php_int_t& cal_int_type,
+ zend_long& cal_int_type,
bool& calendar_owned TSRMLS_DC)
{
char *msg;
@@ -47,10 +47,10 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
cal_int_type = UCAL_GREGORIAN;
- } else if (Z_TYPE_P(calendar_zv) == IS_INT) {
+ } else if (Z_TYPE_P(calendar_zv) == IS_LONG) {
- php_int_t v = Z_IVAL_P(calendar_zv);
- if (v != (php_int_t)UCAL_TRADITIONAL && v != (php_int_t)UCAL_GREGORIAN) {
+ zend_long v = Z_LVAL_P(calendar_zv);
+ if (v != (zend_long)UCAL_TRADITIONAL && v != (zend_long)UCAL_GREGORIAN) {
spprintf(&msg, 0, "%s: invalid value for calendar type; it must be "
"one of IntlDateFormatter::TRADITIONAL (locale's default "
"calendar) or IntlDateFormatter::GREGORIAN. "
@@ -59,14 +59,14 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC);
efree(msg);
return FAILURE;
- } else if (v == (php_int_t)UCAL_TRADITIONAL) {
+ } else if (v == (zend_long)UCAL_TRADITIONAL) {
cal = Calendar::createInstance(locale, status);
} else { //UCAL_GREGORIAN
cal = new GregorianCalendar(locale, status);
}
calendar_owned = true;
- cal_int_type = Z_IVAL_P(calendar_zv);
+ cal_int_type = Z_LVAL_P(calendar_zv);
} else if (Z_TYPE_P(calendar_zv) == IS_OBJECT &&
instanceof_function_ex(Z_OBJCE_P(calendar_zv),
diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h
index 0c5647b0ab..c6121d75bb 100644
--- a/ext/intl/dateformat/dateformat_helpers.h
+++ b/ext/intl/dateformat/dateformat_helpers.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -32,7 +32,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
const char *func_name,
intl_error *err,
Calendar*& cal,
- php_int_t& cal_int_type,
+ zend_long& cal_int_type,
bool& calendar_owned TSRMLS_DC);
#endif /* DATEFORMAT_HELPERS_H */
diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c
index eb28a39ba2..15279da3a1 100644
--- a/ext/intl/dateformat/dateformat_parse.c
+++ b/ext/intl/dateformat/dateformat_parse.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -57,24 +57,24 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex
if(result > LONG_MAX || result < -LONG_MAX) {
ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result));
} else {
- ZVAL_INT(return_value, (php_int_t)result);
+ ZVAL_LONG(return_value, (zend_long)result);
}
}
/* }}} */
-static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, php_int_t calendar_field, char* key_name TSRMLS_DC)
+static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name TSRMLS_DC)
{
- php_int_t calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo));
+ zend_long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo));
INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" );
if( strcmp(key_name, CALENDAR_YEAR )==0 ){
/* since tm_year is years from 1900 */
- add_assoc_int( return_value, key_name,( calendar_field_val-1900) );
+ add_assoc_long( return_value, key_name,( calendar_field_val-1900) );
}else if( strcmp(key_name, CALENDAR_WDAY )==0 ){
/* since tm_wday starts from 0 whereas ICU WDAY start from 1 */
- add_assoc_int( return_value, key_name,( calendar_field_val-1) );
+ add_assoc_long( return_value, key_name,( calendar_field_val-1) );
}else{
- add_assoc_int( return_value, key_name, calendar_field_val );
+ add_assoc_long( return_value, key_name, calendar_field_val );
}
}
@@ -86,7 +86,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex
UCalendar *parsed_calendar = NULL;
UChar* text_utf16 = NULL;
int32_t text_utf16_len = 0;
- php_int_t isInDST = 0;
+ zend_long isInDST = 0;
/* Convert timezone to UTF-16. */
intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo));
@@ -116,7 +116,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex
/* Is in DST? */
isInDST = ucal_inDaylightTime(parsed_calendar , &INTL_DATA_ERROR_CODE(dfo));
INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." );
- add_assoc_int( return_value, CALENDAR_ISDST,(isInDST==1?1:0));
+ add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0));
}
/* }}} */
@@ -128,7 +128,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex
PHP_FUNCTION(datefmt_parse)
{
char* text_to_parse = NULL;
- int32_t text_len =0;
+ size_t text_len =0;
zval* z_parse_pos = NULL;
int32_t parse_pos = -1;
@@ -146,8 +146,8 @@ PHP_FUNCTION(datefmt_parse)
if (z_parse_pos) {
ZVAL_DEREF(z_parse_pos);
- convert_to_int(z_parse_pos);
- parse_pos = (int32_t)Z_IVAL_P(z_parse_pos);
+ convert_to_long(z_parse_pos);
+ parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
if(parse_pos > text_len) {
RETURN_FALSE;
}
@@ -155,7 +155,7 @@ PHP_FUNCTION(datefmt_parse)
internal_parse_to_timestamp( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
if(z_parse_pos) {
zval_dtor(z_parse_pos);
- ZVAL_INT(z_parse_pos, parse_pos);
+ ZVAL_LONG(z_parse_pos, parse_pos);
}
}
/* }}} */
@@ -167,9 +167,9 @@ PHP_FUNCTION(datefmt_parse)
PHP_FUNCTION(datefmt_localtime)
{
char* text_to_parse = NULL;
- int32_t text_len =0;
+ size_t text_len =0;
zval* z_parse_pos = NULL;
- int32_t parse_pos = -1;
+ int32_t parse_pos = -1;
DATE_FORMAT_METHOD_INIT_VARS;
@@ -185,8 +185,8 @@ PHP_FUNCTION(datefmt_localtime)
if (z_parse_pos) {
ZVAL_DEREF(z_parse_pos);
- convert_to_int(z_parse_pos);
- parse_pos = (int32_t)Z_IVAL_P(z_parse_pos);
+ convert_to_long(z_parse_pos);
+ parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
if(parse_pos > text_len) {
RETURN_FALSE;
}
@@ -194,7 +194,7 @@ PHP_FUNCTION(datefmt_localtime)
internal_parse_to_localtime( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
if (z_parse_pos) {
zval_dtor(z_parse_pos);
- ZVAL_INT(z_parse_pos, parse_pos);
+ ZVAL_LONG(z_parse_pos, parse_pos);
}
}
/* }}} */
diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h
index c74a3d5f15..694dbf8d90 100644
--- a/ext/intl/dateformat/dateformat_parse.h
+++ b/ext/intl/dateformat/dateformat_parse.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c
index 2c3ffaa569..bb4d3d2ac5 100644
--- a/ext/intl/formatter/formatter.c
+++ b/ext/intl/formatter/formatter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -40,9 +40,9 @@ void formatter_register_constants( INIT_FUNC_ARGS )
zend_error(E_ERROR, "NumberFormatter class not defined");
}
- #define FORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
- #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC );
- #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
+ #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC );
+ #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
/* UNumberFormatStyle constants */
FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL );
diff --git a/ext/intl/formatter/formatter.h b/ext/intl/formatter/formatter.h
index 1f9ebead8e..47ec473aae 100644
--- a/ext/intl/formatter/formatter.h
+++ b/ext/intl/formatter/formatter.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index 1a1409448a..639342f4af 100644
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -32,7 +32,7 @@
*/
PHP_FUNCTION( numfmt_get_attribute )
{
- php_int_t attribute, value;
+ zend_long attribute, value;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
@@ -72,7 +72,7 @@ PHP_FUNCTION( numfmt_get_attribute )
if(value == -1) {
INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
} else {
- RETVAL_INT(value);
+ RETVAL_LONG(value);
}
break;
case UNUM_ROUNDING_INCREMENT:
@@ -101,7 +101,7 @@ PHP_FUNCTION( numfmt_get_attribute )
*/
PHP_FUNCTION( numfmt_get_text_attribute )
{
- php_int_t attribute;
+ zend_long attribute;
UChar value_buf[64];
int value_buf_size = USIZE( value_buf );
UChar* value = value_buf;
@@ -109,7 +109,7 @@ PHP_FUNCTION( numfmt_get_text_attribute )
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -145,12 +145,12 @@ PHP_FUNCTION( numfmt_get_text_attribute )
*/
PHP_FUNCTION( numfmt_set_attribute )
{
- php_int_t attribute;
+ zend_long attribute;
zval *value;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz",
&object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -182,8 +182,8 @@ PHP_FUNCTION( numfmt_set_attribute )
case UNUM_MIN_SIGNIFICANT_DIGITS:
case UNUM_MAX_SIGNIFICANT_DIGITS:
case UNUM_LENIENT_PARSE:
- convert_to_int_ex(value);
- unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_IVAL_P(value));
+ convert_to_long_ex(value);
+ unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value));
break;
case UNUM_ROUNDING_INCREMENT:
convert_to_double_ex(value);
@@ -209,13 +209,13 @@ PHP_FUNCTION( numfmt_set_text_attribute )
{
int slength = 0;
UChar *svalue = NULL;
- php_int_t attribute;
+ zend_long attribute;
char *value;
- int len;
+ size_t len;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -249,14 +249,14 @@ PHP_FUNCTION( numfmt_set_text_attribute )
*/
PHP_FUNCTION( numfmt_get_symbol )
{
- php_int_t symbol;
+ zend_long symbol;
UChar value_buf[4];
UChar *value = value_buf;
int length = USIZE(value_buf);
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &symbol ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -297,15 +297,15 @@ PHP_FUNCTION( numfmt_get_symbol )
*/
PHP_FUNCTION( numfmt_set_symbol )
{
- php_int_t symbol;
+ zend_long symbol;
char* value = NULL;
- int value_len = 0;
+ size_t value_len = 0;
UChar* svalue = 0;
int slength = 0;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -387,7 +387,7 @@ PHP_FUNCTION( numfmt_get_pattern )
PHP_FUNCTION( numfmt_set_pattern )
{
char* value = NULL;
- int value_len = 0;
+ size_t value_len = 0;
int slength = 0;
UChar* svalue = NULL;
FORMATTER_METHOD_INIT_VARS;
@@ -426,12 +426,12 @@ PHP_FUNCTION( numfmt_set_pattern )
*/
PHP_FUNCTION( numfmt_get_locale )
{
- php_int_t type = ULOC_ACTUAL_LOCALE;
+ zend_long type = ULOC_ACTUAL_LOCALE;
char* loc;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l",
&object, NumberFormatter_ce_ptr, &type ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h
index c4bc94ce5f..e8690ac8a4 100644
--- a/ext/intl/formatter/formatter_attr.h
+++ b/ext/intl/formatter/formatter_attr.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index 601aeae5e6..8fcc155e85 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h
index 12061ba5df..1db688712c 100644
--- a/ext/intl/formatter/formatter_class.h
+++ b/ext/intl/formatter/formatter_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c
index 88f122f7c9..2f785ba68f 100644
--- a/ext/intl/formatter/formatter_data.c
+++ b/ext/intl/formatter/formatter_data.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h
index adc4818afc..0e3bc4fea4 100644
--- a/ext/intl/formatter/formatter_data.h
+++ b/ext/intl/formatter/formatter_data.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c
index 3fe5d6abf1..937cb05812 100644
--- a/ext/intl/formatter/formatter_format.c
+++ b/ext/intl/formatter/formatter_format.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -33,14 +33,14 @@
PHP_FUNCTION( numfmt_format )
{
zval *number;
- php_int_t type = FORMAT_TYPE_DEFAULT;
+ zend_long type = FORMAT_TYPE_DEFAULT;
UChar format_buf[32];
UChar* formatted = format_buf;
int formatted_len = USIZE(format_buf);
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|l",
&object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -57,9 +57,9 @@ PHP_FUNCTION( numfmt_format )
convert_scalar_to_number_ex(number);
}
- if(Z_TYPE_P(number) == IS_INT) {
+ if(Z_TYPE_P(number) == IS_LONG) {
/* take INT32 on 32-bit, int64 on 64-bit */
- type = (sizeof(php_int_t) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32;
+ type = (sizeof(zend_long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32;
} else if(Z_TYPE_P(number) == IS_DOUBLE) {
type = FORMAT_TYPE_DOUBLE;
} else {
@@ -67,20 +67,20 @@ PHP_FUNCTION( numfmt_format )
}
}
- if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_INT) {
+ if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) {
SEPARATE_ZVAL_IF_NOT_REF(number);
convert_scalar_to_number(number TSRMLS_CC );
}
switch(type) {
case FORMAT_TYPE_INT32:
- convert_to_int_ex(number);
- formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number),
+ convert_to_long_ex(number);
+ formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number),
formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo));
if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) {
intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC);
formatted = eumalloc(formatted_len);
- formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number),
+ formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number),
formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo));
if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) {
efree(formatted);
@@ -91,7 +91,7 @@ PHP_FUNCTION( numfmt_format )
case FORMAT_TYPE_INT64:
{
- int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_IVAL_P(number);
+ int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_LVAL_P(number);
formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo));
if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) {
intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC);
@@ -120,7 +120,7 @@ PHP_FUNCTION( numfmt_format )
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported format type %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported format type %pd", type);
RETURN_FALSE;
break;
}
@@ -141,7 +141,7 @@ PHP_FUNCTION( numfmt_format_currency )
UChar* formatted = format_buf;
int formatted_len = USIZE(format_buf);
char* currency = NULL;
- int currency_len = 0;
+ size_t currency_len = 0;
UChar* scurrency = NULL;
int scurrency_len = 0;
FORMATTER_METHOD_INIT_VARS;
diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h
index 35fafd1ede..af7b0ffe26 100644
--- a/ext/intl/formatter/formatter_format.h
+++ b/ext/intl/formatter/formatter_format.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c
index f24df76f51..939a8f782b 100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -29,14 +29,14 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern = NULL;
- int locale_len = 0, pattern_len = 0;
- php_int_t style;
+ size_t locale_len = 0, pattern_len = 0;
+ zend_long style;
UChar* spattern = NULL;
int spattern_len = 0;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "si|s",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s",
&locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -125,7 +125,7 @@ PHP_FUNCTION( numfmt_get_error_code )
nfo = Z_INTL_NUMBERFORMATTER_P(object);
/* Return formatter's last error code. */
- RETURN_INT( INTL_DATA_ERROR_CODE(nfo) );
+ RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) );
}
/* }}} */
diff --git a/ext/intl/formatter/formatter_main.h b/ext/intl/formatter/formatter_main.h
index 7669e684ae..66cf5c1b6b 100644
--- a/ext/intl/formatter/formatter_main.h
+++ b/ext/intl/formatter/formatter_main.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index 3d0c84dab6..0959d11830 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -36,11 +36,11 @@
*/
PHP_FUNCTION( numfmt_parse )
{
- php_int_t type = FORMAT_TYPE_DOUBLE;
+ zend_long type = FORMAT_TYPE_DOUBLE;
UChar* sstr = NULL;
int sstr_len = 0;
char* str = NULL;
- int str_len;
+ size_t str_len;
int32_t val32, position = 0;
int64_t val64;
double val_double;
@@ -50,7 +50,7 @@ PHP_FUNCTION( numfmt_parse )
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|iz/!",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|lz/!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -68,8 +68,8 @@ PHP_FUNCTION( numfmt_parse )
if(zposition) {
ZVAL_DEREF(zposition);
- convert_to_int(zposition);
- position = (int32_t)Z_IVAL_P( zposition );
+ convert_to_long(zposition);
+ position = (int32_t)Z_LVAL_P( zposition );
position_p = &position;
}
@@ -82,14 +82,14 @@ PHP_FUNCTION( numfmt_parse )
switch(type) {
case FORMAT_TYPE_INT32:
val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo));
- RETVAL_INT(val32);
+ RETVAL_LONG(val32);
break;
case FORMAT_TYPE_INT64:
val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo));
- if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) {
+ if(val64 > ZEND_LONG_MAX || val64 < ZEND_LONG_MIN) {
RETVAL_DOUBLE(val64);
} else {
- RETVAL_INT((php_int_t)val64);
+ RETVAL_LONG((zend_long)val64);
}
break;
case FORMAT_TYPE_DOUBLE:
@@ -97,7 +97,7 @@ PHP_FUNCTION( numfmt_parse )
RETVAL_DOUBLE(val_double);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported format type %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported format type %pd", type);
RETVAL_FALSE;
break;
}
@@ -107,7 +107,7 @@ PHP_FUNCTION( numfmt_parse )
#endif
if(zposition) {
zval_dtor(zposition);
- ZVAL_INT(zposition, position);
+ ZVAL_LONG(zposition, position);
}
if (sstr) {
@@ -132,7 +132,7 @@ PHP_FUNCTION( numfmt_parse_currency )
char *currency_str = NULL;
int currency_len = 0;
char *str;
- int str_len;
+ size_t str_len;
int32_t* position_p = NULL;
int32_t position = 0;
zval *zcurrency, *zposition = NULL;
@@ -157,15 +157,15 @@ PHP_FUNCTION( numfmt_parse_currency )
if(zposition) {
ZVAL_DEREF(zposition);
- convert_to_int(zposition);
- position = (int32_t)Z_IVAL_P( zposition );
+ convert_to_long(zposition);
+ position = (int32_t)Z_LVAL_P( zposition );
position_p = &position;
}
number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo));
if(zposition) {
zval_dtor(zposition);
- ZVAL_INT(zposition, position);
+ ZVAL_LONG(zposition, position);
}
if (sstr) {
efree(sstr);
diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h
index cb96c72b5d..7a3098fcb2 100644
--- a/ext/intl/formatter/formatter_parse.h
+++ b/ext/intl/formatter/formatter_parse.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h
index 756ce9173e..5256a272a1 100644
--- a/ext/intl/grapheme/grapheme.h
+++ b/ext/intl/grapheme/grapheme.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 3968508c51..55ce63955f 100644
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -44,18 +44,18 @@
*/
void grapheme_register_constants( INIT_FUNC_ARGS )
{
- REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT);
}
/* }}} */
-/* {{{ proto int grapheme_strlen(string str)
+/* {{{ proto size_t grapheme_strlen(string str)
Get number of graphemes in a string */
PHP_FUNCTION(grapheme_strlen)
{
unsigned char* string;
- int string_len;
+ size_t string_len;
UChar* ustring = NULL;
int ustring_len = 0;
int ret_len;
@@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen)
ret_len = grapheme_ascii_check(string, string_len);
if ( ret_len >= 0 )
- RETURN_INT(ret_len);
+ RETURN_LONG(ret_len);
/* convert the string to UTF-16. */
status = U_ZERO_ERROR;
@@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen)
}
if (ret_len >= 0) {
- RETVAL_INT(ret_len);
+ RETVAL_LONG(ret_len);
} else {
RETVAL_FALSE;
}
@@ -109,13 +109,13 @@ PHP_FUNCTION(grapheme_strlen)
PHP_FUNCTION(grapheme_strpos)
{
unsigned char *haystack, *needle;
- int haystack_len, needle_len;
+ size_t haystack_len, needle_len;
unsigned char *found;
- php_int_t loffset = 0;
+ zend_long loffset = 0;
int32_t offset = 0;
int ret_pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strpos: unable to parse input param", 0 TSRMLS_CC );
@@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos)
/* if it is there, and if the haystack is ascii, we are all done */
if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) {
- RETURN_INT(found - haystack);
+ RETURN_LONG(found - haystack);
}
/* do utf16 part of the strpos */
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC );
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
} else {
RETURN_FALSE;
}
@@ -176,14 +176,14 @@ PHP_FUNCTION(grapheme_strpos)
PHP_FUNCTION(grapheme_stripos)
{
unsigned char *haystack, *needle, *haystack_dup, *needle_dup;
- int haystack_len, needle_len;
+ size_t haystack_len, needle_len;
unsigned char *found;
- php_int_t loffset = 0;
+ zend_long loffset = 0;
int32_t offset = 0;
int ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_stripos: unable to parse input param", 0 TSRMLS_CC );
@@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos)
efree(needle_dup);
if (found) {
- RETURN_INT(found - haystack_dup);
+ RETURN_LONG(found - haystack_dup);
}
/* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */
@@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC );
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
} else {
RETURN_FALSE;
}
@@ -251,13 +251,13 @@ PHP_FUNCTION(grapheme_stripos)
PHP_FUNCTION(grapheme_strrpos)
{
unsigned char *haystack, *needle;
- int haystack_len, needle_len;
- php_int_t loffset = 0;
+ size_t haystack_len, needle_len;
+ zend_long loffset = 0;
int32_t offset = 0;
int32_t ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC );
@@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos)
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
}
/* if the needle was ascii too, we are done */
@@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC);
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
} else {
RETURN_FALSE;
}
@@ -321,13 +321,13 @@ PHP_FUNCTION(grapheme_strrpos)
PHP_FUNCTION(grapheme_strripos)
{
unsigned char *haystack, *needle;
- int haystack_len, needle_len;
- php_int_t loffset = 0;
+ size_t haystack_len, needle_len;
+ zend_long loffset = 0;
int32_t offset = 0;
int32_t ret_pos;
int is_ascii;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC );
@@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos)
efree(needle_dup);
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
}
/* if the needle was ascii too, we are done */
@@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos)
ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC);
if ( ret_pos >= 0 ) {
- RETURN_INT(ret_pos);
+ RETURN_LONG(ret_pos);
} else {
RETURN_FALSE;
}
@@ -400,8 +400,10 @@ PHP_FUNCTION(grapheme_substr)
{
unsigned char *str, *sub_str;
UChar *ustr;
- int str_len, sub_str_len, ustr_len;
- php_int_t lstart = 0, length = 0;
+ size_t str_len;
+ int32_t ustr_len;
+ int32_t sub_str_len;
+ zend_long lstart = 0, length = 0;
int32_t start = 0;
int iter_val;
UErrorCode status;
@@ -410,7 +412,7 @@ PHP_FUNCTION(grapheme_substr)
int sub_str_start_pos, sub_str_end_pos;
int32_t (*iter_func)(UBreakIterator *);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (char **)&str, &str_len, &lstart, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_substr: unable to parse input param", 0 TSRMLS_CC );
@@ -618,7 +620,7 @@ PHP_FUNCTION(grapheme_substr)
static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_case)
{
unsigned char *haystack, *needle, *found;
- int haystack_len, needle_len;
+ size_t haystack_len, needle_len;
int ret_pos, uchar_pos;
zend_bool part = 0;
@@ -815,18 +817,19 @@ PHP_FUNCTION(grapheme_extract)
{
unsigned char *str, *pstr;
UChar *ustr;
- int str_len, ustr_len;
- php_int_t size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
- php_int_t lstart = 0; /* starting position in str in bytes */
+ size_t str_len;
+ int32_t ustr_len;
+ zend_long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
+ zend_long lstart = 0; /* starting position in str in bytes */
int32_t start = 0;
- php_int_t extract_type = GRAPHEME_EXTRACT_TYPE_COUNT;
+ zend_long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT;
UErrorCode status;
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
UBreakIterator* bi = NULL;
int ret_pos;
zval *next = NULL; /* return offset of next part of the string */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_extract: unable to parse input param", 0 TSRMLS_CC );
@@ -846,7 +849,7 @@ PHP_FUNCTION(grapheme_extract)
/* initialize next */
SEPARATE_ZVAL(next);
zval_dtor(next);
- ZVAL_INT(next, lstart);
+ ZVAL_LONG(next, lstart);
}
}
@@ -898,9 +901,9 @@ PHP_FUNCTION(grapheme_extract)
*/
if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) {
- php_int_t nsize = ( size < str_len ? size : str_len );
+ zend_long nsize = ( size < str_len ? size : str_len );
if ( NULL != next ) {
- ZVAL_INT(next, start+nsize);
+ ZVAL_LONG(next, start+nsize);
}
RETURN_STRINGL(((char *)pstr), nsize);
}
@@ -943,7 +946,7 @@ PHP_FUNCTION(grapheme_extract)
ubrk_close(bi);
if ( NULL != next ) {
- ZVAL_INT(next, start+ret_pos);
+ ZVAL_LONG(next, start+ret_pos);
}
RETURN_STRINGL(((char *)pstr), ret_pos);
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index c752b02372..5e94eefc8a 100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index 576e524b16..a66796d80d 100644
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un
UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC );
/* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */
-#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (php_int_t) max_len : offset >= (php_int_t) max_len) )
+#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (zend_long) max_len : offset >= (zend_long) max_len) )
#endif // GRAPHEME_GRAPHEME_UTIL_H
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 96bec482a1..1d07dbba80 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2009 The PHP Group |
+----------------------------------------------------------------------+
@@ -51,56 +51,56 @@ void idn_register_constants( INIT_FUNC_ARGS )
/* Option to prohibit processing of unassigned codepoints in the input and
do not check if the input conforms to STD-3 ASCII rules. */
- REGISTER_INT_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT);
/* Option to allow processing of unassigned codepoints in the input */
- REGISTER_INT_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
/* Option to check if input conforms to STD-3 ASCII rules */
- REGISTER_INT_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT);
#ifdef HAVE_46_API
/* Option to check for whether the input conforms to the BiDi rules.
* Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */
- REGISTER_INT_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT);
/* Option to check for whether the input conforms to the CONTEXTJ rules.
* Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */
- REGISTER_INT_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
/* Option for nontransitional processing in ToASCII().
* By default, ToASCII() uses transitional processing.
* Ignored by the IDNA2003 implementation. */
- REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT);
/* Option for nontransitional processing in ToUnicode().
* By default, ToUnicode() uses transitional processing.
* Ignored by the IDNA2003 implementation. */
- REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT);
#endif
/* VARIANTS */
- REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT);
#ifdef HAVE_46_API
- REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef HAVE_46_API
/* PINFO ERROR CODES */
- REGISTER_INT_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
#endif
}
/* }}} */
@@ -140,14 +140,14 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
UIDNA *uts46;
int32_t len;
int32_t buffer_capac = 255; /* no domain name may exceed this */
- zend_string *buffer = STR_ALLOC(buffer_capac, 0);
+ zend_string *buffer = zend_string_alloc(buffer_capac, 0);
UIDNAInfo info = UIDNA_INFO_INITIALIZER;
int buffer_used = 0;
uts46 = uidna_openUTS46(option, &status);
if (php_intl_idn_check_status(status, "failed to open UIDNA instance",
mode TSRMLS_CC) == FAILURE) {
- STR_FREE(buffer);
+ zend_string_free(buffer);
RETURN_FALSE;
}
@@ -161,7 +161,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
if (php_intl_idn_check_status(status, "failed to convert name",
mode TSRMLS_CC) == FAILURE) {
uidna_close(uts46);
- STR_FREE(buffer);
+ zend_string_free(buffer);
RETURN_FALSE;
}
if (len >= 255) {
@@ -184,17 +184,17 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, return_value);
} else {
zval zv;
- ZVAL_STR(&zv, buffer);
+ ZVAL_NEW_STR(&zv, buffer);
buffer_used = 1;
add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, &zv);
}
add_assoc_bool_ex(idna_info, "isTransitionalDifferent",
sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent);
- add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (php_int_t)info.errors);
+ add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (zend_long)info.errors);
}
if (!buffer_used) {
- STR_FREE(buffer);
+ zend_string_free(buffer);
}
uidna_close(uts46);
@@ -264,14 +264,14 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS,
static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
char *domain;
- int domain_len;
- php_int_t option = 0,
+ size_t domain_len;
+ zend_long option = 0,
variant = INTL_IDN_VARIANT_2003;
zval *idna_info = NULL;
intl_error_reset(NULL TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iiz/",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|llz/",
&domain, &domain_len, &option, &variant, &idna_info) == FAILURE) {
php_intl_bad_args("bad arguments", mode TSRMLS_CC);
RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */
diff --git a/ext/intl/idn/idn.h b/ext/intl/idn/idn.h
index 1fa4f8f2e5..1d49fe9f0a 100644
--- a/ext/intl/idn/idn.h
+++ b/ext/intl/idn/idn.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2009 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h
index cf83e6d7ee..a49794648d 100644
--- a/ext/intl/intl_common.h
+++ b/ext/intl/intl_common.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -39,6 +39,6 @@
#define UCHARS(len) ((len) / sizeof(UChar))
#define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str)
-#define INTL_Z_STRSIZE_P(str) UCHARS( Z_STRSIZE_P(str) )
+#define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) )
#endif /* INTL_COMMON_H */
diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c
index 92cdc4cef4..7f756b9e7f 100644
--- a/ext/intl/intl_convert.c
+++ b/ext/intl/intl_convert.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h
index 3fc03f4bb7..952d765c52 100644
--- a/ext/intl/intl_convert.h
+++ b/ext/intl/intl_convert.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp
index f699a3c61c..f52348bc25 100644
--- a/ext/intl/intl_convertcpp.cpp
+++ b/ext/intl/intl_convertcpp.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_convertcpp.h b/ext/intl/intl_convertcpp.h
index 89d4209dd3..fc2242a6b8 100644
--- a/ext/intl/intl_convertcpp.h
+++ b/ext/intl/intl_convertcpp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h
index e58ec3bd45..e2db488d93 100644
--- a/ext/intl/intl_cppshims.h
+++ b/ext/intl/intl_cppshims.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 1b764a2ab1..a7afb36be9 100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index a94b076511..9474834417 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
if( pe->line > 0 )
{
smart_str_appends( &ret, "on line " );
- smart_str_append_int( &ret, (php_int_t ) pe->line );
+ smart_str_append_long( &ret, (zend_long ) pe->line );
any = 1;
}
if( pe->offset >= 0 ) {
@@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
smart_str_appends( &ret, "at " );
smart_str_appends( &ret, "offset " );
- smart_str_append_int( &ret, (php_int_t ) pe->offset );
+ smart_str_append_long( &ret, (zend_long ) pe->offset );
any = 1;
}
diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h
index 06f33a4bd3..b800d10dbf 100644
--- a/ext/intl/intl_error.h
+++ b/ext/intl/intl_error.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -21,7 +21,7 @@
#include <unicode/utypes.h>
#include <unicode/parseerr.h>
-#include <ext/standard/php_smart_str.h>
+#include <zend_smart_str.h>
#define INTL_ERROR_CODE(e) (e).code
diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c
index fa8edddfa3..21c875ca5d 100644
--- a/ext/intl/locale/locale.c
+++ b/ext/intl/locale/locale.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -39,8 +39,8 @@ void locale_register_constants( INIT_FUNC_ARGS )
return;
}
- #define LOCALE_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
- #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC );
+ #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC );
#define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE );
diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h
index f3859c7a2a..9118bee653 100644
--- a/ext/intl/locale/locale.h
+++ b/ext/intl/locale/locale.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c
index 432cfb28fc..eec4699b6d 100644
--- a/ext/intl/locale/locale_class.c
+++ b/ext/intl/locale/locale_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h
index cbddccbe17..afae06c77c 100644
--- a/ext/intl/locale/locale_class.h
+++ b/ext/intl/locale/locale_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 34e7374969..27f917ffbb 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -36,7 +36,7 @@
#include <zend.h>
#include <php.h>
#include "main/php_ini.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
ZEND_EXTERN_MODULE_GLOBALS( intl )
@@ -223,12 +223,11 @@ PHP_NAMED_FUNCTION(zif_locale_get_default)
Set default locale */
PHP_NAMED_FUNCTION(zif_locale_set_default)
{
- char* locale_name = NULL;
- int len=0;
+ zend_string* locale_name;
zend_string *ini_name;
+ char *default_locale = NULL;
- if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &locale_name ,&len ) == FAILURE)
+ if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "S", &locale_name) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"locale_set_default: unable to parse input params", 0 TSRMLS_CC );
@@ -236,14 +235,17 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
RETURN_FALSE;
}
- if(len == 0) {
- locale_name = (char *)uloc_getDefault() ;
- len = strlen(locale_name);
+ if (locale_name->len == 0) {
+ default_locale = (char *)uloc_getDefault();
+ locale_name = zend_string_init(default_locale, strlen(default_locale), 0);
}
- ini_name = STR_INIT(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0);
- zend_alter_ini_entry(ini_name, locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0);
+ zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
+ if (default_locale != NULL) {
+ zend_string_release(locale_name);
+ }
RETURN_TRUE;
}
@@ -373,7 +375,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
{
const char* loc_name = NULL;
- int loc_name_len = 0;
+ size_t loc_name_len = 0;
char* tag_value = NULL;
char* empty_result = "";
@@ -471,10 +473,10 @@ PHP_FUNCTION(locale_get_primary_language )
static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
{
const char* loc_name = NULL;
- int loc_name_len = 0;
+ size_t loc_name_len = 0;
const char* disp_loc_name = NULL;
- int disp_loc_name_len = 0;
+ size_t disp_loc_name_len = 0;
int free_loc_name = 0;
UChar* disp_name = NULL;
@@ -685,7 +687,7 @@ PHP_FUNCTION( locale_get_keywords )
int32_t kw_key_len = 0;
const char* loc_name = NULL;
- int loc_name_len = 0;
+ size_t loc_name_len = 0;
/*
ICU expects the buffer to be allocated before calling the function
@@ -782,7 +784,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_
/* not lang or grandfathered tag */
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
}
- smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value));
+ smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value));
return SUCCESS;
}
@@ -822,7 +824,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
add_prefix( loc_name , key_name);
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
- smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value));
+ smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value));
return SUCCESS;
} else if(Z_TYPE_P(ele_value) == IS_ARRAY ) {
HashTable *arr = HASH_OF(ele_value);
@@ -836,7 +838,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
add_prefix(loc_name , key_name);
}
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
- smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRSIZE_P(data));
+ smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data));
} ZEND_HASH_FOREACH_END();
return SUCCESS;
} else {
@@ -869,7 +871,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
add_prefix(loc_name , cur_key_name);
}
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
- smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value));
+ smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value));
}
} /* end of for */
} /* end of else */
@@ -1099,7 +1101,7 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name
PHP_FUNCTION(locale_parse)
{
const char* loc_name = NULL;
- int loc_name_len = 0;
+ size_t loc_name_len = 0;
int grOffset = 0;
intl_error_reset( NULL TSRMLS_CC );
@@ -1143,7 +1145,7 @@ PHP_FUNCTION(locale_parse)
PHP_FUNCTION(locale_get_all_variants)
{
const char* loc_name = NULL;
- int loc_name_len = 0;
+ size_t loc_name_len = 0;
int result = 0;
char* token = NULL;
@@ -1238,9 +1240,9 @@ static int strToMatch(const char* str ,char *retstr)
PHP_FUNCTION(locale_filter_matches)
{
char* lang_tag = NULL;
- int lang_tag_len = 0;
+ size_t lang_tag_len = 0;
const char* loc_range = NULL;
- int loc_range_len = 0;
+ size_t loc_range_len = 0;
int result = 0;
char* token = 0;
@@ -1439,7 +1441,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC);
LOOKUP_CLEAN_RETURN(NULL);
}
- cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRSIZE_P(ele_value));
+ cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value));
result = strToMatch(Z_STRVAL_P(ele_value), cur_arr[cur_arr_len*2]);
if(result == 0) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag", 0 TSRMLS_CC);
@@ -1529,9 +1531,9 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca
PHP_FUNCTION(locale_lookup)
{
char* fallback_loc = NULL;
- int fallback_loc_len = 0;
+ size_t fallback_loc_len = 0;
const char* loc_range = NULL;
- int loc_range_len = 0;
+ size_t loc_range_len = 0;
zval* arr = NULL;
HashTable* hash_arr = NULL;
@@ -1582,7 +1584,7 @@ PHP_FUNCTION(locale_accept_from_http)
{
UEnumeration *available;
char *http_accept = NULL;
- int http_accept_len;
+ size_t http_accept_len;
UErrorCode status = 0;
int len;
char resultLocale[INTL_MAX_LOCALE_LEN+1];
diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h
index e88fac64b7..bc11975c18 100644
--- a/ext/intl/locale/locale_methods.h
+++ b/ext/intl/locale/locale_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c
index cfe6538f0a..2ca8ed9186 100644
--- a/ext/intl/msgformat/msgformat.c
+++ b/ext/intl/msgformat/msgformat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -30,7 +30,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern;
- int locale_len = 0, pattern_len = 0;
+ size_t locale_len = 0, pattern_len = 0;
UChar* spattern = NULL;
int spattern_len = 0;
zval* object;
@@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code )
mfo = Z_INTL_MESSAGEFORMATTER_P( object );
/* Return formatter's last error code. */
- RETURN_INT( INTL_DATA_ERROR_CODE(mfo) );
+ RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) );
}
/* }}} */
diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h
index 205c7066fd..a0b2c89644 100644
--- a/ext/intl/msgformat/msgformat.h
+++ b/ext/intl/msgformat/msgformat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c
index a306fc4421..79c04266e0 100644
--- a/ext/intl/msgformat/msgformat_attr.c
+++ b/ext/intl/msgformat/msgformat_attr.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -62,7 +62,7 @@ PHP_FUNCTION( msgfmt_get_pattern )
PHP_FUNCTION( msgfmt_set_pattern )
{
char* value = NULL;
- int value_len = 0;
+ size_t value_len = 0;
int spattern_len = 0;
UChar* spattern = NULL;
MSG_FORMAT_METHOD_INIT_VARS;
diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h
index 898c4451e1..891f44c073 100644
--- a/ext/intl/msgformat/msgformat_attr.h
+++ b/ext/intl/msgformat/msgformat_attr.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index 71504bce2c..65f32bf683 100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h
index 66b6ce18a5..8c2c29a7dd 100644
--- a/ext/intl/msgformat/msgformat_class.h
+++ b/ext/intl/msgformat/msgformat_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c
index 5d49054473..f94920d3e8 100644
--- a/ext/intl/msgformat/msgformat_data.c
+++ b/ext/intl/msgformat/msgformat_data.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h
index 188e6580f7..f3a594d25a 100644
--- a/ext/intl/msgformat/msgformat_data.h
+++ b/ext/intl/msgformat/msgformat_data.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -30,7 +30,7 @@ typedef struct {
// formatter handling
UMessageFormat* umsgf;
char* orig_format;
- php_uint_t orig_format_len;
+ zend_ulong orig_format_len;
HashTable* arg_types;
int tz_set; /* if we've already the time zone in sub-formats */
} msgformat_data;
diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c
index e661c3c17f..36cd61c685 100644
--- a/ext/intl/msgformat/msgformat_format.c
+++ b/ext/intl/msgformat/msgformat_format.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -101,9 +101,9 @@ PHP_FUNCTION( msgfmt_format_message )
UChar *spattern = NULL;
int spattern_len = 0;
char *pattern = NULL;
- int pattern_len = 0;
+ size_t pattern_len = 0;
const char *slocale = NULL;
- int slocale_len = 0;
+ size_t slocale_len = 0;
MessageFormatter_object mf = {0};
MessageFormatter_object *mfo = &mf;
diff --git a/ext/intl/msgformat/msgformat_format.h b/ext/intl/msgformat/msgformat_format.h
index b74deab8ff..12b0e4a283 100644
--- a/ext/intl/msgformat/msgformat_format.h
+++ b/ext/intl/msgformat/msgformat_format.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 3be80791ba..46ebe25a17 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
for (int i = 0; i < parts_count; i++) {
const Formattable::Type t = types[i];
- if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) {
+ if (zend_hash_index_update_mem(ret, (zend_ulong)i, (void*)&t, sizeof(t)) == NULL) {
intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
"Write to argument types hash table failed", 0 TSRMLS_CC);
break;
@@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
"Found part with negative number", 0 TSRMLS_CC);
continue;
}
- if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) {
+ if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (zend_ulong)argNumber)) == NULL) {
/* not found already; create new entry in HT */
Formattable::Type bogusType = Formattable::kObject;
- if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
+ if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (zend_ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
"Write to argument types hash table failed", 0 TSRMLS_CC);
continue;
@@ -388,7 +388,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
// Key related variables
zend_string *str_index;
- php_uint_t num_index;
+ zend_ulong num_index;
ZEND_HASH_FOREACH_KEY_VAL(args, num_index, str_index, elem) {
Formattable& formattable = fargs[argNum];
@@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
/* Process key and retrieve type */
if (str_index == NULL) {
/* includes case where index < 0 because it's exposed as unsigned */
- if (num_index > (php_uint_t)INT32_MAX) {
+ if (num_index > (zend_ulong)INT32_MAX) {
intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR,
"Found negative or too large array key", 0 TSRMLS_CC);
continue;
@@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
key.append(temp, len);
- storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index);
+ storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index);
} else { //string; assumed to be in UTF-8
intl_stringFromChar(key, str_index->val, str_index->len, &err.code);
@@ -447,7 +447,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
UnicodeString *text = new UnicodeString();
intl_stringFromChar(*text,
- Z_STRVAL_P(elem), Z_STRSIZE_P(elem), &err.code);
+ Z_STRVAL_P(elem), Z_STRLEN_P(elem), &err.code);
if (U_FAILURE(err.code)) {
char *message;
@@ -466,14 +466,14 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
double d;
if (Z_TYPE_P(elem) == IS_DOUBLE) {
d = Z_DVAL_P(elem);
- } else if (Z_TYPE_P(elem) == IS_INT) {
- d = (double)Z_IVAL_P(elem);
+ } else if (Z_TYPE_P(elem) == IS_LONG) {
+ d = (double)Z_LVAL_P(elem);
} else {
SEPARATE_ZVAL_IF_NOT_REF(elem);
convert_scalar_to_number(elem TSRMLS_CC);
d = (Z_TYPE_P(elem) == IS_DOUBLE)
? Z_DVAL_P(elem)
- : (double)Z_IVAL_P(elem);
+ : (double)Z_LVAL_P(elem);
}
formattable.setDouble(d);
break;
@@ -491,14 +491,14 @@ retry_klong:
} else {
tInt32 = (int32_t)Z_DVAL_P(elem);
}
- } else if (Z_TYPE_P(elem) == IS_INT) {
- if (Z_IVAL_P(elem) > INT32_MAX ||
- Z_IVAL_P(elem) < INT32_MIN) {
+ } else if (Z_TYPE_P(elem) == IS_LONG) {
+ if (Z_LVAL_P(elem) > INT32_MAX ||
+ Z_LVAL_P(elem) < INT32_MIN) {
intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR,
"Found PHP integer with absolute value too large "
"for 32 bit integer argument", 0 TSRMLS_CC);
} else {
- tInt32 = (int32_t)Z_IVAL_P(elem);
+ tInt32 = (int32_t)Z_LVAL_P(elem);
}
} else {
SEPARATE_ZVAL_IF_NOT_REF(elem);
@@ -521,9 +521,9 @@ retry_kint64:
} else {
tInt64 = (int64_t)Z_DVAL_P(elem);
}
- } else if (Z_TYPE_P(elem) == IS_INT) {
+ } else if (Z_TYPE_P(elem) == IS_LONG) {
/* assume long is not wider than 64 bits */
- tInt64 = (int64_t)Z_IVAL_P(elem);
+ tInt64 = (int64_t)Z_LVAL_P(elem);
} else {
SEPARATE_ZVAL_IF_NOT_REF(elem);
convert_scalar_to_number(elem TSRMLS_CC);
@@ -567,10 +567,10 @@ retry_kint64:
break;
case IS_TRUE:
case IS_FALSE:
- convert_to_int_ex(elem);
+ convert_to_long_ex(elem);
/* Intentional fallthrough */
- case IS_INT:
- formattable.setInt64((int64_t)Z_IVAL_P(elem));
+ case IS_LONG:
+ formattable.setInt64((int64_t)Z_LVAL_P(elem));
break;
case IS_NULL:
formattable.setInt64((int64_t)0);
@@ -658,15 +658,15 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh
break;
case Formattable::kLong:
- ZVAL_INT(&(*args)[i], fargs[i].getLong());
+ ZVAL_LONG(&(*args)[i], fargs[i].getLong());
break;
case Formattable::kInt64:
aInt64 = fargs[i].getInt64();
- if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) {
+ if(aInt64 > ZEND_LONG_MAX || aInt64 < -ZEND_LONG_MAX) {
ZVAL_DOUBLE(&(*args)[i], (double)aInt64);
} else {
- ZVAL_INT(&(*args)[i], (php_int_t)aInt64);
+ ZVAL_LONG(&(*args)[i], (zend_long)aInt64);
}
break;
diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h
index f88fd4f06b..41d179f8d0 100644
--- a/ext/intl/msgformat/msgformat_helpers.h
+++ b/ext/intl/msgformat/msgformat_helpers.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c
index 3ae9a49b46..add2f901eb 100644
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,7 +28,7 @@
#include "intl_convert.h"
/* {{{ */
-static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, int src_len, zval *return_value TSRMLS_DC)
+static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value TSRMLS_DC)
{
zval *fargs;
int count = 0;
@@ -61,7 +61,7 @@ static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, int src_
PHP_FUNCTION( msgfmt_parse )
{
char *source;
- int source_len;
+ size_t source_len;
MSG_FORMAT_METHOD_INIT_VARS;
@@ -92,11 +92,11 @@ PHP_FUNCTION( msgfmt_parse_message )
UChar *spattern = NULL;
int spattern_len = 0;
char *pattern = NULL;
- int pattern_len = 0;
+ size_t pattern_len = 0;
const char *slocale = NULL;
- int slocale_len = 0;
+ size_t slocale_len = 0;
char *source = NULL;
- int src_len = 0;
+ size_t src_len = 0;
MessageFormatter_object mf = {0};
MessageFormatter_object *mfo = &mf;
diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h
index a937235839..4a86403a48 100644
--- a/ext/intl/msgformat/msgformat_parse.h
+++ b/ext/intl/msgformat/msgformat_parse.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c
index cbc680e7aa..18c3cedcaf 100644
--- a/ext/intl/normalizer/normalizer.c
+++ b/ext/intl/normalizer/normalizer.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -37,9 +37,9 @@ void normalizer_register_constants( INIT_FUNC_ARGS )
return;
}
- #define NORMALIZER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
- #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC );
- #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
+ #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
+ #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC );
+ #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
/* Normalization form constants */
NORMALIZER_EXPOSE_CLASS_CONST( NONE );
diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h
index eca9abe05a..c057a51883 100644
--- a/ext/intl/normalizer/normalizer.h
+++ b/ext/intl/normalizer/normalizer.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c
index 154d877e3f..ccd8be3b29 100644
--- a/ext/intl/normalizer/normalizer_class.c
+++ b/ext/intl/normalizer/normalizer_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h
index 4d3f7d2341..3ce37fae88 100644
--- a/ext/intl/normalizer/normalizer_class.h
+++ b/ext/intl/normalizer/normalizer_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c
index ad600c1b55..d3ac07024b 100644
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
@@ -34,8 +34,8 @@ PHP_FUNCTION( normalizer_normalize )
{
char* input = NULL;
/* form is optional, defaults to FORM_C */
- php_int_t form = NORMALIZER_DEFAULT;
- int input_len = 0;
+ zend_long form = NORMALIZER_DEFAULT;
+ size_t input_len = 0;
UChar* uinput = NULL;
int uinput_len = 0;
@@ -53,7 +53,7 @@ PHP_FUNCTION( normalizer_normalize )
intl_error_reset( NULL TSRMLS_CC );
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l",
&input, &input_len, &form ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -174,8 +174,8 @@ PHP_FUNCTION( normalizer_is_normalized )
{
char* input = NULL;
/* form is optional, defaults to FORM_C */
- php_int_t form = NORMALIZER_DEFAULT;
- int input_len = 0;
+ zend_long form = NORMALIZER_DEFAULT;
+ size_t input_len = 0;
UChar* uinput = NULL;
int uinput_len = 0;
@@ -186,7 +186,7 @@ PHP_FUNCTION( normalizer_is_normalized )
intl_error_reset( NULL TSRMLS_CC );
/* Parse parameters. */
- if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i",
+ if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l",
&input, &input_len, &form) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h
index 41c31f7949..c282c56795 100644
--- a/ext/intl/normalizer/normalizer_normalize.h
+++ b/ext/intl/normalizer/normalizer_normalize.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index f837bf9d78..2c5e74809d 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -910,7 +910,7 @@ PHP_MINIT_FUNCTION( intl )
/* For the default locale php.ini setting */
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS);
REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
#ifdef U_ICU_DATA_VERSION
REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h
index 1ee496402f..3625c4fdcc 100644
--- a/ext/intl/php_intl.h
+++ b/ext/intl/php_intl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -50,7 +50,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl)
collator_compare_func_t compare_func;
UBreakIterator* grapheme_iterator;
intl_error g_error;
- php_int_t error_level;
+ zend_long error_level;
zend_bool use_exceptions;
ZEND_END_MODULE_GLOBALS(intl)
diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c
index b13ee901f4..9b6b734ed6 100644
--- a/ext/intl/resourcebundle/resourcebundle.c
+++ b/ext/intl/resourcebundle/resourcebundle.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -32,7 +32,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
const int32_t* vfield;
int32_t ilen;
int i;
- php_int_t lfield;
+ zend_long lfield;
ResourceBundle_object* newrb;
restype = ures_getType( source->child );
@@ -53,7 +53,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
case URES_INT:
lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) );
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value");
- ZVAL_INT( return_value, lfield );
+ ZVAL_LONG( return_value, lfield );
break;
case URES_INT_VECTOR:
@@ -61,7 +61,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value");
array_init( return_value );
for (i=0; i<ilen; i++) {
- add_next_index_int( return_value, vfield[i] );
+ add_next_index_long( return_value, vfield[i] );
}
break;
diff --git a/ext/intl/resourcebundle/resourcebundle.h b/ext/intl/resourcebundle/resourcebundle.h
index 607ece98ba..e5aa9f092b 100644
--- a/ext/intl/resourcebundle/resourcebundle.h
+++ b/ext/intl/resourcebundle/resourcebundle.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 5975c26607..0fbf7931d4 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -77,9 +77,9 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce TSRMLS_DC
static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char *bundlename;
- int bundlename_len = 0;
+ size_t bundlename_len = 0;
const char *locale;
- int locale_len = 0;
+ size_t locale_len = 0;
zend_bool fallback = 1;
zval *object = return_value;
@@ -177,9 +177,9 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
intl_error_reset( NULL TSRMLS_CC );
RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
- if(Z_TYPE_P(offset) == IS_INT) {
+ if(Z_TYPE_P(offset) == IS_LONG) {
is_numeric = 1;
- meindex = Z_IVAL_P(offset);
+ meindex = Z_LVAL_P(offset);
rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) );
} else if(Z_TYPE_P(offset) == IS_STRING) {
mekey = Z_STRVAL_P(offset);
@@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get )
/* }}} */
/* {{{ resourcebundle_array_count */
-int resourcebundle_array_count(zval *object, php_int_t *count TSRMLS_DC)
+int resourcebundle_array_count(zval *object, zend_long *count TSRMLS_DC)
{
ResourceBundle_object *rb;
RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
@@ -299,7 +299,7 @@ PHP_FUNCTION( resourcebundle_count )
RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
len = ures_getSize( rb->me );
- RETURN_INT( len );
+ RETURN_LONG( len );
}
/* {{{ arginfo_resourcebundle_getlocales */
@@ -315,7 +315,7 @@ ZEND_END_ARG_INFO()
PHP_FUNCTION( resourcebundle_locales )
{
char * bundlename;
- int bundlename_len = 0;
+ size_t bundlename_len = 0;
const char * entry;
int entry_len;
UEnumeration *icuenum;
@@ -372,7 +372,7 @@ PHP_FUNCTION( resourcebundle_get_error_code )
rb = Z_INTL_RESOURCEBUNDLE_P( object );
- RETURN_INT(INTL_DATA_ERROR_CODE(rb));
+ RETURN_LONG(INTL_DATA_ERROR_CODE(rb));
}
/* }}} */
diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h
index 7cb015a8df..403b6beb17 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.h
+++ b/ext/intl/resourcebundle/resourcebundle_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c
index 79149cb234..cf38c6b676 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.c
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -109,7 +109,7 @@ static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key T
if (iterator->is_table) {
ZVAL_STRING(key, iterator->currentkey);
} else {
- ZVAL_INT(key, iterator->i);
+ ZVAL_LONG(key, iterator->i);
}
}
/* }}} */
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h
index 0c0849eddd..b28fa91638 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.h
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -25,10 +25,10 @@ typedef struct {
zend_object_iterator intern;
ResourceBundle_object *subject;
zend_bool is_table;
- php_int_t length;
+ zend_long length;
zval current;
char *currentkey;
- php_int_t i;
+ zend_long i;
} ResourceBundle_iterator;
zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref TSRMLS_DC );
diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c
index 747654a53b..0a22875dcf 100644
--- a/ext/intl/spoofchecker/spoofchecker.c
+++ b/ext/intl/spoofchecker/spoofchecker.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -35,7 +35,7 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS)
return;
}
- #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC);
+ #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC);
SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE)
SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE)
diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h
index f976d639ac..1cbdd7ea65 100644
--- a/ext/intl/spoofchecker/spoofchecker.h
+++ b/ext/intl/spoofchecker/spoofchecker.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index 7ae1a2feb6..5fb6ffb90c 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h
index 9683b03b08..847b0a97b5 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.h
+++ b/ext/intl/spoofchecker/spoofchecker_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c
index cf0173f997..962e31cb08 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.c
+++ b/ext/intl/spoofchecker/spoofchecker_create.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h
index 313faab8a3..405c1bda12 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.h
+++ b/ext/intl/spoofchecker/spoofchecker_create.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c
index 57b3bdffc9..959a0c568f 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.c
+++ b/ext/intl/spoofchecker/spoofchecker_main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -28,7 +28,7 @@ PHP_METHOD(Spoofchecker, isSuspicious)
{
int ret;
char *text;
- int text_len;
+ size_t text_len;
zval *error_code = NULL;
SPOOFCHECKER_METHOD_INIT_VARS;
@@ -47,7 +47,7 @@ PHP_METHOD(Spoofchecker, isSuspicious)
if (error_code) {
zval_dtor(error_code);
- ZVAL_INT(error_code, ret);
+ ZVAL_LONG(error_code, ret);
}
RETVAL_BOOL(ret != 0);
}
@@ -60,7 +60,7 @@ PHP_METHOD(Spoofchecker, areConfusable)
{
int ret;
char *s1, *s2;
- int s1_len, s2_len;
+ size_t s1_len, s2_len;
zval *error_code = NULL;
SPOOFCHECKER_METHOD_INIT_VARS;
@@ -80,7 +80,7 @@ PHP_METHOD(Spoofchecker, areConfusable)
if (error_code) {
zval_dtor(error_code);
- ZVAL_INT(error_code, ret);
+ ZVAL_LONG(error_code, ret);
}
RETVAL_BOOL(ret != 0);
}
@@ -92,7 +92,7 @@ PHP_METHOD(Spoofchecker, areConfusable)
PHP_METHOD(Spoofchecker, setAllowedLocales)
{
char *locales;
- int locales_len;
+ size_t locales_len;
SPOOFCHECKER_METHOD_INIT_VARS;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &locales, &locales_len)) {
@@ -115,10 +115,10 @@ PHP_METHOD(Spoofchecker, setAllowedLocales)
*/
PHP_METHOD(Spoofchecker, setChecks)
{
- php_int_t checks;
+ zend_long checks;
SPOOFCHECKER_METHOD_INIT_VARS;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &checks)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &checks)) {
return;
}
diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h
index fb920d7841..44c99ec856 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.h
+++ b/ext/intl/spoofchecker/spoofchecker_main.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index a0651d5352..d2aaa12344 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -180,7 +180,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
gottenId;
UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */
convert_to_string_ex(zv_timezone);
- if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRSIZE_P(zv_timezone),
+ if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone),
&status) == FAILURE) {
spprintf(&message, 0, "%s: Time zone identifier given is not a "
"valid UTF-8 string", func);
@@ -249,7 +249,7 @@ static zend_object *TimeZone_clone_obj(zval *object TSRMLS_DC)
"Could not clone IntlTimeZone", 0 TSRMLS_CC);
err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC);
zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC);
- STR_FREE(err_msg);
+ zend_string_free(err_msg);
} else {
to_new->utimezone = newTimeZone;
}
@@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
return debug_info;
}
- ZVAL_INT(&zv, (php_int_t)rawOffset);
+ ZVAL_LONG(&zv, (zend_long)rawOffset);
zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv);
- ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset));
+ ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset));
zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv);
return debug_info;
@@ -513,26 +513,26 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D)
/* Declare 'IntlTimeZone' class constants */
-#define TIMEZONE_DECL_INT_CONST(name, val) \
- zend_declare_class_constant_int(TimeZone_ce_ptr, name, sizeof(name) - 1, \
+#define TIMEZONE_DECL_LONG_CONST(name, val) \
+ zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \
val TSRMLS_CC)
- TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT", TimeZone::SHORT);
- TIMEZONE_DECL_INT_CONST("DISPLAY_LONG", TimeZone::LONG);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG);
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
- TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
- TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
- TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
- TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
- TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
- TIMEZONE_DECL_INT_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
+ TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
#endif
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
- TIMEZONE_DECL_INT_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
- TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
- TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
+ TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
+ TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
+ TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
#endif
/* Declare 'IntlTimeZone' class properties */
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index 71de20c09e..94b781b332 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 4dbb6ddda3..033b216cdf 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -47,7 +47,7 @@ U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
U_CFUNC PHP_FUNCTION(intltz_create_time_zone)
{
char *str_id;
- int str_id_len;
+ size_t str_id_len;
intl_error_reset(NULL TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
@@ -159,34 +159,34 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) {
se = TimeZone::createEnumeration();
- } else if (Z_TYPE_P(arg) == IS_INT) {
+ } else if (Z_TYPE_P(arg) == IS_LONG) {
int_offset:
- if (Z_IVAL_P(arg) < (php_int_t)INT32_MIN ||
- Z_IVAL_P(arg) > (php_int_t)INT32_MAX) {
+ if (Z_LVAL_P(arg) < (zend_long)INT32_MIN ||
+ Z_LVAL_P(arg) > (zend_long)INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_create_enumeration: value is out of range", 0 TSRMLS_CC);
RETURN_FALSE;
} else {
- se = TimeZone::createEnumeration((int32_t) Z_IVAL_P(arg));
+ se = TimeZone::createEnumeration((int32_t) Z_LVAL_P(arg));
}
} else if (Z_TYPE_P(arg) == IS_DOUBLE) {
double_offset:
- convert_to_int_ex(arg);
+ convert_to_long_ex(arg);
goto int_offset;
} else if (Z_TYPE_P(arg) == IS_OBJECT || Z_TYPE_P(arg) == IS_STRING) {
- php_int_t lval;
+ zend_long lval;
double dval;
convert_to_string_ex(arg);
- switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &lval, &dval, 0)) {
+ switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) {
case IS_DOUBLE:
SEPARATE_ZVAL(arg);
zval_dtor(arg);
ZVAL_DOUBLE(arg, dval);
goto double_offset;
- case IS_INT:
+ case IS_LONG:
SEPARATE_ZVAL(arg);
zval_dtor(arg);
- ZVAL_INT(arg, lval);
+ ZVAL_LONG(arg, lval);
goto int_offset;
}
/* else call string version */
@@ -209,7 +209,7 @@ double_offset:
U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
{
char *str_id;
- int str_id_len;
+ size_t str_id_len;
intl_error_reset(NULL TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
@@ -228,16 +228,16 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
}
int32_t result = TimeZone::countEquivalentIDs(id);
- RETURN_INT((php_int_t)result);
+ RETURN_LONG((zend_long)result);
}
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
{
- php_int_t zoneType,
+ zend_long zoneType,
offset_arg;
char *region = NULL;
- int region_len = 0;
+ size_t region_len = 0;
int32_t offset,
*offsetp = NULL;
int arg3isnull = 0;
@@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
!= FAILURE && Z_TYPE_P(zvoffset) == IS_NULL;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s!i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s!l",
&zoneType, &region, &region_len, &offset_arg) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_create_time_zone_id_enumeration: bad arguments", 0 TSRMLS_CC);
@@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
}
if (ZEND_NUM_ARGS() == 3) {
- if (offset_arg < (php_int_t)INT32_MIN || offset_arg > (php_int_t)INT32_MAX) {
+ if (offset_arg < (zend_long)INT32_MIN || offset_arg > (zend_long)INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_create_time_zone_id_enumeration: offset out of bounds", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -291,7 +291,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
{
char *str_id;
- int str_id_len;
+ size_t str_id_len;
zval *is_systemid = NULL;
intl_error_reset(NULL TSRMLS_CC);
@@ -335,7 +335,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
U_CFUNC PHP_FUNCTION(intltz_get_region)
{
char *str_id;
- int str_id_len;
+ size_t str_id_len;
char outbuf[3];
intl_error_reset(NULL TSRMLS_CC);
@@ -382,13 +382,13 @@ U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id)
{
char *str_id;
- int str_id_len;
- php_int_t index;
+ size_t str_id_len;
+ zend_long index;
intl_error_reset(NULL TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl",
&str_id, &str_id_len, &index) == FAILURE ||
- index < (php_int_t)INT32_MIN || index > (php_int_t)INT32_MAX) {
+ index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_get_equivalent_id: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
@@ -485,10 +485,10 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
ZVAL_DEREF(rawOffsetArg);
zval_dtor(rawOffsetArg);
- ZVAL_INT(rawOffsetArg, rawOffset);
+ ZVAL_LONG(rawOffsetArg, rawOffset);
ZVAL_DEREF(dstOffsetArg);
zval_dtor(dstOffsetArg);
- ZVAL_INT(dstOffsetArg, dstOffset);
+ ZVAL_LONG(dstOffsetArg, dstOffset);
RETURN_TRUE;
}
@@ -506,7 +506,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset)
TIMEZONE_METHOD_FETCH_OBJECT;
- RETURN_INT(to->utimezone->getRawOffset());
+ RETURN_LONG(to->utimezone->getRawOffset());
}
U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
@@ -545,13 +545,13 @@ static const TimeZone::EDisplayType display_types[] = {
U_CFUNC PHP_FUNCTION(intltz_get_display_name)
{
zend_bool daylight = 0;
- php_int_t display_type = TimeZone::LONG;
+ zend_long display_type = TimeZone::LONG;
const char *locale_str = NULL;
- int dummy = 0;
+ size_t dummy = 0;
TIMEZONE_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "O|bis!", &object, TimeZone_ce_ptr, &daylight, &display_type,
+ "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type,
&locale_str, &dummy) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_get_display_name: bad arguments", 0 TSRMLS_CC);
@@ -603,7 +603,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings)
TIMEZONE_METHOD_FETCH_OBJECT;
- RETURN_INT((php_int_t)to->utimezone->getDSTSavings());
+ RETURN_LONG((zend_long)to->utimezone->getDSTSavings());
}
U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone)
@@ -646,7 +646,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code)
if (to == NULL)
RETURN_FALSE;
- RETURN_INT((php_int_t)TIMEZONE_ERROR_CODE(to));
+ RETURN_LONG((zend_long)TIMEZONE_ERROR_CODE(to));
}
U_CFUNC PHP_FUNCTION(intltz_get_error_message)
diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h
index 28c39f4fd7..29d72913fd 100644
--- a/ext/intl/timezone/timezone_methods.h
+++ b/ext/intl/timezone/timezone_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c
index 88e1225654..fda183b85a 100644
--- a/ext/intl/transliterator/transliterator.c
+++ b/ext/intl/transliterator/transliterator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -35,9 +35,9 @@ void transliterator_register_constants( INIT_FUNC_ARGS )
return;
}
- #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_INT_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS )
- #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC );
- #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/
+ #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_LONG_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS )
+ #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC );
+ #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/
/* Normalization form constants */
TRANSLITERATOR_EXPOSE_CLASS_CONST( FORWARD );
diff --git a/ext/intl/transliterator/transliterator.h b/ext/intl/transliterator/transliterator.h
index cfd5d38dbd..081a730cbc 100644
--- a/ext/intl/transliterator/transliterator.h
+++ b/ext/intl/transliterator/transliterator.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -21,7 +21,7 @@
#include <unicode/utypes.h>
#include <unicode/utrans.h>
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
void transliterator_register_constants( INIT_FUNC_ARGS );
smart_str transliterator_parse_error_to_string( UParseError* pe );
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index e5f26f2829..647ece8ba0 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -183,7 +183,7 @@ err:
err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) TSRMLS_CC );
php_error_docref( NULL TSRMLS_CC, E_ERROR, "%s", err_msg->val );
- STR_FREE( err_msg ); /* if it's changed into a warning */
+ zend_string_free( err_msg ); /* if it's changed into a warning */
/* do not destroy tempz; we need to return something */
}
}
@@ -223,7 +223,7 @@ static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, in
TRANSLITERATOR_PROPERTY_HANDLER_PROLOG;
if(zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 )
+ Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 )
{
retval = NULL; /* fallback to read_property */
}
@@ -247,7 +247,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type,
if( ( type != BP_VAR_R && type != BP_VAR_IS ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) )
+ Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
{
php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" );
retval = &EG( uninitialized_zval );
@@ -272,7 +272,7 @@ static void Transliterator_write_property( zval *object, zval *member, zval *val
if( ( EG( scope ) != Transliterator_ce_ptr ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) )
+ Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
{
php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" );
}
diff --git a/ext/intl/transliterator/transliterator_class.h b/ext/intl/transliterator/transliterator_class.h
index a99c2ced16..f70e86995f 100644
--- a/ext/intl/transliterator/transliterator_class.h
+++ b/ext/intl/transliterator/transliterator_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c
index c4f620f9ca..e79aeb1621 100644
--- a/ext/intl/transliterator/transliterator_methods.c
+++ b/ext/intl/transliterator/transliterator_methods.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -27,7 +27,7 @@
#include <zend_exceptions.h>
-static int create_transliterator( char *str_id, int str_id_len, php_int_t direction, zval *object TSRMLS_DC )
+static int create_transliterator( char *str_id, int str_id_len, zend_long direction, zval *object TSRMLS_DC )
{
Transliterator_object *to;
UChar *ustr_id = NULL;
@@ -104,15 +104,15 @@ static int create_transliterator( char *str_id, int str_id_len, php_int_t direct
PHP_FUNCTION( transliterator_create )
{
char *str_id;
- int str_id_len;
- php_int_t direction = TRANSLITERATOR_FORWARD;
+ size_t str_id_len;
+ zend_long direction = TRANSLITERATOR_FORWARD;
int res;
TRANSLITERATOR_METHOD_INIT_VARS;
(void) to; /* unused */
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
&str_id, &str_id_len, &direction ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -136,17 +136,17 @@ PHP_FUNCTION( transliterator_create )
PHP_FUNCTION( transliterator_create_from_rules )
{
char *str_rules;
- int str_rules_len;
+ size_t str_rules_len;
UChar *ustr_rules = NULL;
int32_t ustr_rules_len = 0;
- php_int_t direction = TRANSLITERATOR_FORWARD;
+ zend_long direction = TRANSLITERATOR_FORWARD;
UParseError parse_error = {0, -1};
UTransliterator *utrans;
UChar id[] = {0x52, 0x75, 0x6C, 0x65, 0x73, 0x54, 0x72,
0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */
TRANSLITERATOR_METHOD_INIT_VARS;
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
&str_rules, &str_rules_len, &direction ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -303,11 +303,11 @@ PHP_FUNCTION( transliterator_transliterate )
char *str;
UChar *ustr = NULL,
*uresult = NULL;
- int str_len;
+ size_t str_len;
int32_t ustr_len = 0,
capacity,
uresult_len;
- php_int_t start = 0,
+ zend_long start = 0,
limit = -1;
int success = 0;
zval tmp_object;
@@ -320,7 +320,7 @@ PHP_FUNCTION( transliterator_transliterate )
{
/* in non-OOP version, accept both a transliterator and a string */
zval *arg1;
- if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ii",
+ if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ll",
&arg1, &str, &str_len, &start, &limit ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -342,20 +342,20 @@ PHP_FUNCTION( transliterator_transliterate )
convert_to_string( arg1 );
}
object = &tmp_object;
- res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRSIZE_P( arg1 ),
+ res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ),
TRANSLITERATOR_FORWARD, object TSRMLS_CC );
if( res == FAILURE )
{
zend_string *message = intl_error_get_message( NULL TSRMLS_CC );
php_error_docref0( NULL TSRMLS_CC, E_WARNING, "Could not create "
"transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), message->val );
- STR_FREE( message );
+ zend_string_free( message );
/* don't set U_ILLEGAL_ARGUMENT_ERROR to allow fetching of inner error */
goto cleanup;
}
}
}
- else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ii",
+ else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ll",
&str, &str_len, &start, &limit ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -497,7 +497,7 @@ PHP_FUNCTION( transliterator_get_error_code )
if (to == NULL )
RETURN_FALSE;
- RETURN_INT( (php_int_t) TRANSLITERATOR_ERROR_CODE( to ) );
+ RETURN_LONG( (zend_long) TRANSLITERATOR_ERROR_CODE( to ) );
}
/* }}} */
diff --git a/ext/intl/transliterator/transliterator_methods.h b/ext/intl/transliterator/transliterator_methods.h
index b806de84fb..ff0b93a29a 100644
--- a/ext/intl/transliterator/transliterator_methods.h
+++ b/ext/intl/transliterator/transliterator_methods.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c
index f2a1ee4dda..d78ec35a2e 100644
--- a/ext/json/JSON_parser.c
+++ b/ext/json/JSON_parser.c
@@ -293,7 +293,7 @@ static int dehexchar(char c)
static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC)
{
- if (type == IS_INT)
+ if (type == IS_LONG)
{
zend_bool bigint = 0;
@@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM
buf->s->len--;
}
- if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) {
- if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) {
- int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits);
+ if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) {
+ if (buf->s->len == MAX_LENGTH_OF_LONG - 1) {
+ int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits);
if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) {
bigint = 1;
@@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM
}
}
- ZVAL_INT(z, strtol(buf->s->val, NULL, 10));
+ ZVAL_LONG(z, ZEND_STRTOL(buf->s->val, NULL, 10));
}
else if (type == IS_DOUBLE)
{
@@ -373,7 +373,7 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16)
&& ((unsigned char) buf->s->val[buf->s->len - 1] & 0xc0) == 0x80)
{
/* found surrogate pair */
- php_uint_t utf32;
+ zend_ulong utf32;
utf32 = (((buf->s->val[buf->s->len - 2] & 0xf) << 16)
| ((buf->s->val[buf->s->len - 1] & 0x3f) << 10)
@@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
utf16 += dehexchar(next_char);
utf16_to_utf8(&buf, utf16);
}
- } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) {
- type = IS_INT;
+ } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) {
+ type = IS_LONG;
smart_str_appendc(&buf, next_char);
- } else if (type == IS_INT && next_state == E1) {
+ } else if (type == IS_LONG && next_state == E1) {
type = IS_DOUBLE;
smart_str_appendc(&buf, next_char);
} else if (type < IS_DOUBLE && next_class == C_POINT) {
diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h
index 3df999c5f3..da47f4078f 100644
--- a/ext/json/JSON_parser.h
+++ b/ext/json/JSON_parser.h
@@ -4,8 +4,8 @@
#define JSON_PARSER_H
#include "php.h"
-#include "ext/standard/php_smart_str.h"
#include "php_json.h"
+#include "zend_smart_str.h"
#define JSON_PARSER_DEFAULT_DEPTH 512
diff --git a/ext/json/json.c b/ext/json/json.c
index 60893fe1ea..8f4f281ef1 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,7 +26,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/html.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "JSON_parser.h"
#include "php_json.h"
#include <zend_exceptions.h>
@@ -93,29 +93,29 @@ static PHP_MINIT_FUNCTION(json)
INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface);
php_json_serializable_ce = zend_register_internal_interface(&ce TSRMLS_CC);
- REGISTER_INT_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -167,7 +167,7 @@ static PHP_MINFO_FUNCTION(json)
}
/* }}} */
-static void json_escape_string(smart_str *buf, char *s, int len, int options TSRMLS_DC);
+static void json_escape_string(smart_str *buf, char *s, size_t len, int options TSRMLS_DC);
static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */
{
@@ -177,7 +177,7 @@ static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */
i = myht ? zend_hash_num_elements(myht) : 0;
if (i > 0) {
zend_string *key;
- php_uint_t index, idx;
+ zend_ulong index, idx;
idx = 0;
ZEND_HASH_FOREACH_KEY(myht, index, key) {
@@ -252,7 +252,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
if (i > 0) {
zend_string *key;
zval *data;
- php_uint_t index;
+ zend_ulong index;
HashTable *tmp_ht;
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) {
@@ -308,7 +308,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
json_pretty_print_indent(buf, options TSRMLS_CC);
smart_str_appendc(buf, '"');
- smart_str_append_int(buf, (php_int_t) index);
+ smart_str_append_long(buf, (zend_long) index);
smart_str_appendc(buf, '"');
smart_str_appendc(buf, ':');
@@ -380,12 +380,11 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{
}
/* }}} */
-static void json_escape_string(smart_str *buf, char *s, int len, int options TSRMLS_DC) /* {{{ */
+static void json_escape_string(smart_str *buf, char *s, size_t len, int options TSRMLS_DC) /* {{{ */
{
- int pos = 0, ulen = 0;
- unsigned short us;
- unsigned short *utf16;
- size_t newlen;
+ int status;
+ unsigned int us, next_us = 0;
+ size_t pos, checkpoint;
if (len == 0) {
smart_str_appendl(buf, "\"\"", 2);
@@ -395,11 +394,11 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
if (options & PHP_JSON_NUMERIC_CHECK) {
double d;
int type;
- php_int_t p;
+ zend_long p;
if ((type = is_numeric_string(s, len, &p, &d, 0)) != 0) {
- if (type == IS_INT) {
- smart_str_append_int(buf, p);
+ if (type == IS_LONG) {
+ smart_str_append_long(buf, p);
} else if (type == IS_DOUBLE) {
if (!zend_isinf(d) && !zend_isnan(d)) {
char *tmp;
@@ -416,34 +415,51 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
}
- utf16 = (options & PHP_JSON_UNESCAPED_UNICODE) ? NULL : (unsigned short *) safe_emalloc(len, sizeof(unsigned short), 0);
- ulen = json_utf8_to_utf16(utf16, s, len);
- if (ulen <= 0) {
- if (utf16) {
- efree(utf16);
- }
- if (ulen < 0) {
+ if (options & PHP_JSON_UNESCAPED_UNICODE) {
+ /* validate UTF-8 string first */
+ if (json_utf8_to_utf16(NULL, s, len) < 0) {
JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
smart_str_appendl(buf, "null", 4);
- } else {
- smart_str_appendl(buf, "\"\"", 2);
+ return;
}
- return;
- }
- if (!(options & PHP_JSON_UNESCAPED_UNICODE)) {
- len = ulen;
}
+ pos = 0;
+ checkpoint = buf->s ? buf->s->len : 0;
+
/* pre-allocate for string length plus 2 quotes */
smart_str_alloc(buf, len+2, 0);
smart_str_appendc(buf, '"');
- while (pos < len)
- {
- us = (options & PHP_JSON_UNESCAPED_UNICODE) ? s[pos++] : utf16[pos++];
+ do {
+ if (UNEXPECTED(next_us)) {
+ us = next_us;
+ next_us = 0;
+ } else {
+ us = (unsigned char)s[pos];
+ if (!(options & PHP_JSON_UNESCAPED_UNICODE) && us >= 0x80) {
+ /* UTF-8 character */
+ us = php_next_utf8_char((const unsigned char *)s, len, &pos, &status);
+ if (status != SUCCESS) {
+ if (buf->s) {
+ buf->s->len = checkpoint;
+ }
+ JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
+ smart_str_appendl(buf, "null", 4);
+ return;
+ }
+ /* From http://en.wikipedia.org/wiki/UTF16 */
+ if (us >= 0x10000) {
+ us -= 0x10000;
+ next_us = (unsigned short)((us & 0x3ff) | 0xdc00);
+ us = (unsigned short)((us >> 10) | 0xd800);
+ }
+ } else {
+ pos++;
+ }
+ }
- switch (us)
- {
+ switch (us) {
case '"':
if (options & PHP_JSON_HEX_QUOT) {
smart_str_appendl(buf, "\\u0022", 6);
@@ -528,12 +544,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
}
break;
}
- }
-
+ } while (pos < len || next_us);
+
smart_str_appendc(buf, '"');
- if (utf16) {
- efree(utf16);
- }
}
/* }}} */
@@ -558,7 +571,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
ZVAL_STRING(&fname, "jsonSerialize");
if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL TSRMLS_CC) || Z_TYPE(retval) == IS_UNDEF) {
- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name);
+ zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name->val);
smart_str_appendl(buf, "null", sizeof("null") - 1);
zval_ptr_dtor(&fname);
return;
@@ -602,8 +615,8 @@ again:
smart_str_appendl(buf, "false", 5);
break;
- case IS_INT:
- smart_str_append_int(buf, Z_IVAL_P(val));
+ case IS_LONG:
+ smart_str_append_long(buf, Z_LVAL_P(val));
break;
case IS_DOUBLE:
@@ -624,7 +637,7 @@ again:
break;
case IS_STRING:
- json_escape_string(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val), options TSRMLS_CC);
+ json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC);
break;
case IS_OBJECT:
@@ -651,9 +664,9 @@ again:
}
/* }}} */
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC) /* {{{ */
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC) /* {{{ */
{
- int utf16_len;
+ size_t utf16_len;
unsigned short *utf16;
JSON_parser jp;
@@ -678,7 +691,7 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len,
if (!parse_JSON_ex(jp, return_value, utf16, utf16_len, options TSRMLS_CC)) {
double d;
int type, overflow_info;
- php_int_t p;
+ zend_long p;
char *trim = str;
int trim_len = str_len;
@@ -710,8 +723,8 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len,
}
if ((type = is_numeric_string_ex(trim, trim_len, &p, &d, 0, &overflow_info)) != 0) {
- if (type == IS_INT) {
- RETVAL_INT(p);
+ if (type == IS_LONG) {
+ RETVAL_LONG(p);
} else if (type == IS_DOUBLE) {
if (options & PHP_JSON_BIGINT_AS_STRING && overflow_info) {
/* Within an object or array, a numeric literal is assumed
@@ -758,10 +771,10 @@ static PHP_FUNCTION(json_encode)
{
zval *parameter;
smart_str buf = {0};
- php_int_t options = 0;
- php_int_t depth = JSON_PARSER_DEFAULT_DEPTH;
+ zend_long options = 0;
+ zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", &parameter, &options, &depth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &parameter, &options, &depth) == FAILURE) {
return;
}
@@ -776,7 +789,7 @@ static PHP_FUNCTION(json_encode)
ZVAL_FALSE(return_value);
} else {
smart_str_0(&buf); /* copy? */
- ZVAL_STR(return_value, buf.s);
+ ZVAL_NEW_STR(return_value, buf.s);
}
}
/* }}} */
@@ -786,12 +799,12 @@ static PHP_FUNCTION(json_encode)
static PHP_FUNCTION(json_decode)
{
char *str;
- int str_len;
+ size_t str_len;
zend_bool assoc = 0; /* return JS objects as PHP objects by default */
- php_int_t depth = JSON_PARSER_DEFAULT_DEPTH;
- php_int_t options = 0;
+ zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
+ zend_long options = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bii", &str, &str_len, &assoc, &depth, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) {
return;
}
@@ -820,7 +833,7 @@ static PHP_FUNCTION(json_last_error)
return;
}
- RETURN_INT(JSON_G(error_code));
+ RETURN_LONG(JSON_G(error_code));
}
/* }}} */
diff --git a/ext/json/json.dsp b/ext/json/json.dsp
deleted file mode 100644
index e5bb3767bf..0000000000
--- a/ext/json/json.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="json" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=json - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "json.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "json.mak" CFG="json - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "json - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "json - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "json - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JSON_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "json_c" /D HAVE_JSON=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D ZTS=1 /D COMPILE_DL_JSON=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JSON_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "_DEBUG"
-# ADD RSC /l 0x1009 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 iconv.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_json.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "json - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JSON_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "json_c" /D HAVE_JSON=1 /D "ZEND_WIN32" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D ZTS=1 /D COMPILE_DL_JSON=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JSON_EXPORTS" /D "HAVE_FCNTL_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "NDEBUG"
-# ADD RSC /l 0x1009 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 iconv.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_json.dll" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "json - Win32 Debug_TS"
-# Name "json - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\json.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\JSON_parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\JSON_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8_decode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8_decode.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8_to_utf16.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\utf8_to_utf16.h
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_json.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index b42aecba7d..5b2dc127dd 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -22,7 +22,7 @@
#define PHP_JSON_H
#define PHP_JSON_VERSION "1.2.1"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str_public.h"
extern zend_module_entry json_module_entry;
#define phpext_json_ptr &json_module_entry
@@ -50,7 +50,7 @@ ZEND_END_MODULE_GLOBALS(json)
#endif
PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC);
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC);
extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
@@ -74,7 +74,7 @@ extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
#define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
#define PHP_JSON_BIGINT_AS_STRING (1<<1)
-static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, php_int_t depth TSRMLS_DC)
+static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth TSRMLS_DC)
{
php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC);
}
diff --git a/ext/json/utf8_decode.h b/ext/json/utf8_decode.h
index cc0fc79f6c..0908edd2d4 100644
--- a/ext/json/utf8_decode.h
+++ b/ext/json/utf8_decode.h
@@ -5,8 +5,8 @@
typedef struct json_utf8_decode
{
- int the_index;
char *the_input;
+ int the_index;
int the_length;
int the_char;
int the_byte;
diff --git a/ext/ldap/LDAP_Win32_HOWTO.txt b/ext/ldap/LDAP_Win32_HOWTO.txt
index bcee731e88..30b6096f58 100644
--- a/ext/ldap/LDAP_Win32_HOWTO.txt
+++ b/ext/ldap/LDAP_Win32_HOWTO.txt
@@ -14,7 +14,7 @@ Note 1: During the entire build process, you can ignore warnings about
For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
Select the Preprocessor tab, select 'All Configurations'.
- Add '..\..\..\..\php5\regex' to the 'Additional include directories' list.
+ Add '..\..\..\..\php7\regex' to the 'Additional include directories' list.
Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
- Compile (you can compile both Debug and Release versions).
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 9bfbaaa1ae..f74de699ee 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -147,65 +147,65 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_INI_ENTRIES();
/* Constants to be used with deref-parameter in php_ldap_do_search() */
- REGISTER_INT_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
/* Constants to be used with ldap_modify_batch() */
- REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS);
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS);
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS);
REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS);
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
/* LDAP options */
- REGISTER_INT_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS);
#ifdef LDAP_OPT_NETWORK_TIMEOUT
- REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#elif defined (LDAP_X_OPT_CONNECT_TIMEOUT)
- REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#endif
- REGISTER_INT_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
#ifdef LDAP_OPT_RESTART
- REGISTER_INT_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef LDAP_OPT_HOST_NAME
- REGISTER_INT_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
#endif
- REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
#ifdef LDAP_OPT_MATCHED_DN
- REGISTER_INT_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS);
#endif
- REGISTER_INT_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef LDAP_OPT_DEBUG_LEVEL
- REGISTER_INT_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef HAVE_LDAP_SASL
- REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS);
#endif
#ifdef ORALDAP
- REGISTER_INT_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
#endif
- REGISTER_INT_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS);
le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number);
le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number);
@@ -241,9 +241,9 @@ PHP_MINFO_FUNCTION(ldap)
php_info_print_table_row(2, "RCS Version", "$Id$");
if (LDAPG(max_links) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
+ snprintf(tmp, 31, ZEND_LONG_FMT "/unlimited", LDAPG(num_links));
} else {
- snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
+ snprintf(tmp, 31, ZEND_LONG_FMT "/" ZEND_LONG_FMT, LDAPG(num_links), LDAPG(max_links));
}
php_info_print_table_row(2, "Total Links", tmp);
@@ -294,12 +294,12 @@ PHP_MINFO_FUNCTION(ldap)
PHP_FUNCTION(ldap_connect)
{
char *host = NULL;
- int hostlen;
- php_int_t port = 389; /* Default port */
+ size_t hostlen;
+ zend_long port = 389; /* Default port */
#ifdef HAVE_ORALDAP
char *wallet = NULL, *walletpasswd = NULL;
- int walletlen = 0, walletpasswdlen = 0;
- php_int_t authmode = GSLC_SSL_NO_AUTH;
+ size_t walletlen = 0, walletpasswdlen = 0;
+ zend_long authmode = GSLC_SSL_NO_AUTH;
int ssl=0;
#endif
ldap_linkdata *ld;
@@ -310,7 +310,7 @@ PHP_FUNCTION(ldap_connect)
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sissi", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {
RETURN_FALSE;
}
@@ -318,13 +318,13 @@ PHP_FUNCTION(ldap_connect)
ssl = 1;
}
#else
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|si", &host, &hostlen, &port) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &hostlen, &port) != SUCCESS) {
RETURN_FALSE;
}
#endif
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", LDAPG(num_links));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", LDAPG(num_links));
RETURN_FALSE;
}
@@ -388,13 +388,30 @@ static int _get_lderrno(LDAP *ldap)
}
/* }}} */
+/* {{{ _set_lderrno
+ */
+static void _set_lderrno(LDAP *ldap, int lderr)
+{
+#if !HAVE_NSLDAP
+#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
+ /* New versions of OpenLDAP do it this way */
+ ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
+#else
+ ldap->ld_errno = lderr;
+#endif
+#else
+ ldap_set_lderrno(ldap, lderr, NULL, NULL);
+#endif
+}
+/* }}} */
+
/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
Bind to LDAP directory */
PHP_FUNCTION(ldap_bind)
{
zval *link;
char *ldap_bind_dn = NULL, *ldap_bind_pw = NULL;
- int ldap_bind_dnlen, ldap_bind_pwlen;
+ size_t ldap_bind_dnlen, ldap_bind_pwlen;
ldap_linkdata *ld;
int rc;
@@ -402,18 +419,20 @@ PHP_FUNCTION(ldap_bind)
RETURN_FALSE;
}
+ ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
+
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
+ _set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
RETURN_FALSE;
}
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
+ _set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
RETURN_FALSE;
}
- ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
-
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
RETURN_FALSE;
@@ -521,7 +540,7 @@ PHP_FUNCTION(ldap_sasl_bind)
char *sasl_authz_id = NULL;
char *sasl_authc_id = NULL;
char *props = NULL;
- int rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len;
+ size_t rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len;
php_ldap_bictx *ctx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sssssss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) {
@@ -610,7 +629,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
{
zval *link, *base_dn, *filter, *attrs = NULL, *attr;
- php_int_t attrsonly, sizelimit, timelimit, deref;
+ zend_long attrsonly, sizelimit, timelimit, deref;
char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL;
ldap_linkdata *ld = NULL;
LDAPMessage *ldap_res;
@@ -618,7 +637,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|aiiii", &link, &base_dn, &filter, &attrs, &attrsonly,
+ if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|allll", &link, &base_dn, &filter, &attrs, &attrsonly,
&sizelimit, &timelimit, &deref) == FAILURE) {
return;
}
@@ -870,7 +889,7 @@ PHP_FUNCTION(ldap_count_entries)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
- RETURN_INT(ldap_count_entries(ld->link, ldap_result));
+ RETURN_LONG(ldap_count_entries(ld->link, ldap_result));
}
/* }}} */
@@ -957,7 +976,7 @@ PHP_FUNCTION(ldap_get_entries)
num_entries = ldap_count_entries(ldap, ldap_result);
array_init(return_value);
- add_assoc_int(return_value, "count", num_entries);
+ add_assoc_long(return_value, "count", num_entries);
if (num_entries == 0) {
return;
@@ -981,7 +1000,7 @@ PHP_FUNCTION(ldap_get_entries)
num_values = ldap_count_values_len(ldap_value);
array_init(&tmp2);
- add_assoc_int(&tmp2, "count", num_values);
+ add_assoc_long(&tmp2, "count", num_values);
for (i = 0; i < num_values; i++) {
add_index_stringl(&tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len);
}
@@ -1003,7 +1022,7 @@ PHP_FUNCTION(ldap_get_entries)
}
#endif
- add_assoc_int(&tmp1, "count", num_attrib);
+ add_assoc_long(&tmp1, "count", num_attrib);
dn = ldap_get_dn(ldap, ldap_result_entry);
add_assoc_string(&tmp1, "dn", dn);
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
@@ -1018,7 +1037,7 @@ PHP_FUNCTION(ldap_get_entries)
ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
}
- add_assoc_int(return_value, "count", num_entries);
+ add_assoc_long(return_value, "count", num_entries);
}
/* }}} */
@@ -1031,9 +1050,9 @@ PHP_FUNCTION(ldap_first_attribute)
ldap_linkdata *ld;
ldap_resultentry *resultentry;
char *attribute;
- php_int_t dummy_ber;
+ zend_long dummy_ber;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
return;
}
@@ -1059,9 +1078,9 @@ PHP_FUNCTION(ldap_next_attribute)
ldap_linkdata *ld;
ldap_resultentry *resultentry;
char *attribute;
- php_int_t dummy_ber;
+ zend_long dummy_ber;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
return;
}
@@ -1119,7 +1138,7 @@ PHP_FUNCTION(ldap_get_attributes)
num_values = ldap_count_values_len(ldap_value);
array_init(&tmp);
- add_assoc_int(&tmp, "count", num_values);
+ add_assoc_long(&tmp, "count", num_values);
for (i = 0; i < num_values; i++) {
add_index_stringl(&tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len);
}
@@ -1140,7 +1159,7 @@ PHP_FUNCTION(ldap_get_attributes)
}
#endif
- add_assoc_int(return_value, "count", num_attrib);
+ add_assoc_long(return_value, "count", num_attrib);
}
/* }}} */
@@ -1153,7 +1172,8 @@ PHP_FUNCTION(ldap_get_values_len)
ldap_resultentry *resultentry;
char *attr;
struct berval **ldap_value_len;
- int i, num_values, attr_len;
+ int i, num_values;
+ size_t attr_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result_entry, &attr, &attr_len) != SUCCESS) {
return;
@@ -1174,7 +1194,7 @@ PHP_FUNCTION(ldap_get_values_len)
add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len);
}
- add_assoc_int(return_value, "count", num_values);
+ add_assoc_long(return_value, "count", num_values);
ldap_value_free_len(ldap_value_len);
}
@@ -1214,11 +1234,12 @@ PHP_FUNCTION(ldap_get_dn)
Splits DN into its component parts */
PHP_FUNCTION(ldap_explode_dn)
{
- php_int_t with_attrib;
+ zend_long with_attrib;
char *dn, **ldap_value;
- int i, count, dn_len;
+ int i, count;
+ size_t dn_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &dn, &dn_len, &with_attrib) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &dn, &dn_len, &with_attrib) != SUCCESS) {
return;
}
@@ -1233,7 +1254,7 @@ PHP_FUNCTION(ldap_explode_dn)
array_init(return_value);
- add_assoc_int(return_value, "count", count);
+ add_assoc_long(return_value, "count", count);
for (i = 0; i<count; i++) {
add_index_string(return_value, i, ldap_value[i]);
}
@@ -1247,7 +1268,7 @@ PHP_FUNCTION(ldap_explode_dn)
PHP_FUNCTION(ldap_dn2ufn)
{
char *dn, *ufn;
- int dn_len;
+ size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dn, &dn_len) != SUCCESS) {
return;
@@ -1277,10 +1298,11 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
ldap_linkdata *ld;
char *dn;
LDAPMod **ldap_mods;
- int i, j, num_attribs, num_values, dn_len;
+ int i, j, num_attribs, num_values;
+ size_t dn_len;
int *num_berval;
zend_string *attribute;
- php_uint_t index;
+ zend_ulong index;
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
@@ -1338,7 +1360,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
if ((num_values == 1) && (Z_TYPE_P(value) != IS_ARRAY)) {
convert_to_string_ex(value);
ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRSIZE_P(value);
+ ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value);
ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_P(value);
} else {
for (j = 0; j < num_values; j++) {
@@ -1351,7 +1373,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
}
convert_to_string_ex(ivalue);
ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(ivalue);
+ ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(ivalue);
ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_P(ivalue);
}
}
@@ -1431,7 +1453,8 @@ PHP_FUNCTION(ldap_delete)
zval *link;
ldap_linkdata *ld;
char *dn;
- int rc, dn_len;
+ int rc;
+ size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &link, &dn, &dn_len) != SUCCESS) {
return;
@@ -1500,7 +1523,7 @@ PHP_FUNCTION(ldap_modify_batch)
zval *attrib, *modtype, *vals;
zval *fetched;
char *dn;
- int dn_len;
+ size_t dn_len;
int i, j, k;
int num_mods, num_modprops, num_modvals;
LDAPMod **ldap_mods;
@@ -1539,10 +1562,10 @@ PHP_FUNCTION(ldap_modify_batch)
/* perform validation */
{
zend_string *modkey;
- php_int_t modtype;
+ zend_long modtype;
/* to store the wrongly-typed keys */
- php_uint_t tmpUlong;
+ zend_ulong tmpUlong;
/* make sure the DN contains no NUL bytes */
if (_ldap_strlen_max(dn, dn_len) != dn_len) {
@@ -1552,7 +1575,7 @@ PHP_FUNCTION(ldap_modify_batch)
/* make sure the top level is a normal array */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods));
- if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_INT) {
+ if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed");
RETURN_FALSE;
}
@@ -1604,19 +1627,19 @@ PHP_FUNCTION(ldap_modify_batch)
RETURN_FALSE;
}
- if (Z_STRSIZE_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRSIZE_P(modinfo))) {
+ if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes");
RETURN_FALSE;
}
}
else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) {
- if (Z_TYPE_P(modinfo) != IS_INT) {
+ if (Z_TYPE_P(modinfo) != IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long");
RETURN_FALSE;
}
/* is the value in range? */
- modtype = Z_IVAL_P(modinfo);
+ modtype = Z_LVAL_P(modinfo);
if (
modtype != LDAP_MODIFY_BATCH_ADD &&
modtype != LDAP_MODIFY_BATCH_REMOVE &&
@@ -1656,7 +1679,7 @@ PHP_FUNCTION(ldap_modify_batch)
}
/* are its keys integers? */
- if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_INT) {
+ if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed");
RETURN_FALSE;
}
@@ -1700,7 +1723,7 @@ PHP_FUNCTION(ldap_modify_batch)
_ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals);
/* map the modification type */
- switch (Z_IVAL_P(modtype)) {
+ switch (Z_LVAL_P(modtype)) {
case LDAP_MODIFY_BATCH_ADD:
oper = LDAP_MOD_ADD;
break;
@@ -1718,9 +1741,9 @@ PHP_FUNCTION(ldap_modify_batch)
/* fill in the basic info */
ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES;
- ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRSIZE_P(attrib));
+ ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib));
- if (Z_IVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) {
+ if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) {
/* no values */
ldap_mods[i]->mod_bvalues = NULL;
}
@@ -1739,8 +1762,8 @@ PHP_FUNCTION(ldap_modify_batch)
ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0);
/* fill it */
- ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(modval);
- ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRSIZE_P(modval));
+ ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval);
+ ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval));
}
/* NULL-terminate values */
@@ -1800,7 +1823,7 @@ PHP_FUNCTION(ldap_errno)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- RETURN_INT(_get_lderrno(ld->link));
+ RETURN_LONG(_get_lderrno(ld->link));
}
/* }}} */
@@ -1808,9 +1831,9 @@ PHP_FUNCTION(ldap_errno)
Convert error number to error string */
PHP_FUNCTION(ldap_err2str)
{
- php_int_t perrno;
+ zend_long perrno;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perrno) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perrno) != SUCCESS) {
return;
}
@@ -1844,7 +1867,7 @@ PHP_FUNCTION(ldap_compare)
{
zval *link;
char *dn, *attr, *value;
- int dn_len, attr_len, value_len;
+ size_t dn_len, attr_len, value_len;
ldap_linkdata *ld;
int errno;
@@ -1867,7 +1890,7 @@ PHP_FUNCTION(ldap_compare)
}
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno));
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
/* }}} */
@@ -1878,7 +1901,7 @@ PHP_FUNCTION(ldap_sort)
zval *link, *result;
ldap_linkdata *ld;
char *sortfilter;
- int sflen;
+ size_t sflen;
zend_resource *le;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) {
@@ -1908,9 +1931,9 @@ PHP_FUNCTION(ldap_get_option)
{
zval *link, *retval;
ldap_linkdata *ld;
- php_int_t option;
+ zend_long option;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/", &link, &option, &retval) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/", &link, &option, &retval) != SUCCESS) {
return;
}
@@ -1934,7 +1957,7 @@ PHP_FUNCTION(ldap_get_option)
RETURN_FALSE;
}
zval_ptr_dtor(retval);
- ZVAL_INT(retval, val);
+ ZVAL_LONG(retval, val);
} break;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
case LDAP_OPT_NETWORK_TIMEOUT:
@@ -1951,7 +1974,7 @@ PHP_FUNCTION(ldap_get_option)
RETURN_FALSE;
}
zval_ptr_dtor(retval);
- ZVAL_INT(retval, timeout->tv_sec);
+ ZVAL_LONG(retval, timeout->tv_sec);
ldap_memfree(timeout);
} break;
#elif defined(LDAP_X_OPT_CONNECT_TIMEOUT)
@@ -1963,7 +1986,7 @@ PHP_FUNCTION(ldap_get_option)
RETURN_FALSE;
}
zval_ptr_dtor(retval);
- ZVAL_INT(retval, (timeout / 1000));
+ ZVAL_LONG(retval, (timeout / 1000));
} break;
#endif
/* options with string value */
@@ -2013,9 +2036,9 @@ PHP_FUNCTION(ldap_set_option)
zval *link, *newval;
ldap_linkdata *ld;
LDAP *ldap;
- php_int_t option;
+ zend_long option;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ziz", &link, &option, &newval) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlz", &link, &option, &newval) != SUCCESS) {
return;
}
@@ -2039,8 +2062,8 @@ PHP_FUNCTION(ldap_set_option)
{
int val;
- convert_to_int_ex(newval);
- val = Z_IVAL_P(newval);
+ convert_to_long_ex(newval);
+ val = Z_LVAL_P(newval);
if (ldap_set_option(ldap, option, &val)) {
RETURN_FALSE;
}
@@ -2050,8 +2073,8 @@ PHP_FUNCTION(ldap_set_option)
{
struct timeval timeout;
- convert_to_int_ex(newval);
- timeout.tv_sec = Z_IVAL_P(newval);
+ convert_to_long_ex(newval);
+ timeout.tv_sec = Z_LVAL_P(newval);
timeout.tv_usec = 0;
if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) {
RETURN_FALSE;
@@ -2062,8 +2085,8 @@ PHP_FUNCTION(ldap_set_option)
{
int timeout;
- convert_to_int_ex(newval);
- timeout = 1000 * Z_IVAL_P(newval); /* Convert to milliseconds */
+ convert_to_long_ex(newval);
+ timeout = 1000 * Z_LVAL_P(newval); /* Convert to milliseconds */
if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) {
RETURN_FALSE;
}
@@ -2138,7 +2161,7 @@ PHP_FUNCTION(ldap_set_option)
if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) {
convert_to_string_ex(val);
ctrl->ldctl_value.bv_val = Z_STRVAL_P(val);
- ctrl->ldctl_value.bv_len = Z_STRSIZE_P(val);
+ ctrl->ldctl_value.bv_len = Z_STRLEN_P(val);
} else {
ctrl->ldctl_value.bv_val = NULL;
ctrl->ldctl_value.bv_len = 0;
@@ -2204,7 +2227,7 @@ PHP_FUNCTION(ldap_parse_result)
}
zval_ptr_dtor(errcode);
- ZVAL_INT(errcode, lerrcode);
+ ZVAL_LONG(errcode, lerrcode);
/* Reverse -> fall through */
switch (myargcount) {
@@ -2341,7 +2364,7 @@ PHP_FUNCTION(ldap_rename)
ldap_linkdata *ld;
int rc;
char *dn, *newrdn, *newparent;
- int dn_len, newrdn_len, newparent_len;
+ size_t dn_len, newrdn_len, newparent_len;
zend_bool deleteoldrdn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) {
@@ -2424,8 +2447,8 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
ZVAL_COPY_VALUE(&cb_args[0], cb_link);
ZVAL_STRING(&cb_args[1], url);
if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(cb_retval)) {
- convert_to_int_ex(&cb_retval);
- retval = Z_IVAL(cb_retval);
+ convert_to_long_ex(&cb_retval);
+ retval = Z_LVAL(cb_retval);
zval_ptr_dtor(&cb_retval);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed");
@@ -2450,7 +2473,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
- if (Z_TYPE_P(callback) == IS_STRING && Z_STRSIZE_P(callback) == 0) {
+ if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) {
/* unregister rebind procedure */
if (!Z_ISUNDEF(ld->rebindproc)) {
zval_ptr_dtor(&ld->rebindproc);
@@ -2463,10 +2486,10 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* callable? */
if (!zend_is_callable(callback, 0, &callback_name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
/* register rebind procedure */
if (Z_ISUNDEF(ld->rebindproc)) {
@@ -2520,12 +2543,13 @@ static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, con
PHP_FUNCTION(ldap_escape)
{
char *value, *ignores, *result;
- int valuelen = 0, ignoreslen = 0, i;
+ size_t valuelen = 0, ignoreslen = 0;
+ int i;
size_t resultlen;
- php_int_t flags = 0;
+ zend_long flags = 0;
zend_bool map[256] = {0}, havecharlist = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|si", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) {
return;
}
@@ -2613,11 +2637,11 @@ PHP_FUNCTION(ldap_8859_to_t61)
Inject paged results control*/
PHP_FUNCTION(ldap_control_paged_result)
{
- php_int_t pagesize;
+ zend_long pagesize;
zend_bool iscritical;
zval *link;
char *cookie = NULL;
- int cookie_len = 0;
+ size_t cookie_len = 0;
struct berval lcookie = { 0, NULL };
ldap_linkdata *ld;
LDAP *ldap;
@@ -2625,7 +2649,7 @@ PHP_FUNCTION(ldap_control_paged_result)
LDAPControl ctrl, *ctrlsp[2];
int rc, myargcount = ZEND_NUM_ARGS();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
return;
}
@@ -2778,7 +2802,7 @@ PHP_FUNCTION(ldap_control_paged_result_response)
ldap_controls_free(lserverctrls);
if (myargcount == 4) {
zval_dtor(estimated);
- ZVAL_INT(estimated, lestimated);
+ ZVAL_LONG(estimated, lestimated);
}
zval_ptr_dtor(cookie);
diff --git a/ext/ldap/ldap.dsp b/ext/ldap/ldap.dsp
deleted file mode 100644
index a97ebe4105..0000000000
--- a/ext/ldap/ldap.dsp
+++ /dev/null
@@ -1,288 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ldap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ldap - Win32 Debug_TS_SSL
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak" CFG="ldap - Win32 Debug_TS_SSL"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ldap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5nts.lib /nologo /dll /machine:I386 /out:"Release/php_ldap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\openldap\libraries\Release"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 oldap32.lib olber32.lib php5nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php5nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\openldap\libraries\Debug" /libpath:"..\..\Debug"
-# ADD LINK32 oldap32.lib olber32.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SASL"
-# PROP Intermediate_Dir "Release_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS_SASL"
-# PROP Intermediate_Dir "Debug_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS_SSL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SSL"
-# PROP Intermediate_Dir "Release_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php5ts.lib oldap32.lib olber32.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS_SSL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS_SSL"
-# PROP Intermediate_Dir "Debug_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "HAVE_LDAP_START_TLS_S" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-# ADD LINK32 php5ts_debug.lib oldap32.lib olber32.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ldap - Win32 Release"
-# Name "ldap - Win32 Debug"
-# Name "ldap - Win32 Debug_TS"
-# Name "ldap - Win32 Release_TS"
-# Name "ldap - Win32 Release_TS SASL"
-# Name "ldap - Win32 Debug_TS SASL"
-# Name "ldap - Win32 Release_TS_SSL"
-# Name "ldap - Win32 Debug_TS_SSL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ldap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ldap.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\LDAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ldap/ldap.mak b/ext/ldap/ldap.mak
index 959fe16cf1..f285db0eff 100644
--- a/ext/ldap/ldap.mak
+++ b/ext/ldap/ldap.mak
@@ -4,7 +4,7 @@ PROJECT_ROOT = ..\..
# Module details
MODULE_NAME = php_ldap
-MODULE_DESC = "PHP 5 - LDAP Extension"
+MODULE_DESC = "PHP 7 - LDAP Extension"
VMAJ = 3
VMIN = 0
VREV = 0
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index 4588c53cd3..0ccdbfe665 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,8 +38,8 @@ PHP_MSHUTDOWN_FUNCTION(ldap);
PHP_MINFO_FUNCTION(ldap);
ZEND_BEGIN_MODULE_GLOBALS(ldap)
- php_int_t num_links;
- php_int_t max_links;
+ zend_long num_links;
+ zend_long max_links;
ZEND_END_MODULE_GLOBALS(ldap)
#ifdef ZTS
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 3580891019..d9e92541e9 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -779,51 +779,51 @@ static PHP_MINIT_FUNCTION(libxml)
php_libxml_initialize();
- REGISTER_INT_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("LIBXML_DOTTED_VERSION", LIBXML_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("LIBXML_LOADED_VERSION", (char *)xmlParserVersion, CONST_CS | CONST_PERSISTENT);
/* For use with loading xml */
- REGISTER_INT_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT);
#if LIBXML_VERSION >= 20621
- REGISTER_INT_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT);
#endif
#if LIBXML_VERSION >= 20703
- REGISTER_INT_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT);
/* Schema validation options */
#if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614
- REGISTER_INT_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT);
#endif
/* Additional constants for use with loading html */
#if LIBXML_VERSION >= 20707
- REGISTER_INT_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT);
#endif
#if LIBXML_VERSION >= 20708
- REGISTER_INT_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT);
#endif
/* Error levels */
- REGISTER_INT_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
INIT_CLASS_ENTRY(ce, "LibXMLError", NULL);
libxmlerror_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
@@ -991,9 +991,9 @@ static PHP_FUNCTION(libxml_get_last_error)
if (error) {
object_init_ex(return_value, libxmlerror_class_entry);
- add_property_int(return_value, "level", error->level);
- add_property_int(return_value, "code", error->code);
- add_property_int(return_value, "column", error->int2);
+ add_property_long(return_value, "level", error->level);
+ add_property_long(return_value, "code", error->code);
+ add_property_long(return_value, "column", error->int2);
if (error->message) {
add_property_string(return_value, "message", error->message);
} else {
@@ -1004,7 +1004,7 @@ static PHP_FUNCTION(libxml_get_last_error)
} else {
add_property_stringl(return_value, "file", "", 0);
}
- add_property_int(return_value, "line", error->line);
+ add_property_long(return_value, "line", error->line);
} else {
RETURN_FALSE;
}
@@ -1030,20 +1030,20 @@ static PHP_FUNCTION(libxml_get_errors)
zval z_error;
object_init_ex(&z_error, libxmlerror_class_entry);
- add_property_int(&z_error, "level", error->level);
- add_property_int(&z_error, "code", error->code);
- add_property_int(&z_error, "column", error->int2);
+ add_property_long_ex(&z_error, "level", sizeof("level") - 1, error->level TSRMLS_CC);
+ add_property_long_ex(&z_error, "code", sizeof("code") - 1, error->code TSRMLS_CC);
+ add_property_long_ex(&z_error, "column", sizeof("column") - 1, error->int2 TSRMLS_CC);
if (error->message) {
- add_property_string(&z_error, "message", error->message);
+ add_property_string_ex(&z_error, "message", sizeof("message") - 1, error->message TSRMLS_CC);
} else {
- add_property_stringl(&z_error, "message", "", 0);
+ add_property_stringl_ex(&z_error, "message", sizeof("message") - 1, "", 0 TSRMLS_CC);
}
if (error->file) {
- add_property_string(&z_error, "file", error->file);
+ add_property_string_ex(&z_error, "file", sizeof("file") - 1, error->file TSRMLS_CC);
} else {
- add_property_stringl(&z_error, "file", "", 0);
+ add_property_stringl_ex(&z_error, "file", sizeof("file") - 1, "", 0 TSRMLS_CC);
}
- add_property_int(&z_error, "line", error->line);
+ add_property_long_ex(&z_error, "line", sizeof("line") - 1, error->line TSRMLS_CC);
add_next_index_zval(return_value, &z_error);
error = zend_llist_get_next(LIBXML(error_list));
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index b79ca17556..cccc83f8db 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -34,7 +34,7 @@ extern zend_module_entry libxml_module_entry;
# define PHP_LIBXML_API
#endif
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include <libxml/tree.h>
#define LIBXML_SAVE_NOEMPTYTAG 1<<2
diff --git a/ext/mbstring/libmbfl/NEWS b/ext/mbstring/libmbfl/NEWS
index fc16367ed1..8217e4158f 100644
--- a/ext/mbstring/libmbfl/NEWS
+++ b/ext/mbstring/libmbfl/NEWS
@@ -27,4 +27,3 @@ version 1.1.0 March 02, 2010
- added cp5022x encoding (moriyoshi)
- added ISO-2022-JP-MS (moriyoshi)
- moved to github.com from sourceforge.jp (moriyoshi)
-
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index 63670d5177..a50768f6d0 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -197,7 +197,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i
char *strtok_buf = NULL, **val_list = NULL;
zval *array_ptr = (zval *) arg;
int n, num, *len_list = NULL;
- php_size_t val_len, new_val_len;
+ size_t val_len, new_val_len;
mbfl_string string, resvar, resval;
const mbfl_encoding *from_encoding = NULL;
mbfl_encoding_detector *identd = NULL;
@@ -254,7 +254,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i
}
if (n > (PG(max_input_vars) * 2)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %pd. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
goto out;
}
@@ -378,7 +378,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
php_stream_rewind(SG(request_info).request_body);
post_data_str = php_stream_copy_to_mem(SG(request_info).request_body, PHP_STREAM_COPY_ALL, 0);
detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str->val TSRMLS_CC);
- STR_RELEASE(post_data_str);
+ zend_string_release(post_data_str);
MBSTRG(http_input_identify) = detected;
if (detected) {
diff --git a/ext/mbstring/mb_gpc.h b/ext/mbstring/mb_gpc.h
index ab6fcc86e0..091d8e2d9b 100644
--- a/ext/mbstring/mb_gpc.h
+++ b/ext/mbstring/mb_gpc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2001 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,14 +30,14 @@
#if HAVE_MBSTRING
/* {{{ typedefs */
typedef struct _php_mb_encoding_handler_info_t {
- int data_type;
const char *separator;
- unsigned int report_errors: 1;
- enum mbfl_no_language to_language;
const mbfl_encoding *to_encoding;
- enum mbfl_no_language from_language;
const mbfl_encoding **from_encodings;
size_t num_from_encodings;
+ int data_type;
+ unsigned int report_errors : 1;
+ enum mbfl_no_language to_language;
+ enum mbfl_no_language from_language;
} php_mb_encoding_handler_info_t;
/* }}}*/
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 31b8a6251e..691391ab92 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1209,7 +1209,7 @@ static PHP_INI_MH(OnUpdate_mbstring_language)
{
enum mbfl_no_language no_language;
- no_language = mbfl_name2no_language(new_value);
+ no_language = mbfl_name2no_language(new_value->val);
if (no_language == mbfl_no_language_invalid) {
MBSTRG(language) = mbfl_no_language_neutral;
return FAILURE;
@@ -1235,7 +1235,7 @@ static PHP_INI_MH(OnUpdate_mbstring_detect_order)
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
return FAILURE;
}
@@ -1268,7 +1268,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
return FAILURE;
}
@@ -1291,7 +1291,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
{
const mbfl_encoding *encoding;
- if (new_value == NULL || new_value_length == 0) {
+ if (new_value == NULL || new_value->len == 0) {
encoding = mbfl_name2encoding(get_output_encoding(TSRMLS_C));
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
@@ -1299,7 +1299,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
return SUCCESS;
}
} else {
- encoding = mbfl_name2encoding(new_value);
+ encoding = mbfl_name2encoding(new_value->val);
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
@@ -1350,13 +1350,13 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated");
}
- if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+ if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_STARTUP | PHP_INI_STAGE_SHUTDOWN | PHP_INI_STAGE_RUNTIME)) {
- if (new_value_length) {
- return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
+ if (new_value && new_value->len) {
+ return _php_mb_ini_mbstring_internal_encoding_set(new_value->val, new_value->len TSRMLS_CC);
} else {
return _php_mb_ini_mbstring_internal_encoding_set(get_internal_encoding(TSRMLS_C), strlen(get_internal_encoding(TSRMLS_C))+1 TSRMLS_CC);
}
@@ -1379,20 +1379,20 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
char *endptr = NULL;
if (new_value != NULL) {
- if (strcasecmp("none", new_value) == 0) {
+ if (strcasecmp("none", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", new_value) == 0) {
+ } else if (strcasecmp("long", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else if (strcasecmp("entity", new_value) == 0) {
+ } else if (strcasecmp("entity", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- if (new_value_length >0) {
- c = strtol(new_value, &endptr, 0);
+ if (new_value->len >0) {
+ c = strtol(new_value->val, &endptr, 0);
if (*endptr == '\0') {
MBSTRG(filter_illegal_substchar) = c;
MBSTRG(current_filter_illegal_substchar) = c;
@@ -1417,7 +1417,7 @@ static PHP_INI_MH(OnUpdate_mbstring_encoding_translation)
return FAILURE;
}
- OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
if (MBSTRG(encoding_translation)) {
sapi_unregister_post_entry(php_post_entries TSRMLS_CC);
@@ -1439,11 +1439,10 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes)
if (!new_value) {
new_value = entry->orig_value;
- new_value_length = entry->orig_value_length;
}
- php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC);
+ php_trim(new_value->val, new_value->len, NULL, 0, &tmp, 3 TSRMLS_CC);
- if (Z_STRSIZE(tmp) > 0) {
+ if (Z_STRLEN(tmp) > 0) {
if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) {
zval_dtor(&tmp);
return FAILURE;
@@ -1559,13 +1558,13 @@ PHP_MINIT_FUNCTION(mbstring)
sapi_register_post_entries(mbstr_post_entries TSRMLS_CC);
}
- REGISTER_INT_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT);
#if HAVE_MBREGEX
PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
@@ -1622,9 +1621,8 @@ PHP_RINIT_FUNCTION(mbstring)
CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN;
while (p->type > 0) {
if ((MBSTRG(func_overload) & p->type) == p->type &&
- (orig = zend_hash_str_find_ptr(EG(function_table), p->save_func,
- strlen(p->save_func))) == NULL) {
-
+ !zend_hash_str_exists(EG(function_table), p->save_func, strlen(p->save_func))
+ ) {
func = zend_hash_str_find_ptr(EG(function_table), p->ovld_func, strlen(p->ovld_func));
if ((orig = zend_hash_str_find_ptr(EG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) {
@@ -1633,11 +1631,14 @@ PHP_RINIT_FUNCTION(mbstring)
} else {
ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION);
zend_hash_str_add_mem(EG(function_table), p->save_func, strlen(p->save_func), orig, sizeof(zend_internal_function));
+ function_add_ref(orig);
if (zend_hash_str_update_mem(EG(function_table), p->orig_func, strlen(p->orig_func), func, sizeof(zend_internal_function)) == NULL) {
php_error_docref("ref.mbstring" TSRMLS_CC, E_WARNING, "mbstring couldn't replace function %s.", p->orig_func);
return FAILURE;
}
+
+ function_add_ref(func);
}
}
p++;
@@ -1684,6 +1685,7 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
(orig = zend_hash_str_find_ptr(EG(function_table), p->save_func, strlen(p->save_func)))) {
zend_hash_str_update_mem(EG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function));
+ function_add_ref(orig);
zend_hash_str_del(EG(function_table), p->save_func, strlen(p->save_func));
}
p++;
@@ -1729,23 +1731,22 @@ PHP_MINFO_FUNCTION(mbstring)
Sets the current language or Returns the current language as a string */
PHP_FUNCTION(mb_language)
{
- char *name = NULL;
- int name_len = 0;
+ zend_string *name = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
if (name == NULL) {
RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language)));
} else {
- zend_string *ini_name = STR_INIT("mbstring.language", sizeof("mbstring.language") - 1, 0);
- if (FAILURE == zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name);
+ zend_string *ini_name = zend_string_init("mbstring.language", sizeof("mbstring.language") - 1, 0);
+ if (FAILURE == zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name->val);
RETVAL_FALSE;
} else {
RETVAL_TRUE;
}
- STR_RELEASE(ini_name);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -1755,7 +1756,7 @@ PHP_FUNCTION(mb_language)
PHP_FUNCTION(mb_internal_encoding)
{
const char *name = NULL;
- int name_len;
+ size_t name_len;
const mbfl_encoding *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
@@ -1786,7 +1787,7 @@ PHP_FUNCTION(mb_internal_encoding)
PHP_FUNCTION(mb_http_input)
{
char *typ = NULL;
- int typ_len;
+ size_t typ_len;
int retname;
char *list, *temp;
const mbfl_encoding *result = NULL;
@@ -1878,7 +1879,7 @@ PHP_FUNCTION(mb_http_input)
PHP_FUNCTION(mb_http_output)
{
const char *name = NULL;
- int name_len;
+ size_t name_len;
const mbfl_encoding *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
@@ -1938,7 +1939,7 @@ PHP_FUNCTION(mb_detect_order)
break;
default:
convert_to_string_ex(arg1);
- if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), &list, &size, 0 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0 TSRMLS_CC)) {
if (list) {
efree(list);
}
@@ -1979,25 +1980,25 @@ PHP_FUNCTION(mb_substitute_character)
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
RETURN_STRING("entity");
} else {
- RETURN_INT(MBSTRG(current_filter_illegal_substchar));
+ RETURN_LONG(MBSTRG(current_filter_illegal_substchar));
}
} else {
RETVAL_TRUE;
switch (Z_TYPE_P(arg1)) {
case IS_STRING:
- if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) {
+ if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) {
+ } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) {
+ } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
- convert_to_int_ex(arg1);
+ convert_to_long_ex(arg1);
- if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) {
+ if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1);
+ MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
RETURN_FALSE;
@@ -2005,10 +2006,10 @@ PHP_FUNCTION(mb_substitute_character)
}
break;
default:
- convert_to_int_ex(arg1);
- if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) {
+ convert_to_long_ex(arg1);
+ if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1);
+ MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
RETURN_FALSE;
@@ -2025,7 +2026,7 @@ PHP_FUNCTION(mb_preferred_mime_name)
{
enum mbfl_no_encoding no_encoding;
char *name = NULL;
- int name_len;
+ size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
@@ -2056,7 +2057,7 @@ PHP_FUNCTION(mb_parse_str)
{
zval *track_vars_array = NULL;
char *encstr = NULL;
- int encstr_len;
+ size_t encstr_len;
php_mb_encoding_handler_info_t info;
const mbfl_encoding *detected;
@@ -2105,8 +2106,8 @@ PHP_FUNCTION(mb_parse_str)
PHP_FUNCTION(mb_output_handler)
{
char *arg_string;
- int arg_string_len;
- php_int_t arg_status;
+ size_t arg_string_len;
+ zend_long arg_status;
mbfl_string string, result;
const char *charset;
char *p;
@@ -2115,7 +2116,7 @@ PHP_FUNCTION(mb_output_handler)
unsigned char send_text_mimetype = 0;
char *s, *mimetype = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
return;
}
@@ -2211,7 +2212,7 @@ PHP_FUNCTION(mb_strlen)
int n;
mbfl_string string;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
mbfl_string_init(&string);
@@ -2232,7 +2233,7 @@ PHP_FUNCTION(mb_strlen)
n = mbfl_strlen(&string);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2244,10 +2245,10 @@ PHP_FUNCTION(mb_strlen)
PHP_FUNCTION(mb_strpos)
{
int n, reverse = 0;
- php_int_t offset;
+ zend_long offset;
mbfl_string haystack, needle;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -2257,7 +2258,7 @@ PHP_FUNCTION(mb_strpos)
needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
offset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) {
return;
}
@@ -2280,7 +2281,7 @@ PHP_FUNCTION(mb_strpos)
n = mbfl_strpos(&haystack, &needle, offset, reverse);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
switch (-n) {
case 1:
@@ -2310,7 +2311,7 @@ PHP_FUNCTION(mb_strrpos)
int n;
mbfl_string haystack, needle;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
zval *zoffset = NULL;
long offset = 0, str_flg;
char *enc_name2 = NULL;
@@ -2330,7 +2331,7 @@ PHP_FUNCTION(mb_strrpos)
if (zoffset) {
if (Z_TYPE_P(zoffset) == IS_STRING) {
enc_name2 = Z_STRVAL_P(zoffset);
- enc_name_len2 = Z_STRSIZE_P(zoffset);
+ enc_name_len2 = Z_STRLEN_P(zoffset);
str_flg = 1;
if (enc_name2 != NULL) {
@@ -2356,15 +2357,15 @@ PHP_FUNCTION(mb_strrpos)
}
if (str_flg) {
- convert_to_int_ex(zoffset);
- offset = Z_IVAL_P(zoffset);
+ convert_to_long_ex(zoffset);
+ offset = Z_LVAL_P(zoffset);
} else {
enc_name = enc_name2;
enc_name_len = enc_name_len2;
}
} else {
- convert_to_int_ex(zoffset);
- offset = Z_IVAL_P(zoffset);
+ convert_to_long_ex(zoffset);
+ offset = Z_LVAL_P(zoffset);
}
}
@@ -2394,7 +2395,7 @@ PHP_FUNCTION(mb_strrpos)
n = mbfl_strpos(&haystack, &needle, offset, 1);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2406,14 +2407,14 @@ PHP_FUNCTION(mb_strrpos)
PHP_FUNCTION(mb_stripos)
{
int n;
- php_int_t offset;
+ zend_long offset;
mbfl_string haystack, needle;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
- int from_encoding_len;
+ size_t from_encoding_len;
n = -1;
offset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
if (needle.len == 0) {
@@ -2423,7 +2424,7 @@ PHP_FUNCTION(mb_stripos)
n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2435,21 +2436,21 @@ PHP_FUNCTION(mb_stripos)
PHP_FUNCTION(mb_strripos)
{
int n;
- php_int_t offset;
+ zend_long offset;
mbfl_string haystack, needle;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
- int from_encoding_len;
+ size_t from_encoding_len;
n = -1;
offset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2463,7 +2464,7 @@ PHP_FUNCTION(mb_strstr)
int n, len, mblen;
mbfl_string haystack, needle, result, *ret = NULL;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
zend_bool part = 0;
mbfl_string_init(&haystack);
@@ -2525,7 +2526,7 @@ PHP_FUNCTION(mb_strrchr)
int n, len, mblen;
mbfl_string haystack, needle, result, *ret = NULL;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
zend_bool part = 0;
mbfl_string_init(&haystack);
@@ -2587,7 +2588,7 @@ PHP_FUNCTION(mb_strrchr)
PHP_FUNCTION(mb_stristr)
{
zend_bool part = 0;
- unsigned int from_encoding_len, len, mblen;
+ size_t from_encoding_len, len, mblen;
int n;
mbfl_string haystack, needle, result, *ret = NULL;
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
@@ -2650,7 +2651,8 @@ PHP_FUNCTION(mb_stristr)
PHP_FUNCTION(mb_strrichr)
{
zend_bool part = 0;
- int n, from_encoding_len, len, mblen;
+ int n, len, mblen;
+ size_t from_encoding_len;
mbfl_string haystack, needle, result, *ret = NULL;
const char *from_encoding = MBSTRG(current_internal_encoding)->name;
mbfl_string_init(&haystack);
@@ -2709,7 +2711,7 @@ PHP_FUNCTION(mb_substr_count)
int n;
mbfl_string haystack, needle;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
mbfl_string_init(&haystack);
mbfl_string_init(&needle);
@@ -2737,7 +2739,7 @@ PHP_FUNCTION(mb_substr_count)
n = mbfl_substr_count(&haystack, &needle);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2750,12 +2752,13 @@ PHP_FUNCTION(mb_substr)
{
size_t argc = ZEND_NUM_ARGS();
char *str, *encoding;
- php_int_t from, len;
- int mblen, str_len, encoding_len;
+ zend_long from, len;
+ int mblen;
+ size_t str_len, encoding_len;
zval *z_len = NULL;
mbfl_string string, result, *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
return;
}
@@ -2777,8 +2780,8 @@ PHP_FUNCTION(mb_substr)
if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) {
len = str_len;
} else {
- convert_to_int_ex(z_len);
- len = Z_IVAL_P(z_len);
+ convert_to_long_ex(z_len);
+ len = Z_LVAL_P(z_len);
}
/* measures length */
@@ -2829,8 +2832,8 @@ PHP_FUNCTION(mb_strcut)
{
size_t argc = ZEND_NUM_ARGS();
char *encoding;
- php_int_t from, len;
- int encoding_len;
+ zend_long from, len;
+ size_t encoding_len;
zval *z_len = NULL;
mbfl_string string, result, *ret;
@@ -2838,7 +2841,7 @@ PHP_FUNCTION(mb_strcut)
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) {
return;
}
@@ -2853,8 +2856,8 @@ PHP_FUNCTION(mb_strcut)
if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) {
len = string.len;
} else {
- convert_to_int_ex(z_len);
- len = Z_IVAL_P(z_len);
+ convert_to_long_ex(z_len);
+ len = Z_LVAL_P(z_len);
}
/* if "from" position is negative, count start position from the end
@@ -2899,7 +2902,7 @@ PHP_FUNCTION(mb_strwidth)
int n;
mbfl_string string;
char *enc_name = NULL;
- int enc_name_len;
+ size_t enc_name_len;
mbfl_string_init(&string);
@@ -2920,7 +2923,7 @@ PHP_FUNCTION(mb_strwidth)
n = mbfl_strwidth(&string);
if (n >= 0) {
- RETVAL_INT(n);
+ RETVAL_LONG(n);
} else {
RETVAL_FALSE;
}
@@ -2932,11 +2935,11 @@ PHP_FUNCTION(mb_strwidth)
PHP_FUNCTION(mb_strimwidth)
{
char *str, *trimmarker, *encoding;
- php_int_t from, width;
- int str_len, trimmarker_len, encoding_len;
+ zend_long from, width;
+ size_t str_len, trimmarker_len, encoding_len;
mbfl_string string, result, marker, *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) {
return;
}
@@ -2960,7 +2963,7 @@ PHP_FUNCTION(mb_strimwidth)
string.val = (unsigned char *)str;
string.len = str_len;
- if (from < 0 || from > str_len) {
+ if (from < 0 || (size_t)from > str_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start position is out of range");
RETURN_FALSE;
}
@@ -3078,9 +3081,8 @@ MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length, co
PHP_FUNCTION(mb_convert_encoding)
{
char *arg_str, *arg_new;
- int str_len, new_len;
+ size_t str_len, new_len;
zval *arg_old;
- int i;
size_t size, l, n;
char *_from_encodings = NULL, *ret, *s_free = NULL;
@@ -3106,7 +3108,7 @@ PHP_FUNCTION(mb_convert_encoding)
n = strlen(Z_STRVAL_P(hash_entry));
_from_encodings = erealloc(_from_encodings, l+n+2);
memcpy(_from_encodings + l, ",", 1);
- memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRSIZE_P(hash_entry) + 1);
+ memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRLEN_P(hash_entry) + 1);
} else {
_from_encodings = estrdup(Z_STRVAL_P(hash_entry));
}
@@ -3147,13 +3149,13 @@ PHP_FUNCTION(mb_convert_case)
{
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
char *str;
- int str_len, from_encoding_len;
- php_int_t case_mode = 0;
+ size_t str_len, from_encoding_len;
+ zend_long case_mode = 0;
char *newstr;
size_t ret_len;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|s!", &str, &str_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s!", &str, &str_len,
&case_mode, &from_encoding, &from_encoding_len) == FAILURE) {
return;
}
@@ -3175,7 +3177,7 @@ PHP_FUNCTION(mb_strtoupper)
{
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
char *str;
- int str_len, from_encoding_len;
+ size_t str_len, from_encoding_len;
char *newstr;
size_t ret_len;
@@ -3202,7 +3204,7 @@ PHP_FUNCTION(mb_strtolower)
{
const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name;
char *str;
- int str_len, from_encoding_len;
+ size_t str_len, from_encoding_len;
char *newstr;
size_t ret_len;
@@ -3227,7 +3229,7 @@ PHP_FUNCTION(mb_strtolower)
PHP_FUNCTION(mb_detect_encoding)
{
char *str;
- int str_len;
+ size_t str_len;
zend_bool strict=0;
zval *encoding_list;
@@ -3256,7 +3258,7 @@ PHP_FUNCTION(mb_detect_encoding)
break;
default:
convert_to_string(encoding_list);
- if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRSIZE_P(encoding_list), &list, &size, 0 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0 TSRMLS_CC)) {
if (list) {
efree(list);
list = NULL;
@@ -3322,7 +3324,7 @@ PHP_FUNCTION(mb_encoding_aliases)
{
const mbfl_encoding *encoding;
char *name = NULL;
- int name_len;
+ size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
@@ -3351,18 +3353,18 @@ PHP_FUNCTION(mb_encode_mimeheader)
enum mbfl_no_encoding charset, transenc;
mbfl_string string, result, *ret;
char *charset_name = NULL;
- int charset_name_len;
+ size_t charset_name_len;
char *trans_enc_name = NULL;
- int trans_enc_name_len;
+ size_t trans_enc_name_len;
char *linefeed = "\r\n";
- int linefeed_len;
- php_int_t indent = 0;
+ size_t linefeed_len;
+ zend_long indent = 0;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssi", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
return;
}
@@ -3436,9 +3438,9 @@ PHP_FUNCTION(mb_convert_kana)
int opt, i;
mbfl_string string, result, *ret;
char *optstr = NULL;
- int optstr_len;
+ size_t optstr_len;
char *encname = NULL;
- int encname_len;
+ size_t encname_len;
mbfl_string_init(&string);
string.no_language = MBSTRG(language);
@@ -3546,7 +3548,8 @@ PHP_FUNCTION(mb_convert_variables)
const mbfl_encoding *from_encoding, *to_encoding;
mbfl_encoding_detector *identd;
mbfl_buffer_converter *convd;
- int n, to_enc_len, argc, stack_level, stack_max;
+ int n, argc, stack_level, stack_max;
+ size_t to_enc_len;
size_t elistsz;
const mbfl_encoding **elist;
char *to_enc;
@@ -3579,7 +3582,7 @@ PHP_FUNCTION(mb_convert_variables)
break;
default:
convert_to_string_ex(zfrom_enc);
- php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRSIZE_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC);
+ php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC);
break;
}
@@ -3636,7 +3639,7 @@ PHP_FUNCTION(mb_convert_variables)
}
} else if (Z_TYPE_P(hash_entry) == IS_STRING) {
string.val = (unsigned char *)Z_STRVAL_P(hash_entry);
- string.len = Z_STRSIZE_P(hash_entry);
+ string.len = Z_STRLEN_P(hash_entry);
if (mbfl_encoding_detector_feed(identd, &string)) {
goto detect_end; /* complete detecting */
}
@@ -3645,7 +3648,7 @@ PHP_FUNCTION(mb_convert_variables)
}
} else if (Z_TYPE_P(var) == IS_STRING) {
string.val = (unsigned char *)Z_STRVAL_P(var);
- string.len = Z_STRSIZE_P(var);
+ string.len = Z_STRLEN_P(var);
if (mbfl_encoding_detector_feed(identd, &string)) {
goto detect_end; /* complete detecting */
}
@@ -3725,7 +3728,7 @@ detect_end:
}
} else if (Z_TYPE_P(hash_entry) == IS_STRING) {
string.val = (unsigned char *)Z_STRVAL_P(hash_entry);
- string.len = Z_STRSIZE_P(hash_entry);
+ string.len = Z_STRLEN_P(hash_entry);
ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
if (ret != NULL) {
zval_ptr_dtor(hash_entry_ptr);
@@ -3738,7 +3741,7 @@ detect_end:
}
} else if (Z_TYPE_P(var) == IS_STRING) {
string.val = (unsigned char *)Z_STRVAL_P(var);
- string.len = Z_STRSIZE_P(var);
+ string.len = Z_STRLEN_P(var);
ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
if (ret != NULL) {
zval_ptr_dtor(var);
@@ -3768,10 +3771,10 @@ static void
php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
{
char *str, *encoding;
- int str_len, encoding_len;
+ size_t str_len, encoding_len;
zval *zconvmap, *hash_entry;
HashTable *target_hash;
- size_t argc = ZEND_NUM_ARGS();
+ int argc = ZEND_NUM_ARGS();
int i, *convmap, *mapelm, mapsize=0;
zend_bool is_hex = 0;
mbfl_string string, result, *ret;
@@ -3814,8 +3817,8 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
mapelm = convmap;
mapsize = 0;
ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
- convert_to_int_ex(hash_entry);
- *mapelm++ = Z_IVAL_P(hash_entry);
+ convert_to_long_ex(hash_entry);
+ *mapelm++ = Z_LVAL_P(hash_entry);
mapsize++;
} ZEND_HASH_FOREACH_END();
}
@@ -3907,7 +3910,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
}
if (state == 0 || state == 1) {
- fld_name = STR_INIT(token, token_pos, 0);
+ fld_name = zend_string_init(token, token_pos, 0);
state = 2;
} else {
@@ -3972,7 +3975,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
case 3:
if (crlf_state == -1) {
- fld_val = STR_INIT(token, token_pos, 0);
+ fld_val = zend_string_init(token, token_pos, 0);
if (fld_name != NULL && fld_val != NULL) {
zval val;
@@ -3983,7 +3986,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t
zend_hash_update(ht, fld_name, &val);
- STR_RELEASE(fld_name);
+ zend_string_release(fld_name);
}
fld_name = fld_val = NULL;
@@ -4019,7 +4022,7 @@ out:
state = 3;
}
if (state == 3) {
- fld_val = STR_INIT(token, 0, 0);
+ fld_val = zend_string_init(token, 0, 0);
if (fld_name != NULL && fld_val != NULL) {
zval val;
@@ -4030,7 +4033,7 @@ out:
zend_hash_update(ht, fld_name, &val);
- STR_RELEASE(fld_name);
+ zend_string_release(fld_name);
}
}
return state;
@@ -4040,14 +4043,14 @@ PHP_FUNCTION(mb_send_mail)
{
int n;
char *to = NULL;
- int to_len;
+ size_t to_len;
char *message = NULL;
- int message_len;
+ size_t message_len;
char *headers = NULL;
- int headers_len;
+ size_t headers_len;
char *subject = NULL;
zend_string *extra_cmd = NULL;
- int subject_len;
+ size_t subject_len;
int i;
char *to_r = NULL;
char *force_extra_parameters = INI_STR("mail.force_extra_parameters");
@@ -4192,7 +4195,7 @@ PHP_FUNCTION(mb_send_mail)
}
/* Subject: */
- if (subject != NULL && subject_len >= 0) {
+ if (subject != NULL) {
orig_str.no_language = MBSTRG(language);
orig_str.val = (unsigned char *)subject;
orig_str.len = subject_len;
@@ -4297,7 +4300,7 @@ PHP_FUNCTION(mb_send_mail)
}
if (extra_cmd) {
- STR_RELEASE(extra_cmd);
+ zend_string_release(extra_cmd);
}
if (to_r != to) {
@@ -4326,7 +4329,7 @@ PHP_FUNCTION(mb_send_mail)
PHP_FUNCTION(mb_get_info)
{
char *typ = NULL;
- int typ_len;
+ size_t typ_len;
size_t n;
char *name;
const struct mb_overload_def *over_func;
@@ -4352,7 +4355,7 @@ PHP_FUNCTION(mb_get_info)
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
add_assoc_string(return_value, "http_output_conv_mimetypes", name);
}
- add_assoc_int(return_value, "func_overload", MBSTRG(func_overload));
+ add_assoc_long(return_value, "func_overload", MBSTRG(func_overload));
if (MBSTRG(func_overload)){
over_func = &(mb_ovld[0]);
array_init(&row1);
@@ -4377,7 +4380,7 @@ PHP_FUNCTION(mb_get_info)
add_assoc_string(return_value, "mail_body_encoding", name);
}
}
- add_assoc_int(return_value, "illegal_chars", MBSTRG(illegalchars));
+ add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars));
if (MBSTRG(encoding_translation)) {
add_assoc_string(return_value, "encoding_translation", "On");
} else {
@@ -4404,7 +4407,7 @@ PHP_FUNCTION(mb_get_info)
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
add_assoc_string(return_value, "substitute_character", "entity");
} else {
- add_assoc_int(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar));
+ add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar));
}
if (MBSTRG(strict_detection)) {
add_assoc_string(return_value, "strict_detection", "On");
@@ -4428,7 +4431,7 @@ PHP_FUNCTION(mb_get_info)
RETVAL_STRING(name);
}
} else if (!strcasecmp("func_overload", typ)) {
- RETVAL_INT(MBSTRG(func_overload));
+ RETVAL_LONG(MBSTRG(func_overload));
} else if (!strcasecmp("func_overload_list", typ)) {
if (MBSTRG(func_overload)){
over_func = &(mb_ovld[0]);
@@ -4455,7 +4458,7 @@ PHP_FUNCTION(mb_get_info)
RETVAL_STRING(name);
}
} else if (!strcasecmp("illegal_chars", typ)) {
- RETVAL_INT(MBSTRG(illegalchars));
+ RETVAL_LONG(MBSTRG(illegalchars));
} else if (!strcasecmp("encoding_translation", typ)) {
if (MBSTRG(encoding_translation)) {
RETVAL_STRING("On");
@@ -4485,7 +4488,7 @@ PHP_FUNCTION(mb_get_info)
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
RETVAL_STRING("entity");
} else {
- RETVAL_INT(MBSTRG(current_filter_illegal_substchar));
+ RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
} else if (!strcasecmp("strict_detection", typ)) {
if (MBSTRG(strict_detection)) {
@@ -4504,9 +4507,9 @@ PHP_FUNCTION(mb_get_info)
PHP_FUNCTION(mb_check_encoding)
{
char *var = NULL;
- int var_len;
+ size_t var_len;
char *enc = NULL;
- int enc_len;
+ size_t enc_len;
mbfl_buffer_converter *convd;
const mbfl_encoding *encoding = MBSTRG(current_internal_encoding);
mbfl_string string, result, *ret = NULL;
diff --git a/ext/mbstring/mbstring.dsp b/ext/mbstring/mbstring.dsp
deleted file mode 100644
index 2e050c6d20..0000000000
--- a/ext/mbstring/mbstring.dsp
+++ /dev/null
@@ -1,1112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mbstring" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mbstring - Win32 Debug_TS MBSTRING
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak" CFG="mbstring - Win32 Debug_TS MBSTRING"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mbstring - Win32 Release_TS MBSTRING" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mbstring - Win32 Debug_TS MBSTRING" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "mbstring___Win32_Release_TS_MBSTRING"
-# PROP BASE Intermediate_Dir "mbstring___Win32_Release_TS_MBSTRING"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libmbfl" /I "libmbfl\mbfl" /D ZEND_DEBUG=0 /D "MBSTRING_EXPORTS" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /D MBFL_DLL_EXPORT=1 /D NOT_RUBY=1 /D "LIBMBFL_EXPORTS" /D "HAVE_STRICMP" /D "HAVE_CONFIG_H" /D "HAVE_STDLIB_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mbstring.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mbstring.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "mbstring___Win32_Debug_TS_MBSTRING"
-# PROP BASE Intermediate_Dir "mbstring___Win32_Debug_TS_MBSTRING"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "MBSTRING_EXPORTS" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libmbfl" /I "libmbfl\mbfl" /I "oniguruma" /D ZEND_DEBUG=1 /D MBSTRING_EXPORTS=1 /D HAVE_STDLIB_H=1 /D HAVE_STRING_H=1 /D "MBSTRING_EXPORTS" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /D MBFL_DLL_EXPORT=1 /D NOT_RUBY=1 /D "LIBMBFL_EXPORTS" /D "HAVE_STRICMP" /D "HAVE_CONFIG_H" /D "HAVE_STDLIB_H" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mbstring.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mbstring.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mbstring - Win32 Release_TS MBSTRING"
-# Name "mbstring - Win32 Debug_TS MBSTRING"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mb_gpc.c
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbstring.c
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_mbregex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_unicode.c
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mb_gpc.h
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\mbstring.h
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_mbregex.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_unicode.h
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode_data.h
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# PROP Intermediate_Dir "Release_TS"
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# PROP Intermediate_Dir "Debug_TS"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "libmbfl"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\html_entities.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_7bit.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_8bit.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ascii.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_big5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_byte2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_byte4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp1251.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp1252.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp866.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp932.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp936.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_cn.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_jp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_jp_win.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_kr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_tw.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_htmlent.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_hz.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso2022_kr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_1.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_10.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_13.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_14.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_15.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_3.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_6.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_9.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_jis.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_koi8r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_koi8u.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_armscii8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp850.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_pass.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_qprint.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_sjis.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ucs2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ucs4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_uhc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf16.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf32.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf7imap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_uuencode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_wchar.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_allocators.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_encoding.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_filter_output.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_ident.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_language.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_memory_device.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_de.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_en.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_ja.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_kr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_neutral.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_ru.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_uni.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_zh.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_hy.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libmbfl\config.h.vc6
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# Begin Custom Build
-InputDir=.\libmbfl
-InputPath=.\libmbfl\config.h.vc6
-
-"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputDir)\config.h.vc6 "$(InputDir)\config.h"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# Begin Custom Build
-InputDir=.\libmbfl
-InputPath=.\libmbfl\config.h.vc6
-
-"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputDir)\config.h.vc6 "$(InputDir)\config.h"
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\cp932_table.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\html_entities.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_7bit.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_8bit.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ascii.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_big5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_byte2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_byte4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp1251.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp1252.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp866.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp932.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp936.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_cn.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_jp.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_jp_win.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_kr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_euc_tw.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_htmlent.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_hz.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso2022_kr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_1.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_10.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_13.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_14.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_15.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_6.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_7.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_iso8859_9.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_jis.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_koi8r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_koi8u.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_armscii8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_cp850.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_pass.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_qprint.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_sjis.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ucs2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_ucs4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_uhc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf16.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf7.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf7imap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_utf8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\mbfilter_uuencode.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfilter_wchar.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_allocators.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_consts.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_encoding.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_filter_output.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_ident.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_language.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_memory_device.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\mbfl\mbfl_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_de.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_en.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_ja.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_kr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_neutral.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_ru.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_uni.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_zh.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\nls\nls_hy.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_prop.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_big5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cns11643.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp1251.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp1252.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp866.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp932_ext.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp936.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_10.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_13.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_14.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_15.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_6.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_7.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_iso8859_9.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_jis.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_koi8r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_koi8u.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_armscii8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_cp850.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmbfl\filters\unicode_table_uhc.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "oniguruma"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\oniguruma\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\reggnu.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regparse.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regposerr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\ascii.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\utf8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\euc_jp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\euc_tw.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\euc_kr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\sjis.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_1.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_3.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_6.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_9.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_10.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_11.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_13.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_14.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_15.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\iso8859_16.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\koi8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\koi8_r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\enc\big5.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\oniguruma\win32\config.h
-
-!IF "$(CFG)" == "mbstring - Win32 Release_TS MBSTRING"
-
-# Begin Custom Build
-InputDir=.\oniguruma\win32
-InputPath=.\oniguruma\win32\config.h
-
-"$(InputDir)\..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputDir)\config.h "$(InputDir)\..\config.h"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug_TS MBSTRING"
-
-# Begin Custom Build
-InputDir=.\oniguruma\win32
-InputPath=.\oniguruma\win32\config.h
-
-"$(InputDir)\..\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputDir)\config.h "$(InputDir)\..\config.h"
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\onigposix.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\oniguruma.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\php_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regint.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\oniguruma\regparse.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index 8e6310f75f..0136f8ef7d 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index baf0a2d44a..8be88c3fee 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,7 @@
#if HAVE_MBREGEX
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/info.h"
#include "php_mbregex.h"
#include "mbstring.h"
@@ -655,7 +655,7 @@ PHP_FUNCTION(mb_regex_encoding)
{
size_t argc = ZEND_NUM_ARGS();
char *encoding;
- int encoding_len;
+ size_t encoding_len;
OnigEncoding mbctype;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &encoding, &encoding_len) == FAILURE) {
@@ -689,7 +689,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
zval *arg_pattern, *array;
char *string;
- int string_len;
+ size_t string_len;
php_mb_regex_t *re;
OnigRegion *regs = NULL;
int i, match_len, beg, end;
@@ -711,19 +711,19 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
if (Z_TYPE_P(arg_pattern) != IS_STRING) {
/* we convert numbers to integers and treat them as a string */
if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) {
- convert_to_int_ex(arg_pattern); /* get rid of decimal places */
+ convert_to_long_ex(arg_pattern); /* get rid of decimal places */
}
convert_to_string_ex(arg_pattern);
/* don't bother doing an extended regex with just a number */
}
- if (!Z_STRVAL_P(arg_pattern) || Z_STRSIZE_P(arg_pattern) == 0) {
+ if (Z_STRLEN_P(arg_pattern) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern");
RETVAL_FALSE;
goto out;
}
- re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRSIZE_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC);
+ re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC);
if (re == NULL) {
RETVAL_FALSE;
goto out;
@@ -758,7 +758,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
if (match_len == 0) {
match_len = 1;
}
- RETVAL_INT(match_len);
+ RETVAL_LONG(match_len);
out:
if (regs != NULL) {
onig_region_free(regs, 1);
@@ -788,16 +788,16 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
zval *arg_pattern_zval;
char *arg_pattern;
- int arg_pattern_len;
+ size_t arg_pattern_len;
char *replace;
- int replace_len;
+ size_t replace_len;
zend_fcall_info arg_replace_fci;
zend_fcall_info_cache arg_replace_fci_cache;
char *string;
- int string_len;
+ size_t string_len;
char *p;
php_mb_regex_t *re;
@@ -826,7 +826,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
eval = 0;
{
char *option_str = NULL;
- int option_str_len = 0;
+ size_t option_str_len = 0;
if (!is_callable) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zss|s",
@@ -855,11 +855,11 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
}
if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) {
arg_pattern = Z_STRVAL_P(arg_pattern_zval);
- arg_pattern_len = Z_STRSIZE_P(arg_pattern_zval);
+ arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
} else {
/* FIXME: this code is not multibyte aware! */
- convert_to_int_ex(arg_pattern_zval);
- pat_buf[0] = (char)Z_IVAL_P(arg_pattern_zval);
+ convert_to_long_ex(arg_pattern_zval);
+ pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);
pat_buf[1] = '\0';
arg_pattern = pat_buf;
@@ -947,7 +947,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
/* result of eval */
convert_to_string(&v);
- smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRSIZE(v));
+ smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v));
/* Clean up */
eval_buf.s->len = 0;
zval_dtor(&v);
@@ -971,7 +971,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
if (zend_call_function(&arg_replace_fci, &arg_replace_fci_cache TSRMLS_CC) == SUCCESS &&
!Z_ISUNDEF(retval)) {
convert_to_string_ex(&retval);
- smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRSIZE(retval));
+ smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval));
if (eval_buf.s) {
eval_buf.s->len = 0;
}
@@ -1052,17 +1052,17 @@ PHP_FUNCTION(mb_ereg_replace_callback)
PHP_FUNCTION(mb_split)
{
char *arg_pattern;
- int arg_pattern_len;
+ size_t arg_pattern_len;
php_mb_regex_t *re;
OnigRegion *regs = NULL;
char *string;
OnigUChar *pos, *chunk_pos;
- int string_len;
+ size_t string_len;
int n, err;
- php_int_t count = -1;
+ zend_long count = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
RETURN_FALSE;
}
@@ -1081,7 +1081,7 @@ PHP_FUNCTION(mb_split)
err = 0;
regs = onig_region_new();
/* churn through str, generating array entries as we go */
- while (count != 0 && (pos - (OnigUChar *)string) < string_len) {
+ while (count != 0 && (pos - (OnigUChar *)string) < (ptrdiff_t)string_len) {
int beg, end;
err = onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), pos, (OnigUChar *)(string + string_len), regs, 0);
if (err < 0) {
@@ -1131,10 +1131,10 @@ PHP_FUNCTION(mb_split)
PHP_FUNCTION(mb_ereg_match)
{
char *arg_pattern;
- int arg_pattern_len;
+ size_t arg_pattern_len;
char *string;
- int string_len;
+ size_t string_len;
php_mb_regex_t *re;
OnigSyntaxType *syntax;
@@ -1143,7 +1143,7 @@ PHP_FUNCTION(mb_ereg_match)
{
char *option_str = NULL;
- int option_str_len = 0;
+ size_t option_str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
&arg_pattern, &arg_pattern_len, &string, &string_len,
@@ -1180,7 +1180,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
size_t argc = ZEND_NUM_ARGS();
char *arg_pattern, *arg_options;
- int arg_pattern_len, arg_options_len;
+ size_t arg_pattern_len, arg_options_len;
int n, i, err, pos, len, beg, end;
OnigOptionType option;
OnigUChar *str;
@@ -1209,7 +1209,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
len = 0;
if (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING){
str = (OnigUChar *)Z_STRVAL(MBREX(search_str));
- len = Z_STRSIZE(MBREX(search_str));
+ len = Z_STRLEN(MBREX(search_str));
}
if (MBREX(search_re) == NULL) {
@@ -1245,8 +1245,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
array_init(return_value);
beg = MBREX(search_regs)->beg[0];
end = MBREX(search_regs)->end[0];
- add_next_index_int(return_value, beg);
- add_next_index_int(return_value, end - beg);
+ add_next_index_long(return_value, beg);
+ add_next_index_long(return_value, end - beg);
break;
case 2:
array_init(return_value);
@@ -1311,7 +1311,7 @@ PHP_FUNCTION(mb_ereg_search_init)
size_t argc = ZEND_NUM_ARGS();
zval *arg_str;
char *arg_pattern = NULL, *arg_options = NULL;
- int arg_pattern_len = 0, arg_options_len = 0;
+ size_t arg_pattern_len = 0, arg_options_len = 0;
OnigSyntaxType *syntax = NULL;
OnigOptionType option;
@@ -1343,8 +1343,7 @@ PHP_FUNCTION(mb_ereg_search_init)
zval_ptr_dtor(&MBREX(search_str));
}
- ZVAL_COPY(&MBREX(search_str), arg_str);
- SEPARATE_ZVAL_IF_NOT_REF(&MBREX(search_str));
+ ZVAL_DUP(&MBREX(search_str), arg_str);
MBREX(search_pos) = 0;
@@ -1368,7 +1367,7 @@ PHP_FUNCTION(mb_ereg_search_getregs)
array_init(return_value);
str = (OnigUChar *)Z_STRVAL(MBREX(search_str));
- len = Z_STRSIZE(MBREX(search_str));
+ len = Z_STRLEN(MBREX(search_str));
n = MBREX(search_regs)->num_regs;
for (i = 0; i < n; i++) {
beg = MBREX(search_regs)->beg[i];
@@ -1389,7 +1388,7 @@ PHP_FUNCTION(mb_ereg_search_getregs)
Get search start position */
PHP_FUNCTION(mb_ereg_search_getpos)
{
- RETVAL_INT(MBREX(search_pos));
+ RETVAL_LONG(MBREX(search_pos));
}
/* }}} */
@@ -1397,13 +1396,13 @@ PHP_FUNCTION(mb_ereg_search_getpos)
Set search start position */
PHP_FUNCTION(mb_ereg_search_setpos)
{
- php_int_t position;
+ zend_long position;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) {
return;
}
- if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRSIZE(MBREX(search_str)))) {
+ if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position >= Z_STRLEN(MBREX(search_str)))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range");
MBREX(search_pos) = 0;
RETURN_FALSE;
@@ -1435,7 +1434,7 @@ PHP_FUNCTION(mb_regex_set_options)
OnigOptionType opt;
OnigSyntaxType *syntax;
char *string = NULL;
- int string_len;
+ size_t string_len;
char buf[16];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h
index 3d2e2b8e46..0088b0a716 100644
--- a/ext/mbstring/php_mbregex.h
+++ b/ext/mbstring/php_mbregex.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
index a1db6819e9..ee5b75e67a 100644
--- a/ext/mbstring/php_unicode.c
+++ b/ext/mbstring/php_unicode.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h
index 5932b8d2da..e376895cbd 100644
--- a/ext/mbstring/php_unicode.h
+++ b/ext/mbstring/php_unicode.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mbstring/tests/zend_multibyte-02.phpt b/ext/mbstring/tests/zend_multibyte-02.phpt
index 8a1a572804..7db444841e 100644
--- a/ext/mbstring/tests/zend_multibyte-02.phpt
+++ b/ext/mbstring/tests/zend_multibyte-02.phpt
@@ -1,6 +1,7 @@
--TEST--
zend multibyte (2)
--INI--
+error_reporting=E_ALL & ~E_DEPRECATED
zend.multibyte=On
zend.script_encoding=UTF-8
mbstring.internal_encoding=CP932
@@ -9,4 +10,4 @@ mbstring.internal_encoding=CP932
var_dump(bin2hex("テスト"));
?>
--EXPECTF--
-php: Zend/zend_language_scanner.l:%d: encoding_filter_script_to_internal: Assertion `internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding)' failed.
+string(12) "836583588367"
diff --git a/ext/mbstring/tests/zend_multibyte-06.phpt b/ext/mbstring/tests/zend_multibyte-06.phpt
index 1b8adb5186..7eeac1d353 100644
--- a/ext/mbstring/tests/zend_multibyte-06.phpt
+++ b/ext/mbstring/tests/zend_multibyte-06.phpt
@@ -10,4 +10,4 @@ declare(encoding="UTF-8");
var_dump(bin2hex("テスト"));
?>
--EXPECTF--
-php: Zend/zend_language_scanner.l:%d: encoding_filter_script_to_internal: Assertion `internal_encoding && zend_multibyte_check_lexer_compatibility(internal_encoding)' failed.
+string(12) "836583588367"
diff --git a/ext/mbstring/tests/zend_multibyte-07.phpt b/ext/mbstring/tests/zend_multibyte-07.phpt
index 50d4cd95ed..685c6f1f04 100644
--- a/ext/mbstring/tests/zend_multibyte-07.phpt
+++ b/ext/mbstring/tests/zend_multibyte-07.phpt
@@ -1,8 +1,5 @@
--TEST--
zend multibyte (7)
---SKIPIF--
---XFAIL--
-https://bugs.php.net/bug.php?id=66582
--INI--
error_reporting=E_ALL & ~E_DEPRECATED
zend.multibyte=On
diff --git a/ext/mbstring/tests/zend_multibyte-09.phpt b/ext/mbstring/tests/zend_multibyte-09.phpt
index 7b0015c6c1..f9b8bf734f 100644
--- a/ext/mbstring/tests/zend_multibyte-09.phpt
+++ b/ext/mbstring/tests/zend_multibyte-09.phpt
@@ -1,8 +1,5 @@
--TEST--
zend multibyte (9)
---SKIPIF--
---XFAIL--
-https://bugs.php.net/bug.php?id=66582
--INI--
error_reporting=E_ALL & ~E_DEPRECATED
zend.multibyte=On
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 3ae0bb314f..82cbe72176 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -40,7 +40,7 @@
#include "php_globals.h"
#include "ext/standard/info.h"
#include "ext/standard/php_rand.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_mcrypt_filter.h"
static int le_mcrypt;
@@ -345,9 +345,9 @@ typedef enum {
#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
char *dir = NULL; \
- int dir_len; \
+ size_t dir_len; \
char *module; \
- int module_len; \
+ size_t module_len; \
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, \
"s|s", &module, &module_len, &dir, &dir_len) == FAILURE) { \
return; \
@@ -386,13 +386,13 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */
le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
/* modes for mcrypt_??? routines */
- REGISTER_INT_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
/* sources for mcrypt_create_iv */
- REGISTER_INT_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT);
/* ciphers */
MCRYPT_ENTRY2_2_4(3DES, "tripledes");
@@ -452,7 +452,7 @@ static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */
}
/* }}} */
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
PHP_MINFO_FUNCTION(mcrypt) /* {{{ */
{
@@ -508,8 +508,8 @@ PHP_FUNCTION(mcrypt_module_open)
{
char *cipher, *cipher_dir;
char *mode, *mode_dir;
- int cipher_len, cipher_dir_len;
- int mode_len, mode_dir_len;
+ size_t cipher_len, cipher_dir_len;
+ size_t mode_len, mode_dir_len;
MCRYPT td;
php_mcrypt *pm;
@@ -543,7 +543,7 @@ PHP_FUNCTION(mcrypt_module_open)
PHP_FUNCTION(mcrypt_generic_init)
{
char *key, *iv;
- int key_len, iv_len;
+ size_t key_len, iv_len;
zval *mcryptind;
unsigned char *key_s, *iv_s;
int max_key_size, key_size, iv_size;
@@ -603,7 +603,7 @@ PHP_FUNCTION(mcrypt_generic_init)
}
}
pm->init = 1;
- RETVAL_INT(result);
+ RETVAL_LONG(result);
efree(iv_s);
efree(key_s);
@@ -616,7 +616,7 @@ PHP_FUNCTION(mcrypt_generic)
{
zval *mcryptind;
char *data;
- int data_len;
+ size_t data_len;
php_mcrypt *pm;
char* data_s;
int block_size, data_size;
@@ -661,7 +661,7 @@ PHP_FUNCTION(mdecrypt_generic)
{
zval *mcryptind;
char *data;
- int data_len;
+ size_t data_len;
php_mcrypt *pm;
char* data_s;
int block_size, data_size;
@@ -712,7 +712,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
key_sizes = mcrypt_enc_get_supported_key_sizes(pm->td, &count);
for (i = 0; i < count; i++) {
- add_index_int(return_value, i, key_sizes[i]);
+ add_index_long(return_value, i, key_sizes[i]);
}
mcrypt_free(key_sizes);
@@ -724,7 +724,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
PHP_FUNCTION(mcrypt_enc_self_test)
{
MCRYPT_GET_TD_ARG
- RETURN_INT(mcrypt_enc_self_test(pm->td));
+ RETURN_LONG(mcrypt_enc_self_test(pm->td));
}
/* }}} */
@@ -800,7 +800,7 @@ PHP_FUNCTION(mcrypt_enc_is_block_mode)
PHP_FUNCTION(mcrypt_enc_get_block_size)
{
MCRYPT_GET_TD_ARG
- RETURN_INT(mcrypt_enc_get_block_size(pm->td));
+ RETURN_LONG(mcrypt_enc_get_block_size(pm->td));
}
/* }}} */
@@ -809,7 +809,7 @@ PHP_FUNCTION(mcrypt_enc_get_block_size)
PHP_FUNCTION(mcrypt_enc_get_key_size)
{
MCRYPT_GET_TD_ARG
- RETURN_INT(mcrypt_enc_get_key_size(pm->td));
+ RETURN_LONG(mcrypt_enc_get_key_size(pm->td));
}
/* }}} */
@@ -818,7 +818,7 @@ PHP_FUNCTION(mcrypt_enc_get_key_size)
PHP_FUNCTION(mcrypt_enc_get_iv_size)
{
MCRYPT_GET_TD_ARG
- RETURN_INT(mcrypt_enc_get_iv_size(pm->td));
+ RETURN_LONG(mcrypt_enc_get_iv_size(pm->td));
}
/* }}} */
@@ -910,7 +910,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
- RETURN_INT(mcrypt_module_get_algo_block_size(module, dir));
+ RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir));
}
/* }}} */
@@ -920,7 +920,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
- RETURN_INT(mcrypt_module_get_algo_key_size(module, dir));
+ RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir));
}
/* }}} */
@@ -937,7 +937,7 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count);
for (i = 0; i < count; i++) {
- add_index_int(return_value, i, key_sizes[i]);
+ add_index_long(return_value, i, key_sizes[i]);
}
mcrypt_free(key_sizes);
}
@@ -949,7 +949,7 @@ PHP_FUNCTION(mcrypt_list_algorithms)
{
char **modules;
char *lib_dir = MCG(algorithms_dir);
- int lib_dir_len;
+ size_t lib_dir_len;
int i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
@@ -976,7 +976,7 @@ PHP_FUNCTION(mcrypt_list_modes)
{
char **modules;
char *lib_dir = MCG(modes_dir);
- int lib_dir_len;
+ size_t lib_dir_len;
int i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
@@ -1003,7 +1003,7 @@ PHP_FUNCTION(mcrypt_get_key_size)
{
char *cipher;
char *module;
- int cipher_len, module_len;
+ size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
@@ -1017,7 +1017,7 @@ PHP_FUNCTION(mcrypt_get_key_size)
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
- RETVAL_INT(mcrypt_enc_get_key_size(td));
+ RETVAL_LONG(mcrypt_enc_get_key_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
@@ -1032,7 +1032,7 @@ PHP_FUNCTION(mcrypt_get_block_size)
{
char *cipher;
char *module;
- int cipher_len, module_len;
+ size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
@@ -1046,7 +1046,7 @@ PHP_FUNCTION(mcrypt_get_block_size)
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
- RETVAL_INT(mcrypt_enc_get_block_size(td));
+ RETVAL_LONG(mcrypt_enc_get_block_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
@@ -1061,7 +1061,7 @@ PHP_FUNCTION(mcrypt_get_iv_size)
{
char *cipher;
char *module;
- int cipher_len, module_len;
+ size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
@@ -1075,7 +1075,7 @@ PHP_FUNCTION(mcrypt_get_iv_size)
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
- RETVAL_INT(mcrypt_enc_get_iv_size(td));
+ RETVAL_LONG(mcrypt_enc_get_iv_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
@@ -1092,7 +1092,7 @@ PHP_FUNCTION(mcrypt_get_cipher_name)
char *module_dir_string;
char *cipher_name;
char *cipher;
- int cipher_len;
+ size_t cipher_len;
MCRYPT td;
MCRYPT_GET_INI
@@ -1149,7 +1149,7 @@ static char *php_mcrypt_get_key_size_str(
smart_str_appends(&str, ", ");
}
- smart_str_append_int(&str, key_sizes[i]);
+ smart_str_append_long(&str, key_sizes[i]);
}
smart_str_appends(&str, " supported");
@@ -1238,11 +1238,11 @@ static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSR
}
/* }}} */
-static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, const char *data, int data_len, char *mode, const char *iv, int iv_len, int dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
+static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, const char *data, int data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
{
char *cipher_dir_string;
char *module_dir_string;
- unsigned long int data_size;
+ zend_long data_size;
char *data_s;
MCRYPT td;
@@ -1304,7 +1304,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
PHP_FUNCTION(mcrypt_encrypt)
{
char *cipher, *key, *data, *mode, *iv = NULL;
- int cipher_len, key_len, data_len, mode_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, mode_len, iv_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len,
&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
@@ -1320,7 +1320,7 @@ PHP_FUNCTION(mcrypt_encrypt)
PHP_FUNCTION(mcrypt_decrypt)
{
char *cipher, *key, *data, *mode, *iv = NULL;
- int cipher_len, key_len, data_len, mode_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, mode_len, iv_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len,
&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
@@ -1337,13 +1337,13 @@ PHP_FUNCTION(mcrypt_ecb)
{
zval *mode;
char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, iv_len = 0;
MCRYPT_GET_CRYPT_ARGS
- convert_to_int_ex(mode);
+ convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1353,13 +1353,13 @@ PHP_FUNCTION(mcrypt_cbc)
{
zval *mode;
char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, iv_len = 0;
MCRYPT_GET_CRYPT_ARGS
- convert_to_int_ex(mode);
+ convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1369,13 +1369,13 @@ PHP_FUNCTION(mcrypt_cfb)
{
zval *mode;
char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, iv_len = 0;
MCRYPT_GET_CRYPT_ARGS
- convert_to_int_ex(mode);
+ convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1385,13 +1385,13 @@ PHP_FUNCTION(mcrypt_ofb)
{
zval *mode;
char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ size_t cipher_len, key_len, data_len, iv_len = 0;
MCRYPT_GET_CRYPT_ARGS
- convert_to_int_ex(mode);
+ convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1400,11 +1400,11 @@ PHP_FUNCTION(mcrypt_ofb)
PHP_FUNCTION(mcrypt_create_iv)
{
char *iv;
- php_int_t source = URANDOM;
- php_int_t size;
+ zend_long source = URANDOM;
+ zend_long size;
int n = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &size, &source) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) {
return;
}
diff --git a/ext/mcrypt/mcrypt.dsp b/ext/mcrypt/mcrypt.dsp
deleted file mode 100644
index a0a1f00f4c..0000000000
--- a/ext/mcrypt/mcrypt.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mcrypt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mcrypt - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak" CFG="mcrypt - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mcrypt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mcrypt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mcrypt - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /D HAVE_MCRYPT_GENERIC_DEINIT /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS"
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmcrypt.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mcrypt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mcrypt" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\TSRM\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mcrypt - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /D HAVE_MCRYPT_GENERIC_DEINIT /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"mssql-70"
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmcrypt.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mcrypt.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mcrypt\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mcrypt - Win32 Release_TS"
-# Name "mcrypt - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mcrypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mcrypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mcrypt/mcrypt_filter.c b/ext/mcrypt/mcrypt_filter.c
index c0b89300a9..26f3dceba7 100644
--- a/ext/mcrypt/mcrypt_filter.c
+++ b/ext/mcrypt/mcrypt_filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -201,7 +201,7 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) &&
Z_TYPE_P(tmpzval) == IS_STRING) {
key = Z_STRVAL_P(tmpzval);
- key_len = Z_STRSIZE_P(tmpzval);
+ key_len = Z_STRLEN_P(tmpzval);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string");
return NULL;
@@ -226,11 +226,11 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval
}
iv = emalloc(iv_len + 1);
- if (iv_len <= Z_STRSIZE_P(tmpzval)) {
+ if (iv_len <= Z_STRLEN_P(tmpzval)) {
memcpy(iv, Z_STRVAL_P(tmpzval), iv_len);
} else {
- memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval));
- memset(iv + Z_STRSIZE_P(tmpzval), 0, iv_len - Z_STRSIZE_P(tmpzval));
+ memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
+ memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval));
}
result = mcrypt_generic_init(mcrypt_module, key, key_len, iv);
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
index 9dfa1d8185..994e1cbfa5 100644
--- a/ext/mcrypt/php_mcrypt.h
+++ b/ext/mcrypt/php_mcrypt.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mcrypt/php_mcrypt_filter.h b/ext/mcrypt/php_mcrypt_filter.h
index bfb0d7288f..cacac5ca46 100644
--- a/ext/mcrypt/php_mcrypt_filter.h
+++ b/ext/mcrypt/php_mcrypt_filter.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mssql/mssql.dsp b/ext/mssql/mssql.dsp
deleted file mode 100644
index 43294280dd..0000000000
--- a/ext/mssql/mssql.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mssql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mssql - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak" CFG="mssql - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mssql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mssql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mssql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql70.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mssql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql70.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib ntwdblib.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_mssql.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mssql - Win32 Release_TS"
-# Name "mssql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mssql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mssql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\mssql_win32_howto.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mssql/mssql_win32_howto.txt b/ext/mssql/mssql_win32_howto.txt
index d42bc2555b..735226f88a 100644
--- a/ext/mssql/mssql_win32_howto.txt
+++ b/ext/mssql/mssql_win32_howto.txt
@@ -12,7 +12,7 @@ Win32 Debug_TS
php_build\mssql-70\include\sqlfront.h
php_build\mssql-70\lib\ntwdblib.lib
-php_build is a directory at the same level as php5.
+php_build is a directory at the same level as php7.
Start Visual Studio, load php_modules.dsw, select the MSSQL projects,
configuration and build it.
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index 03dbeca61c..1ba77ca8c4 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -285,7 +285,7 @@ static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate
php_error_docref(NULL TSRMLS_CC, E_WARNING, "message: %s (severity %d)", msgtext, severity);
}
if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
+ zend_string_free(MS_SQL_G(server_message));
MS_SQL_G(server_message) = NULL;
}
MS_SQL_G(server_message) = estrdup(msgtext);
@@ -330,8 +330,8 @@ static void _free_result(mssql_result *result, int free_fields)
if (free_fields && result->fields) {
for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
+ zend_string_free(result->fields[i].name);
+ zend_string_free(result->fields[i].column_source);
}
efree(result->fields);
}
@@ -424,7 +424,7 @@ static PHP_GINIT_FUNCTION(mssql)
mssql_globals->num_persistent = 0;
mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
- if (cfg_get_int("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) {
+ if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) {
if (compatibility_mode) {
mssql_globals->get_column_content = php_mssql_get_column_content_without_type;
}
@@ -449,20 +449,20 @@ PHP_MINIT_FUNCTION(mssql)
}
/* BEGIN MSSQL data types for mssql_bind */
- REGISTER_INT_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT);
/* END MSSQL data types for mssql_bind */
return SUCCESS;
@@ -489,7 +489,7 @@ PHP_RINIT_FUNCTION(mssql)
{
MS_SQL_G(default_link) = -1;
MS_SQL_G(num_links) = MS_SQL_G(num_persistent);
- MS_SQL_G(appname) = estrndup("PHP 5", 5);
+ MS_SQL_G(appname) = estrndup("PHP 7", 5);
MS_SQL_G(server_message) = NULL;
MS_SQL_G(min_error_severity) = MS_SQL_G(cfg_min_error_severity);
MS_SQL_G(min_message_severity) = MS_SQL_G(cfg_min_message_severity);
@@ -507,10 +507,10 @@ PHP_RINIT_FUNCTION(mssql)
*/
PHP_RSHUTDOWN_FUNCTION(mssql)
{
- STR_FREE(MS_SQL_G(appname));
+ zend_string_free(MS_SQL_G(appname));
MS_SQL_G(appname) = NULL;
if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
+ zend_string_free(MS_SQL_G(server_message));
MS_SQL_G(server_message) = NULL;
}
return SUCCESS;
@@ -773,7 +773,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ptr = zend_list_find(link,&type); /* check if the link is still there */
if (ptr && (type==le_link || type==le_plink)) {
zend_list_addref(link);
- Z_IVAL_P(return_value) = link;
+ Z_LVAL_P(return_value) = link;
php_mssql_set_default_link(link TSRMLS_CC);
Z_TYPE_P(return_value) = IS_RESOURCE;
dbfreelogin(mssql.login);
@@ -828,7 +828,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link);
/* add it to the hash */
- new_index_ptr.ptr = (void *) Z_IVAL_P(return_value);
+ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
Z_TYPE(new_index_ptr) = le_index_ptr;
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry),NULL)==FAILURE) {
efree(hashed_details);
@@ -837,7 +837,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
MS_SQL_G(num_links)++;
}
efree(hashed_details);
- php_mssql_set_default_link(Z_IVAL_P(return_value) TSRMLS_CC);
+ php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC);
}
/* }}} */
@@ -944,7 +944,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
case SQLINT2:
case SQLINT4:
case SQLINTN: {
- ZVAL_INT(result, (long) anyintcol(offset));
+ ZVAL_LONG(result, (long) anyintcol(offset));
break;
}
case SQLCHAR:
@@ -1160,9 +1160,9 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
case SQLINT1:
case SQLINT2:
case SQLINT4:
- convert_to_int_ex(&bind->zval);
+ convert_to_long_ex(&bind->zval);
/* FIXME this works only on little endian machine !!! */
- Z_IVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i)));
+ Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i)));
break;
case SQLFLT4:
@@ -1179,8 +1179,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
case SQLVARCHAR:
case SQLTEXT:
convert_to_string_ex(&bind->zval);
- Z_STRSIZE_P(bind->zval) = dbretlen(mssql_ptr->link,i);
- Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRSIZE_P(bind->zval));
+ Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i);
+ Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval));
break;
/* TODO binary */
}
@@ -1195,8 +1195,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
if (statement->binds != NULL) { /* Maybe a non-parameter sp */
if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) {
if (dbhasretstat(mssql_ptr->link)) {
- convert_to_int_ex(&bind->zval);
- Z_IVAL_P(bind->zval)=dbretstatus(mssql_ptr->link);
+ convert_to_long_ex(&bind->zval);
+ Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link);
}
else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure has no return value. Nothing was returned into RETVAL");
@@ -1315,7 +1315,7 @@ PHP_FUNCTION(mssql_fetch_batch)
result->cur_row=result->num_rows=0;
result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC);
- RETURN_INT(result->num_rows);
+ RETURN_LONG(result->num_rows);
}
/* }}} */
@@ -1407,7 +1407,7 @@ PHP_FUNCTION(mssql_rows_affected)
ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, &mssql_link_index, -1, "MS SQL-Link", le_link, le_plink);
- RETURN_INT(DBCOUNT(mssql_ptr->link));
+ RETURN_LONG(DBCOUNT(mssql_ptr->link));
}
/* }}} */
@@ -1468,7 +1468,7 @@ PHP_FUNCTION(mssql_num_rows)
ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
- RETURN_INT(result->num_rows);
+ RETURN_LONG(result->num_rows);
}
/* }}} */
@@ -1485,7 +1485,7 @@ PHP_FUNCTION(mssql_num_fields)
ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
- RETURN_INT(result->num_fields);
+ RETURN_LONG(result->num_fields);
}
/* }}} */
@@ -1518,7 +1518,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result);
if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
+ zend_string_free(MS_SQL_G(server_message));
MS_SQL_G(server_message) = NULL;
}
@@ -1535,7 +1535,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
data = Z_STRVAL(result->data[result->cur_row][i]);
- data_len = Z_STRSIZE(result->data[result->cur_row][i]);
+ data_len = Z_STRLEN(result->data[result->cur_row][i]);
if (result_type & MSSQL_NUM) {
add_index_stringl(return_value, i, data, data_len);
@@ -1545,12 +1545,12 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
add_assoc_stringl(return_value, result->fields[i].name, data, data_len);
}
}
- else if (Z_TYPE(result->data[result->cur_row][i]) == IS_INT) {
+ else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
if (result_type & MSSQL_NUM)
- add_index_int(return_value, i, Z_IVAL(result->data[result->cur_row][i]));
+ add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i]));
if (result_type & MSSQL_ASSOC)
- add_assoc_int(return_value, result->fields[i].name, Z_IVAL(result->data[result->cur_row][i]));
+ add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i]));
}
else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) {
if (result_type & MSSQL_NUM)
@@ -1719,9 +1719,9 @@ PHP_FUNCTION(mssql_fetch_field)
object_init(return_value);
add_property_string(return_value, "name",result->fields[field_offset].name);
- add_property_int(return_value, "max_length",result->fields[field_offset].max_length);
+ add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
add_property_string(return_value, "column_source",result->fields[field_offset].column_source);
- add_property_int(return_value, "numeric", result->fields[field_offset].numeric);
+ add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])));
}
/* }}} */
@@ -1752,7 +1752,7 @@ PHP_FUNCTION(mssql_field_length)
RETURN_FALSE;
}
- RETURN_INT(result->fields[field_offset].max_length);
+ RETURN_LONG(result->fields[field_offset].max_length);
}
/* }}} */
@@ -1877,8 +1877,8 @@ PHP_FUNCTION(mssql_result)
break;
}
default:
- convert_to_int_ex(field);
- field_offset = Z_IVAL_PP(field);
+ convert_to_long_ex(field);
+ field_offset = Z_LVAL_PP(field);
if (field_offset<0 || field_offset>=result->num_fields) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
@@ -2043,7 +2043,7 @@ PHP_FUNCTION(mssql_bind)
datalen=0;
} else {
convert_to_string_ex(var);
- datalen=Z_STRSIZE_PP(var);
+ datalen=Z_STRLEN_PP(var);
value=(LPBYTE)Z_STRVAL_PP(var);
}
} else {
@@ -2067,8 +2067,8 @@ PHP_FUNCTION(mssql_bind)
case SQLINT1:
case SQLINT2:
case SQLINT4:
- convert_to_int_ex(var);
- value=(LPBYTE)(&Z_IVAL_PP(var));
+ convert_to_long_ex(var);
+ value=(LPBYTE)(&Z_LVAL_PP(var));
break;
default:
diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h
index 5b2456e9bd..b0313a160a 100644
--- a/ext/mssql/php_mssql.h
+++ b/ext/mssql/php_mssql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysql/mysql.dsp b/ext/mysql/mysql.dsp
deleted file mode 100644
index dfc9c63db5..0000000000
--- a/ext/mysql/mysql.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mysql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak" CFG="mysql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5nts.lib /nologo /dll /machine:I386 /out:"Release/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysql - Win32 Release"
-# Name "mysql - Win32 Debug"
-# Name "mysql - Win32 Debug_TS"
-# Name "mysql - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mysql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mysql/mysql_mysqlnd.h b/ext/mysql/mysql_mysqlnd.h
index 0c4c221b15..29ac9838f2 100644
--- a/ext/mysql/mysql_mysqlnd.h
+++ b/ext/mysql/mysql_mysqlnd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2009 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index b0596c396a..fc1dac5da7 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -80,7 +80,7 @@ static int le_result, le_link, le_plink;
#define SAFE_STRING(s) ((s)?(s):"")
#if MYSQL_VERSION_ID > 32199 || defined(MYSQL_USE_MYSQLND)
-# define mysql_row_length_type php_uint_t
+# define mysql_row_length_type zend_ulong
# define HAVE_MYSQL_ERRNO
#else
# define mysql_row_length_type unsigned int
@@ -485,7 +485,7 @@ static void _close_mysql_plink(zend_resource *rsrc TSRMLS_DC)
static PHP_INI_MH(OnMySQLPort)
{
if (new_value != NULL) { /* default port */
- MySG(default_port) = atoi(new_value);
+ MySG(default_port) = atoi(new_value->val);
} else {
MySG(default_port) = -1;
}
@@ -568,15 +568,15 @@ ZEND_MODULE_STARTUP_D(mysql)
le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number);
mysql_module_entry.type = type;
- REGISTER_INT_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID >= 40000
- REGISTER_INT_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
#ifndef MYSQL_USE_MYSQLND
#if MYSQL_VERSION_ID >= 40000
@@ -662,7 +662,7 @@ PHP_RSHUTDOWN_FUNCTION(mysql)
if (MySG(trace_mode)) {
if (MySG(result_allocated)){
- php_error_docref("function.mysql-free-result" TSRMLS_CC, E_WARNING, "%lu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated));
+ php_error_docref("function.mysql-free-result" TSRMLS_CC, E_WARNING, "%pu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated));
}
}
@@ -686,9 +686,9 @@ PHP_MINFO_FUNCTION(mysql)
php_info_print_table_start();
php_info_print_table_header(2, "MySQL Support", "enabled");
- snprintf(buf, sizeof(buf), "%ld", MySG(num_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
- snprintf(buf, sizeof(buf), "%ld", MySG(num_links));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_row(2, "Client API version", mysql_get_client_info());
#if !defined (PHP_WIN32) && !defined (NETWARE) && !defined(MYSQL_USE_MYSQLND)
@@ -725,14 +725,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *user = NULL, *passwd = NULL;
char *host_and_port = NULL, *socket = NULL;
char *tmp = NULL, *host = NULL;
- int user_len = 0, passwd_len = 0, host_len = 0;
+ size_t user_len = 0, passwd_len = 0, host_len = 0;
int port = MYSQL_PORT;
- php_int_t client_flags = 0;
+ zend_long client_flags = 0;
php_mysql_conn *mysql = NULL;
#if MYSQL_VERSION_ID <= 32230
void (*handler) (int);
#endif
- php_int_t connect_timeout;
+ zend_long connect_timeout;
zend_string *hashed_details = NULL;
zend_bool free_host = 0, new_link = 0;
@@ -774,19 +774,19 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
}
user = php_get_current_user(TSRMLS_C);
- hashed_details = STR_ALLOC(sizeof("mysql___") + strlen(user) - 1, 0);
+ hashed_details = zend_string_alloc(sizeof("mysql___") + strlen(user) - 1, 0);
snprintf(hashed_details->val, hashed_details->len + 1, "mysql__%s_", user);
client_flags = CLIENT_INTERACTIVE;
} else {
/* mysql_pconnect does not support new_link parameter */
if (persistent) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!i", &host_and_port, &host_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len,
&user, &user_len, &passwd, &passwd_len,
&client_flags)==FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bi", &host_and_port, &host_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len,
&user, &user_len, &passwd, &passwd_len,
&new_link, &client_flags)==FAILURE) {
return;
@@ -819,9 +819,9 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#ifdef CLIENT_MULTI_STATEMENTS
client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */
#endif
- hashed_details = STR_ALLOC(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0)
- + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_ZEND_INT - 1, 0);
- hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
+ hashed_details = zend_string_alloc(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0)
+ + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0);
+ hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_" ZEND_LONG_FMT, SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
}
/* We cannot use mysql_port anymore in windows, need to use
@@ -862,14 +862,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
zval new_le;
if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MySG(num_links));
- STR_RELEASE(hashed_details);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", MySG(num_links));
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
if (MySG(max_persistent) != -1 && MySG(num_persistent) >= MySG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)", MySG(num_persistent));
- STR_RELEASE(hashed_details);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%pd)", MySG(num_persistent));
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
/* create the link */
@@ -911,7 +911,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
MySG(connect_errno) = mysql_errno(mysql->conn);
#endif
free(mysql);
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
@@ -920,14 +920,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ZVAL_NEW_PERSISTENT_RES(&new_le, -1, mysql, le_plink);
/* avoid bogus memleak report */
- phashed = STR_INIT(hashed_details->val, hashed_details->len, 1);
+ phashed = zend_string_init(hashed_details->val, hashed_details->len, 1);
if (zend_hash_update(&EG(persistent_list), phashed, &new_le) == NULL) {
- STR_RELEASE(phashed);
+ zend_string_release(phashed);
free(mysql);
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
- STR_RELEASE(phashed);
+ zend_string_release(phashed);
MySG(num_persistent)++;
MySG(num_links)++;
} else { /* The link is in our list of persistent connections */
@@ -955,7 +955,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect");
zend_hash_del(&EG(persistent_list), hashed_details);
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
@@ -988,7 +988,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
GC_REFCOUNT(link)++;
ZVAL_RES(return_value, link);
php_mysql_set_default_link(link TSRMLS_CC);
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_CLEANUP();
return;
} else {
@@ -997,8 +997,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MySG(num_links));
- STR_RELEASE(hashed_details);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", MySG(num_links));
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
@@ -1016,7 +1016,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (!mysql->conn) {
MySG(connect_error) = estrdup("OOM");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OOM");
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
efree(mysql);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
@@ -1044,7 +1044,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#ifdef MYSQL_USE_MYSQLND
mysqlnd_close(mysql->conn, MYSQLND_CLOSE_DISCONNECTED);
#endif
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
efree(mysql);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
@@ -1057,14 +1057,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ZVAL_NEW_RES(&new_index_ptr, -1, Z_RES_P(return_value), le_index_ptr);
if (zend_hash_update(&EG(regular_list), hashed_details, &new_index_ptr) == NULL) {
zval_ptr_dtor(return_value);
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
Z_ADDREF_P(return_value);
MySG(num_links)++;
}
- STR_RELEASE(hashed_details);
+ zend_string_release(hashed_details);
php_mysql_set_default_link(Z_RES_P(return_value) TSRMLS_CC);
MYSQL_DO_CONNECT_CLEANUP();
}
@@ -1145,7 +1145,7 @@ PHP_FUNCTION(mysql_close)
PHP_FUNCTION(mysql_select_db)
{
char *db;
- int db_len;
+ size_t db_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1225,7 +1225,7 @@ PHP_FUNCTION(mysql_get_proto_info)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink);
}
- RETURN_INT(mysql_get_proto_info(mysql->conn));
+ RETURN_LONG(mysql_get_proto_info(mysql->conn));
}
/* }}} */
@@ -1299,7 +1299,7 @@ PHP_FUNCTION(mysql_thread_id)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink);
}
- RETURN_INT((long) mysql_thread_id(mysql->conn));
+ RETURN_LONG((zend_long) mysql_thread_id(mysql->conn));
}
/* }}} */
@@ -1372,7 +1372,7 @@ PHP_FUNCTION(mysql_client_encoding)
PHP_FUNCTION(mysql_set_charset)
{
char *csname;
- int csname_len;
+ size_t csname_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1404,7 +1404,7 @@ PHP_FUNCTION(mysql_set_charset)
PHP_FUNCTION(mysql_create_db)
{
char *db;
- int db_len;
+ size_t db_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1435,7 +1435,7 @@ PHP_FUNCTION(mysql_create_db)
PHP_FUNCTION(mysql_drop_db)
{
char *db;
- int db_len;
+ size_t db_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1555,7 +1555,7 @@ static void php_mysql_do_query_general(php_mysql_conn *mysql, char *query, int q
static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store)
{
char *query;
- int query_len;
+ size_t query_len;
zval *mysql_link = NULL;
php_mysql_conn *mysql;
@@ -1596,7 +1596,7 @@ PHP_FUNCTION(mysql_unbuffered_query)
PHP_FUNCTION(mysql_db_query)
{
char *db, *query;
- int db_len, query_len;
+ size_t db_len, query_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1657,7 +1657,7 @@ PHP_FUNCTION(mysql_list_dbs)
PHP_FUNCTION(mysql_list_tables)
{
char *db;
- int db_len;
+ size_t db_len;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
MYSQL_RES *mysql_result;
@@ -1694,7 +1694,7 @@ PHP_FUNCTION(mysql_list_tables)
PHP_FUNCTION(mysql_list_fields)
{
char *db, *table;
- int db_len, table_len;
+ size_t db_len, table_len;
zval *mysql_link = NULL;
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
@@ -1802,7 +1802,7 @@ PHP_FUNCTION(mysql_errno)
if (!mysql_link) {
if (MySG(default_link) == NULL) {
if (MySG(connect_error) != NULL){
- RETURN_INT(MySG(connect_errno));
+ RETURN_LONG(MySG(connect_errno));
} else {
RETURN_FALSE;
}
@@ -1812,7 +1812,7 @@ PHP_FUNCTION(mysql_errno)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink);
}
- RETURN_INT(mysql_errno(mysql->conn));
+ RETURN_LONG(mysql_errno(mysql->conn));
}
#endif
/* }}} */
@@ -1837,7 +1837,7 @@ PHP_FUNCTION(mysql_affected_rows)
}
/* conversion from int64 to long happing here */
- RETURN_INT((long)mysql_affected_rows(mysql->conn));
+ RETURN_LONG((zend_long)mysql_affected_rows(mysql->conn));
}
/* }}} */
@@ -1846,7 +1846,7 @@ PHP_FUNCTION(mysql_affected_rows)
PHP_FUNCTION(mysql_escape_string)
{
char *str;
- int str_len;
+ size_t str_len;
zend_string *escaped_str;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
@@ -1857,7 +1857,7 @@ PHP_FUNCTION(mysql_escape_string)
* we don't realloc() down to the real size since it'd most probably not
* be worth it
*/
- escaped_str = STR_ALLOC(str_len * 2, 0);
+ escaped_str = zend_string_alloc(str_len * 2, 0);
escaped_str->len = mysql_escape_string(escaped_str->val, str, str_len);
php_error_docref("function.mysql-real-escape-string" TSRMLS_CC, E_DEPRECATED, "This function is deprecated; use mysql_real_escape_string() instead.");
@@ -1870,7 +1870,7 @@ PHP_FUNCTION(mysql_escape_string)
PHP_FUNCTION(mysql_real_escape_string)
{
char *str;
- int str_len;
+ size_t str_len;
zend_string *new_str;
php_mysql_conn *mysql;
zval *mysql_link = NULL;
@@ -1891,7 +1891,7 @@ PHP_FUNCTION(mysql_real_escape_string)
* we don't realloc() down to the real size since it'd most probably not
* be worth it
*/
- new_str = STR_ALLOC(str_len * 2, 0);
+ new_str = zend_string_alloc(str_len * 2, 0);
new_str->len = mysql_real_escape_string(mysql->conn, new_str->val, str, str_len);
RETURN_NEW_STR(new_str);
@@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_insert_id)
}
/* conversion from int64 to long happing here */
- RETURN_INT((long)mysql_insert_id(mysql->conn));
+ RETURN_LONG((zend_long)mysql_insert_id(mysql->conn));
}
/* }}} */
@@ -1927,7 +1927,7 @@ PHP_FUNCTION(mysql_insert_id)
PHP_FUNCTION(mysql_result)
{
zval *result, *field=NULL;
- php_int_t row;
+ zend_long row;
MYSQL_RES *mysql_result;
#ifndef MYSQL_USE_MYSQLND
MYSQL_ROW sql_row;
@@ -1940,14 +1940,14 @@ johannes TODO:
Do 2 zend_parse_parameters calls instead of type "z" and switch below
Q: String or long first?
*/
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z", &result, &row, &field) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
if (row < 0 || row >= (int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on MySQL result index %ld", row, Z_RES_P(result)->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on MySQL result index %pd", row, Z_RES_P(result)->handle);
RETURN_FALSE;
}
mysql_data_seek(mysql_result, row);
@@ -1964,7 +1964,7 @@ Q: String or long first?
field_name = estrdup(tmp + 1);
} else {
table_name = NULL;
- field_name = estrndup(Z_STRVAL_P(field),Z_STRSIZE_P(field));
+ field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field));
}
mysql_field_seek(mysql_result, 0);
while ((tmp_field = mysql_fetch_field(mysql_result))) {
@@ -1977,7 +1977,7 @@ Q: String or long first?
i++;
}
if (!tmp_field) { /* no match found */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s%s%s not found in MySQL result index %ld",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s%s%s not found in MySQL result index %pd",
(table_name?table_name:""), (table_name?".":""), field_name, Z_RES_P(result)->handle);
efree(field_name);
if (table_name) {
@@ -1992,8 +1992,8 @@ Q: String or long first?
}
break;
default:
- convert_to_int_ex(field);
- field_offset = Z_IVAL_P(field);
+ convert_to_long_ex(field);
+ field_offset = Z_LVAL_P(field);
if (field_offset < 0 || field_offset >= (int)mysql_num_fields(mysql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
@@ -2040,7 +2040,7 @@ PHP_FUNCTION(mysql_num_rows)
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
/* conversion from int64 to long happing here */
- RETURN_INT((long) mysql_num_rows(mysql_result));
+ RETURN_LONG((zend_long) mysql_num_rows(mysql_result));
}
/* }}} */
@@ -2057,13 +2057,13 @@ PHP_FUNCTION(mysql_num_fields)
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
- RETURN_INT(mysql_num_fields(mysql_result));
+ RETURN_LONG(mysql_num_fields(mysql_result));
}
/* }}} */
/* {{{ php_mysql_fetch_hash
*/
-static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int expected_args, int into_object)
+static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int expected_args, int into_object)
{
MYSQL_RES *mysql_result;
zval *res, *ctor_params = NULL;
@@ -2096,7 +2096,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &res, &result_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &result_type) == FAILURE) {
return;
}
if (!result_type) {
@@ -2271,17 +2271,17 @@ PHP_FUNCTION(mysql_fetch_assoc)
PHP_FUNCTION(mysql_data_seek)
{
zval *result;
- php_int_t offset;
+ zend_long offset;
MYSQL_RES *mysql_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset)) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset)) {
return;
}
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
if (offset < 0 || offset >= (int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset %ld is invalid for MySQL result index %ld (or the query data is unbuffered)", offset, Z_RES_P(result)->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset %pd is invalid for MySQL result index %pd (or the query data is unbuffered)", offset, Z_RES_P(result)->handle);
RETURN_FALSE;
}
mysql_data_seek(mysql_result, offset);
@@ -2312,7 +2312,7 @@ PHP_FUNCTION(mysql_fetch_lengths)
num_fields = mysql_num_fields(mysql_result);
for (i=0; i<num_fields; i++) {
- add_index_int(return_value, i, lengths[i]);
+ add_index_long(return_value, i, lengths[i]);
}
}
/* }}} */
@@ -2398,11 +2398,11 @@ static char *php_mysql_get_field_name(int field_type)
PHP_FUNCTION(mysql_fetch_field)
{
zval *result;
- php_int_t field=0;
+ zend_long field=0;
MYSQL_RES *mysql_result;
const MYSQL_FIELD *mysql_field;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &field) == FAILURE) {
return;
}
@@ -2421,22 +2421,22 @@ PHP_FUNCTION(mysql_fetch_field)
object_init(return_value);
#if MYSQL_USE_MYSQLND
- add_property_str(return_value, "name", STR_COPY(mysql_field->sname));
+ add_property_str(return_value, "name", zend_string_copy(mysql_field->sname));
#else
add_property_stringl(return_value, "name", (mysql_field->name?mysql_field->name:""), mysql_field->name_length);
#endif
add_property_stringl(return_value, "table", (mysql_field->table?mysql_field->table:""), mysql_field->table_length);
add_property_stringl(return_value, "def", (mysql_field->def?mysql_field->def:""), mysql_field->def_length);
- add_property_int(return_value, "max_length", mysql_field->max_length);
- add_property_int(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
- add_property_int(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
- add_property_int(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
- add_property_int(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
- add_property_int(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
- add_property_int(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
+ add_property_long(return_value, "max_length", mysql_field->max_length);
+ add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
+ add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
+ add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
+ add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
+ add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
+ add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type));
- add_property_int(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0));
- add_property_int(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0));
+ add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0));
+ add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0));
}
/* }}} */
@@ -2445,16 +2445,16 @@ PHP_FUNCTION(mysql_fetch_field)
PHP_FUNCTION(mysql_field_seek)
{
zval *result;
- php_int_t offset;
+ zend_long offset;
MYSQL_RES *mysql_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
if (offset < 0 || offset >= (int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is invalid for MySQL result index %ld", offset, Z_RES_P(result)->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %pd is invalid for MySQL result index %pd", offset, Z_RES_P(result)->handle);
RETURN_FALSE;
}
mysql_field_seek(mysql_result, offset);
@@ -2473,20 +2473,20 @@ PHP_FUNCTION(mysql_field_seek)
static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
- php_int_t field;
+ zend_long field;
MYSQL_RES *mysql_result;
const MYSQL_FIELD *mysql_field = {0};
char buf[512];
int len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
if (field < 0 || field >= (int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is invalid for MySQL result index %ld", field, Z_RES_P(result)->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %pd is invalid for MySQL result index %pd", field, Z_RES_P(result)->handle);
RETURN_FALSE;
}
mysql_field_seek(mysql_result, field);
@@ -2497,7 +2497,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch (entry_type) {
case PHP_MYSQL_FIELD_NAME:
#ifdef MYSQL_USE_MYSQLND
- RETVAL_STR(STR_COPY(mysql_field->sname));
+ RETVAL_STR(zend_string_copy(mysql_field->sname));
#else
RETVAL_STRING(mysql_field->name);
#endif
@@ -2506,7 +2506,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
RETVAL_STRING(mysql_field->table);
break;
case PHP_MYSQL_FIELD_LEN:
- RETVAL_INT(mysql_field->length);
+ RETVAL_LONG(mysql_field->length);
break;
case PHP_MYSQL_FIELD_TYPE:
RETVAL_STRING(php_mysql_get_field_name(mysql_field->type));
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
index 0368140580..279aec001d 100644
--- a/ext/mysql/php_mysql.h
+++ b/ext/mysql/php_mysql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h
index 0f4dbec110..8eb9aa1d29 100644
--- a/ext/mysql/php_mysql_structs.h
+++ b/ext/mysql/php_mysql_structs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -112,18 +112,18 @@ PHP_FUNCTION(mysql_set_charset);
ZEND_BEGIN_MODULE_GLOBALS(mysql)
zend_resource *default_link;
- php_int_t num_links,num_persistent;
- php_int_t max_links,max_persistent;
- php_int_t allow_persistent;
- php_int_t default_port;
+ zend_long num_links,num_persistent;
+ zend_long max_links,max_persistent;
+ zend_long allow_persistent;
+ zend_long default_port;
char *default_host, *default_user, *default_password;
char *default_socket;
char *connect_error;
- php_int_t connect_errno;
- php_int_t connect_timeout;
- php_int_t result_allocated;
- php_int_t trace_mode;
- php_int_t allow_local_infile;
+ zend_long connect_errno;
+ zend_long connect_timeout;
+ zend_long result_allocated;
+ zend_long trace_mode;
+ zend_long allow_local_infile;
ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 79d340b2a6..878c8fb946 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -185,7 +185,7 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC)
/* {{{ php_clear_mysql */
void php_clear_mysql(MY_MYSQL *mysql) {
if (mysql->hash_key) {
- STR_RELEASE(mysql->hash_key);
+ zend_string_release(mysql->hash_key);
mysql->hash_key = NULL;
}
if (!Z_ISUNDEF(mysql->li_read)) {
@@ -375,11 +375,11 @@ void mysqli_write_property(zval *object, zval *member, zval *value, void **cache
void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysqli_read_t r_func, mysqli_write_t w_func TSRMLS_DC) {
mysqli_prop_handler p;
- p.name = STR_INIT(pname, pname_len, 1);
+ p.name = zend_string_init(pname, pname_len, 1);
p.read_func = (r_func) ? r_func : mysqli_read_na;
p.write_func = (w_func) ? w_func : mysqli_write_na;
zend_hash_add_mem(h, p.name, &p, sizeof(mysqli_prop_handler));
- STR_RELEASE(p.name);
+ zend_string_release(p.name);
}
/* }}} */
@@ -612,7 +612,7 @@ PHP_MINIT_FUNCTION(mysqli)
mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
#endif
mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
- zend_declare_property_int(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED TSRMLS_CC);
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, mysqli_driver_methods);
@@ -694,179 +694,179 @@ PHP_MINIT_FUNCTION(mysqli)
zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties);
/* mysqli_options */
- REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT);
#if defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
- REGISTER_INT_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT);
#endif
/* mysqli_real_connect flags */
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT);
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT);
#endif
/* for mysqli_query */
- REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT);
#if defined (MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT);
#endif
/* for mysqli_fetch_assoc */
- REGISTER_INT_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT);
/* for mysqli_stmt_set_attr */
- REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT);
#endif
#if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT);
#endif
/* column information */
- REGISTER_INT_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
#endif
#if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT);
#if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND)
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT);
/* bind support */
- REGISTER_INT_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT);
#ifdef MYSQL_DATA_TRUNCATED
- REGISTER_INT_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT);
#endif
/* reporting */
- REGISTER_INT_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT);
/* We use non-nested macros with expansion, as VC has problems */
#ifdef MYSQLI_USE_MYSQLND
- REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT);
#else
#ifdef DBUG_ON
- REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT);
#else
- REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT);
#endif
#endif
- REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT);
#ifdef SERVER_QUERY_WAS_SLOW
- REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SERVER_PS_OUT_PARAMS
- REGISTER_INT_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT);
#ifdef REFRESH_BACKUP_LOG
- REGISTER_INT_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT);
#ifdef MYSQLI_USE_MYSQLND
@@ -884,7 +884,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
#ifndef MYSQLI_USE_MYSQLND
#if MYSQL_VERSION_ID >= 40000
#ifdef PHP_WIN32
- php_uint_t client_ver = mysql_get_client_version();
+ zend_ulong client_ver = mysql_get_client_version();
/*
Can't call mysql_server_end() multiple times prior to 5.0.46 on Windows.
PHP bug#41350 MySQL bug#25621
@@ -976,11 +976,11 @@ PHP_MINFO_FUNCTION(mysqli)
php_info_print_table_start();
php_info_print_table_header(2, "MysqlI Support", "enabled");
php_info_print_table_row(2, "Client API library version", mysql_get_client_info());
- snprintf(buf, sizeof(buf), "%ld", MyG(num_active_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_active_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
- snprintf(buf, sizeof(buf), "%ld", MyG(num_inactive_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_inactive_persistent));
php_info_print_table_row(2, "Inactive Persistent Links", buf);
- snprintf(buf, sizeof(buf), "%ld", MyG(num_links));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_links));
php_info_print_table_row(2, "Active Links", buf);
#if !defined(MYSQLI_USE_MYSQLND)
php_info_print_table_row(2, "Client API header version", MYSQL_SERVER_VERSION);
@@ -1047,7 +1047,7 @@ PHP_FUNCTION(mysqli_stmt_construct)
MY_STMT *stmt;
MYSQLI_RESOURCE *mysqli_resource;
char *statement;
- int statement_len;
+ size_t statement_len;
switch (ZEND_NUM_ARGS())
{
@@ -1105,7 +1105,7 @@ PHP_FUNCTION(mysqli_result_construct)
MYSQL_RES *result = NULL;
zval *mysql_link;
MYSQLI_RESOURCE *mysqli_resource;
- php_int_t resmode = MYSQLI_STORE_RESULT;
+ zend_long resmode = MYSQLI_STORE_RESULT;
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -1114,7 +1114,7 @@ PHP_FUNCTION(mysqli_result_construct)
}
break;
case 2:
- if (zend_parse_parameters(2 TSRMLS_CC, "Oi", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
+ if (zend_parse_parameters(2 TSRMLS_CC, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
return;
}
break;
@@ -1149,13 +1149,13 @@ PHP_FUNCTION(mysqli_result_construct)
/* {{{ php_mysqli_fetch_into_hash_aux
*/
-void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC)
+void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype TSRMLS_DC)
{
#if !defined(MYSQLI_USE_MYSQLND)
MYSQL_ROW row;
unsigned int i;
MYSQL_FIELD *fields;
- php_uint_t *field_len;
+ zend_ulong *field_len;
if (!(row = mysql_fetch_row(result))) {
RETURN_NULL();
@@ -1238,7 +1238,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
{
MYSQL_RES *result;
zval *mysql_result;
- php_int_t fetchtype;
+ zend_long fetchtype;
zval *ctor_params = NULL;
zend_class_entry *ce = NULL;
@@ -1266,7 +1266,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
fetchtype = override_flags;
} else {
fetchtype = MYSQLI_BOTH;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
return;
}
}
diff --git a/ext/mysqli/mysqli.dsp b/ext/mysqli/mysqli.dsp
deleted file mode 100755
index a334202187..0000000000
--- a/ext/mysqli/mysqli.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mysqli" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysqli - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysqli.mak" CFG="mysqli - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysqli - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysqli - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysqli - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mysqli.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "mysqli - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQLI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\mysqli" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MYSQLI" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_MYSQLI_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib zlib.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mysqli.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysqli - Win32 Release_TS"
-# Name "mysqli - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mysqli.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_api.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_fe.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqli_nonapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysqli.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index d2567ae1b4..69799729b7 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,14 +30,14 @@
#include "php_ini.h"
#include "php_globals.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_mysqli_structs.h"
#include "mysqli_priv.h"
#if !defined(MYSQLI_USE_MYSQLND)
/* {{{ mysqli_tx_cor_options_to_string */
-static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned int mode)
+static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const uint32_t mode)
{
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
if (str->s && str->s->len) {
@@ -108,7 +108,7 @@ mysqli_escape_string_for_tx_name_in_comment(const char * const name TSRMLS_DC)
/* }}} */
/* {{{ mysqli_commit_or_rollback_libmysql */
-static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const unsigned int mode, const char * const name TSRMLS_DC)
+static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const uint32_t mode, const char * const name TSRMLS_DC)
{
int ret;
smart_str tmp_str = {0};
@@ -152,9 +152,9 @@ PHP_FUNCTION(mysqli_affected_rows)
rc = mysql_affected_rows(mysql->mysql);
if (rc == (my_ulonglong) -1) {
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
- MYSQLI_RETURN_INT_INT(rc);
+ MYSQLI_RETURN_LONG_INT(rc);
}
/* }}} */
@@ -213,12 +213,12 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
break;
case 'i': /* Integer */
-#if SIZEOF_ZEND_INT==8
+#if SIZEOF_ZEND_LONG==8
bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
-#elif SIZEOF_ZEND_INT==4
+#elif SIZEOF_ZEND_LONG==4
bind[ofs].buffer_type = MYSQL_TYPE_LONG;
#endif
- bind[ofs].buffer = &Z_IVAL_P(param);
+ bind[ofs].buffer = &Z_LVAL_P(param);
bind[ofs].is_null = &stmt->param.is_null[ofs];
break;
@@ -284,9 +284,9 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
type = MYSQL_TYPE_DOUBLE;
break;
case 'i': /* Integer */
-#if SIZEOF_ZEND_INT==8
+#if SIZEOF_ZEND_LONG==8
type = MYSQL_TYPE_LONGLONG;
-#elif SIZEOF_ZEND_INT==4
+#elif SIZEOF_ZEND_LONG==4
type = MYSQL_TYPE_LONG;
#endif
break;
@@ -325,8 +325,8 @@ PHP_FUNCTION(mysqli_stmt_bind_param)
MY_STMT *stmt;
zval *mysql_stmt;
char *types;
- int types_len;
- php_uint_t rc;
+ size_t types_len;
+ zend_ulong rc;
/* calculate and check number of parameters */
if (argc < 2) {
@@ -391,8 +391,8 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
MYSQL_BIND *bind;
int i, ofs;
int var_cnt = argc - start;
- php_int_t col_type;
- php_uint_t rc;
+ zend_long col_type;
+ zend_ulong rc;
/* prevent leak if variables are already bound */
if (stmt->result.var_cnt) {
@@ -443,7 +443,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_YEAR:
- stmt->result.buf[ofs].type = IS_INT;
+ stmt->result.buf[ofs].type = IS_LONG;
/* don't set stmt->result.buf[ofs].buflen to 0, we used ecalloc */
stmt->result.buf[ofs].val = (char *)emalloc(sizeof(int));
bind[ofs].buffer_type = MYSQL_TYPE_LONG;
@@ -488,7 +488,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
my_bool tmp;
#else
- php_uint_t tmp = 0;
+ zend_ulong tmp = 0;
#endif
stmt->result.buf[ofs].type = IS_STRING;
/*
@@ -578,7 +578,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
zval *args;
int argc = ZEND_NUM_ARGS();
int start = 1;
- php_uint_t rc;
+ zend_ulong rc;
MY_STMT *stmt;
zval *mysql_stmt;
@@ -623,8 +623,8 @@ PHP_FUNCTION(mysqli_change_user)
MY_MYSQL *mysql;
zval *mysql_link = NULL;
char *user, *password, *dbname;
- int user_len, password_len, dbname_len;
- php_uint_t rc;
+ size_t user_len, password_len, dbname_len;
+ zend_ulong rc;
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
const CHARSET_INFO * old_charset;
#endif
@@ -752,11 +752,11 @@ PHP_FUNCTION(mysqli_commit)
{
MY_MYSQL *mysql;
zval *mysql_link;
- php_int_t flags = TRANS_COR_NO_OPT;
+ zend_long flags = TRANS_COR_NO_OPT;
char * name = NULL;
- int name_len = 0;
+ size_t name_len = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -778,9 +778,9 @@ PHP_FUNCTION(mysqli_data_seek)
{
MYSQL_RES *result;
zval *mysql_result;
- php_int_t offset;
+ zend_long offset;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
}
@@ -791,7 +791,7 @@ PHP_FUNCTION(mysqli_data_seek)
RETURN_FALSE;
}
- if (offset < 0 || offset >= mysql_num_rows(result)) {
+ if (offset < 0 || (uint64_t)offset >= mysql_num_rows(result)) {
RETURN_FALSE;
}
@@ -805,7 +805,7 @@ PHP_FUNCTION(mysqli_data_seek)
PHP_FUNCTION(mysqli_debug)
{
char *debug;
- int debug_len;
+ size_t debug_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &debug, &debug_len) == FAILURE) {
return;
@@ -843,7 +843,7 @@ PHP_FUNCTION(mysqli_errno)
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_errno(mysql->mysql));
+ RETURN_LONG(mysql_errno(mysql->mysql));
}
/* }}} */
@@ -911,7 +911,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
case MYSQL_TYPE_VAR_STRING:
convert_to_string_ex(param);
stmt->stmt->params[i].buffer = Z_STRVAL_P(param);
- stmt->stmt->params[i].buffer_length = Z_STRSIZE_P(param);
+ stmt->stmt->params[i].buffer_length = Z_STRLEN_P(param);
break;
case MYSQL_TYPE_DOUBLE:
convert_to_double_ex(param);
@@ -919,8 +919,8 @@ PHP_FUNCTION(mysqli_stmt_execute)
break;
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_LONG:
- convert_to_int_ex(param);
- stmt->stmt->params[i].buffer = &Z_IVAL_P(param);
+ convert_to_long_ex(param);
+ stmt->stmt->params[i].buffer = &Z_LVAL_P(param);
break;
default:
break;
@@ -951,7 +951,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
MY_STMT *stmt;
zval *mysql_stmt;
unsigned int i;
- php_uint_t ret;
+ zend_ulong ret;
unsigned int uval;
my_ulonglong llval;
@@ -990,13 +990,13 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
zval_ptr_dtor(result);
if (!stmt->result.is_null[i]) {
switch (stmt->result.buf[i].type) {
- case IS_INT:
+ case IS_LONG:
if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG)
&& (stmt->stmt->fields[i].flags & UNSIGNED_FLAG))
{
/* unsigned int (11) */
uval= *(unsigned int *) stmt->result.buf[i].val;
-#if SIZEOF_ZEND_INT==4
+#if SIZEOF_ZEND_LONG==4
if (uval > INT_MAX) {
char *tmp, *p;
int j = 10;
@@ -1015,9 +1015,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
#endif
}
if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) {
- ZVAL_INT(result, *(unsigned int *)stmt->result.buf[i].val);
+ ZVAL_LONG(result, *(unsigned int *)stmt->result.buf[i].val);
} else {
- ZVAL_INT(result, *(int *)stmt->result.buf[i].val);
+ ZVAL_LONG(result, *(int *)stmt->result.buf[i].val);
}
break;
case IS_DOUBLE:
@@ -1047,9 +1047,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
{
llval= *(my_ulonglong *) stmt->result.buf[i].val;
}
-#if SIZEOF_ZEND_INT==8
+#if SIZEOF_ZEND_LONG==8
if (uns && llval > 9223372036854775807L) {
-#elif SIZEOF_ZEND_INT==4
+#elif SIZEOF_ZEND_LONG==4
if ((uns && llval > L64(2147483647)) ||
(!uns && (( L64(2147483647) < (my_longlong) llval) ||
(L64(-2147483648) > (my_longlong) llval))))
@@ -1063,7 +1063,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
snprintf(tmp, sizeof(tmp), (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval);
ZVAL_STRING(result, tmp);
} else {
- ZVAL_INT(result, llval);
+ ZVAL_LONG(result, llval);
}
} else {
#if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002
@@ -1149,7 +1149,7 @@ PHP_FUNCTION(mysqli_stmt_fetch)
static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC)
{
#ifdef MYSQLI_USE_MYSQLND
- add_property_str(value, "name", STR_COPY(field->sname));
+ add_property_str(value, "name", zend_string_copy(field->sname));
#else
add_property_stringl(value, "name",(field->name ? field->name : ""), field->name_length);
#endif
@@ -1166,12 +1166,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML
*/
add_property_string(value, "catalog", "def");
- add_property_int(value, "max_length", field->max_length);
- add_property_int(value, "length", field->length);
- add_property_int(value, "charsetnr", field->charsetnr);
- add_property_int(value, "flags", field->flags);
- add_property_int(value, "type", field->type);
- add_property_int(value, "decimals", field->decimals);
+ add_property_long(value, "max_length", field->max_length);
+ add_property_long(value, "length", field->length);
+ add_property_long(value, "charsetnr", field->charsetnr);
+ add_property_long(value, "flags", field->flags);
+ add_property_long(value, "type", field->type);
+ add_property_long(value, "decimals", field->decimals);
}
/* }}} */
@@ -1234,15 +1234,15 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
MYSQL_RES *result;
zval *mysql_result;
const MYSQL_FIELD *field;
- php_int_t offset;
+ zend_long offset;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
- if (offset < 0 || offset >= (php_int_t) mysql_num_fields(result)) {
+ if (offset < 0 || offset >= (zend_long) mysql_num_fields(result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset");
RETURN_FALSE;
}
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
MYSQL_RES *result;
zval *mysql_result;
unsigned int i;
- php_uint_t *ret;
+ zend_ulong *ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
@@ -1278,7 +1278,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
array_init(return_value);
for (i = 0; i < mysql_num_fields(result); i++) {
- add_index_int(return_value, i, ret[i]);
+ add_index_long(return_value, i, ret[i]);
}
}
/* }}} */
@@ -1304,7 +1304,7 @@ PHP_FUNCTION(mysqli_field_count)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_field_count(mysql->mysql));
+ RETURN_LONG(mysql_field_count(mysql->mysql));
}
/* }}} */
@@ -1315,9 +1315,9 @@ PHP_FUNCTION(mysqli_field_seek)
{
MYSQL_RES *result;
zval *mysql_result;
- php_int_t fieldnr;
+ zend_long fieldnr;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1344,7 +1344,7 @@ PHP_FUNCTION(mysqli_field_tell)
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_field_tell(result));
+ RETURN_LONG(mysql_field_tell(result));
}
/* }}} */
@@ -1380,7 +1380,7 @@ PHP_FUNCTION(mysqli_get_client_info)
Get MySQL client info */
PHP_FUNCTION(mysqli_get_client_version)
{
- RETURN_INT((php_int_t)mysql_get_client_version());
+ RETURN_LONG((zend_long)mysql_get_client_version());
}
/* }}} */
@@ -1414,7 +1414,7 @@ PHP_FUNCTION(mysqli_get_proto_info)
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_get_proto_info(mysql->mysql));
+ RETURN_LONG(mysql_get_proto_info(mysql->mysql));
}
/* }}} */
@@ -1450,7 +1450,7 @@ PHP_FUNCTION(mysqli_get_server_version)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_get_server_version(mysql->mysql));
+ RETURN_LONG(mysql_get_server_version(mysql->mysql));
}
/* }}} */
@@ -1540,7 +1540,7 @@ PHP_FUNCTION(mysqli_insert_id)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
rc = mysql_insert_id(mysql->mysql);
- MYSQLI_RETURN_INT_INT(rc)
+ MYSQLI_RETURN_LONG_INT(rc)
}
/* }}} */
@@ -1550,9 +1550,9 @@ PHP_FUNCTION(mysqli_kill)
{
MY_MYSQL *mysql;
zval *mysql_link;
- php_int_t processid;
+ zend_long processid;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1658,7 +1658,7 @@ PHP_FUNCTION(mysqli_num_fields)
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_num_fields(result));
+ RETURN_LONG(mysql_num_fields(result));
}
/* }}} */
@@ -1676,10 +1676,10 @@ PHP_FUNCTION(mysqli_num_rows)
if (mysqli_result_is_unbuffered_and_not_everything_is_fetched(result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT");
- RETURN_INT(0);
+ RETURN_LONG(0);
}
- MYSQLI_RETURN_INT_INT(mysql_num_rows(result));
+ MYSQLI_RETURN_LONG_INT(mysql_num_rows(result));
}
/* }}} */
@@ -1725,12 +1725,12 @@ static int mysqli_options_get_option_zval_type(int option)
case MYSQL_OPT_COMPRESS:
#endif /* mysqlnd @ PHP 5.3.2 */
#ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT
- REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
#endif /* MySQL 5.1.1., mysqlnd @ PHP 5.3.3 */
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
#endif
- return IS_INT;
+ return IS_LONG;
#ifdef MYSQL_SHARED_MEMORY_BASE_NAME
case MYSQL_SHARED_MEMORY_BASE_NAME:
@@ -1761,12 +1761,12 @@ PHP_FUNCTION(mysqli_options)
MY_MYSQL *mysql;
zval *mysql_link = NULL;
zval *mysql_value;
- php_int_t mysql_option;
+ zend_long mysql_option;
unsigned int l_value;
- php_int_t ret;
+ zend_long ret;
int expected_type;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
@@ -1786,8 +1786,8 @@ PHP_FUNCTION(mysqli_options)
case IS_STRING:
convert_to_string_ex(mysql_value);
break;
- case IS_INT:
- convert_to_int_ex(mysql_value);
+ case IS_LONG:
+ convert_to_long_ex(mysql_value);
break;
default:
break;
@@ -1797,8 +1797,8 @@ PHP_FUNCTION(mysqli_options)
case IS_STRING:
ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_P(mysql_value));
break;
- case IS_INT:
- l_value = Z_IVAL_P(mysql_value);
+ case IS_LONG:
+ l_value = Z_LVAL_P(mysql_value);
ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value);
break;
default:
@@ -1816,7 +1816,7 @@ PHP_FUNCTION(mysqli_ping)
{
MY_MYSQL *mysql;
zval *mysql_link;
- php_int_t rc;
+ zend_long rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1836,7 +1836,7 @@ PHP_FUNCTION(mysqli_prepare)
MY_MYSQL *mysql;
MY_STMT *stmt;
char *query = NULL;
- int query_len;
+ size_t query_len;
zval *mysql_link;
MYSQLI_RESOURCE *mysqli_resource;
@@ -1924,7 +1924,7 @@ PHP_FUNCTION(mysqli_real_query)
MY_MYSQL *mysql;
zval *mysql_link;
char *query = NULL;
- int query_len;
+ size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
return;
@@ -1954,7 +1954,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
MY_MYSQL *mysql;
zval *mysql_link = NULL;
char *escapestr;
- int escapestr_len;
+ size_t escapestr_len;
zend_string *newstr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &escapestr, &escapestr_len) == FAILURE) {
@@ -1962,9 +1962,9 @@ PHP_FUNCTION(mysqli_real_escape_string) {
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- newstr = STR_ALLOC(2 * escapestr_len, 0);
+ newstr = zend_string_alloc(2 * escapestr_len, 0);
newstr->len = mysql_real_escape_string(mysql->mysql, newstr->val, escapestr, escapestr_len);
- newstr = STR_REALLOC(newstr, newstr->len, 0);
+ newstr = zend_string_realloc(newstr, newstr->len, 0);
RETURN_STR(newstr);
}
@@ -1976,11 +1976,11 @@ PHP_FUNCTION(mysqli_rollback)
{
MY_MYSQL *mysql;
zval *mysql_link;
- php_int_t flags = TRANS_COR_NO_OPT;
+ zend_long flags = TRANS_COR_NO_OPT;
char * name = NULL;
- int name_len = 0;
+ size_t name_len = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2003,10 +2003,10 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
MY_STMT *stmt;
zval *mysql_stmt;
char *data;
- php_int_t param_nr;
- int data_len;
+ zend_long param_nr;
+ size_t data_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2037,9 +2037,9 @@ PHP_FUNCTION(mysqli_stmt_affected_rows)
rc = mysql_stmt_affected_rows(stmt->stmt);
if (rc == (my_ulonglong) -1) {
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
- MYSQLI_RETURN_INT_INT(rc)
+ MYSQLI_RETURN_LONG_INT(rc)
}
/* }}} */
@@ -2069,9 +2069,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek)
{
MY_STMT *stmt;
zval *mysql_stmt;
- php_int_t offset;
+ zend_long offset;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
return;
}
if (offset < 0) {
@@ -2097,7 +2097,7 @@ PHP_FUNCTION(mysqli_stmt_field_count)
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_stmt_field_count(stmt->stmt));
+ RETURN_LONG(mysql_stmt_field_count(stmt->stmt));
}
/* }}} */
@@ -2131,7 +2131,7 @@ PHP_FUNCTION(mysqli_stmt_insert_id)
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
rc = mysql_stmt_insert_id(stmt->stmt);
- MYSQLI_RETURN_INT_INT(rc)
+ MYSQLI_RETURN_LONG_INT(rc)
}
/* }}} */
@@ -2147,7 +2147,7 @@ PHP_FUNCTION(mysqli_stmt_param_count)
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_stmt_param_count(stmt->stmt));
+ RETURN_LONG(mysql_stmt_param_count(stmt->stmt));
}
/* }}} */
@@ -2186,7 +2186,7 @@ PHP_FUNCTION(mysqli_stmt_num_rows)
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
rc = mysql_stmt_num_rows(stmt->stmt);
- MYSQLI_RETURN_INT_INT(rc)
+ MYSQLI_RETURN_LONG_INT(rc)
}
/* }}} */
@@ -2197,7 +2197,7 @@ PHP_FUNCTION(mysqli_select_db)
MY_MYSQL *mysql;
zval *mysql_link;
char *dbname;
- int dbname_len;
+ size_t dbname_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) {
return;
@@ -2238,7 +2238,7 @@ PHP_FUNCTION(mysqli_ssl_set)
MY_MYSQL *mysql;
zval *mysql_link;
char *ssl_parm[5];
- int ssl_parm_len[5], i;
+ size_t ssl_parm_len[5], i;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
return;
@@ -2296,9 +2296,9 @@ PHP_FUNCTION(mysqli_refresh)
{
MY_MYSQL *mysql;
zval *mysql_link = NULL;
- php_int_t options;
+ zend_long options;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
@@ -2316,15 +2316,15 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
{
MY_STMT *stmt;
zval *mysql_stmt;
- php_int_t mode_in;
+ zend_long mode_in;
#if MYSQL_VERSION_ID >= 50107
my_bool mode_b;
#endif
- php_uint_t mode;
- php_int_t attr;
+ zend_ulong mode;
+ zend_long attr;
void *mode_p;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2363,11 +2363,11 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
{
MY_STMT *stmt;
zval *mysql_stmt;
- php_uint_t value = 0;
- php_int_t attr;
+ zend_ulong value = 0;
+ zend_long attr;
int rc;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2380,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
if (attr == STMT_ATTR_UPDATE_MAX_LENGTH)
value = *((my_bool *)&value);
#endif
- RETURN_INT((php_uint_t)value);
+ RETURN_LONG((zend_ulong)value);
}
/* }}} */
@@ -2396,7 +2396,7 @@ PHP_FUNCTION(mysqli_stmt_errno)
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED);
- RETURN_INT(mysql_stmt_errno(stmt->stmt));
+ RETURN_LONG(mysql_stmt_errno(stmt->stmt));
}
/* }}} */
@@ -2460,7 +2460,7 @@ PHP_FUNCTION(mysqli_stmt_prepare)
MY_STMT *stmt;
zval *mysql_stmt;
char *query;
- int query_len;
+ size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_stmt, mysqli_stmt_class_entry, &query, &query_len) == FAILURE) {
return;
@@ -2580,10 +2580,10 @@ PHP_FUNCTION(mysqli_store_result)
MYSQL_RES *result;
zval *mysql_link;
MYSQLI_RESOURCE *mysqli_resource;
- php_int_t flags = 0;
+ zend_long flags = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2619,7 +2619,7 @@ PHP_FUNCTION(mysqli_thread_id)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT((php_int_t) mysql_thread_id(mysql->mysql));
+ RETURN_LONG((zend_long) mysql_thread_id(mysql->mysql));
}
/* }}} */
@@ -2672,7 +2672,7 @@ PHP_FUNCTION(mysqli_warning_count)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_INT(mysql_warning_count(mysql->mysql));
+ RETURN_LONG(mysql_warning_count(mysql->mysql));
}
/* }}} */
diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c
index a895fd0bae..95096f4a61 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -39,21 +39,21 @@ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \
#define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \
static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
{ \
- MyG(value) = Z_IVAL_P(value) > 0; \
+ MyG(value) = Z_LVAL_P(value) > 0; \
return SUCCESS; \
} \
#define MAP_PROPERTY_MYG_LONG_READ(name, value) \
static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \
{ \
- ZVAL_INT(retval, MyG(value)); \
+ ZVAL_LONG(retval, MyG(value)); \
return retval; \
} \
#define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \
static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
{ \
- MyG(value) = Z_IVAL_P(value); \
+ MyG(value) = Z_LVAL_P(value); \
return SUCCESS; \
} \
@@ -74,7 +74,7 @@ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \
/* {{{ property driver_report_write */
static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC)
{
- MyG(report_mode) = Z_IVAL_P(value);
+ MyG(report_mode) = Z_LVAL_P(value);
/*FIXME*/
/* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); */
return SUCCESS;
@@ -96,7 +96,7 @@ static zval *driver_embedded_read(mysqli_object *obj, zval *retval TSRMLS_DC)
/* {{{ property driver_client_version_read */
static zval *driver_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
- ZVAL_INT(retval, MYSQL_VERSION_ID);
+ ZVAL_LONG(retval, MYSQL_VERSION_ID);
return retval;
}
/* }}} */
@@ -112,7 +112,7 @@ static zval *driver_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC)
/* {{{ property driver_driver_version_read */
static zval *driver_driver_version_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
- ZVAL_INT(retval, MYSQLI_VERSION_ID);
+ ZVAL_LONG(retval, MYSQLI_VERSION_ID);
return retval;
}
/* }}} */
diff --git a/ext/mysqli/mysqli_embedded.c b/ext/mysqli/mysqli_embedded.c
index 34d0b6fa78..4c1c4a37a5 100644
--- a/ext/mysqli/mysqli_embedded.c
+++ b/ext/mysqli/mysqli_embedded.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -32,7 +32,7 @@
PHP_FUNCTION(mysqli_embedded_server_start)
{
#ifdef HAVE_EMBEDDED_MYSQLI
- php_int_t start;
+ zend_long start;
zval *args;
zval *grps;
@@ -42,7 +42,7 @@ PHP_FUNCTION(mysqli_embedded_server_start)
HashPosition pos;
int index, rc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iaa", &start, &args, &grps) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "laa", &start, &args, &grps) == FAILURE) {
return;
}
diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c
index 191a16ce31..ec86b9d740 100644
--- a/ext/mysqli/mysqli_exception.c
+++ b/ext/mysqli/mysqli_exception.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -68,7 +68,7 @@ void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char
}
efree(message);
- zend_update_property_int(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC);
+ zend_update_property_long(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC);
zend_throw_exception_object(&sql_ex TSRMLS_CC);
}
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index e099fe7194..2b6c99b9c7 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqli/mysqli_fe.h b/ext/mysqli/mysqli_fe.h
index 9a9f851248..f5ca0963b5 100644
--- a/ext/mysqli/mysqli_fe.h
+++ b/ext/mysqli/mysqli_fe.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqli/mysqli_libmysql.h b/ext/mysqli/mysqli_libmysql.h
index 5e7f730aec..a22899185a 100644
--- a/ext/mysqli/mysqli_libmysql.h
+++ b/ext/mysqli/mysqli_libmysql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqli/mysqli_mysqlnd.h b/ext/mysqli/mysqli_mysqlnd.h
index b6d23d9ef1..a1656e59eb 100644
--- a/ext/mysqli/mysqli_mysqlnd.h
+++ b/ext/mysqli/mysqli_mysqlnd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2009 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 82cb1baf26..db0d0ee677 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_mysqli_structs.h"
#include "mysqli_priv.h"
@@ -42,7 +42,7 @@
/* {{{ php_mysqli_set_error
*/
-static void php_mysqli_set_error(php_int_t mysql_errno, char *mysql_err TSRMLS_DC)
+static void php_mysqli_set_error(zend_long mysql_errno, char *mysql_err TSRMLS_DC)
{
MyG(error_no) = mysql_errno;
if (MyG(error_msg)) {
@@ -62,9 +62,9 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
MYSQLI_RESOURCE *mysqli_resource = NULL;
zval *object = getThis();
char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
- int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
+ size_t hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
zend_bool persistent = FALSE;
- php_int_t port = 0, flags = 0;
+ zend_long port = 0, flags = 0;
zend_string *hash_key = NULL;
zend_bool new_connection = FALSE;
zend_resource *le;
@@ -87,7 +87,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
hostname = username = dbname = passwd = socket = NULL;
if (!is_real_connect) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssis", &hostname, &hostname_len, &username, &username_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len,
&passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) {
return;
}
@@ -105,7 +105,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
} else {
/* We have flags too */
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ssssisi", &object, mysqli_link_class_entry,
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &object, mysqli_link_class_entry,
&hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len,
&flags) == FAILURE) {
return;
@@ -200,7 +200,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
}
}
if (MyG(max_links) != -1 && MyG(num_links) >= MyG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MyG(num_links));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", MyG(num_links));
goto err;
}
@@ -291,7 +291,7 @@ end:
err:
if (mysql->hash_key) {
- STR_RELEASE(mysql->hash_key);
+ zend_string_release(mysql->hash_key);
mysql->hash_key = NULL;
mysql->persistent = FALSE;
}
@@ -321,7 +321,7 @@ PHP_FUNCTION(mysqli_link_construct)
Returns the numerical value of the error message from last connect command */
PHP_FUNCTION(mysqli_connect_errno)
{
- RETURN_INT(MyG(error_no));
+ RETURN_LONG(MyG(error_no));
}
/* }}} */
@@ -360,9 +360,9 @@ PHP_FUNCTION(mysqli_fetch_all)
{
MYSQL_RES *result;
zval *mysql_result;
- php_int_t mode = MYSQLND_FETCH_NUM;
+ zend_long mode = MYSQLND_FETCH_NUM;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -428,7 +428,7 @@ PHP_FUNCTION(mysqli_error_list)
{
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
add_next_index_zval(return_value, &single_error);
@@ -438,7 +438,7 @@ PHP_FUNCTION(mysqli_error_list)
if (mysql_errno(mysql->mysql)) {
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql));
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql));
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql));
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql));
add_next_index_zval(return_value, &single_error);
@@ -469,7 +469,7 @@ PHP_FUNCTION(mysqli_stmt_error_list)
{
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
add_next_index_zval(return_value, &single_error);
@@ -479,7 +479,7 @@ PHP_FUNCTION(mysqli_stmt_error_list)
if (mysql_stmt_errno(stmt->stmt)) {
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt));
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt));
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt));
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt));
add_next_index_zval(return_value, &single_error);
@@ -503,7 +503,7 @@ PHP_FUNCTION(mysqli_multi_query)
MY_MYSQL *mysql;
zval *mysql_link;
char *query = NULL;
- int query_len;
+ size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
return;
@@ -548,10 +548,10 @@ PHP_FUNCTION(mysqli_query)
MYSQLI_RESOURCE *mysqli_resource;
MYSQL_RES *result = NULL;
char *query = NULL;
- int query_len;
- php_int_t resultmode = MYSQLI_STORE_RESULT;
+ size_t query_len;
+ zend_long resultmode = MYSQLI_STORE_RESULT;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
return;
}
@@ -750,11 +750,11 @@ PHP_FUNCTION(mysqli_poll)
{
zval *r_array, *e_array, *dont_poll_array;
MYSQLND **new_r_array = NULL, **new_e_array = NULL, **new_dont_poll_array = NULL;
- php_int_t sec = 0, usec = 0;
+ zend_long sec = 0, usec = 0;
enum_func_status ret;
int desc_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!ai|i", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
return;
}
if (sec < 0 || usec < 0) {
@@ -795,7 +795,7 @@ PHP_FUNCTION(mysqli_poll)
efree(new_e_array);
}
if (ret == PASS) {
- RETURN_INT(desc_num);
+ RETURN_LONG(desc_num);
} else {
RETURN_FALSE;
}
@@ -944,7 +944,7 @@ PHP_FUNCTION(mysqli_set_charset)
MY_MYSQL *mysql;
zval *mysql_link;
char *cs_name;
- int csname_len;
+ size_t csname_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &cs_name, &csname_len) == FAILURE) {
return;
@@ -1009,10 +1009,10 @@ PHP_FUNCTION(mysqli_get_charset)
add_property_string(return_value, "charset", (name) ? (char *)name : "");
add_property_string(return_value, "collation",(collation) ? (char *)collation : "");
add_property_string(return_value, "dir", (dir) ? (char *)dir : "");
- add_property_int(return_value, "min_length", minlength);
- add_property_int(return_value, "max_length", maxlength);
- add_property_int(return_value, "number", number);
- add_property_int(return_value, "state", state);
+ add_property_long(return_value, "min_length", minlength);
+ add_property_long(return_value, "max_length", maxlength);
+ add_property_long(return_value, "number", number);
+ add_property_long(return_value, "state", state);
add_property_string(return_value, "comment", (comment) ? (char *)comment : "");
}
/* }}} */
@@ -1076,17 +1076,17 @@ PHP_FUNCTION(mysqli_begin_transaction)
{
MY_MYSQL *mysql;
zval *mysql_link;
- php_int_t flags = TRANS_START_NO_OPT;
+ zend_long flags = TRANS_START_NO_OPT;
char * name = NULL;
- int name_len = -1;
+ size_t name_len = -1;
zend_bool err = FALSE;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (flags < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for parameter flags (%ld)", flags);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for parameter flags (%pd)", flags);
err = TRUE;
}
if (!name_len) {
@@ -1131,7 +1131,7 @@ PHP_FUNCTION(mysqli_savepoint)
MY_MYSQL *mysql;
zval *mysql_link;
char * name = NULL;
- int name_len = -1;
+ size_t name_len = -1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &name, &name_len) == FAILURE) {
return;
@@ -1160,7 +1160,7 @@ PHP_FUNCTION(mysqli_release_savepoint)
MY_MYSQL *mysql;
zval *mysql_link;
char * name = NULL;
- int name_len = -1;
+ size_t name_len = -1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &name, &name_len) == FAILURE) {
return;
@@ -1190,9 +1190,9 @@ PHP_FUNCTION(mysqli_get_links_stats)
return;
}
array_init(return_value);
- add_assoc_int_ex(return_value, "total", sizeof("total") - 1, MyG(num_links));
- add_assoc_int_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent));
- add_assoc_int_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent));
+ add_assoc_long_ex(return_value, "total", sizeof("total") - 1, MyG(num_links));
+ add_assoc_long_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent));
+ add_assoc_long_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent));
}
/* }}} */
diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h
index 8ca60a9055..cff28400ed 100644
--- a/ext/mysqli/mysqli_priv.h
+++ b/ext/mysqli/mysqli_priv.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -96,10 +96,10 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC
mysql->multi_query = 1; \
}
-#define MYSQLI_RETURN_INT_INT(__val) \
+#define MYSQLI_RETURN_LONG_INT(__val) \
{ \
- if ((__val) < PHP_INT_MAX) { \
- RETURN_INT((php_int_t) (__val)); \
+ if ((__val) < ZEND_LONG_MAX) { \
+ RETURN_LONG((zend_long) (__val)); \
} else { \
/* always used with my_ulonglong -> %llu */ \
RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index 912152343a..1354e0db93 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -72,7 +72,7 @@ if (!obj->ptr) { \
p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt;\
}
-#define MYSQLI_MAP_PROPERTY_FUNC_INT( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
+#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \
{\
__ret_type l;\
@@ -81,10 +81,10 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \
ZVAL_NULL(retval);\
} else {\
l = (__ret_type)__int_func(p);\
- if (l < PHP_INT_MAX) {\
- ZVAL_INT(retval, (php_int_t) l);\
+ if (l < ZEND_LONG_MAX) {\
+ ZVAL_LONG(retval, (zend_long) l);\
} else { \
- ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
+ ZVAL_NEW_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
} \
}\
return retval;\
@@ -111,7 +111,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC)\
/* {{{ property link_client_version_read */
static zval *link_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
- ZVAL_INT(retval, MYSQL_VERSION_ID);
+ ZVAL_LONG(retval, MYSQL_VERSION_ID);
return retval;
}
/* }}} */
@@ -128,7 +128,7 @@ static zval *link_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC)
/* {{{ property link_connect_errno_read */
static zval *link_connect_errno_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
- ZVAL_INT(retval, (php_int_t)MyG(error_no));
+ ZVAL_LONG(retval, (zend_long)MyG(error_no));
return retval;
}
/* }}} */
@@ -163,14 +163,14 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
rc = mysql_affected_rows(mysql->mysql);
if (rc == (my_ulonglong) -1) {
- ZVAL_INT(retval, -1);
+ ZVAL_LONG(retval, -1);
return retval;
}
- if (rc < PHP_INT_MAX) {
- ZVAL_INT(retval, (php_int_t) rc);
+ if (rc < ZEND_LONG_MAX) {
+ ZVAL_LONG(retval, (zend_long) rc);
} else {
- ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
}
return retval;
@@ -198,7 +198,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
add_next_index_zval(retval, &single_error);
@@ -208,7 +208,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (mysql_errno(mysql->mysql)) {
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql));
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql));
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql));
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql));
add_next_index_zval(retval, &single_error);
@@ -221,18 +221,18 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
/* }}} */
/* link properties */
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED))
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_INT(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
/* {{{ property link_stat_read */
static zval *link_stat_read(mysqli_object *obj, zval *retval TSRMLS_DC)
@@ -279,7 +279,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (!p) {
ZVAL_NULL(retval);
} else {
- ZVAL_INT(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT);
+ ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT);
}
return retval;
}
@@ -289,7 +289,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC)
static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
MYSQL_RES *p;
- php_uint_t *ret;
+ zend_ulong *ret;
uint field_count;
CHECK_STATUS(MYSQLI_STATUS_VALID);
@@ -298,21 +298,21 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (!p || !field_count || !(ret = mysql_fetch_lengths(p))) {
ZVAL_NULL(retval);
} else {
- php_uint_t i;
+ zend_ulong i;
array_init(retval);
for (i = 0; i < field_count; i++) {
- add_index_int(retval, i, ret[i]);
+ add_index_long(retval, i, ret[i]);
}
}
return retval;
}
/* }}} */
-MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_INT(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
/* statement properties */
@@ -328,7 +328,7 @@ static zval *stmt_id_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (!p) {
ZVAL_NULL(retval);
} else {
- ZVAL_INT(retval, mysqli_stmt_get_id(p->stmt));
+ ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt));
}
return retval;
}
@@ -350,14 +350,14 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
rc = mysql_stmt_affected_rows(p->stmt);
if (rc == (my_ulonglong) -1) {
- ZVAL_INT(retval, -1);
+ ZVAL_LONG(retval, -1);
return retval;
}
- if (rc < PHP_INT_MAX) {
- ZVAL_INT(retval, (php_int_t) rc);
+ if (rc < ZEND_LONG_MAX) {
+ ZVAL_LONG(retval, (zend_long) rc);
} else {
- ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
+ ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
}
}
return retval;
@@ -384,7 +384,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
{
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
add_next_index_zval(retval, &single_error);
@@ -394,7 +394,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
if (mysql_stmt_errno(stmt->stmt)) {
zval single_error;
array_init(&single_error);
- add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt));
+ add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt));
add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt));
add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt));
add_next_index_zval(retval, &single_error);
@@ -405,11 +405,11 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
}
/* }}} */
-MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
-MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
-MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
-MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
diff --git a/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c
index c4ffd1c199..ceec68efb4 100644
--- a/ext/mysqli/mysqli_report.c
+++ b/ext/mysqli/mysqli_report.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -33,10 +33,10 @@ extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC
sets report level */
PHP_FUNCTION(mysqli_report)
{
- php_int_t flags;
+ zend_long flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
return;
}
diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c
index c60946b449..5caa926b47 100644
--- a/ext/mysqli/mysqli_result_iterator.c
+++ b/ext/mysqli/mysqli_result_iterator.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -141,7 +141,7 @@ static void php_mysqli_result_iterator_current_key(zend_object_iterator *iter, z
{
php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter;
- ZVAL_INT(key, iterator->row_num);
+ ZVAL_LONG(key, iterator->row_num);
}
/* }}} */
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 3c86bee800..084bc58581 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,8 +28,8 @@
#include "php_mysqli_structs.h"
#include "mysqli_priv.h"
-/* Define these in the PHP5 tree to make merging easy process */
-#define ZSTR_DUPLICATE (1<<0)
+/* Define these in the PHP7 tree to make merging easy process */
+#define Zzend_string_dupLICATE (1<<0)
#define ZSTR_AUTOFREE (1<<1)
#define ZVAL_UTF8_STRING(z, s, flags) ZVAL_STRING((z), (char*)(s))
@@ -59,9 +59,9 @@ MYSQLI_WARNING *php_new_warning(const char *reason, int errorno TSRMLS_DC)
w = (MYSQLI_WARNING *)ecalloc(1, sizeof(MYSQLI_WARNING));
- ZVAL_UTF8_STRING(&(w->reason), reason, ZSTR_DUPLICATE);
+ ZVAL_UTF8_STRING(&(w->reason), reason, Zzend_string_dupLICATE);
- ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE);
+ ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, Zzend_string_dupLICATE);
w->errorno = errorno;
@@ -108,9 +108,9 @@ MYSQLI_WARNING *php_new_warning(const zval * reason, int errorno TSRMLS_DC)
ZVAL_DUP(&w->reason, (zval *)reason);
convert_to_string(&w->reason);
- //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRSIZE(w->reason), ZSTR_AUTOFREE);
+ //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRLEN(w->reason), ZSTR_AUTOFREE);
- ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE);
+ ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, Zzend_string_dupLICATE);
w->errorno = errorno;
@@ -146,8 +146,8 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql TSRMLS_DC)
/* 1. Here comes the error no */
entry = zend_hash_get_current_data(Z_ARRVAL(row));
- convert_to_int_ex(entry);
- errno = Z_IVAL_P(entry);
+ convert_to_long_ex(entry);
+ errno = Z_LVAL_P(entry);
zend_hash_move_forward(Z_ARRVAL(row));
/* 2. Here comes the reason */
@@ -243,7 +243,7 @@ zval *mysqli_warning_errno(mysqli_object *obj, zval *retval TSRMLS_DC)
return NULL;
}
w = (MYSQLI_WARNING *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
- ZVAL_INT(retval, w->errorno);
+ ZVAL_LONG(retval, w->errorno);
return retval;
}
/* }}} */
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index e036cf42b7..566bdd7004 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index 607f9c602a..d815df3eee 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -99,9 +99,9 @@ enum mysqli_status {
typedef struct {
char *val;
- php_uint_t buflen;
- php_uint_t output_len;
- php_uint_t type;
+ zend_ulong buflen;
+ zend_ulong output_len;
+ zend_ulong type;
} VAR_BUFFER;
typedef struct {
@@ -214,7 +214,7 @@ extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_stat
extern zend_object_iterator_funcs php_mysqli_result_iterator_funcs;
extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
-extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC);
+extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype TSRMLS_DC);
#ifdef HAVE_SPL
extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
@@ -318,27 +318,27 @@ extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
ZEND_BEGIN_MODULE_GLOBALS(mysqli)
- php_int_t default_link;
- php_int_t num_links;
- php_int_t max_links;
- php_int_t num_active_persistent;
- php_int_t num_inactive_persistent;
- php_int_t max_persistent;
- php_int_t allow_persistent;
- php_uint_t default_port;
+ zend_long default_link;
+ zend_long num_links;
+ zend_long max_links;
+ zend_long num_active_persistent;
+ zend_long num_inactive_persistent;
+ zend_long max_persistent;
+ zend_long allow_persistent;
+ zend_ulong default_port;
char *default_host;
char *default_user;
char *default_socket;
char *default_pw;
- php_int_t reconnect;
- php_int_t allow_local_infile;
- php_int_t strict;
- php_int_t error_no;
+ zend_long reconnect;
+ zend_long allow_local_infile;
+ zend_long strict;
+ zend_long error_no;
char *error_msg;
- php_int_t report_mode;
+ zend_long report_mode;
HashTable *report_ht;
- php_uint_t multi_query;
- php_uint_t embedded;
+ zend_ulong multi_query;
+ zend_ulong embedded;
zend_bool rollback_on_cached_plink;
ZEND_END_MODULE_GLOBALS(mysqli)
diff --git a/ext/mysqli/tests/bug33491.phpt b/ext/mysqli/tests/bug33491.phpt
index 7e994bc4d0..c83e126495 100644
--- a/ext/mysqli/tests/bug33491.phpt
+++ b/ext/mysqli/tests/bug33491.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #33491 (extended mysqli class crashes when result is not object)
--INI--
-error_reporting=4095
+error_reporting=4096
--SKIPIF--
<?php
require_once('skipif.inc');
@@ -26,4 +26,4 @@ $DB->query_single('SELECT DATE()');
?>
--EXPECTF--
-Fatal error: Call to a member function fetch_row() on boolean in %sbug33491.php on line %d
+Catchable fatal error: Call to a member function fetch_row() on boolean in %sbug33491.php on line %d
diff --git a/ext/mysqli/tests/mysqli_change_user_new.phpt b/ext/mysqli/tests/mysqli_change_user_new.phpt
index e16895766f..06c721ac87 100644
--- a/ext/mysqli/tests/mysqli_change_user_new.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_new.phpt
@@ -41,4 +41,4 @@ Warning: mysqli_query(): MySQL server has gone away in %s on line %d
Warning: mysqli_query(): Error reading result set's header in %s on line %d
[003] [2006] MySQL server has gone away
-Fatal error: Call to a member function fetch_assoc() on %s in %s on line %d \ No newline at end of file
+Catchable fatal error: Call to a member function fetch_assoc() on %s in %s on line %d
diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4
index 816f4431f5..1a0136d8db 100644
--- a/ext/mysqlnd/config9.m4
+++ b/ext/mysqlnd/config9.m4
@@ -58,12 +58,17 @@ dnl
AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[
AC_TRY_RUN( [
#include <stdio.h>
+#include <string.h>
int main(int argc, char **argv) {
typedef float dec32 __attribute__((mode(SD)));
dec32 k = 99.49f;
double d2 = (double)k;
- return 0;
+ const char *check_str = "99.49";
+ char print_str[32];
+
+ snprintf(print_str, 32, "%f", d2);
+ return memcmp(print_str, check_str, 5);
}
],[
ac_cv_decimal_fp_supported=yes
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 65752d74a8..41f34e366a 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "mysqlnd_statistics.h"
#include "mysqlnd_charset.h"
#include "mysqlnd_debug.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/*
TODO :
@@ -440,7 +440,7 @@ mysqlnd_switch_to_ssl_if_needed(
MYSQLND_CONN_DATA * conn,
const MYSQLND_PACKET_GREET * const greet_packet,
const MYSQLND_OPTIONS * const options,
- php_uint_t mysql_flags
+ zend_ulong mysql_flags
TSRMLS_DC
)
{
@@ -546,7 +546,7 @@ mysqlnd_run_authentication(
const char * const auth_protocol,
unsigned int charset_no,
const MYSQLND_OPTIONS * const options,
- php_uint_t mysql_flags,
+ zend_ulong mysql_flags,
zend_bool silent,
zend_bool is_change_user
TSRMLS_DC)
@@ -678,7 +678,7 @@ mysqlnd_connect_run_authentication(
size_t passwd_len,
const MYSQLND_PACKET_GREET * const greet_packet,
const MYSQLND_OPTIONS * const options,
- php_uint_t mysql_flags
+ zend_ulong mysql_flags
TSRMLS_DC)
{
enum_func_status ret = FAIL;
@@ -1588,7 +1588,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn
/* {{{ mysqlnd_old_escape_string */
-PHPAPI php_uint_t
+PHPAPI zend_ulong
mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
{
DBG_ENTER("mysqlnd_old_escape_string");
@@ -1622,11 +1622,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const
/* {{{ mysqlnd_conn_data::escape_string */
-static php_uint_t
+static zend_ulong
MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
{
size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string);
- php_uint_t ret = FAIL;
+ zend_ulong ret = FAIL;
DBG_ENTER("mysqlnd_conn_data::escape_string");
DBG_INF_FMT("conn=%llu", conn->thread_id);
@@ -1750,7 +1750,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_stri
if (PASS == (ret = PACKET_READ(stats_header, conn))) {
/* will be freed by Zend, thus don't use the mnd_ allocator */
- *message = STR_INIT(stats_header->message, stats_header->message_len, 0);
+ *message = zend_string_init(stats_header->message, stats_header->message_len, 0);
DBG_INF((*message)->val);
}
PACKET_FREE(stats_header);
@@ -2114,23 +2114,23 @@ MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const con
/* {{{ mysqlnd_conn_data::get_server_version */
-static php_uint_t
+static zend_ulong
MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC)
{
- php_int_t major, minor, patch;
+ zend_long major, minor, patch;
char *p;
if (!(p = conn->server_version)) {
return 0;
}
- major = ZEND_STRTOI(p, &p, 10);
+ major = ZEND_STRTOL(p, &p, 10);
p += 1; /* consume the dot */
- minor = ZEND_STRTOI(p, &p, 10);
+ minor = ZEND_STRTOL(p, &p, 10);
p += 1; /* consume the dot */
- patch = ZEND_STRTOI(p, &p, 10);
+ patch = ZEND_STRTOL(p, &p, 10);
- return (php_uint_t)(major * Z_I(10000) + (php_uint_t)(minor * Z_I(100) + patch));
+ return (zend_ulong)(major * Z_L(10000) + (zend_ulong)(minor * Z_L(100) + patch));
}
/* }}} */
@@ -2496,7 +2496,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons
DBG_INF_FMT("Adding [%s][%s]", key, value);
{
zval attrz;
- ZVAL_STR(&attrz, STR_INIT(value, strlen(value), 1));
+ ZVAL_NEW_STR(&attrz, zend_string_init(value, strlen(value), 1));
zend_hash_str_update(conn->options->connect_attr, key, strlen(key), &attrz);
}
break;
@@ -2798,18 +2798,18 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
}
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
- unsigned long server_version = conn->m->get_server_version(conn TSRMLS_CC);
+ zend_ulong server_version = conn->m->get_server_version(conn TSRMLS_CC);
if (server_version < 50605L) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
smart_str_free(&tmp_str);
break;
} else if (mode & TRANS_START_READ_WRITE) {
- if (tmp_str.s->len) {
+ if (tmp_str.s && tmp_str.s->len) {
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
}
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
} else if (mode & TRANS_START_READ_ONLY) {
- if (tmp_str.s->len) {
+ if (tmp_str.s && tmp_str.s->len) {
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
}
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index f79dc37a3e..1a23781eb0 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -219,7 +219,7 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn);
#define mysqlnd_escape_string(newstr, escapestr, escapestr_len) \
mysqlnd_old_escape_string((newstr), (escapestr), (escapestr_len) TSRMLS_CC)
-PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+PHPAPI zend_ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
/* PS */
@@ -264,25 +264,25 @@ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_L
#define MYSQLND_METHOD_PRIVATE(class, method) php_##class##_##method##_priv
ZEND_BEGIN_MODULE_GLOBALS(mysqlnd)
- zend_bool collect_statistics;
- zend_bool collect_memory_statistics;
char * debug; /* The actual string */
char * trace_alloc_settings; /* The actual string */
MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */
MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */
- php_int_t net_cmd_buffer_size;
- php_int_t net_read_buffer_size;
- php_int_t log_mask;
- php_int_t net_read_timeout;
- php_int_t mempool_default_size;
- php_int_t debug_emalloc_fail_threshold;
- php_int_t debug_ecalloc_fail_threshold;
- php_int_t debug_erealloc_fail_threshold;
- php_int_t debug_malloc_fail_threshold;
- php_int_t debug_calloc_fail_threshold;
- php_int_t debug_realloc_fail_threshold;
+ zend_long net_cmd_buffer_size;
+ zend_long net_read_buffer_size;
+ zend_long log_mask;
+ zend_long net_read_timeout;
+ zend_long mempool_default_size;
+ zend_long debug_emalloc_fail_threshold;
+ zend_long debug_ecalloc_fail_threshold;
+ zend_long debug_erealloc_fail_threshold;
+ zend_long debug_malloc_fail_threshold;
+ zend_long debug_calloc_fail_threshold;
+ zend_long debug_realloc_fail_threshold;
char * sha256_server_public_key;
zend_bool fetch_data_copy;
+ zend_bool collect_statistics;
+ zend_bool collect_memory_statistics;
ZEND_END_MODULE_GLOBALS(mysqlnd)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd)
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index 903753ef89..daa758c043 100644
--- a/ext/mysqlnd/mysqlnd_alloc.c
+++ b/ext/mysqlnd/mysqlnd_alloc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -79,7 +79,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_emalloc_name);
@@ -119,7 +119,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold);
+ zend_long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name);
@@ -162,7 +162,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name);
@@ -203,7 +203,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold);
+ zend_long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name);
#if PHP_DEBUG
@@ -246,7 +246,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_erealloc_name);
@@ -287,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
#if PHP_DEBUG
- php_int_t * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold);
+ zend_long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_perealloc_name);
@@ -393,7 +393,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_malloc_name);
@@ -432,7 +432,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_calloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_calloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_calloc_name);
@@ -471,7 +471,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
- php_int_t * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
+ zend_long * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
#endif
TRACE_ALLOC_ENTER(mysqlnd_realloc_name);
@@ -539,7 +539,7 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D)
#define SMART_STR_START_SIZE 2048
#define SMART_STR_PREALLOC 512
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* {{{ _mysqlnd_pestrndup */
diff --git a/ext/mysqlnd/mysqlnd_alloc.h b/ext/mysqlnd/mysqlnd_alloc.h
index eef5988829..b8a14fd1ab 100644
--- a/ext/mysqlnd/mysqlnd_alloc.h
+++ b/ext/mysqlnd/mysqlnd_alloc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index 76d4a56f38..255098c4f3 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,7 +37,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
const char * const db,
const size_t db_len,
const MYSQLND_OPTIONS * const options,
- php_uint_t mysql_flags,
+ zend_ulong mysql_flags,
unsigned int server_charset_no,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
@@ -361,7 +361,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_OPTIONS * const options,
const MYSQLND_NET_OPTIONS * const net_options,
- php_uint_t mysql_flags
+ zend_ulong mysql_flags
TSRMLS_DC)
{
zend_uchar * ret = NULL;
@@ -421,7 +421,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_OPTIONS * const options,
const MYSQLND_NET_OPTIONS * const net_options,
- php_uint_t mysql_flags
+ zend_ulong mysql_flags
TSRMLS_DC)
{
zend_uchar * ret = NULL;
@@ -553,7 +553,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
BIO_free(bio);
DBG_INF("Successfully loaded");
DBG_INF_FMT("Public key:%*.s", key_str->len, key_str->val);
- STR_RELEASE(key_str);
+ zend_string_release(key_str);
}
php_stream_free(stream, PHP_STREAM_FREE_CLOSE);
}
@@ -571,7 +571,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_OPTIONS * const options,
const MYSQLND_NET_OPTIONS * const net_options,
- php_uint_t mysql_flags
+ zend_ulong mysql_flags
TSRMLS_DC)
{
RSA * server_public_key;
diff --git a/ext/mysqlnd/mysqlnd_block_alloc.c b/ext/mysqlnd/mysqlnd_block_alloc.c
index 100e807bae..705f52ea82 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.c
+++ b/ext/mysqlnd/mysqlnd_block_alloc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_block_alloc.h b/ext/mysqlnd/mysqlnd_block_alloc.h
index f9627744d5..c0232d4286 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.h
+++ b/ext/mysqlnd/mysqlnd_block_alloc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c
index fa97b877e5..97a49e1054 100644
--- a/ext/mysqlnd/mysqlnd_charset.c
+++ b/ext/mysqlnd/mysqlnd_charset.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -726,7 +726,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name
/* {{{ mysqlnd_cset_escape_quotes */
-PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr,
const char * escapestr, size_t escapestr_len TSRMLS_DC)
{
const char *newstr_s = newstr;
@@ -780,7 +780,7 @@ PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset,
/* {{{ mysqlnd_cset_escape_slashes */
-PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
const char * escapestr, size_t escapestr_len TSRMLS_DC)
{
const char *newstr_s = newstr;
diff --git a/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h
index 0a7ced68aa..ef77b2fb74 100644
--- a/ext/mysqlnd/mysqlnd_charset.h
+++ b/ext/mysqlnd/mysqlnd_charset.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -21,10 +21,10 @@
#ifndef MYSQLND_CHARSET_H
#define MYSQLND_CHARSET_H
-PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr,
+PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr,
const char *escapestr, size_t escapestr_len TSRMLS_DC);
-PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
const char *escapestr, size_t escapestr_len TSRMLS_DC);
struct st_mysqlnd_plugin_charsets
@@ -34,8 +34,8 @@ struct st_mysqlnd_plugin_charsets
{
const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr);
const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name);
- php_uint_t (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
- php_uint_t (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+ zend_ulong (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+ zend_ulong (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
} methods;
};
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index 92121cf247..f1fde4efbb 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index 6f073b1489..bb4ff3e895 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -124,7 +124,8 @@ PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[] TSRMLS_D
if ((dbg_obj2)) { \
dbg_skip_trace |= !(dbg_obj2)->m->func_enter((dbg_obj2), __LINE__, __FILE__, func_name, strlen(func_name)); \
} \
- if (dbg_skip_trace); /* shut compiler's mouth */\
+ if (dbg_skip_trace) \
+ /* EMPTY */ ; /* shut compiler's mouth */ \
do { \
if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \
((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \
diff --git a/ext/mysqlnd/mysqlnd_driver.c b/ext/mysqlnd/mysqlnd_driver.c
index 98826b9ce3..e67d023edb 100644
--- a/ext/mysqlnd/mysqlnd_driver.c
+++ b/ext/mysqlnd/mysqlnd_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h
index 81be117277..90068783d9 100644
--- a/ext/mysqlnd/mysqlnd_enum_n_def.h
+++ b/ext/mysqlnd/mysqlnd_enum_n_def.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -606,7 +606,7 @@ enum php_mysqlnd_server_command
};
-#define MYSQLND_DEFAULT_PREFETCH_ROWS (php_uint_t) 1
+#define MYSQLND_DEFAULT_PREFETCH_ROWS (zend_ulong) 1
#define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */
#define MYSQLND_REFRESH_LOG 2 /* Start on new log file */
diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.c b/ext/mysqlnd/mysqlnd_ext_plugin.c
index 13f1e294dc..43f1318caa 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.c
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.h b/ext/mysqlnd/mysqlnd_ext_plugin.h
index d4a9d6cfc0..c66043da83 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.h
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_libmysql_compat.h b/ext/mysqlnd/mysqlnd_libmysql_compat.h
index b8ff959d18..db3883cd1e 100644
--- a/ext/mysqlnd/mysqlnd_libmysql_compat.h
+++ b/ext/mysqlnd/mysqlnd_libmysql_compat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index ab7a1ae9eb..a29a5a186d 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index e014f86390..da92acfbff 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -193,7 +193,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha
SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr->val);
if (errstr) {
/* no mnd_ since we don't allocate it */
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
DBG_RETURN(NULL);
}
@@ -676,7 +676,7 @@ MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * co
}
net->compressed_envelope_packet_no++;
#ifdef MYSQLND_DUMP_HEADER_N_BODY
- DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (php_uint_t) net_payload_size);
+ DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (zend_ulong) net_payload_size);
#endif
/* Now let's read from the wire, decompress it and fill the read buffer */
net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_stats, error_info TSRMLS_CC);
@@ -950,7 +950,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
DBG_RETURN(PASS);
#else
DBG_ENTER("mysqlnd_net::enable_ssl");
- DBG_INFO("MYSQLND_SSL_SUPPORTED is not defined");
+ DBG_INF("MYSQLND_SSL_SUPPORTED is not defined");
DBG_RETURN(PASS);
#endif
}
diff --git a/ext/mysqlnd/mysqlnd_net.h b/ext/mysqlnd/mysqlnd_net.h
index 76a474bc5f..699dd7f7d5 100644
--- a/ext/mysqlnd/mysqlnd_net.h
+++ b/ext/mysqlnd/mysqlnd_net.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c
index 7f5fb9b03f..3bb3c05147 100644
--- a/ext/mysqlnd/mysqlnd_plugin.c
+++ b/ext/mysqlnd/mysqlnd_plugin.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h
index d9936e0425..424f52d1e6 100644
--- a/ext/mysqlnd/mysqlnd_portability.h
+++ b/ext/mysqlnd/mysqlnd_portability.h
@@ -194,13 +194,13 @@ This file is public domain and comes with NO WARRANTY of any kind */
(((uint32_t) (zend_uchar) (A)[2]) << 16) |\
(((uint32_t) (zend_uchar) (A)[1]) << 8) | \
((uint32_t) (zend_uchar) (A)[0])))
-#define sint4korr(A) (*((php_int_t *) (A)))
+#define sint4korr(A) (*((zend_long *) (A)))
#define uint2korr(A) (*((uint16_t *) (A)))
#define uint3korr(A) (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
(((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
(((uint32_t) ((zend_uchar) (A)[2])) << 16))
-#define uint4korr(A) (*((php_uint_t *) (A)))
+#define uint4korr(A) (*((zend_ulong *) (A)))
@@ -211,7 +211,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
*(T)= (zend_uchar) ((A));\
*(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\
*(T+2)=(zend_uchar) (((A) >> 16)); }
-#define int4store(T,A) *((php_int_t *) (T))= (php_int_t) (A)
+#define int4store(T,A) *((zend_long *) (T))= (zend_long) (A)
#define int5store(T,A) { \
*((zend_uchar *)(T))= (zend_uchar)((A));\
*(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\
@@ -232,12 +232,12 @@ This file is public domain and comes with NO WARRANTY of any kind */
typedef union {
double v;
- php_int_t m[2];
+ zend_long m[2];
} float8get_union;
-#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((php_int_t*) (M)); \
- ((float8get_union *)&(V))->m[1] = *(((php_int_t*) (M))+1); }
-#define float8store(T,V) { *((php_int_t *) (T)) = ((float8get_union *)&(V))->m[0]; \
- *(((php_int_t *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
+#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((zend_long*) (M)); \
+ ((float8get_union *)&(V))->m[1] = *(((zend_long*) (M))+1); }
+#define float8store(T,V) { *((zend_long *) (T)) = ((float8get_union *)&(V))->m[0]; \
+ *(((zend_long *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
#define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); }
/* From Andrey Hristov based on float8get */
#define floatget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float))
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index 475a33d38e..f05e352baa 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -209,7 +209,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
const char * const db,
const size_t db_len,
const MYSQLND_OPTIONS * const options,
- php_uint_t mysql_flags,
+ zend_ulong mysql_flags,
unsigned int server_charset_no,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index c47da0262a..1b2602e6b6 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -115,7 +115,7 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s TSRMLS_DC)
SET_OOM_ERROR(*conn->error_info);
DBG_RETURN(NULL);
}
- memset(set->data, 0, (size_t)(result->stored_data->row_count * result->meta->field_count * sizeof(zval)));;
+ memset(set->data, 0, (size_t)(result->stored_data->row_count * result->meta->field_count * sizeof(zval)));
}
/* Position at the first row */
set->data_cursor = set->data;
@@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(current_row[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(current_row[i]);
+ zend_ulong len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -905,8 +905,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, unsigned i
#endif
if (!Z_ISNULL_P(data)) {
if ((Z_TYPE_P(data) == IS_STRING) &&
- (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) {
- meta->fields[i].max_length = Z_STRSIZE_P(data);
+ (meta->fields[i].max_length < (zend_ulong) Z_STRLEN_P(data))) {
+ meta->fields[i].max_length = Z_STRLEN_P(data);
}
ZVAL_COPY_VALUE(result, data);
/* copied data, thus also the ownership. Thus null data */
@@ -1093,8 +1093,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f
if (!Z_ISNULL_P(data)) {
if ((Z_TYPE_P(data) == IS_STRING) &&
- (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) {
- meta->fields[i].max_length = Z_STRSIZE_P(data);
+ (meta->fields[i].max_length < (zend_ulong) Z_STRLEN_P(data))) {
+ meta->fields[i].max_length = Z_STRLEN_P(data);
}
ZVAL_COPY_VALUE(result, data);
/* copied data, thus also the ownership. Thus null data */
@@ -1302,7 +1302,7 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC)
/* {{{ mysqlnd_stmt::send_long_data */
static enum_func_status
MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned int param_no,
- const char * const data, php_uint_t length TSRMLS_DC)
+ const char * const data, zend_ulong length TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
enum_func_status ret = FAIL;
@@ -1879,7 +1879,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s,
}
case STMT_ATTR_CURSOR_TYPE: {
unsigned int ival = *(unsigned int *) value;
- if (ival > (php_uint_t) CURSOR_TYPE_READ_ONLY) {
+ if (ival > (zend_ulong) CURSOR_TYPE_READ_ONLY) {
SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented");
DBG_INF("FAIL");
DBG_RETURN(FAIL);
@@ -1927,10 +1927,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s,
*(zend_bool *) value= stmt->update_max_length;
break;
case STMT_ATTR_CURSOR_TYPE:
- *(php_uint_t *) value= stmt->flags;
+ *(zend_ulong *) value= stmt->flags;
break;
case STMT_ATTR_PREFETCH_ROWS:
- *(php_uint_t *) value= stmt->prefetch_rows;
+ *(zend_ulong *) value= stmt->prefetch_rows;
break;
default:
DBG_RETURN(FAIL);
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index 8b59d918ba..e98d1c3a52 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +41,7 @@ enum mysqlnd_timestamp_type
struct st_mysqlnd_time
{
unsigned int year, month, day, hour, minute, second;
- php_uint_t second_part;
+ zend_ulong second_part;
zend_bool neg;
enum mysqlnd_timestamp_type time_type;
};
@@ -76,7 +76,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
case 1:uval = (uint64_t) uint1korr(*row);break;
}
-#if SIZEOF_ZEND_INT==4
+#if SIZEOF_ZEND_LONG==4
if (uval > INT_MAX) {
DBG_INF("stringify");
tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
@@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
#endif /* #if SIZEOF_LONG==4 */
{
if (byte_count < 8 || uval <= L64(9223372036854775807)) {
- ZVAL_INT(zv, (php_int_t) uval); /* the cast is safe, we are in the range */
+ ZVAL_LONG(zv, (zend_long) uval); /* the cast is safe, we are in the range */
} else {
DBG_INF("stringify");
tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
@@ -105,14 +105,14 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
case 1:lval = (int64_t) *(int8_t*)*row;break;
}
-#if SIZEOF_ZEND_INT==4
+#if SIZEOF_ZEND_LONG==4
if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) {
DBG_INF("stringify");
tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval);
} else
#endif /* SIZEOF */
{
- ZVAL_INT(zv, (php_int_t) lval); /* the cast is safe, we are in the range */
+ ZVAL_LONG(zv, (zend_long) lval); /* the cast is safe, we are in the range */
}
}
@@ -200,17 +200,27 @@ ps_fetch_float(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_l
/* The following cast is guaranteed to do the right thing */
dval = (double) d32val;
}
+#elif defined(PHP_WIN32)
+ {
+ /* float datatype on Winows is already 4 byte but has a precision of 7 digits */
+ char num_buf[2048];
+ (void)_gcvt_s(num_buf, 2048, fval, field->decimals >= 31 ? 7 : field->decimals);
+ dval = zend_strtod(num_buf, NULL);
+ }
#else
{
char num_buf[2048]; /* Over allocated */
char *s;
+#ifndef FLT_DIG
+# define FLT_DIG 6
+#endif
/* Convert to string. Ignoring localization, etc.
* Following MySQL's rules. If precision is undefined (NOT_FIXED_DEC i.e. 31)
* or larger than 31, the value is limited to 6 (FLT_DIG).
*/
s = php_gcvt(fval,
- field->decimals >= 31 ? 6 : field->decimals,
+ field->decimals >= 31 ? FLT_DIG : field->decimals,
'.',
'e',
num_buf);
@@ -246,7 +256,7 @@ static void
ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
{
struct st_mysqlnd_time t;
- php_uint_t length; /* First byte encodes the length*/
+ zend_ulong length; /* First byte encodes the length*/
char * value;
DBG_ENTER("ps_fetch_time");
@@ -256,11 +266,11 @@ ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_le
t.time_type = MYSQLND_TIMESTAMP_TIME;
t.neg = (zend_bool) to[0];
- t.day = (php_uint_t) sint4korr(to+1);
+ t.day = (zend_ulong) sint4korr(to+1);
t.hour = (unsigned int) to[5];
t.minute = (unsigned int) to[6];
t.second = (unsigned int) to[7];
- t.second_part = (length > 8) ? (php_uint_t) sint4korr(to+8) : 0;
+ t.second_part = (length > 8) ? (zend_ulong) sint4korr(to+8) : 0;
t.year = t.month= 0;
if (t.day) {
/* Convert days to hours at once */
@@ -289,7 +299,7 @@ static void
ps_fetch_date(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
{
struct st_mysqlnd_time t = {0};
- php_uint_t length; /* First byte encodes the length*/
+ zend_ulong length; /* First byte encodes the length*/
char * value;
DBG_ENTER("ps_fetch_date");
@@ -326,7 +336,7 @@ static void
ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
{
struct st_mysqlnd_time t;
- php_uint_t length; /* First byte encodes the length*/
+ zend_ulong length; /* First byte encodes the length*/
char * value;
DBG_ENTER("ps_fetch_datetime");
@@ -347,7 +357,7 @@ ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pac
} else {
t.hour = t.minute = t.second= 0;
}
- t.second_part = (length > 7) ? (php_uint_t) sint4korr(to+7) : 0;
+ t.second_part = (length > 7) ? (zend_ulong) sint4korr(to+7) : 0;
(*row)+= length;
} else {
@@ -373,7 +383,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_
For now just copy, before we make it possible
to write \0 to the row buffer
*/
- const php_uint_t length = php_mysqlnd_net_field_length(row);
+ const zend_ulong length = php_mysqlnd_net_field_length(row);
DBG_ENTER("ps_fetch_string");
DBG_INF_FMT("len = %lu", length);
DBG_INF("copying from the row buffer");
@@ -389,7 +399,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_
static void
ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
{
- php_uint_t length = php_mysqlnd_net_field_length(row);
+ zend_ulong length = php_mysqlnd_net_field_length(row);
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, length TSRMLS_CC);
}
/* }}} */
@@ -406,32 +416,32 @@ void _mysqlnd_init_ps_fetch_subsystem()
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float;
@@ -495,7 +505,7 @@ void _mysqlnd_init_ps_fetch_subsystem()
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].func = ps_fetch_bit;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].pack_len = 8;
- mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_INT;
+ mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_LONG;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].can_ret_as_str_in_uni = TRUE;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_VAR_STRING].func = ps_fetch_string;
@@ -610,7 +620,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie
ZVAL_DEREF(parameter);
if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) {
/* always copy the var, because we do many conversions */
- if (Z_TYPE_P(parameter) != IS_INT &&
+ if (Z_TYPE_P(parameter) != IS_LONG &&
PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i TSRMLS_CC))
{
SET_OOM_ERROR(*stmt->error_info);
@@ -620,7 +630,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie
if it doesn't fit in a long send it as a string.
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
*/
- if (Z_TYPE_P(parameter) != IS_INT) {
+ if (Z_TYPE_P(parameter) != IS_LONG) {
zval *tmp_data = (*copies_param && !Z_ISUNDEF((*copies_param)[i]))? &(*copies_param)[i]: parameter;
/*
Because converting to double and back to long can lead
@@ -636,11 +646,11 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
We do transformation here, which will be used later when sending types. The code later relies on this.
*/
- if (Z_DVAL(tmp_data_copy) > PHP_INT_MAX || Z_DVAL(tmp_data_copy) < PHP_INT_MIN) {
+ if (Z_DVAL(tmp_data_copy) > ZEND_LONG_MAX || Z_DVAL(tmp_data_copy) < ZEND_LONG_MIN) {
stmt->send_types_to_server = *resend_types_next_time = 1;
convert_to_string_ex(tmp_data);
} else {
- convert_to_int_ex(tmp_data);
+ convert_to_long_ex(tmp_data);
}
zval_ptr_dtor(&tmp_data_copy);
@@ -663,7 +673,7 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u
short current_type = stmt->param_bind[i].type;
zval *parameter = &stmt->param_bind[i].zv;
/* our types are not unsigned */
-#if SIZEOF_ZEND_INT==8
+#if SIZEOF_ZEND_LONG==8
if (current_type == MYSQL_TYPE_LONG) {
current_type = MYSQL_TYPE_LONGLONG;
}
@@ -674,17 +684,17 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u
if it doesn't fit in a long send it as a string.
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
*/
- if (Z_TYPE_P(parameter) != IS_INT) {
+ if (Z_TYPE_P(parameter) != IS_LONG) {
const zval *tmp_data = (copies && !Z_ISUNDEF(copies[i]))? &copies[i] : parameter;
/*
- In case of IS_INT we do nothing, it is ok, in case of string, we just need to set current_type.
+ In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type.
The actual transformation has been performed several dozens line above.
*/
if (Z_TYPE_P(tmp_data) == IS_STRING) {
current_type = MYSQL_TYPE_VAR_STRING;
/*
don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING
- we force convert_to_int_ex in all cases, thus the type will be right in the next switch.
+ we force convert_to_long_ex in all cases, thus the type will be right in the next switch.
if the type is however not long, then we will do a goto in the next switch.
We want to preserve the original bind type given by the user. Thus, we do these hacks.
*/
@@ -751,7 +761,7 @@ mysqlnd_stmt_execute_calculate_param_values_size(MYSQLND_STMT_DATA * stmt, zval
if (Z_TYPE_P(tmp_data) == IS_STRING) {
goto use_string;
}
- convert_to_int_ex(tmp_data);
+ convert_to_long_ex(tmp_data);
}
*data_size += 4 + is_longlong;
break;
@@ -778,7 +788,7 @@ use_string:
the_var = &((*copies_param)[i]);
}
convert_to_string_ex(the_var);
- *data_size += Z_STRSIZE_P(the_var);
+ *data_size += Z_STRLEN_P(the_var);
break;
}
}
@@ -814,7 +824,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies,
goto send_string;
}
/* data has alreade been converted to long */
- int8store(*p, Z_IVAL_P(data));
+ int8store(*p, Z_LVAL_P(data));
(*p) += 8;
break;
case MYSQL_TYPE_LONG:
@@ -822,7 +832,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies,
goto send_string;
}
/* data has alreade been converted to long */
- int4store(*p, Z_IVAL_P(data));
+ int4store(*p, Z_LVAL_P(data));
(*p) += 4;
break;
case MYSQL_TYPE_LONG_BLOB:
@@ -836,7 +846,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies,
case MYSQL_TYPE_VAR_STRING:
send_string:
{
- size_t len = Z_STRSIZE_P(data);
+ size_t len = Z_STRLEN_P(data);
/* to is after p. The latter hasn't been moved */
*p = php_mysqlnd_net_store_length(*p, len);
memcpy(*p, Z_STRVAL_P(data), len);
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index 65ad1099b6..610642d8de 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(data_cursor[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(data_cursor[i]);
+ zend_ulong len = Z_STRLEN(data_cursor[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(current_row[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(current_row[i]);
+ zend_ulong len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -599,7 +599,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s
of PHP, to be called as separate function. But let's have it for
completeness.
*/
-static php_uint_t *
+static zend_ulong *
MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC)
{
const MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result;
@@ -631,7 +631,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED
of PHP, to be called as separate function. But let's have it for
completeness.
*/
-static php_uint_t *
+static zend_ulong *
MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC)
{
const MYSQLND_RES_BUFFERED_C * set = (MYSQLND_RES_BUFFERED_C *) result;
@@ -648,7 +648,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED *
/* {{{ mysqlnd_result_unbuffered::fetch_lengths */
-static php_uint_t *
+static zend_ulong *
MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC)
{
/* simulate output of libmysql */
@@ -658,10 +658,10 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED
/* {{{ mysqlnd_res::fetch_lengths */
-static php_uint_t *
+static zend_ulong *
MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC)
{
- php_uint_t * ret;
+ zend_ulong * ret;
DBG_ENTER("mysqlnd_res::fetch_lengths");
ret = result->stored_data && result->stored_data->m.fetch_lengths ?
result->stored_data->m.fetch_lengths(result->stored_data TSRMLS_CC) :
@@ -731,11 +731,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi
*row = mnd_malloc(field_count * sizeof(char *));
if (*row) {
MYSQLND_FIELD * field = meta->fields;
- php_uint_t * lengths = result->unbuf->lengths;
+ zend_ulong * lengths = result->unbuf->lengths;
for (i = 0; i < field_count; i++, field++) {
zval * data = &result->unbuf->last_row_data[i];
- unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0;
+ unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0;
/* BEGIN difference between normal normal fetch and _c */
if (Z_TYPE_P(data) != IS_NULL) {
@@ -849,11 +849,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
{
HashTable * row_ht = Z_ARRVAL_P(row);
MYSQLND_FIELD * field = meta->fields;
- php_uint_t * lengths = result->unbuf->lengths;
+ zend_ulong * lengths = result->unbuf->lengths;
for (i = 0; i < field_count; i++, field++) {
zval * data = &result->unbuf->last_row_data[i];
- unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0;
+ unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0;
if (flags & MYSQLND_FETCH_NUM) {
Z_TRY_ADDREF_P(data);
@@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(current_row[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(current_row[i]);
+ zend_ulong len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -1017,7 +1017,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void
for (i = 0; i < field_count; i++) {
zval * data = &current_row[i];
- set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0;
+ set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0;
if (Z_TYPE_P(data) != IS_NULL) {
convert_to_string(data);
@@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(current_row[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(current_row[i]);
+ zend_ulong len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -1104,7 +1104,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo
for (i = 0; i < field_count; i++) {
zval * data = &current_row[i];
- set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0;
+ set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0;
if (flags & MYSQLND_FETCH_NUM) {
Z_TRY_ADDREF_P(data);
@@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void
Thus for NULL and zero-length we are quite efficient.
*/
if (Z_TYPE(current_row[i]) == IS_STRING) {
- php_uint_t len = Z_STRSIZE(current_row[i]);
+ zend_ulong len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
meta->fields[i].max_length = len;
}
@@ -1199,7 +1199,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void
for (i = 0; i < field_count; i++) {
zval * data = &current_row[i];
- set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0;
+ set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0;
if (flags & MYSQLND_FETCH_NUM) {
Z_TRY_ADDREF_P(data);
@@ -1776,7 +1776,7 @@ static void
MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC)
{
zval row;
- php_uint_t i = 0;
+ zend_ulong i = 0;
MYSQLND_RES_BUFFERED *set = result->stored_data;
DBG_ENTER("mysqlnd_res::fetch_all");
@@ -1927,7 +1927,7 @@ mysqlnd_result_unbuffered_init(unsigned int field_count, zend_bool ps, zend_bool
DBG_RETURN(NULL);
}
- if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) {
+ if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) {
mnd_pefree(ret, persistent);
DBG_RETURN(NULL);
}
@@ -1967,7 +1967,7 @@ mysqlnd_result_buffered_zval_init(unsigned int field_count, zend_bool ps, zend_b
if (!ret) {
DBG_RETURN(NULL);
}
- if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) {
+ if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) {
mnd_pefree(ret, persistent);
DBG_RETURN(NULL);
}
@@ -2010,7 +2010,7 @@ mysqlnd_result_buffered_c_init(unsigned int field_count, zend_bool ps, zend_bool
if (!ret) {
DBG_RETURN(NULL);
}
- if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) {
+ if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) {
mnd_pefree(ret, persistent);
DBG_RETURN(NULL);
}
diff --git a/ext/mysqlnd/mysqlnd_result.h b/ext/mysqlnd/mysqlnd_result.h
index f7e22a1d87..700efed83e 100644
--- a/ext/mysqlnd/mysqlnd_result.h
+++ b/ext/mysqlnd/mysqlnd_result.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c
index ac7526d22d..447de33ac9 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.c
+++ b/ext/mysqlnd/mysqlnd_result_meta.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -42,7 +42,7 @@ php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS
meta->def = NULL;
}
if (meta->sname) {
- STR_RELEASE(meta->sname);
+ zend_string_release(meta->sname);
}
}
}
@@ -64,7 +64,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
}
field_packet->persistent_alloc = meta->persistent;
for (;i < meta->field_count; i++) {
- php_int_t idx;
+ zend_ulong idx;
if (meta->fields[i].root) {
/* We re-read metadata for PS */
@@ -226,7 +226,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, clone_metadata)(const MYSQLND_RES_METADATA * co
memcpy(new_fields[i].root, orig_fields[i].root, new_fields[i].root_len);
if (orig_fields[i].sname) {
- new_fields[i].sname = STR_COPY(orig_fields[i].sname);
+ new_fields[i].sname = zend_string_copy(orig_fields[i].sname);
new_fields[i].name = new_fields[i].sname->val;
new_fields[i].name_length = new_fields[i].sname->len;
}
diff --git a/ext/mysqlnd/mysqlnd_result_meta.h b/ext/mysqlnd/mysqlnd_result_meta.h
index 97720adba1..91388b65a5 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.h
+++ b/ext/mysqlnd/mysqlnd_result_meta.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_reverse_api.c b/ext/mysqlnd/mysqlnd_reverse_api.c
index 49684876a4..553a507818 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.c
+++ b/ext/mysqlnd/mysqlnd_reverse_api.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_reverse_api.h b/ext/mysqlnd/mysqlnd_reverse_api.h
index 79c0feb60a..58a1ddd087 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.h
+++ b/ext/mysqlnd/mysqlnd_reverse_api.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c
index a664f9b578..e25befbc15 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_statistics.h b/ext/mysqlnd/mysqlnd_statistics.h
index 0493d89396..bfc316ec59 100644
--- a/ext/mysqlnd/mysqlnd_statistics.h
+++ b/ext/mysqlnd/mysqlnd_statistics.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index 87270a93c8..6be8b68034 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,7 @@
#ifndef MYSQLND_STRUCTS_H
#define MYSQLND_STRUCTS_H
-#include "ext/standard/php_smart_str_public.h"
+#include "zend_smart_str_public.h"
#define MYSQLND_TYPEDEFED_METHODS
@@ -56,9 +56,9 @@ struct st_mysqlnd_memory_pool_chunk
size_t app;
MYSQLND_MEMORY_POOL *pool;
zend_uchar *ptr;
- unsigned int size;
enum_func_status (*resize_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigned int size TSRMLS_DC);
void (*free_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk TSRMLS_DC);
+ unsigned int size;
zend_bool from_pool;
};
@@ -80,8 +80,8 @@ typedef struct st_mysqlnd_field
const char *db; /* Database for table */
const char *catalog; /* Catalog for table */
char *def; /* Default value (set by mysql_list_fields) */
- php_uint_t length; /* Width of column (create length) */
- php_uint_t max_length; /* Max width for selected set */
+ zend_ulong length; /* Width of column (create length) */
+ zend_ulong max_length; /* Max width for selected set */
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
@@ -414,7 +414,7 @@ struct st_mysqlnd_object_factory_methods
typedef enum_func_status (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC);
-typedef php_int_t (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
+typedef zend_ulong (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__send_query)(MYSQLND_CONN_DATA * conn, const char *query, unsigned int query_len TSRMLS_DC);
@@ -441,7 +441,7 @@ typedef const char * (*func_mysqlnd_conn_data__get_sqlstate)(const MYSQLND_CONN
typedef uint64_t (*func_mysqlnd_conn_data__get_thread_id)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef void (*func_mysqlnd_conn_data__get_statistics)(const MYSQLND_CONN_DATA * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC);
-typedef php_uint_t (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
+typedef zend_ulong (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef const char * (*func_mysqlnd_conn_data__get_server_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_conn_data__get_server_statistics)(MYSQLND_CONN_DATA * conn, zend_string **message TSRMLS_DC);
typedef const char * (*func_mysqlnd_conn_data__get_host_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
@@ -639,7 +639,7 @@ typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_field_direct)(MYSQLND_RES
typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_fields)(MYSQLND_RES * const result TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_res__read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn TSRMLS_DC);
-typedef php_uint_t * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC);
+typedef zend_ulong * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_res__store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, MYSQLND_RES_METADATA * meta, MYSQLND_MEMORY_POOL_CHUNK *** row_buffers, zend_bool binary_protocol TSRMLS_DC);
typedef void (*func_mysqlnd_res__free_result_buffers)(MYSQLND_RES * result TSRMLS_DC); /* private */
@@ -690,7 +690,7 @@ struct st_mysqlnd_res_methods
typedef uint64_t (*func_mysqlnd_result_unbuffered__num_rows)(const MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
-typedef php_uint_t * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
+typedef zend_ulong * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
typedef void (*func_mysqlnd_result_unbuffered__free_last_data)(MYSQLND_RES_UNBUFFERED * result, MYSQLND_STATS * const global_stats TSRMLS_DC);
typedef void (*func_mysqlnd_result_unbuffered__free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQLND_STATS * const global_stats TSRMLS_DC);
@@ -707,7 +707,7 @@ struct st_mysqlnd_result_unbuffered_methods
typedef uint64_t (*func_mysqlnd_result_buffered__num_rows)(const MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_result_buffered__initialize_result_set_rest)(MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta,
MYSQLND_STATS * stats, zend_bool int_and_float_native TSRMLS_DC);
-typedef php_uint_t * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
+typedef zend_ulong * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_result_buffered__data_seek)(MYSQLND_RES_BUFFERED * const result, const uint64_t row TSRMLS_DC);
typedef void (*func_mysqlnd_result_buffered__free_result)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
@@ -763,7 +763,7 @@ typedef enum_func_status (*func_mysqlnd_stmt__bind_one_parameter)(MYSQLND_STMT *
typedef enum_func_status (*func_mysqlnd_stmt__refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_stmt__bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC);
typedef enum_func_status (*func_mysqlnd_stmt__bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC);
-typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, php_uint_t length TSRMLS_DC);
+typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, zend_ulong length TSRMLS_DC);
typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_parameter_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
typedef uint64_t (*func_mysqlnd_stmt__get_last_insert_id)(const MYSQLND_STMT * const stmt TSRMLS_DC);
@@ -869,11 +869,10 @@ struct st_mysqlnd_net_data
struct st_mysqlnd_net
{
- struct st_mysqlnd_net_data * data;
+ /* cmd buffer */
+ MYSQLND_CMD_BUFFER cmd_buffer;
- /* sequence for simple checking of correct packets */
- zend_uchar packet_no;
- zend_uchar compressed_envelope_packet_no;
+ struct st_mysqlnd_net_data * data;
#ifdef MYSQLND_COMPRESSION_ENABLED
MYSQLND_READ_BUFFER * uncompressed_data;
@@ -881,10 +880,11 @@ struct st_mysqlnd_net
void * unused_pad1;
#endif
- /* cmd buffer */
- MYSQLND_CMD_BUFFER cmd_buffer;
-
zend_bool persistent;
+
+ /* sequence for simple checking of correct packets */
+ zend_uchar packet_no;
+ zend_uchar compressed_envelope_packet_no;
};
@@ -923,10 +923,10 @@ struct st_mysqlnd_connection_data
unsigned int connect_or_select_db_len;
MYSQLND_INFILE infile;
unsigned int protocol_version;
- php_uint_t max_packet_size;
+ zend_ulong max_packet_size;
unsigned int port;
- php_uint_t client_flag;
- php_uint_t server_capabilities;
+ zend_ulong client_flag;
+ zend_ulong server_capabilities;
/* For UPSERT queries */
MYSQLND_UPSERT_STATUS * upsert_status;
@@ -986,7 +986,7 @@ struct st_mysqlnd_connection
struct mysqlnd_field_hash_key
{
zend_bool is_numeric;
- php_uint_t key;
+ zend_ulong key;
};
@@ -994,14 +994,17 @@ struct st_mysqlnd_result_metadata
{
MYSQLND_FIELD *fields;
struct mysqlnd_field_hash_key *zend_hash_keys;
- unsigned int current_field;
- unsigned int field_count;
+
+ struct st_mysqlnd_res_meta_methods * m;
+
+ size_t bit_fields_total_len; /* trailing \0 not counted */
/* We need this to make fast allocs in rowp_read */
unsigned int bit_fields_count;
- size_t bit_fields_total_len; /* trailing \0 not counted */
- zend_bool persistent;
- struct st_mysqlnd_res_meta_methods * m;
+ unsigned int current_field;
+ unsigned int field_count;
+
+ zend_bool persistent;
};
@@ -1011,7 +1014,7 @@ struct st_mysqlnd_result_metadata
uint64_t initialized_rows; \
\
/* Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ \
- php_uint_t *lengths; \
+ zend_ulong *lengths; \
\
MYSQLND_MEMORY_POOL *result_set_memory_pool; \
\
@@ -1055,6 +1058,8 @@ struct st_mysqlnd_buffered_result_c
struct st_mysqlnd_unbuffered_result
{
+ struct st_mysqlnd_result_unbuffered_methods m;
+ uint64_t row_count;
/* For unbuffered (both normal and PS) */
zval *last_row_data;
@@ -1064,20 +1069,19 @@ struct st_mysqlnd_unbuffered_result
Column lengths of current row - both buffered and unbuffered.
For buffered results it duplicates the data found in **data
*/
- php_uint_t *lengths;
+ zend_ulong *lengths;
MYSQLND_MEMORY_POOL *result_set_memory_pool;
struct st_mysqlnd_packet_row * row_packet;
- uint64_t row_count;
+ unsigned int field_count;
+
zend_bool eof_reached;
- unsigned int field_count;
zend_bool ps;
zend_bool persistent;
- struct st_mysqlnd_result_unbuffered_methods m;
};
@@ -1117,8 +1121,8 @@ struct st_mysqlnd_result_bind
struct st_mysqlnd_stmt_data
{
MYSQLND_CONN_DATA *conn;
- php_uint_t stmt_id;
- php_uint_t flags;/* cursor is set here */
+ zend_ulong stmt_id;
+ zend_ulong flags;/* cursor is set here */
enum_mysqlnd_stmt_state state;
unsigned int warning_count;
MYSQLND_RES *result;
@@ -1137,7 +1141,7 @@ struct st_mysqlnd_stmt_data
MYSQLND_ERROR_INFO error_info_impl;
zend_bool update_max_length;
- php_uint_t prefetch_rows;
+ zend_ulong prefetch_rows;
zend_bool cursor_exists;
mysqlnd_stmt_use_or_store_func default_rset_handler;
@@ -1166,7 +1170,7 @@ struct st_mysqlnd_plugin_header
{
unsigned int plugin_api_version;
const char * plugin_name;
- php_uint_t plugin_version;
+ zend_ulong plugin_version;
const char * plugin_string_version;
const char * plugin_license;
const char * plugin_author;
@@ -1203,7 +1207,7 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_OPTIONS * const options,
- const MYSQLND_NET_OPTIONS * const net_options, php_uint_t mysql_flags
+ const MYSQLND_NET_OPTIONS * const net_options, zend_ulong mysql_flags
TSRMLS_DC);
struct st_mysqlnd_authentication_plugin
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 2acccf3f43..1d86df7859 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -126,14 +126,14 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L
/* {{{ php_mysqlnd_net_field_length
Get next field's length */
-php_uint_t
+zend_ulong
php_mysqlnd_net_field_length(zend_uchar **packet)
{
register zend_uchar *p= (zend_uchar *)*packet;
if (*p < 251) {
(*packet)++;
- return (php_uint_t) *p;
+ return (zend_ulong) *p;
}
switch (*p) {
@@ -142,13 +142,13 @@ php_mysqlnd_net_field_length(zend_uchar **packet)
return MYSQLND_NULL_LENGTH;
case 252:
(*packet) += 3;
- return (php_uint_t) uint2korr(p+1);
+ return (zend_ulong) uint2korr(p+1);
case 253:
(*packet) += 4;
- return (php_uint_t) uint3korr(p+1);
+ return (zend_ulong) uint3korr(p+1);
default:
(*packet) += 9;
- return (php_uint_t) uint4korr(p+1);
+ return (zend_ulong) uint4korr(p+1);
}
}
/* }}} */
@@ -201,7 +201,7 @@ php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length)
if (length < (uint64_t) L64(16777216)) {
*packet++ = 253;
- int3store(packet,(php_uint_t) length);
+ int3store(packet,(zend_ulong) length);
return packet + 3;
}
*packet++ = 254;
@@ -524,7 +524,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
int1store(p, packet->auth_data_len);
++p;
/*!!!!! is the buffer big enough ??? */
- if ((sizeof(buffer) - (p - buffer)) < packet->auth_data_len) {
+ if (sizeof(buffer) < (packet->auth_data_len + (p - buffer))) {
DBG_ERR("the stack buffer was not enough!!");
DBG_RETURN(0);
}
@@ -567,7 +567,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
char *s_key;
unsigned int s_len;
- php_uint_t num_key;
+ zend_ulong num_key;
size_t value_len = strlen(*entry_value);
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
@@ -582,11 +582,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
{
zend_string * key;
- php_uint_t unused_num_key;
+ zend_ulong unused_num_key;
zval * entry_value;
ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) {
if (key) { /* HASH_KEY_IS_STRING */
- size_t value_len = Z_STRSIZE_P(entry_value);
+ size_t value_len = Z_STRLEN_P(entry_value);
ca_payload_len += php_mysqlnd_net_store_length_size(key->len);
ca_payload_len += key->len;
@@ -596,7 +596,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
} ZEND_HASH_FOREACH_END();
}
#endif
- if ((sizeof(buffer) - (p - buffer)) >= (ca_payload_len + php_mysqlnd_net_store_length_size(ca_payload_len))) {
+ if (sizeof(buffer) >= (ca_payload_len + php_mysqlnd_net_store_length_size(ca_payload_len) + (p - buffer))) {
p = php_mysqlnd_net_store_length(p, ca_payload_len);
#ifdef OLD_CODE
@@ -604,7 +604,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
char *s_key;
unsigned int s_len;
- php_uint_t num_key;
+ zend_ulong num_key;
size_t value_len = strlen(*entry_value);
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
/* copy key */
@@ -621,11 +621,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
#else
{
zend_string * key;
- php_uint_t unused_num_key;
+ zend_ulong unused_num_key;
zval * entry_value;
ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) {
if (key) { /* HASH_KEY_IS_STRING */
- size_t value_len = Z_STRSIZE_P(entry_value);
+ size_t value_len = Z_STRLEN_P(entry_value);
/* copy key */
p = php_mysqlnd_net_store_length(p, key->len);
@@ -685,7 +685,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D
zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf;
zend_uchar *p = buf;
zend_uchar *begin = buf;
- php_uint_t i;
+ zend_ulong i;
register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet;
DBG_ENTER("php_mysqlnd_auth_response_read");
@@ -848,7 +848,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf;
zend_uchar *p = buf;
zend_uchar *begin = buf;
- php_uint_t i;
+ zend_ulong i;
register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet;
DBG_ENTER("php_mysqlnd_ok_read");
@@ -1230,7 +1230,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
zend_uchar *p = buf;
zend_uchar *begin = buf;
char *root_ptr;
- php_uint_t len;
+ zend_ulong len;
MYSQLND_FIELD *meta;
unsigned int i, field_count = sizeof(rset_field_offsets)/sizeof(size_t);
@@ -1356,7 +1356,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
meta->root_len = total_len;
if (meta->name != mysqlnd_empty_string) {
- meta->sname = STR_INIT(meta->name, meta->name_length, packet->persistent_alloc);
+ meta->sname = zend_string_init(meta->name, meta->name_length, packet->persistent_alloc);
} else {
meta->sname = STR_EMPTY_ALLOC();
}
@@ -1587,7 +1587,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1,
STAT_BYTES_RECEIVED_PURE_DATA_PS,
(Z_TYPE_P(current_field) == IS_STRING)?
- Z_STRSIZE_P(current_field) : (p - orig_p));
+ Z_STRLEN_P(current_field) : (p - orig_p));
if (!((bit<<=1) & 255)) {
bit = 1; /* to the following byte */
@@ -1622,7 +1622,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) {
/* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */
- php_uint_t len = php_mysqlnd_net_field_length(&p);
+ zend_ulong len = php_mysqlnd_net_field_length(&p);
/* NULL or NOT NULL, this is the question! */
if (len == MYSQLND_NULL_LENGTH) {
@@ -1667,11 +1667,11 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len);
}
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
- if (as_int_or_float && perm_bind.php_type == IS_INT) {
+ if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
- if (perm_bind.pack_len < SIZEOF_ZEND_INT) {
+ if (perm_bind.pack_len < SIZEOF_ZEND_LONG) {
/* direct conversion */
int64_t v =
#ifndef PHP_WIN32
@@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
#else
_atoi64((char *) p);
#endif
- ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */
+ ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */
} else {
uint64_t v =
#ifndef PHP_WIN32
@@ -1689,9 +1689,9 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
#endif
zend_bool uns = fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE;
/* We have to make it ASCIIZ temporarily */
-#if SIZEOF_ZEND_INT==8
+#if SIZEOF_ZEND_LONG==8
if (uns == TRUE && v > 9223372036854775807L)
-#elif SIZEOF_ZEND_INT==4
+#elif SIZEOF_ZEND_LONG==4
if ((uns == TRUE && v > L64(2147483647)) ||
(uns == FALSE && (( L64(2147483647) < (int64_t) v) ||
(L64(-2147483648) > (int64_t) v))))
@@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
{
ZVAL_STRINGL(current_field, (char *)p, len);
} else {
- ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */
+ ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */
}
}
*(p + len) = save;
@@ -1730,12 +1730,12 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
later in this function there will be an advancement.
*/
p -= len;
- if (Z_TYPE_P(current_field) == IS_INT) {
- bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_IVAL_P(current_field));
+ if (Z_TYPE_P(current_field) == IS_LONG) {
+ bit_area += 1 + sprintf((char *)start, ZEND_LONG_FMT, Z_LVAL_P(current_field));
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
} else if (Z_TYPE_P(current_field) == IS_STRING){
- memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field));
- bit_area += Z_STRSIZE_P(current_field);
+ memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field));
+ bit_area += Z_STRLEN_P(current_field);
*bit_area++ = '\0';
zval_dtor(current_field);
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h
index 059cfb2416..5238715987 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.h
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,7 @@
#define MYSQLND_HEADER_SIZE 4
#define COMPRESSED_HEADER_SIZE 3
-#define MYSQLND_NULL_LENGTH (php_uint_t) ~0
+#define MYSQLND_NULL_LENGTH (zend_ulong) ~0
/* Used in mysqlnd_debug.c */
PHPAPI extern const char mysqlnd_read_header_name[];
@@ -90,20 +90,20 @@ typedef struct st_mysqlnd_packet_greet {
/* Client authenticates */
typedef struct st_mysqlnd_packet_auth {
MYSQLND_PACKET_HEADER header;
- uint32_t client_flags;
- uint32_t max_packet_size;
- uint8_t charset_no;
const char *user;
const zend_uchar *auth_data;
size_t auth_data_len;
const char *db;
const char *auth_plugin_name;
+ uint32_t client_flags;
+ uint32_t max_packet_size;
+ uint8_t charset_no;
/* Here the packet ends. This is user supplied data */
- size_t db_len;
zend_bool send_auth_data;
zend_bool is_change_user_packet;
zend_bool silent;
HashTable *connect_attr;
+ size_t db_len;
} MYSQLND_PACKET_AUTH;
/* Auth response packet */
@@ -185,7 +185,7 @@ typedef struct st_mysqlnd_packet_rset_header {
error_no != 0 => error
others => result set -> Read res_field packets up to field_count
*/
- php_uint_t field_count;
+ zend_ulong field_count;
/*
These are filled if no SELECT query. For SELECT warning_count
and server status are in the last row packet, the EOF packet.
@@ -258,7 +258,7 @@ typedef struct st_mysqlnd_packet_prepare_response {
MYSQLND_PACKET_HEADER header;
/* also known as field_count 0x00=OK , 0xFF=error */
unsigned char error_code;
- php_uint_t stmt_id;
+ zend_ulong stmt_id;
unsigned int field_count;
unsigned int param_count;
unsigned int warning_count;
@@ -300,7 +300,7 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response {
PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass, size_t pass_len);
-php_uint_t php_mysqlnd_net_field_length(zend_uchar **packet);
+zend_ulong php_mysqlnd_net_field_length(zend_uchar **packet);
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length);
size_t php_mysqlnd_net_store_length_size(uint64_t length);
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index 95747a7e3a..a16018f6ba 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "mysqlnd_statistics.h"
#include "mysqlnd_reverse_api.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* {{{ mysqlnd_functions[]
*
@@ -138,11 +138,11 @@ PHP_MINFO_FUNCTION(mysqlnd)
#else
"not supported");
#endif
- snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_cmd_buffer_size));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_cmd_buffer_size));
php_info_print_table_row(2, "Command buffer size", buf);
- snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_buffer_size));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_read_buffer_size));
php_info_print_table_row(2, "Read buffer size", buf);
- snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_timeout));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_read_timeout));
php_info_print_table_row(2, "Read timeout", buf);
php_info_print_table_row(2, "Collecting statistics", MYSQLND_G(collect_statistics)? "Yes":"No");
php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No");
@@ -206,9 +206,9 @@ static PHP_GINIT_FUNCTION(mysqlnd)
*/
static PHP_INI_MH(OnUpdateNetCmdBufferSize)
{
- php_int_t long_value;
+ zend_long long_value;
- ZEND_ATOI(long_value, new_value);
+ ZEND_ATOL(long_value, new_value->val);
if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
return FAILURE;
}
diff --git a/ext/mysqlnd/php_mysqlnd.h b/ext/mysqlnd/php_mysqlnd.h
index dc39028900..d81e0a0799 100644
--- a/ext/mysqlnd/php_mysqlnd.h
+++ b/ext/mysqlnd/php_mysqlnd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 73f0c7f682..dba13ced93 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -33,7 +33,7 @@
#include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#if HAVE_OCI8
@@ -1207,92 +1207,92 @@ PHP_MINIT_FUNCTION(oci)
oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC);
/* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */
- REGISTER_INT_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
/* for $LOB->seek() */
- REGISTER_INT_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT);
/* for $LOB->flush() */
- REGISTER_INT_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT);
/* for OCIBindByName (real "oci" names + short "php" names */
- REGISTER_INT_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT);
#if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 10)
- REGISTER_INT_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT);
#endif
#if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12
- REGISTER_INT_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE", CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT);
#if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12
- REGISTER_INT_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT);
#endif
/* for OCIFetchStatement */
- REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT);
/* for OCIFetchInto & OCIResult */
- REGISTER_INT_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT);
/* for OCINewDescriptor (real "oci" names + short "php" names */
- REGISTER_INT_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
/* for OCIWriteTemporaryLob */
- REGISTER_INT_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -1383,9 +1383,9 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_header(2, "Statistics", "");
- snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
+ snprintf(buf, sizeof(buf), "%pd", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
- snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links));
+ snprintf(buf, sizeof(buf), "%pd", OCI_G(num_links));
php_info_print_table_row(2, "Active Connections", buf);
php_info_print_table_end();
}
@@ -1758,9 +1758,9 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
php_oci_connection *connection;
char *username, *password;
char *dbname = NULL, *charset = NULL;
- int username_len = 0, password_len = 0;
- int dbname_len = 0, charset_len = 0;
- long session_mode = OCI_DEFAULT;
+ size_t username_len = 0, password_len = 0;
+ size_t dbname_len = 0, charset_len = 0;
+ zend_long session_mode = OCI_DEFAULT;
/* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) {
@@ -1789,7 +1789,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
if (!connection) {
RETURN_FALSE;
}
- RETURN_RESOURCE(connection->id);
+ RETURN_RES(connection->id);
}
/* }}} */
@@ -1799,7 +1799,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
* The real connect function. Allocates all the resources needed, establishes the connection and
* returns the result handle (or NULL)
*/
-php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC)
+php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, zend_long session_mode, int persistent, int exclusive TSRMLS_DC)
{
zval *zvp;
zend_resource *le;
@@ -1815,7 +1815,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
ub2 charsetid_nls_lang = 0;
if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%pd)", session_mode);
return NULL;
}
if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
@@ -1889,7 +1889,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0);
if (password_len) {
- ulong password_hash;
+ zend_ulong password_hash;
password_hash = zend_inline_hash_func(password, password_len);
smart_str_append_unsigned_ex(&hashed_details, password_hash, 0);
}
@@ -1949,9 +1949,8 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
int type, link;
void *ptr;
- link = OCI8_PTR_TO_INT(le->ptr);
- ptr = zend_list_find(link, &type); /* PHPNG TODO */
- if (ptr && (type == le_connection)) {
+ ptr = le->ptr; /* PHPNG TODO */
+ if (ptr && (le->type == le_connection)) {
connection = (php_oci_connection *)ptr;
}
}
@@ -1972,7 +1971,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
*/
if (connection && connection->is_persistent && connection->is_stub) {
if (php_oci_create_session(connection, NULL, dbname, dbname_len, username, username_len, password, password_len, new_password, new_password_len, session_mode TSRMLS_CC)) {
- smart_str_free_ex(&hashed_details, 0);
+ smart_str_free(&hashed_details);
zend_hash_del(&EG(persistent_list), connection->hash_key);
return NULL;
@@ -2007,10 +2006,10 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* okay, the connection is open and the server is still alive */
connection->used_this_request = 1;
- tmp = (php_oci_connection *)zend_list_find(connection->id, &rsrc_type);
+ tmp = (php_oci_connection *)connection->id->ptr;
if (tmp != NULL && rsrc_type == le_pconnection && tmp->hash_key->len == hashed_details.s->len &&
- memcmp(tmp->hash_key->val, hashed_details.s->val, tmp->hash_key->len) == 0 && zend_list_addref(connection->id) == SUCCESS) {
+ memcmp(tmp->hash_key->val, hashed_details.s->val, tmp->hash_key->len) == 0 && ++GC_REFCOUNT(connection->id) == SUCCESS) {
/* do nothing */
} else {
PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
@@ -2020,18 +2019,18 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
* decremented in the persistent helper
*/
if (OCI_G(old_oci_close_semantics)) {
- zend_list_addref(connection->id);
+ ++GC_REFCOUNT(connection->id);
}
}
- smart_str_free_ex(&hashed_details, 0);
+ smart_str_free(&hashed_details);
return connection;
}
}
/* server died */
} else {
/* we do not ping non-persistent connections */
- smart_str_free_ex(&hashed_details, 0);
- zend_list_addref(connection->id);
+ smart_str_free(&hashed_details);
+ ++GC_REFCOUNT(connection->id);
return connection;
}
} /* is_open is true? */
@@ -2048,7 +2047,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* We have to do a hash_del but need to preserve the resource if there is a positive
* refcount. Set the data pointer in the list entry to NULL
*/
- if (connection == zend_list_find(connection->id, &rsrc_type) && rsrc_type == le_pconnection) {
+ if (connection == connection->id->ptr && rsrc_type == le_pconnection) {
le->ptr = NULL;
}
@@ -2083,14 +2082,14 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) {
/* all persistent connactions are in use, fallback to non-persistent connection creation */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%ld)", OCI_G(num_persistent));
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%pd)", OCI_G(num_persistent));
alloc_non_persistent = 1;
}
}
if (alloc_non_persistent) {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
- connection->hash_key = zend_str_dup(hashed_details.s, 0);
+ connection->hash_key = zend_string_dup(hashed_details.s, 0);
connection->is_persistent = 0;
#ifdef HAVE_OCI8_DTRACE
connection->client_id = NULL;
@@ -2100,7 +2099,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
if (connection == NULL) {
return NULL;
}
- connection->hash_key = zend_str_dup(hashed_details.s, 1);
+ connection->hash_key = zend_string_dup(hashed_details.s, 1);
if (connection->hash_key == NULL) {
free(connection);
return NULL;
@@ -2112,7 +2111,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
}
} else {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
- connection->hash_key = zend_str_dup(hashed_details.s, 0);
+ connection->hash_key = zend_string_dup(hashed_details.s, 0);
connection->is_persistent = 0;
#ifdef HAVE_OCI8_DTRACE
connection->client_id = NULL;
@@ -2131,7 +2130,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
if ((session_pool = php_oci_get_spool(username, username_len, password, password_len, dbname, dbname_len, charsetid ? charsetid:charsetid_nls_lang TSRMLS_CC))==NULL)
{
php_oci_connection_close(connection TSRMLS_CC);
- smart_str_free_ex(&hashed_details, 0);
+ smart_str_free(&hashed_details);
return NULL;
}
}
@@ -2142,7 +2141,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* Mark password as unchanged by PHP during the duration of the database session */
connection->passwd_changed = 0;
- smart_str_free_ex(&hashed_details, 0);
+ smart_str_free(&hashed_details);
if (charsetid) {
connection->charset = charsetid;
@@ -2181,14 +2180,14 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
* refcount is decremented in the persistent helper
*/
if (OCI_G(old_oci_close_semantics)) {
- zend_list_addref(connection->id);
+ ++GC_REFCOUNT(connection->id);
}
zend_hash_update_mem(&EG(persistent_list), connection->hash_key, (void *)&new_le, sizeof(zend_resource));
OCI_G(num_persistent)++;
OCI_G(num_links)++;
} else if (!exclusive) {
PHP_OCI_REGISTER_RESOURCE(connection, le_connection);
- new_le.ptr = OCI8_INT_TO_PTR(connection->id);
+ new_le.ptr = connection->id;
new_le.type = le_index_ptr;
zend_hash_update_mem(&EG(regular_list), connection->hash_key, (void *)&new_le, sizeof(zend_resource));
OCI_G(num_links)++;
@@ -2564,15 +2563,15 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
}
if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */
- ZVAL_RESOURCE(value, column->stmtid);
- zend_list_addref(column->stmtid);
+ zend_register_resource(value, column->stmtid, 0 TSRMLS_CC); /* XXX type correct? */
+ ++GC_REFCOUNT(column->stmtid);
} else if (column->is_descr) {
if (column->data_type != SQLT_RDD) {
int rsrc_type;
/* reset descriptor's length */
- descriptor = (php_oci_descriptor *) zend_list_find(column->descid, &rsrc_type);
+ descriptor = (php_oci_descriptor *) column->descid->ptr;
if (!descriptor || rsrc_type != le_descriptor) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find LOB descriptor #%d", column->descid);
@@ -2608,7 +2607,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
/* return the locator */
object_init_ex(value, oci_lob_class_entry_ptr);
add_property_resource(value, "descriptor", column->descid);
- zend_list_addref(column->descid);
+ ++GC_REFCOUNT(column->descid);
}
} else {
switch (column->retcode) {
@@ -2648,7 +2647,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
php_oci_out_column *column;
ub4 nrows = 1;
int i;
- long fetch_mode = 0;
+ zend_long fetch_mode = 0;
if (expected_args > 2) {
/* only for ocifetchinto BC */
@@ -2762,19 +2761,18 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
}
if (!(column->indicator == -1)) {
- zval *element;
+ zval element;
- MAKE_STD_ZVAL(element);
- php_oci_column_to_zval(column, element, fetch_mode TSRMLS_CC);
+ php_oci_column_to_zval(column, &element, fetch_mode TSRMLS_CC);
if (fetch_mode & PHP_OCI_NUM || !(fetch_mode & PHP_OCI_ASSOC)) {
- add_index_zval(return_value, i, element);
+ add_index_zval(return_value, i, &element);
}
if (fetch_mode & PHP_OCI_ASSOC) {
if (fetch_mode & PHP_OCI_NUM) {
- Z_ADDREF_P(element);
+ Z_ADDREF(element);
}
- add_assoc_zval(return_value, column->name, element);
+ add_assoc_zval(return_value, column->name, &element);
}
} else {
@@ -2789,9 +2787,9 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
if (expected_args > 2) {
/* Only for ocifetchinto BC. In all other cases we return array, not long */
- REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */
+ ZVAL_COPY_VALUE(array, return_value); /* copy return_value to given reference */
zval_dtor(return_value);
- RETURN_INT(statement->ncolumns);
+ RETURN_LONG(statement->ncolumns);
}
}
/* }}} */
@@ -2849,7 +2847,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha
/* Populate key if passed */
if (hash_key->val) {
- session_pool->spool_hash_key = zend_str_dup(hash_key, 1);
+ session_pool->spool_hash_key = zend_string_dup(hash_key, 1);
if (session_pool->spool_hash_key == NULL) {
iserror = 1;
goto exit_create_spool;
@@ -2976,6 +2974,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
zend_resource spool_le = {0};
zend_resource *spool_out_le = NULL;
zend_bool iserror = 0;
+ zval *spool_out_zv = NULL;
/* {{{ Create the spool hash key */
smart_str_appendl_ex(&spool_hashed_details, "oci8spool***", sizeof("oci8spool***") - 1, 0);
@@ -2987,7 +2986,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
}
smart_str_appendl_ex(&spool_hashed_details, "**", sizeof("**") - 1, 0);
if (password_len) {
- ulong password_hash;
+ zend_ulong password_hash;
password_hash = zend_inline_hash_func(password, password_len);
smart_str_append_unsigned_ex(&spool_hashed_details, password_hash, 0);
}
@@ -3007,7 +3006,12 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
php_strtolower(spool_hashed_details.s->val, spool_hashed_details.s->len);
/* }}} */
- if ((spool_out_le = zend_hash_find(&EG(persistent_list), spool_hashed_details.s)) == NULL) {
+ spool_out_zv = zend_hash_find(&EG(persistent_list), spool_hashed_details.s);
+ if (spool_out_zv != NULL) {
+ spool_out_le = Z_RES_P(spool_out_zv);
+ }
+
+ if (spool_out_le == NULL) {
session_pool = php_oci_create_spool(username, username_len, password, password_len, dbname, dbname_len, spool_hashed_details.s, charsetid TSRMLS_CC);
@@ -3027,7 +3031,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
}
exit_get_spool:
- smart_str_free_ex(&spool_hashed_details, 0);
+ smart_str_free(&spool_hashed_details);
if (iserror && session_pool) {
php_oci_spool_close(session_pool TSRMLS_CC);
session_pool = NULL;
diff --git a/ext/oci8/oci8.dsp b/ext/oci8/oci8.dsp
deleted file mode 100644
index f0b27fa824..0000000000
--- a/ext/oci8/oci8.dsp
+++ /dev/null
@@ -1,133 +0,0 @@
-# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oci8 - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oci8 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\lib\instantclient" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\instantclient" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D HAVE_OCI8_ATTR_STATEMENT=1 /D COMPILE_DL_OCI8=1 /D PHP_OCI8_HAVE_COLLECTIONS=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\instantclient"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oci8 - Win32 Release_TS"
-# Name "oci8 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oci8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_collection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_interface.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_lob.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\oci8_statement.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oci8.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_oci8_int.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index d525ef4a9b..341a983ef5 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -56,7 +56,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
collection->connection = connection;
collection->collection = NULL;
- zend_list_addref(collection->connection->id);
+ ++GC_REFCOUNT(collection->connection->id);
/* get type handle by name */
PHP_OCI_CALL_RETURN(errstatus, OCITypeByName,
@@ -260,7 +260,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
/* {{{ php_oci_collection_max()
Return max number of elements in the collection */
-int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
+int php_oci_collection_max(php_oci_collection *collection, zend_long *max TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
@@ -273,7 +273,7 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
/* {{{ php_oci_collection_trim()
Trim collection to the given number of elements */
-int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC)
+int php_oci_collection_trim(php_oci_collection *collection, zend_long trim_size TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
sword errstatus;
@@ -473,7 +473,7 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int
/* {{{ php_oci_collection_element_get()
Get the element with the given index */
-int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC)
+int php_oci_collection_element_get(php_oci_collection *collection, zend_long index, zval *result_element TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
dvoid *element;
@@ -483,8 +483,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
ub4 buff_len = 1024;
sword errstatus;
- MAKE_STD_ZVAL(*result_element);
- ZVAL_NULL(*result_element);
+ ZVAL_NULL(result_element);
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
@@ -503,13 +502,11 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- FREE_ZVAL(*result_element);
return 1;
}
if (exists == 0) {
/* element doesn't exist */
- FREE_ZVAL(*result_element);
return 1;
}
@@ -525,12 +522,11 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- FREE_ZVAL(*result_element);
return 1;
}
- ZVAL_STRINGL(*result_element, (char *)buff, buff_len, 1);
- Z_STRVAL_P(*result_element)[buff_len] = '\0';
+ ZVAL_STRINGL(result_element, (char *)buff, buff_len);
+ Z_STRVAL_P(result_element)[buff_len] = '\0';
return 0;
break;
@@ -543,7 +539,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
if (str) {
- ZVAL_STRING(*result_element, (char *)str, 1);
+ ZVAL_STRING(result_element, (char *)str);
}
return 0;
}
@@ -568,18 +564,16 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- FREE_ZVAL(*result_element);
return 1;
}
- ZVAL_DOUBLE(*result_element, double_number);
+ ZVAL_DOUBLE(result_element, double_number);
return 0;
}
break;
default:
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or unsupported type of element: %d", collection->element_typecode);
- FREE_ZVAL(*result_element);
return 1;
break;
}
@@ -590,7 +584,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
/* {{{ php_oci_collection_element_set_null()
Set the element with the given index to NULL */
-int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC)
+int php_oci_collection_element_set_null(php_oci_collection *collection, zend_long index TSRMLS_DC)
{
OCIInd null_index = OCI_IND_NULL;
php_oci_connection *connection = collection->connection;
@@ -611,7 +605,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
/* {{{ php_oci_collection_element_set_date()
Change element's value to the given DATE */
-int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC)
+int php_oci_collection_element_set_date(php_oci_collection *collection, zend_long index, char *date, int date_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
@@ -652,7 +646,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
/* {{{ php_oci_collection_element_set_number()
Change element's value to the given NUMBER */
-int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC)
+int php_oci_collection_element_set_number(php_oci_collection *collection, zend_long index, char *number, int number_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
double element_double;
@@ -694,7 +688,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
/* {{{ php_oci_collection_element_set_string()
Change element's value to the given string */
-int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC)
+int php_oci_collection_element_set_string(php_oci_collection *collection, zend_long index, char *element, int element_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
@@ -733,7 +727,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
/* {{{ php_oci_collection_element_set()
Collection element setter */
-int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC)
+int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len TSRMLS_DC)
{
if (value_len == 0) {
return php_oci_collection_element_set_null(collection, index TSRMLS_CC);
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 985fd973c8..6c73ad0a32 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -51,8 +51,8 @@ PHP_FUNCTION(oci_define_by_name)
{
zval *stmt, *var;
char *name;
- int name_len;
- long type = 0;
+ size_t name_len;
+ zend_long type = 0;
php_oci_statement *statement;
php_oci_define *define, *tmp_define;
@@ -74,7 +74,8 @@ PHP_FUNCTION(oci_define_by_name)
define = ecalloc(1,sizeof(php_oci_define));
- if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+ //if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+ if ((tmp_define = zend_hash_add_new_ptr(statement->defines, zend_string_init(name, name_len, 0), define)) != NULL) {
efree(define);
define = tmp_define;
} else {
@@ -85,8 +86,8 @@ PHP_FUNCTION(oci_define_by_name)
define->name = (text*) estrndup(name, name_len);
define->name_len = name_len;
define->type = type;
- define->zval = var;
- zval_add_ref(&var);
+ memmove(&define->zval, var, sizeof(zval));
+ Z_ADDREF_P(var);
RETURN_TRUE;
}
@@ -98,8 +99,8 @@ PHP_FUNCTION(oci_define_by_name)
PHP_FUNCTION(oci_bind_by_name)
{
ub2 bind_type = SQLT_CHR; /* unterminated string */
- int name_len;
- long maxlen = -1, type = 0;
+ size_t name_len;
+ zend_long maxlen = -1, type = 0;
char *name;
zval *z_statement;
zval *bind_var = NULL;
@@ -126,10 +127,10 @@ PHP_FUNCTION(oci_bind_by_name)
Bind a PHP array to an Oracle PL/SQL type by name */
PHP_FUNCTION(oci_bind_array_by_name)
{
- int name_len;
- long max_item_len = -1;
- long max_array_len = 0;
- long type = SQLT_AFC;
+ size_t name_len;
+ zend_long max_item_len = -1;
+ zend_long max_array_len = 0;
+ zend_long type = SQLT_AFC;
char *name;
zval *z_statement;
zval *bind_var = NULL;
@@ -161,7 +162,7 @@ PHP_FUNCTION(oci_bind_array_by_name)
Deletes large object description */
PHP_FUNCTION(oci_free_descriptor)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -170,12 +171,12 @@ PHP_FUNCTION(oci_free_descriptor)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
zend_list_delete(descriptor->id);
RETURN_TRUE;
@@ -186,11 +187,11 @@ PHP_FUNCTION(oci_free_descriptor)
Saves a large object */
PHP_FUNCTION(oci_lob_save)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *data;
- int data_len;
- long offset = 0;
+ size_t data_len;
+ zend_long offset = 0;
ub4 bytes_written;
if (getThis()) {
@@ -204,12 +205,12 @@ PHP_FUNCTION(oci_lob_save)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset parameter must be greater than or equal to 0");
@@ -227,10 +228,10 @@ PHP_FUNCTION(oci_lob_save)
Loads file into a LOB */
PHP_FUNCTION(oci_lob_import)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *filename;
- int filename_len;
+ size_t filename_len;
if (getThis()) {
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
@@ -259,12 +260,12 @@ PHP_FUNCTION(oci_lob_import)
}
#endif
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_import(descriptor, filename TSRMLS_CC)) {
RETURN_FALSE;
@@ -277,7 +278,7 @@ PHP_FUNCTION(oci_lob_import)
Loads a large object */
PHP_FUNCTION(oci_lob_load)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *buffer = NULL;
ub4 buffer_len;
@@ -288,18 +289,18 @@ PHP_FUNCTION(oci_lob_load)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
RETURN_FALSE;
}
if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
+ RETURN_STRINGL(buffer, buffer_len);
}
else {
RETURN_EMPTY_STRING();
@@ -311,9 +312,9 @@ PHP_FUNCTION(oci_lob_load)
Reads particular part of a large object */
PHP_FUNCTION(oci_lob_read)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long length;
+ zend_long length;
char *buffer;
ub4 buffer_len;
@@ -328,12 +329,12 @@ PHP_FUNCTION(oci_lob_read)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (length <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
@@ -344,7 +345,7 @@ PHP_FUNCTION(oci_lob_read)
RETURN_FALSE;
}
if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
+ RETURN_STRINGL(buffer, buffer_len);
}
else {
RETURN_EMPTY_STRING();
@@ -356,7 +357,7 @@ PHP_FUNCTION(oci_lob_read)
Checks if EOF is reached */
PHP_FUNCTION(oci_lob_eof)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
@@ -366,12 +367,12 @@ PHP_FUNCTION(oci_lob_eof)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (!php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC) && lob_length >= 0) {
if (lob_length == descriptor->lob_current_position) {
@@ -386,7 +387,7 @@ PHP_FUNCTION(oci_lob_eof)
Tells LOB pointer position */
PHP_FUNCTION(oci_lob_tell)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -395,14 +396,14 @@ PHP_FUNCTION(oci_lob_tell)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
- RETURN_INT(descriptor->lob_current_position);
+ RETURN_LONG(descriptor->lob_current_position);
}
/* }}} */
@@ -410,7 +411,7 @@ PHP_FUNCTION(oci_lob_tell)
Rewind pointer of a LOB */
PHP_FUNCTION(oci_lob_rewind)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -419,12 +420,12 @@ PHP_FUNCTION(oci_lob_rewind)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
descriptor->lob_current_position = 0;
@@ -436,9 +437,9 @@ PHP_FUNCTION(oci_lob_rewind)
Moves the pointer of a LOB */
PHP_FUNCTION(oci_lob_seek)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long offset, whence = PHP_OCI_SEEK_SET;
+ zend_long offset, whence = PHP_OCI_SEEK_SET;
ub4 lob_length;
if (getThis()) {
@@ -452,12 +453,12 @@ PHP_FUNCTION(oci_lob_seek)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -488,7 +489,7 @@ PHP_FUNCTION(oci_lob_seek)
Returns size of a large object */
PHP_FUNCTION(oci_lob_size)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 lob_length;
@@ -498,17 +499,17 @@ PHP_FUNCTION(oci_lob_size)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(lob_length);
+ RETURN_LONG(lob_length);
}
/* }}} */
@@ -516,10 +517,10 @@ PHP_FUNCTION(oci_lob_size)
Writes data to current position of a LOB */
PHP_FUNCTION(oci_lob_write)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- int data_len;
- long write_len = 0;
+ size_t data_len;
+ zend_long write_len = 0;
ub4 bytes_written;
char *data;
@@ -542,21 +543,21 @@ PHP_FUNCTION(oci_lob_write)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (data_len <= 0) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(bytes_written);
+ RETURN_LONG(bytes_written);
}
/* }}} */
@@ -564,7 +565,7 @@ PHP_FUNCTION(oci_lob_write)
Appends data from a LOB to another LOB */
PHP_FUNCTION(oci_lob_append)
{
- zval **tmp_dest, **tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
+ zval *tmp_dest, *tmp_from, *z_descriptor_dest = getThis(), *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
if (getThis()) {
@@ -578,18 +579,18 @@ PHP_FUNCTION(oci_lob_append)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_dest, descriptor_dest);
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_from, descriptor_from);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
if (php_oci_lob_append(descriptor_dest, descriptor_from TSRMLS_CC)) {
RETURN_FALSE;
@@ -603,9 +604,9 @@ PHP_FUNCTION(oci_lob_append)
Truncates a LOB */
PHP_FUNCTION(oci_lob_truncate)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long trim_length = 0;
+ zend_long trim_length = 0;
ub4 ub_trim_length;
if (getThis()) {
@@ -619,7 +620,7 @@ PHP_FUNCTION(oci_lob_truncate)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
@@ -630,7 +631,7 @@ PHP_FUNCTION(oci_lob_truncate)
}
ub_trim_length = (ub4) trim_length;
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_truncate(descriptor, ub_trim_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -643,10 +644,10 @@ PHP_FUNCTION(oci_lob_truncate)
Erases a specified portion of the internal LOB, starting at a specified offset */
PHP_FUNCTION(oci_lob_erase)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
ub4 bytes_erased;
- long offset = -1, length = -1;
+ zend_long offset = -1, length = -1;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) {
@@ -679,17 +680,17 @@ PHP_FUNCTION(oci_lob_erase)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(bytes_erased);
+ RETURN_LONG(bytes_erased);
}
/* }}} */
@@ -697,9 +698,9 @@ PHP_FUNCTION(oci_lob_erase)
Flushes the LOB buffer */
PHP_FUNCTION(oci_lob_flush)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- long flush_flag = 0;
+ zend_long flush_flag = 0;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) {
@@ -712,12 +713,12 @@ PHP_FUNCTION(oci_lob_flush)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
/* buffering wasn't enabled, there is nothing to flush */
@@ -735,7 +736,7 @@ PHP_FUNCTION(oci_lob_flush)
Enables/disables buffering for a LOB */
PHP_FUNCTION(ocisetbufferinglob)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
zend_bool flag;
@@ -750,12 +751,12 @@ PHP_FUNCTION(ocisetbufferinglob)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_set_buffering(descriptor, flag TSRMLS_CC)) {
RETURN_FALSE;
@@ -768,7 +769,7 @@ PHP_FUNCTION(ocisetbufferinglob)
Returns current state of buffering for a LOB */
PHP_FUNCTION(ocigetbufferinglob)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -777,12 +778,12 @@ PHP_FUNCTION(ocigetbufferinglob)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (descriptor->buffering != PHP_OCI_LOB_BUFFER_DISABLED) {
RETURN_TRUE;
@@ -795,26 +796,26 @@ PHP_FUNCTION(ocigetbufferinglob)
Copies data from a LOB to another LOB */
PHP_FUNCTION(oci_lob_copy)
{
- zval **tmp_dest, **tmp_from, *z_descriptor_dest, *z_descriptor_from;
+ zval *tmp_dest, *tmp_from, *z_descriptor_dest, *z_descriptor_from;
php_oci_descriptor *descriptor_dest, *descriptor_from;
- long length = 0;
+ zend_long length = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_dest, descriptor_dest);
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_from, descriptor_from);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_dest, descriptor_dest);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_from, descriptor_from);
if (ZEND_NUM_ARGS() == 3 && length < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
@@ -837,7 +838,7 @@ PHP_FUNCTION(oci_lob_copy)
Tests to see if two LOB/FILE locators are equal */
PHP_FUNCTION(oci_lob_is_equal)
{
- zval **tmp_first, **tmp_second, *z_descriptor_first, *z_descriptor_second;
+ zval *tmp_first, *tmp_second, *z_descriptor_first, *z_descriptor_second;
php_oci_descriptor *descriptor_first, *descriptor_second;
boolean is_equal;
@@ -845,18 +846,18 @@ PHP_FUNCTION(oci_lob_is_equal)
return;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"), (void **)&tmp_first) == FAILURE) {
+ if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"), (void **)&tmp_second) == FAILURE) {
+ if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_first, descriptor_first);
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp_second, descriptor_second);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_first, descriptor_first);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp_second, descriptor_second);
if (php_oci_lob_is_equal(descriptor_first, descriptor_second, &is_equal TSRMLS_CC)) {
RETURN_FALSE;
@@ -873,12 +874,12 @@ PHP_FUNCTION(oci_lob_is_equal)
Writes a large object into a file */
PHP_FUNCTION(oci_lob_export)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *filename;
char *buffer;
- int filename_len;
- long start = -1, length = -1, block_length;
+ size_t filename_len;
+ zend_long start = -1, length = -1, block_length;
php_stream *stream;
ub4 lob_length;
@@ -927,12 +928,12 @@ PHP_FUNCTION(oci_lob_export)
}
#endif
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
@@ -1006,11 +1007,11 @@ PHP_FUNCTION(oci_lob_export)
Writes temporary blob */
PHP_FUNCTION(oci_lob_write_temporary)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
char *data;
- int data_len;
- long type = OCI_TEMP_CLOB;
+ size_t data_len;
+ zend_long type = OCI_TEMP_CLOB;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) {
@@ -1023,12 +1024,12 @@ PHP_FUNCTION(oci_lob_write_temporary)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_write_tmp(descriptor, type, data, data_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -1041,7 +1042,7 @@ PHP_FUNCTION(oci_lob_write_temporary)
Closes lob descriptor */
PHP_FUNCTION(oci_lob_close)
{
- zval **tmp, *z_descriptor = getThis();
+ zval *tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
if (!getThis()) {
@@ -1050,12 +1051,12 @@ PHP_FUNCTION(oci_lob_close)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_close(descriptor TSRMLS_CC)) {
RETURN_FALSE;
@@ -1071,7 +1072,7 @@ PHP_FUNCTION(oci_new_descriptor)
zval *z_connection;
php_oci_connection *connection;
php_oci_descriptor *descriptor;
- long type = OCI_DTYPE_LOB;
+ zend_long type = OCI_DTYPE_LOB;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) {
return;
@@ -1146,7 +1147,7 @@ PHP_FUNCTION(oci_field_name)
php_oci_out_column *column;
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
- RETURN_STRINGL(column->name, column->name_len, 1);
+ RETURN_STRINGL(column->name, column->name_len);
}
RETURN_FALSE;
}
@@ -1161,9 +1162,9 @@ PHP_FUNCTION(oci_field_size)
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
/* Handle data type of LONG */
if (column->data_type == SQLT_LNG){
- RETURN_INT(column->storage_size4);
+ RETURN_LONG(column->storage_size4);
}
- RETURN_INT(column->data_size);
+ RETURN_LONG(column->data_size);
}
RETURN_FALSE;
}
@@ -1176,7 +1177,7 @@ PHP_FUNCTION(oci_field_scale)
php_oci_out_column *column;
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
- RETURN_INT(column->scale);
+ RETURN_LONG(column->scale);
}
RETURN_FALSE;
}
@@ -1189,7 +1190,7 @@ PHP_FUNCTION(oci_field_precision)
php_oci_out_column *column;
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
- RETURN_INT(column->precision);
+ RETURN_LONG(column->precision);
}
RETURN_FALSE;
}
@@ -1210,67 +1211,67 @@ PHP_FUNCTION(oci_field_type)
switch (column->data_type) {
#ifdef SQLT_TIMESTAMP
case SQLT_TIMESTAMP:
- RETVAL_STRING("TIMESTAMP",1);
+ RETVAL_STRING("TIMESTAMP");
break;
#endif
#ifdef SQLT_TIMESTAMP_TZ
case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP WITH TIMEZONE",1);
+ RETVAL_STRING("TIMESTAMP WITH TIMEZONE");
break;
#endif
#ifdef SQLT_TIMESTAMP_LTZ
case SQLT_TIMESTAMP_LTZ:
- RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE",1);
+ RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE");
break;
#endif
#ifdef SQLT_INTERVAL_YM
case SQLT_INTERVAL_YM:
- RETVAL_STRING("INTERVAL YEAR TO MONTH",1);
+ RETVAL_STRING("INTERVAL YEAR TO MONTH");
break;
#endif
#ifdef SQLT_INTERVAL_DS
case SQLT_INTERVAL_DS:
- RETVAL_STRING("INTERVAL DAY TO SECOND",1);
+ RETVAL_STRING("INTERVAL DAY TO SECOND");
break;
#endif
case SQLT_DAT:
- RETVAL_STRING("DATE",1);
+ RETVAL_STRING("DATE");
break;
case SQLT_NUM:
- RETVAL_STRING("NUMBER",1);
+ RETVAL_STRING("NUMBER");
break;
case SQLT_LNG:
- RETVAL_STRING("LONG",1);
+ RETVAL_STRING("LONG");
break;
case SQLT_BIN:
- RETVAL_STRING("RAW",1);
+ RETVAL_STRING("RAW");
break;
case SQLT_LBI:
- RETVAL_STRING("LONG RAW",1);
+ RETVAL_STRING("LONG RAW");
break;
case SQLT_CHR:
- RETVAL_STRING("VARCHAR2",1);
+ RETVAL_STRING("VARCHAR2");
break;
case SQLT_RSET:
- RETVAL_STRING("REFCURSOR",1);
+ RETVAL_STRING("REFCURSOR");
break;
case SQLT_AFC:
- RETVAL_STRING("CHAR",1);
+ RETVAL_STRING("CHAR");
break;
case SQLT_BLOB:
- RETVAL_STRING("BLOB",1);
+ RETVAL_STRING("BLOB");
break;
case SQLT_CLOB:
- RETVAL_STRING("CLOB",1);
+ RETVAL_STRING("CLOB");
break;
case SQLT_BFILE:
- RETVAL_STRING("BFILE",1);
+ RETVAL_STRING("BFILE");
break;
case SQLT_RDD:
- RETVAL_STRING("ROWID",1);
+ RETVAL_STRING("ROWID");
break;
default:
- RETVAL_INT(column->data_type);
+ RETVAL_LONG(column->data_type);
}
}
/* }}} */
@@ -1283,7 +1284,7 @@ PHP_FUNCTION(oci_field_type_raw)
column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
if (column) {
- RETURN_INT(column->data_type);
+ RETURN_LONG(column->data_type);
}
RETURN_FALSE;
}
@@ -1318,7 +1319,7 @@ PHP_FUNCTION(oci_execute)
{
zval *z_statement;
php_oci_statement *statement;
- long mode = OCI_COMMIT_ON_SUCCESS;
+ zend_long mode = OCI_COMMIT_ON_SUCCESS;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) {
return;
@@ -1386,13 +1387,14 @@ PHP_FUNCTION(ocifetchinto)
Fetch all rows of result data into an array */
PHP_FUNCTION(oci_fetch_all)
{
- zval *z_statement, *array, *element, *tmp;
+ zval *z_statement, *array;
+ zval element, tmp;
php_oci_statement *statement;
php_oci_out_column **columns;
- zval ***outarrs;
+ zval **outarrs;
ub4 nrows = 1;
int i;
- long rows = 0, flags = 0, skip = 0, maxrows = -1;
+ zend_long rows = 0, flags = 0, skip = 0, maxrows = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|lll", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) {
return;
@@ -1405,7 +1407,7 @@ PHP_FUNCTION(oci_fetch_all)
while (skip--) {
if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
@@ -1417,23 +1419,21 @@ PHP_FUNCTION(oci_fetch_all)
}
while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
- zval *row;
+ zval row;
- MAKE_STD_ZVAL(row);
- array_init(row);
+ array_init(&row);
for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
- php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
+ php_oci_column_to_zval(columns[ i ], &element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
if (flags & PHP_OCI_NUM) {
- zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL(row), &element);
} else { /* default to ASSOC */
- zend_symtable_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
+ zend_symtable_update(Z_ARRVAL(row), zend_string_init(columns[ i ]->name, columns[ i ]->name_len+1, 0), &element);
}
}
- zend_hash_next_index_insert(Z_ARRVAL_P(array), &row, sizeof(zval*), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(array), &row);
rows++;
if (maxrows != -1 && rows == maxrows) {
@@ -1451,25 +1451,22 @@ PHP_FUNCTION(oci_fetch_all)
for (i = 0; i < statement->ncolumns; i++) {
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+ array_init(&tmp);
+ outarrs[ i ] = zend_hash_next_index_insert(Z_ARRVAL_P(array), &tmp);
}
} else { /* default to ASSOC */
for (i = 0; i < statement->ncolumns; i++) {
columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- zend_symtable_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+ array_init(&tmp);
+ outarrs[ i ] = zend_symtable_update(Z_ARRVAL_P(array), zend_string_init(columns[ i ]->name, columns[ i ]->name_len+1, 0), &tmp);
}
}
while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
- php_oci_column_to_zval(columns[ i ], element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
- zend_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(zval*), NULL);
+ php_oci_column_to_zval(columns[ i ], &element, PHP_OCI_RETURN_LOBS TSRMLS_CC);
+ zend_hash_index_update(&(outarrs[ i ])->value.arr->ht, rows, &element);
}
rows++;
@@ -1484,7 +1481,7 @@ PHP_FUNCTION(oci_fetch_all)
efree(outarrs);
}
- RETURN_INT(rows);
+ RETURN_LONG(rows);
}
/* }}} */
@@ -1616,7 +1613,7 @@ PHP_FUNCTION(oci_error)
}
if (ZEND_NUM_ARGS() > 0) {
- statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement);
+ statement = (php_oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement);
if (statement) {
errh = statement->err;
errcode = statement->errcode;
@@ -1627,14 +1624,14 @@ PHP_FUNCTION(oci_error)
goto go_out;
}
- connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
+ connection = (php_oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
if (connection) {
errh = connection->err;
errcode = connection->errcode;
goto go_out;
}
- connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
+ connection = (php_oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
if (connection) {
errh = connection->err;
errcode = connection->errcode;
@@ -1659,11 +1656,11 @@ go_out:
if (errcode) {
array_init(return_value);
- add_assoc_int(return_value, "code", errcode);
+ add_assoc_long(return_value, "code", errcode);
// TODO: avoid reallocation ???
add_assoc_string(return_value, "message", (char*) errbuf);
efree(errbuf);
- add_assoc_int(return_value, "offset", error_offset);
+ add_assoc_long(return_value, "offset", error_offset);
add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "");
} else {
RETURN_FALSE;
@@ -1684,7 +1681,7 @@ PHP_FUNCTION(oci_num_fields)
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
- RETURN_INT(statement->ncolumns);
+ RETURN_LONG(statement->ncolumns);
}
/* }}} */
@@ -1696,7 +1693,7 @@ PHP_FUNCTION(oci_parse)
php_oci_connection *connection;
php_oci_statement *statement;
char *query;
- int query_len;
+ size_t query_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) {
return;
@@ -1707,7 +1704,7 @@ PHP_FUNCTION(oci_parse)
statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC);
if (statement) {
- RETURN_RESOURCE(statement->id);
+ RETURN_RES(statement->id);
}
RETURN_FALSE;
}
@@ -1719,7 +1716,7 @@ PHP_FUNCTION(oci_set_prefetch)
{
zval *z_statement;
php_oci_statement *statement;
- long size;
+ zend_long size;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) {
return;
@@ -1746,7 +1743,7 @@ PHP_FUNCTION(oci_set_client_identifier)
zval *z_connection;
php_oci_connection *connection;
char *client_id;
- int client_id_len;
+ size_t client_id_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) {
@@ -1796,7 +1793,7 @@ PHP_FUNCTION(oci_set_edition)
{
#if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2)))
char *edition;
- int edition_len;
+ size_t edition_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &edition, &edition_len) == FAILURE) {
return;
@@ -1830,7 +1827,7 @@ PHP_FUNCTION(oci_set_module_name)
zval *z_connection;
php_oci_connection *connection;
char *module;
- int module_len;
+ size_t module_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) {
@@ -1862,7 +1859,7 @@ PHP_FUNCTION(oci_set_action)
zval *z_connection;
php_oci_connection *connection;
char *action;
- int action_len;
+ size_t action_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) {
@@ -1894,7 +1891,7 @@ PHP_FUNCTION(oci_set_client_info)
zval *z_connection;
php_oci_connection *connection;
char *client_info;
- int client_info_len;
+ size_t client_info_len;
sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) {
@@ -1927,7 +1924,7 @@ PHP_FUNCTION(oci_set_db_operation)
zval *z_connection;
php_oci_connection *connection;
char *dbop_name;
- int dbop_name_len;
+ size_t dbop_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) {
return;
@@ -1956,7 +1953,7 @@ PHP_FUNCTION(oci_password_change)
{
zval *z_connection;
char *user, *pass_old, *pass_new, *dbname;
- int user_len, pass_old_len, pass_new_len, dbname_len;
+ size_t user_len, pass_old_len, pass_new_len, dbname_len;
php_oci_connection *connection;
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
@@ -2006,7 +2003,7 @@ PHP_FUNCTION(oci_password_change)
if (!connection) {
RETURN_FALSE;
}
- RETURN_RESOURCE(connection->id);
+ RETURN_RES(connection->id);
}
WRONG_PARAM_COUNT;
}
@@ -2029,7 +2026,7 @@ PHP_FUNCTION(oci_new_cursor)
statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC);
if (statement) {
- RETURN_RESOURCE(statement->id);
+ RETURN_RES(statement->id);
}
RETURN_FALSE;
}
@@ -2058,7 +2055,7 @@ PHP_FUNCTION(oci_client_version)
char *version = NULL;
php_oci_client_get_version(&version TSRMLS_CC);
- RETURN_STRING(version, 0);
+ RETURN_STRING(version);
}
/* }}} */
@@ -2080,7 +2077,7 @@ PHP_FUNCTION(oci_server_version)
RETURN_FALSE;
}
- RETURN_STRING(version, 0);
+ RETURN_STRING(version);
}
/* }}} */
@@ -2104,37 +2101,37 @@ PHP_FUNCTION(oci_statement_type)
switch (type) {
case OCI_STMT_SELECT:
- RETVAL_STRING("SELECT",1);
+ RETVAL_STRING("SELECT");
break;
case OCI_STMT_UPDATE:
- RETVAL_STRING("UPDATE",1);
+ RETVAL_STRING("UPDATE");
break;
case OCI_STMT_DELETE:
- RETVAL_STRING("DELETE",1);
+ RETVAL_STRING("DELETE");
break;
case OCI_STMT_INSERT:
- RETVAL_STRING("INSERT",1);
+ RETVAL_STRING("INSERT");
break;
case OCI_STMT_CREATE:
- RETVAL_STRING("CREATE",1);
+ RETVAL_STRING("CREATE");
break;
case OCI_STMT_DROP:
- RETVAL_STRING("DROP",1);
+ RETVAL_STRING("DROP");
break;
case OCI_STMT_ALTER:
- RETVAL_STRING("ALTER",1);
+ RETVAL_STRING("ALTER");
break;
case OCI_STMT_BEGIN:
- RETVAL_STRING("BEGIN",1);
+ RETVAL_STRING("BEGIN");
break;
case OCI_STMT_DECLARE:
- RETVAL_STRING("DECLARE",1);
+ RETVAL_STRING("DECLARE");
break;
case OCI_STMT_CALL:
- RETVAL_STRING("CALL",1);
+ RETVAL_STRING("CALL");
break;
default:
- RETVAL_STRING("UNKNOWN",1);
+ RETVAL_STRING("UNKNOWN");
}
}
/* }}} */
@@ -2156,7 +2153,7 @@ PHP_FUNCTION(oci_num_rows)
if (php_oci_statement_get_numrows(statement, &rowcount TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(rowcount);
+ RETURN_LONG(rowcount);
}
/* }}} */
@@ -2164,7 +2161,7 @@ PHP_FUNCTION(oci_num_rows)
Deletes collection object*/
PHP_FUNCTION(oci_free_collection)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
if (!getThis()) {
@@ -2173,12 +2170,12 @@ PHP_FUNCTION(oci_free_collection)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
zend_list_delete(collection->id);
RETURN_TRUE;
@@ -2189,10 +2186,10 @@ PHP_FUNCTION(oci_free_collection)
Append an object to the collection */
PHP_FUNCTION(oci_collection_append)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
char *value;
- int value_len;
+ size_t value_len;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) {
@@ -2205,12 +2202,12 @@ PHP_FUNCTION(oci_collection_append)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_append(collection, value, value_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -2223,10 +2220,10 @@ PHP_FUNCTION(oci_collection_append)
Retrieve the value at collection index ndx */
PHP_FUNCTION(oci_collection_element_get)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long element_index;
- zval *value;
+ zend_long element_index;
+ zval value;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &element_index) == FAILURE) {
@@ -2239,20 +2236,18 @@ PHP_FUNCTION(oci_collection_element_get)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_get(collection, element_index, &value TSRMLS_CC)) {
RETURN_FALSE;
}
- *return_value = *value;
- zval_copy_ctor(return_value);
- zval_ptr_dtor(&value);
+ RETURN_ZVAL(&value, 1, 1);
}
/* }}} */
@@ -2260,7 +2255,7 @@ PHP_FUNCTION(oci_collection_element_get)
Assign a collection from another existing collection */
PHP_FUNCTION(oci_collection_assign)
{
- zval **tmp_dest, **tmp_from, *z_collection_dest = getThis(), *z_collection_from;
+ zval *tmp_dest, *tmp_from, *z_collection_dest = getThis(), *z_collection_from;
php_oci_collection *collection_dest, *collection_from;
if (getThis()) {
@@ -2274,18 +2269,18 @@ PHP_FUNCTION(oci_collection_assign)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection_dest), "collection", sizeof("collection"), (void **)&tmp_dest) == FAILURE) {
+ if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The first argument should be valid collection object");
RETURN_FALSE;
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection_from), "collection", sizeof("collection"), (void **)&tmp_from) == FAILURE) {
+ if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_collection_from), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The second argument should be valid collection object");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp_dest, collection_dest);
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp_from, collection_from);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp_dest, collection_dest);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp_from, collection_from);
if (php_oci_collection_assign(collection_dest, collection_from TSRMLS_CC)) {
RETURN_FALSE;
@@ -2298,10 +2293,10 @@ PHP_FUNCTION(oci_collection_assign)
Assign element val to collection at index ndx */
PHP_FUNCTION(oci_collection_element_assign)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- int value_len;
- long element_index;
+ size_t value_len;
+ zend_long element_index;
char *value;
if (getThis()) {
@@ -2315,12 +2310,12 @@ PHP_FUNCTION(oci_collection_element_assign)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_element_set(collection, element_index, value, value_len TSRMLS_CC)) {
RETURN_FALSE;
@@ -2333,7 +2328,7 @@ PHP_FUNCTION(oci_collection_element_assign)
Return the size of a collection */
PHP_FUNCTION(oci_collection_size)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
sb4 size = 0;
@@ -2343,17 +2338,17 @@ PHP_FUNCTION(oci_collection_size)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_size(collection, &size TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(size);
+ RETURN_LONG(size);
}
/* }}} */
@@ -2361,9 +2356,9 @@ PHP_FUNCTION(oci_collection_size)
Return the max value of a collection. For a varray this is the maximum length of the array */
PHP_FUNCTION(oci_collection_max)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long max;
+ zend_long max;
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
@@ -2371,17 +2366,17 @@ PHP_FUNCTION(oci_collection_max)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_max(collection, &max TSRMLS_CC)) {
RETURN_FALSE;
}
- RETURN_INT(max);
+ RETURN_LONG(max);
}
/* }}} */
@@ -2389,9 +2384,9 @@ PHP_FUNCTION(oci_collection_max)
Trim num elements from the end of a collection */
PHP_FUNCTION(oci_collection_trim)
{
- zval **tmp, *z_collection = getThis();
+ zval *tmp, *z_collection = getThis();
php_oci_collection *collection;
- long trim_size;
+ zend_long trim_size;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) {
@@ -2404,12 +2399,12 @@ PHP_FUNCTION(oci_collection_trim)
}
}
- if (zend_hash_find(Z_OBJPROP_P(z_collection), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
RETURN_FALSE;
}
- PHP_OCI_ZVAL_TO_COLLECTION(*tmp, collection);
+ PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
if (php_oci_collection_trim(collection, trim_size TSRMLS_CC)) {
RETURN_FALSE;
@@ -2426,7 +2421,7 @@ PHP_FUNCTION(oci_new_collection)
php_oci_connection *connection;
php_oci_collection *collection;
char *tdo, *schema = NULL;
- int tdo_len, schema_len = 0;
+ size_t tdo_len, schema_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
return;
@@ -2463,7 +2458,7 @@ PHP_FUNCTION(oci_get_implicit_resultset)
if (imp_statement) {
if (php_oci_statement_execute(imp_statement, (ub4)OCI_DEFAULT TSRMLS_CC))
RETURN_FALSE;
- RETURN_RESOURCE(imp_statement->id);
+ RETURN_RES(imp_statement->id);
}
RETURN_FALSE;
}
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 4982d0f88f..12986a8d3a 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -51,7 +51,7 @@
/* {{{ php_oci_lob_create()
Create LOB descriptor and allocate all the resources needed */
-php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC)
+php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_long type TSRMLS_DC)
{
php_oci_descriptor *descriptor;
sword errstatus;
@@ -63,7 +63,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
/* these three are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %pd", type);
return NULL;
break;
}
@@ -71,7 +71,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
descriptor->type = type;
descriptor->connection = connection;
- zend_list_addref(descriptor->connection->id);
+ ++GC_REFCOUNT(descriptor->connection->id);
PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
@@ -109,7 +109,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
return NULL;
}
- zend_hash_index_update(connection->descriptors,descriptor->index,&descriptor,sizeof(php_oci_descriptor *),NULL);
+ zend_hash_index_update_ptr(connection->descriptors, descriptor->index, &descriptor);
}
return descriptor;
@@ -210,7 +210,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece
/* {{{ php_oci_lob_calculate_buffer()
Work out the size for LOB buffering */
-static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC)
+static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_length TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
ub4 chunk_size;
@@ -241,7 +241,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
/* {{{ php_oci_lob_read()
Read specified portion of the LOB into the buffer */
-int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, char **data, ub4 *data_len TSRMLS_DC)
+int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zend_long initial_offset, char **data, ub4 *data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
ub4 length = 0;
@@ -513,7 +513,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
/* {{{ php_oci_lob_copy()
Copy one LOB (or its part) to another one */
-int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC)
+int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, zend_long length TSRMLS_DC)
{
php_oci_connection *connection = descriptor_dest->connection;
ub4 length_dest, length_from, copy_len;
@@ -619,7 +619,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
/* {{{ php_oci_lob_flush()
Flush buffers for the LOB (only if they have been used) */
-int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
+int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag TSRMLS_DC)
{
OCILobLocator *lob = descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
@@ -635,7 +635,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %pd", flush_flag);
return 1;
break;
}
@@ -806,7 +806,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
/* {{{ php_oci_lob_truncate()
Truncate LOB to the given length */
-int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC)
+int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_length TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
@@ -848,7 +848,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
/* {{{ php_oci_lob_erase()
Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */
-int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC)
+int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
@@ -906,7 +906,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
/* {{{ php_oci_lob_write_tmp()
Create temporary LOB and write data to it */
-int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC)
+int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char *data, int data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
@@ -919,7 +919,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %pd", type);
return 1;
break;
}
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 16fe457433..7dc0d5ee66 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -106,7 +106,7 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
statement->impres_child_stmt = NULL;
statement->impres_count = 0;
statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set children */
- zend_list_addref(statement->connection->id);
+ ++GC_REFCOUNT(statement->connection->id);
if (OCI_G(default_prefetch) >= 0) {
php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch) TSRMLS_CC);
@@ -166,8 +166,8 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T
statement2->has_descr = 0;
statement2->stmttype = 0;
- zend_list_addref(statement->id);
- zend_list_addref(statement2->connection->id);
+ Z_ADDREF_P(statement->id);
+ Z_ADDREF_P(statement2->connection->id);
php_oci_statement_set_prefetch(statement2, statement->prefetch_count TSRMLS_CC);
@@ -359,8 +359,8 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
continue;
}
- zval_dtor(column->define->zval);
- php_oci_column_to_zval(column, column->define->zval, 0 TSRMLS_CC);
+ zval_dtor(&column->define->zval);
+ php_oci_column_to_zval(column, &column->define->zval, 0 TSRMLS_CC);
}
return 0;
@@ -377,7 +377,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
/* {{{ php_oci_statement_get_column()
Get column from the result set */
-php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC)
+php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_index, char *column_name, int column_name_len TSRMLS_DC)
{
php_oci_out_column *column = NULL;
int i;
@@ -396,7 +396,7 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
}
}
} else if (column_index != -1) {
- if (zend_hash_index_find(statement->columns, column_index, (void **)&column) == FAILURE) {
+ if ((column = zend_hash_index_find_ptr(statement->columns, column_index)) == NULL) {
return NULL;
}
return column;
@@ -427,7 +427,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
return OCI_ERROR;
}
nested_stmt->parent_stmtid = outcol->statement->id;
- zend_list_addref(outcol->statement->id);
+ ++GC_REFCOUNT(outcol->statement->id);
outcol->nested_statement = nested_stmt;
outcol->stmtid = nested_stmt->id;
@@ -590,7 +590,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
for (counter = 1; counter <= colcount; counter++) {
memset(&column,0,sizeof(php_oci_out_column));
- if (zend_hash_index_update(statement->columns, counter, &column, sizeof(php_oci_out_column), (void**) &outcol) == FAILURE) {
+ if ((outcol = zend_hash_index_update_ptr(statement->columns, counter, &column)) == NULL) {
efree(statement->columns);
/* out of memory */
return 1;
@@ -683,7 +683,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
/* find a user-set define */
if (statement->defines) {
- if (zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define) == SUCCESS) {
+ if ((outcol->define = zend_hash_str_find_ptr(statement->defines, outcol->name, outcol->name_len)) != NULL) {
if (outcol->define->type) {
outcol->data_type = outcol->define->type;
}
@@ -909,7 +909,7 @@ int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC)
*(int *)result = 0;
- if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
+ if (Z_TYPE(bind->zval) == IS_ARRAY) {
/* These checks are currently valid for oci_bind_by_name, not
* oci_bind_array_by_name. Also bind->type and
* bind->indicator are not used for oci_bind_array_by_name.
@@ -923,7 +923,7 @@ int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC)
case SQLT_CLOB:
case SQLT_BLOB:
case SQLT_RDD:
- if (Z_TYPE_P(bind->zval) != IS_OBJECT) {
+ if (Z_TYPE(bind->zval) != IS_OBJECT) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind");
*(int *)result = 1;
}
@@ -939,14 +939,14 @@ int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC)
case SQLT_LBI:
case SQLT_BIN:
case SQLT_LNG:
- if (Z_TYPE_P(bind->zval) == IS_RESOURCE || Z_TYPE_P(bind->zval) == IS_OBJECT) {
+ if (Z_TYPE(bind->zval) == IS_RESOURCE || Z_TYPE(bind->zval) == IS_OBJECT) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind");
*(int *)result = 1;
}
break;
case SQLT_RSET:
- if (Z_TYPE_P(bind->zval) != IS_RESOURCE) {
+ if (Z_TYPE(bind->zval) != IS_RESOURCE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind");
*(int *)result = 1;
}
@@ -969,27 +969,27 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
sword errstatus;
if (bind->indicator == -1) { /* NULL */
- zval *val = bind->zval;
+ zval *val = &bind->zval;
if (Z_TYPE_P(val) == IS_STRING) {
*Z_STRVAL_P(val) = '\0'; /* XXX avoid warning in debug mode */
}
zval_dtor(val);
ZVAL_NULL(val);
- } else if (Z_TYPE_P(bind->zval) == IS_STRING
- && Z_STRSIZE_P(bind->zval) > 0
- && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') {
+ } else if (Z_TYPE(bind->zval) == IS_STRING
+ && Z_STRLEN(bind->zval) > 0
+ && Z_STRVAL(bind->zval)[ Z_STRLEN(bind->zval) ] != '\0') {
/* The post- PHP 5.3 feature for "interned" strings disallows
* their reallocation but (i) any IN binds either interned or
* not should already be null terminated and (ii) for OUT
* binds, php_oci_bind_out_callback() should have allocated a
* new string that we can modify here.
*/
- Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1);
- Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0';
- } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
+ Z_STR(bind->zval) = zend_string_realloc(Z_STR(bind->zval), Z_STRLEN(bind->zval)+1, 0);
+ Z_STRVAL(bind->zval)[ Z_STRLEN(bind->zval) ] = '\0';
+ } else if (Z_TYPE(bind->zval) == IS_ARRAY) {
int i;
- zval **entry;
- HashTable *hash = HASH_OF(bind->zval);
+ zval *entry = NULL;
+ HashTable *hash = HASH_OF(&bind->zval);
zend_hash_internal_pointer_reset(hash);
@@ -998,23 +998,23 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
case SQLT_INT:
case SQLT_LNG:
for (i = 0; i < bind->array.current_length; i++) {
- if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- zval_dtor(*entry);
- ZVAL_INT(*entry, ((ub4 *)(bind->array.elements))[i]);
+ if ((i < bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
+ zval_dtor(entry);
+ ZVAL_LONG(entry, ((ub4 *)(bind->array.elements))[i]);
zend_hash_move_forward(hash);
} else {
- add_next_index_int(bind->zval, ((ub4 *)(bind->array.elements))[i]);
+ add_next_index_long(&bind->zval, ((ub4 *)(bind->array.elements))[i]);
}
}
break;
case SQLT_FLT:
for (i = 0; i < bind->array.current_length; i++) {
- if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- zval_dtor(*entry);
- ZVAL_DOUBLE(*entry, ((double *)(bind->array.elements))[i]);
+ if ((i < bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
+ zval_dtor(entry);
+ ZVAL_DOUBLE(entry, ((double *)(bind->array.elements))[i]);
zend_hash_move_forward(hash);
} else {
- add_next_index_double(bind->zval, ((double *)(bind->array.elements))[i]);
+ add_next_index_double(&bind->zval, ((double *)(bind->array.elements))[i]);
}
}
break;
@@ -1025,17 +1025,17 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
memset((void*)buff,0,sizeof(buff));
- if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
+ if ((i < bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
- zval_dtor(*entry);
+ zval_dtor(entry);
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- ZVAL_NULL(*entry);
+ ZVAL_NULL(entry);
} else {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
- ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1);
+ ZVAL_STRINGL(entry, (char *)buff, buff_len);
}
zend_hash_move_forward(hash);
} else {
@@ -1043,10 +1043,10 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
if (errstatus != OCI_SUCCESS) {
connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- add_next_index_null(bind->zval);
+ add_next_index_null(&bind->zval);
} else {
connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
- add_next_index_stringl(bind->zval, (char *)buff, buff_len);
+ add_next_index_stringl(&bind->zval, (char *)buff, buff_len);
}
}
}
@@ -1061,12 +1061,12 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
for (i = 0; i < bind->array.current_length; i++) {
/* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */
int curr_element_length = bind->array.element_lengths[i];
- if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- zval_dtor(*entry);
- ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1);
+ if ((i < bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
+ zval_dtor(entry);
+ ZVAL_STRINGL(entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length);
zend_hash_move_forward(hash);
} else {
- add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length);
+ add_next_index_stringl(&bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length);
}
}
break;
@@ -1079,7 +1079,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
/* {{{ php_oci_bind_by_name()
Bind zval to the given placeholder */
-int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC)
+int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long maxlength, ub2 type TSRMLS_DC)
{
php_oci_collection *bind_collection = NULL;
php_oci_descriptor *bind_descriptor = NULL;
@@ -1096,14 +1096,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
switch (type) {
case SQLT_NTY:
{
- zval **tmp;
+ zval *tmp;
- if (Z_TYPE_P(var) != IS_OBJECT || zend_hash_find(Z_OBJPROP_P(var), "collection", sizeof("collection"), (void **)&tmp) == FAILURE) {
+ if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "collection", sizeof("collection"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
return 1;
}
- PHP_OCI_ZVAL_TO_COLLECTION_EX(*tmp, bind_collection);
+ PHP_OCI_ZVAL_TO_COLLECTION_EX(tmp, bind_collection);
value_sz = sizeof(void*);
mode = OCI_DEFAULT;
@@ -1118,14 +1118,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
case SQLT_BLOB:
case SQLT_RDD:
{
- zval **tmp;
+ zval *tmp;
- if (Z_TYPE_P(var) != IS_OBJECT || zend_hash_find(Z_OBJPROP_P(var), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
return 1;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(*tmp, bind_descriptor);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(tmp, bind_descriptor);
value_sz = sizeof(void*);
@@ -1143,8 +1143,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind");
return 1;
}
- convert_to_int(var);
- bind_data = (ub4 *)&Z_IVAL_P(var);
+ convert_to_long(var);
+ bind_data = (ub4 *)&Z_LVAL_P(var);
value_sz = sizeof(ub4);
mode = OCI_DEFAULT;
break;
@@ -1162,7 +1162,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
convert_to_string(var);
}
if (maxlength == -1) {
- value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0;
+ value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0;
} else {
value_sz = maxlength;
}
@@ -1190,7 +1190,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
return 1;
}
convert_to_boolean(var);
- bind_data = (int *)&Z_IVAL_P(var);
+ bind_data = (int *)&Z_LVAL_P(var);
value_sz = sizeof(int);
mode = OCI_DEFAULT;
@@ -1213,21 +1213,19 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
}
memset((void*)&bind,0,sizeof(php_oci_bind));
- if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) {
+ if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) {
bindp = old_bind;
- if (bindp->zval) {
- zval_ptr_dtor(&bindp->zval);
- }
+ zval_ptr_dtor(&bindp->zval);
} else {
- zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bindp);
+ bindp = zend_hash_update_ptr(statement->binds, zend_string_init(name, name_len + 1, 0), &bind);
}
bindp->descriptor = oci_desc;
bindp->statement = oci_stmt;
bindp->parent_statement = statement;
- bindp->zval = var;
+ ZVAL_COPY(&bindp->zval, var);
bindp->type = type;
- zval_add_ref(&var);
+ Z_ADDREF_P(var);
PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
@@ -1316,7 +1314,7 @@ sb4 php_oci_bind_in_callback(
zval *val;
TSRMLS_FETCH();
- if (!(phpbind=(php_oci_bind *)ictxp) || !(val = phpbind->zval)) {
+ if (!(phpbind=(php_oci_bind *)ictxp) || !(val = &phpbind->zval)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value");
return OCI_ERROR;
}
@@ -1332,7 +1330,7 @@ sb4 php_oci_bind_in_callback(
convert_to_string(val);
*bufpp = Z_STRVAL_P(val);
- *alenp = Z_STRSIZE_P(val);
+ *alenp = Z_STRLEN_P(val);
*indpp = (dvoid *)&phpbind->indicator;
} else if (phpbind->statement != 0) {
/* RSET */
@@ -1370,7 +1368,7 @@ sb4 php_oci_bind_out_callback(
sb4 retval = OCI_ERROR;
TSRMLS_FETCH();
- if (!(phpbind=(php_oci_bind *)octxp) || !(val = phpbind->zval)) {
+ if (!(phpbind=(php_oci_bind *)octxp) || !(val = &phpbind->zval)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value");
return retval;
}
@@ -1386,7 +1384,7 @@ sb4 php_oci_bind_out_callback(
}
retval = OCI_CONTINUE;
} else if (Z_TYPE_P(val) == IS_OBJECT) {
- zval **tmp;
+ zval *tmp;
php_oci_descriptor *desc;
if (!phpbind->descriptor) {
@@ -1397,11 +1395,11 @@ sb4 php_oci_bind_out_callback(
* out-bind as the contents would have been changed for in/out
* binds (Bug #46994).
*/
- if (zend_hash_find(Z_OBJPROP_P(val), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(val), "descriptor", sizeof("descriptor"))) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find object outbind descriptor property");
return OCI_ERROR;
}
- PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(*tmp, desc);
+ PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(tmp, desc);
desc->lob_size = -1; /* force OCI8 to update cached size */
*alenpp = &phpbind->dummy_len;
@@ -1414,12 +1412,14 @@ sb4 php_oci_bind_out_callback(
convert_to_string(val);
zval_dtor(val);
- Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
- Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1);
-
+ //Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
+ //Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1);
+ // XXX is this right?
+ ZVAL_STRINGL(val, NULL, Z_STRLEN(phpbind->zval) + 1);
+
/* XXX we assume that zend-zval len has 4 bytes */
- *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval);
- *bufpp = Z_STRVAL_P(phpbind->zval);
+ *alenpp = (ub4*) &Z_STRLEN(phpbind->zval);
+ *bufpp = Z_STRVAL(phpbind->zval);
*piecep = OCI_ONE_PIECE;
*rcodepp = &phpbind->retcode;
*indpp = &phpbind->indicator;
@@ -1442,7 +1442,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
return NULL;
}
- statement = (php_oci_statement *) zend_fetch_resource(&z_statement TSRMLS_CC, -1, "oci8 statement", NULL, 1, le_statement);
+ statement = (php_oci_statement *) zend_fetch_resource(z_statement TSRMLS_CC, -1, "oci8 statement", NULL, 1, le_statement);
if (!statement) {
return NULL;
@@ -1453,7 +1453,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
}
if (Z_TYPE_P(column_index) == IS_STRING) {
- column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC);
if (!column) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index));
return NULL;
@@ -1463,10 +1463,10 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
/* NB: for PHP4 compat only, it should be using 'Z' instead */
tmp = *column_index;
zval_copy_ctor(&tmp);
- convert_to_int(&tmp);
- column = php_oci_statement_get_column(statement, Z_IVAL(tmp), NULL, 0 TSRMLS_CC);
+ convert_to_long(&tmp);
+ column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC);
if (!column) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_IVAL(tmp));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%pd\"", Z_LVAL(tmp));
zval_dtor(&tmp);
return NULL;
}
@@ -1524,7 +1524,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR
/* {{{ php_oci_bind_array_by_name()
Bind arrays to PL/SQL types */
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC)
+int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long max_table_length, zend_long maxlength, zend_long type TSRMLS_DC)
{
php_oci_bind *bind, *bindp;
sword errstatus;
@@ -1532,7 +1532,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
convert_to_array(var);
if (maxlength < -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%ld)", maxlength);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%pd)", maxlength);
return 1;
}
@@ -1563,7 +1563,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection TSRMLS_CC);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %pd", type);
return 1;
break;
}
@@ -1578,18 +1578,18 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0);
}
- zend_hash_update(statement->binds, name, name_len + 1, bind, sizeof(php_oci_bind), (void **)&bindp);
+ bindp = zend_hash_update_ptr(statement->binds, zend_string_init(name, name_len + 1, 0), bind);
bindp->descriptor = NULL;
bindp->statement = NULL;
bindp->parent_statement = statement;
bindp->bind = NULL;
- bindp->zval = var;
+ ZVAL_COPY(&bindp->zval, var);
bindp->array.type = type;
bindp->indicator = 0; /* not used for array binds */
bindp->type = 0; /* not used for array binds */
- zval_add_ref(&var);
+ Z_ADDREF_P(var);
PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
@@ -1626,21 +1626,21 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
/* {{{ php_oci_bind_array_helper_string()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_length, zend_long maxlength TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
HashTable *hash;
- zval **entry;
+ zval *entry;
hash = HASH_OF(var);
if (maxlength == -1) {
zend_hash_internal_pointer_reset(hash);
- while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
+ while ((entry = zend_hash_get_current_data(hash)) != NULL) {
convert_to_string_ex(entry);
- if (Z_STRSIZE_PP(entry) > maxlength) {
- maxlength = Z_STRSIZE_PP(entry) + 1;
+ if (Z_STRLEN_P(entry) > maxlength) {
+ maxlength = Z_STRLEN_P(entry) + 1;
}
zend_hash_move_forward(hash);
}
@@ -1660,10 +1660,10 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length,
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < bind->array.current_length; i++) {
- if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
+ if ((entry = zend_hash_get_current_data(hash)) != NULL) {
convert_to_string_ex(entry);
- bind->array.element_lengths[i] = Z_STRSIZE_PP(entry);
- if (Z_STRSIZE_PP(entry) == 0) {
+ bind->array.element_lengths[i] = Z_STRLEN_P(entry);
+ if (Z_STRLEN_P(entry) == 0) {
bind->array.indicators[i] = -1;
}
zend_hash_move_forward(hash);
@@ -1674,13 +1674,13 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length,
zend_hash_internal_pointer_reset(hash);
for (i = 0; i < max_table_length; i++) {
- if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
+ if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
int element_length;
convert_to_string_ex(entry);
- element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength;
+ element_length = (maxlength > Z_STRLEN_P(entry)) ? Z_STRLEN_P(entry) : maxlength;
- memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length);
+ memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_P(entry), element_length);
((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
zend_hash_move_forward(hash);
@@ -1696,12 +1696,12 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length,
/* {{{ php_oci_bind_array_helper_number()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_length TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
HashTable *hash;
- zval **entry;
+ zval *entry;
hash = HASH_OF(var);
@@ -1719,9 +1719,9 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length
if (i < bind->array.current_length) {
bind->array.element_lengths[i] = sizeof(ub4);
}
- if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- convert_to_int_ex(entry);
- ((ub4 *)bind->array.elements)[i] = (ub4) Z_IVAL_PP(entry);
+ if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
+ convert_to_long_ex(entry);
+ ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_P(entry);
zend_hash_move_forward(hash);
} else {
((ub4 *)bind->array.elements)[i] = 0;
@@ -1735,12 +1735,12 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length
/* {{{ php_oci_bind_array_helper_double()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_length TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
HashTable *hash;
- zval **entry;
+ zval *entry;
hash = HASH_OF(var);
@@ -1758,9 +1758,9 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length
if (i < bind->array.current_length) {
bind->array.element_lengths[i] = sizeof(double);
}
- if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
+ if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
convert_to_double_ex(entry);
- ((double *)bind->array.elements)[i] = (double) Z_DVAL_PP(entry);
+ ((double *)bind->array.elements)[i] = (double) Z_DVAL_P(entry);
zend_hash_move_forward(hash);
} else {
((double *)bind->array.elements)[i] = 0;
@@ -1774,12 +1774,12 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length
/* {{{ php_oci_bind_array_helper_date()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_length, php_oci_connection *connection TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
HashTable *hash;
- zval **entry;
+ zval *entry;
sword errstatus;
hash = HASH_OF(var);
@@ -1799,10 +1799,10 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p
if (i < bind->array.current_length) {
bind->array.element_lengths[i] = sizeof(OCIDate);
}
- if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
+ if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
convert_to_string_ex(entry);
- PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_P(entry), Z_STRLEN_P(entry), NULL, 0, NULL, 0, &oci_date));
if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 066812edad..d673a3c083 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 7cf3d170fa..852fe986f3 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -144,7 +144,7 @@ typedef struct {
sb4 errcode; /* last ORA- error number */
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
- ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */
+ zend_ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */
unsigned is_open:1; /* hels to determine if the connection is dead or not */
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
unsigned is_persistent:1; /* self-descriptive */
@@ -165,7 +165,7 @@ typedef struct {
/* {{{ php_oci_descriptor */
typedef struct {
zend_resource *id;
- ulong index; /* descriptors hash table index */
+ zend_ulong index; /* descriptors hash table index */
php_oci_connection *connection; /* parent connection handle */
dvoid *descriptor; /* OCI descriptor handle */
ub4 type; /* descriptor type (FILE/LOB) */
@@ -221,7 +221,7 @@ typedef struct {
OCIStmt *stmt; /* statement handle */
char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor received from Oracle */
char impres_flag; /* PHP_OCI_IMPRES_*_ */
- long last_query_len; /* last query length */
+ zend_long last_query_len; /* last query length */
HashTable *columns; /* hash containing all the result columns */
HashTable *binds; /* binds hash */
HashTable *defines; /* defines hash */
@@ -249,7 +249,7 @@ typedef struct {
ub4 current_length;
ub4 old_length;
ub4 max_length;
- long type;
+ zend_long type;
} array;
sb2 indicator; /* -1 means NULL */
ub2 retcode;
@@ -361,20 +361,20 @@ typedef struct {
} while (0)
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
- ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection)
+ ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, zval, -1, "oci8 connection", le_connection, le_pconnection)
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
ZEND_FETCH_RESOURCE(statement, php_oci_statement *, zval, -1, "oci8 statement", le_statement)
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
- ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor)
+ ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, zval, -1, "oci8 descriptor", le_descriptor)
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
- ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
+ ZEND_FETCH_RESOURCE(collection, php_oci_collection *, zval, -1, "oci8 collection", le_collection)
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
do { \
- var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
+ var = (type) zend_fetch_resource(zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
if (!var) { \
return 1; \
} \
@@ -407,7 +407,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC);
sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC);
int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC);
void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive);
-php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
+php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, zend_long session_mode, int persistent, int exclusive TSRMLS_DC);
int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC);
int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC);
int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC);
@@ -422,22 +422,22 @@ void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode
/* {{{ lob related prototypes */
-php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, long type TSRMLS_DC);
+php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, zend_long type TSRMLS_DC);
int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC);
-int php_oci_lob_read(php_oci_descriptor *descriptor, long read_length, long inital_offset, char **data, ub4 *data_len TSRMLS_DC);
+int php_oci_lob_read(php_oci_descriptor *descriptor, zend_long read_length, zend_long inital_offset, char **data, ub4 *data_len TSRMLS_DC);
int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC);
-int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC);
+int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag TSRMLS_DC);
int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off TSRMLS_DC);
int php_oci_lob_get_buffering(php_oci_descriptor *descriptor);
-int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, long length TSRMLS_DC);
+int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, zend_long length TSRMLS_DC);
int php_oci_lob_close(php_oci_descriptor *descriptor TSRMLS_DC);
int php_oci_temp_lob_close(php_oci_descriptor *descriptor TSRMLS_DC);
-int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC);
+int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, zend_long type, char *data, int data_len TSRMLS_DC);
void php_oci_lob_free(php_oci_descriptor *descriptor TSRMLS_DC);
int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename TSRMLS_DC);
int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC);
-int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC);
-int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC);
+int php_oci_lob_truncate(php_oci_descriptor *descriptor, zend_long new_lob_length TSRMLS_DC);
+int php_oci_lob_erase(php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC);
int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC);
sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
/* }}} */
@@ -446,15 +446,15 @@ sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece,
php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC);
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC);
-int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC);
-int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC);
+int php_oci_collection_max(php_oci_collection *collection, zend_long *max TSRMLS_DC);
+int php_oci_collection_trim(php_oci_collection *collection, zend_long trim_size TSRMLS_DC);
int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC);
-int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC);
-int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC);
-int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC);
-int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC);
-int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC);
-int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC);
+int php_oci_collection_element_get(php_oci_collection *collection, zend_long index, zval *result_element TSRMLS_DC);
+int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len TSRMLS_DC);
+int php_oci_collection_element_set_null(php_oci_collection *collection, zend_long index TSRMLS_DC);
+int php_oci_collection_element_set_date(php_oci_collection *collection, zend_long index, char *date, int date_len TSRMLS_DC);
+int php_oci_collection_element_set_number(php_oci_collection *collection, zend_long index, char *number, int number_len TSRMLS_DC);
+int php_oci_collection_element_set_string(php_oci_collection *collection, zend_long index, char *element, int element_len TSRMLS_DC);
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC);
void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC);
int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC);
@@ -471,24 +471,24 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC);
int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC);
int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC);
-php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC);
+php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_index, char *column_name, int column_name_len TSRMLS_DC);
int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC);
int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC);
void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC);
int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC);
int php_oci_bind_post_exec(void *data TSRMLS_DC);
-int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC);
+int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long maxlength, ub2 type TSRMLS_DC);
sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp);
sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp);
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC);
int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC);
int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC);
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
+int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long max_table_length, zend_long maxlength, zend_long type TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_length TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_length TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_length, zend_long maxlength TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_length, php_oci_connection *connection TSRMLS_DC);
/* }}} */
@@ -496,14 +496,14 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */
sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */
OCIError *err; /* global error handle */
- long max_persistent; /* maximum number of persistent connections per process */
- long num_persistent; /* number of existing persistent connections */
- long num_links; /* non-persistent + persistent connections */
- long num_statements; /* number of statements open */
- long ping_interval; /* time interval between pings */
- long persistent_timeout; /* time period after which idle persistent connection is considered expired */
- long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
- long default_prefetch; /* default prefetch setting */
+ zend_long max_persistent; /* maximum number of persistent connections per process */
+ zend_long num_persistent; /* number of existing persistent connections */
+ zend_long num_links; /* non-persistent + persistent connections */
+ zend_long num_statements; /* number of statements open */
+ zend_long ping_interval; /* time interval between pings */
+ zend_long persistent_timeout; /* time period after which idle persistent connection is considered expired */
+ zend_long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
+ zend_long default_prefetch; /* default prefetch setting */
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c
index 13e4d523fb..3857c6955c 100644
--- a/ext/odbc/birdstep.c
+++ b/ext/odbc/birdstep.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -193,7 +193,7 @@ PHP_MINIT_FUNCTION(birdstep)
{
SQLAllocEnv(&henv);
- if ( cfg_get_int("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) {
+ if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) {
php_birdstep_module.max_links = -1;
}
php_birdstep_module.num_links = 0;
@@ -287,11 +287,11 @@ static void birdstep_del_result(HashTable *list,int ind)
PHP_FUNCTION(birdstep_connect)
{
char *serv, *user, *pass;
- int serv_len, user_len, pass_len;
+ size_t serv_len, user_len, pass_len;
RETCODE stat;
HDBC hdbc;
VConn *new;
- php_int_t ind;
+ zend_long ind;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) {
return;
@@ -316,7 +316,7 @@ PHP_FUNCTION(birdstep_connect)
new = (VConn *)emalloc(sizeof(VConn));
ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC);
php_birdstep_module.num_links++;
- RETURN_INT(ind);
+ RETURN_LONG(ind);
}
/* }}} */
@@ -324,10 +324,10 @@ PHP_FUNCTION(birdstep_connect)
*/
PHP_FUNCTION(birdstep_close)
{
- php_int_t id;
+ zend_long id;
VConn *conn;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
return;
}
@@ -346,15 +346,15 @@ PHP_FUNCTION(birdstep_close)
PHP_FUNCTION(birdstep_exec)
{
char *query;
- php_int_t ind;
- int query_len, indx;
+ zend_long ind;
+ size_t query_len, indx;
VConn *conn;
Vresult *res;
RETCODE stat;
SWORD cols,i,colnamelen;
SDWORD rows,coldesc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &ind, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &ind, &query, &query_len) == FAILURE) {
return;
}
@@ -392,7 +392,7 @@ PHP_FUNCTION(birdstep_exec)
}
SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res);
- RETURN_INT(rows);
+ RETURN_LONG(rows);
} else { /* Was SELECT query */
res->values = (VResVal *)safe_emalloc(sizeof(VResVal), cols, 0);
res->numcols = cols;
@@ -418,7 +418,7 @@ PHP_FUNCTION(birdstep_exec)
}
res->fetched = 0;
indx = birdstep_add_result(list,res,conn);
- RETURN_INT(indx);
+ RETURN_LONG(indx);
}
/* }}} */
@@ -426,13 +426,13 @@ PHP_FUNCTION(birdstep_exec)
*/
PHP_FUNCTION(birdstep_fetch)
{
- php_int_t ind;
+ zend_long ind;
Vresult *res;
RETCODE stat;
UDWORD row;
UWORD RowStat[1];
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
return;
}
@@ -441,13 +441,13 @@ PHP_FUNCTION(birdstep_fetch)
stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
res->fetched = 1;
@@ -460,7 +460,7 @@ PHP_FUNCTION(birdstep_fetch)
PHP_FUNCTION(birdstep_result)
{
zval **col;
- php_int_t ind;
+ zend_long ind;
Vresult *res;
RETCODE stat;
int i,sql_c_type;
@@ -469,7 +469,7 @@ PHP_FUNCTION(birdstep_result)
SWORD indx = -1;
char *field = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iZ", &ind, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &ind, &col) == FAILURE) {
return;
}
@@ -478,8 +478,8 @@ PHP_FUNCTION(birdstep_result)
if ( Z_TYPE_PP(col) == IS_STRING ) {
field = Z_STRVAL_PP(col);
} else {
- convert_to_int_ex(col);
- indx = Z_IVAL_PP(col);
+ convert_to_long_ex(col);
+ indx = Z_LVAL_PP(col);
}
if ( field ) {
for ( i = 0; i < res->numcols; i++ ) {
@@ -502,13 +502,13 @@ PHP_FUNCTION(birdstep_result)
stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
res->fetched = 1;
@@ -527,19 +527,19 @@ l1:
res->values[indx].value,4095,&res->values[indx].vallen);
if ( stat == SQL_NO_DATA_FOUND ) {
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error");
SQLFreeStmt(res->hstmt,SQL_DROP);
- birdstep_del_result(list,Z_IVAL_PP(ind));
+ birdstep_del_result(list,Z_LVAL_PP(ind));
RETURN_FALSE;
}
if ( res->values[indx].valtype == SQL_LONGVARCHAR ) {
RETURN_STRING(res->values[indx].value,TRUE);
} else {
- RETURN_INT((long)res->values[indx].value);
+ RETURN_LONG((zend_long)res->values[indx].value);
}
default:
if ( res->values[indx].value != NULL ) {
@@ -553,10 +553,10 @@ l1:
*/
PHP_FUNCTION(birdstep_freeresult)
{
- php_int_t ind;
+ zend_long ind;
Vresult *res;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
return;
}
@@ -572,11 +572,11 @@ PHP_FUNCTION(birdstep_freeresult)
*/
PHP_FUNCTION(birdstep_autocommit)
{
- php_int_t id;
+ zend_long id;
RETCODE stat;
VConn *conn;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
return;
}
@@ -595,11 +595,11 @@ PHP_FUNCTION(birdstep_autocommit)
*/
PHP_FUNCTION(birdstep_off_autocommit)
{
- php_int_t id;
+ zend_long id;
RETCODE stat;
VConn *conn;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
return;
}
@@ -618,11 +618,11 @@ PHP_FUNCTION(birdstep_off_autocommit)
*/
PHP_FUNCTION(birdstep_commit)
{
-php_int_t
+zend_long
RETCODE stat;
VConn *conn;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
return;
}
@@ -641,11 +641,11 @@ php_int_t
*/
PHP_FUNCTION(birdstep_rollback)
{
- php_int_t id;
+ zend_long id;
RETCODE stat;
VConn *conn;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) {
return;
}
@@ -664,11 +664,11 @@ PHP_FUNCTION(birdstep_rollback)
*/
PHP_FUNCTION(birdstep_fieldname)
{
- php_int_t ind, col;
+ zend_long ind, col;
Vresult *res;
SWORD indx;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &ind, &col) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &ind, &col) == FAILURE) {
return;
}
@@ -687,16 +687,16 @@ PHP_FUNCTION(birdstep_fieldname)
*/
PHP_FUNCTION(birdstep_fieldnum)
{
- php_int_t ind;
+ zend_long ind;
Vresult *res;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) {
return;
}
PHP_GET_BIRDSTEP_RES_IDX(ind);
- RETURN_INT(res->numcols);
+ RETURN_LONG(res->numcols);
}
/* }}} */
diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h
index 430445b415..eab1dcee7c 100644
--- a/ext/odbc/php_birdstep.h
+++ b/ext/odbc/php_birdstep.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,28 +28,28 @@
typedef struct VConn {
HDBC hdbc;
- php_int_t index;
+ zend_long index;
} VConn;
typedef struct {
char name[32];
char *value;
- php_int_t vallen;
+ zend_long vallen;
SDWORD valtype;
} VResVal;
typedef struct Vresult {
HSTMT hstmt;
VConn *conn;
- php_int_t index;
+ zend_long index;
VResVal *values;
- php_int_t numcols;
+ zend_long numcols;
int fetched;
} Vresult;
typedef struct {
- php_int_t num_links;
- php_int_t max_links;
+ zend_long num_links;
+ zend_long max_links;
int le_link,le_result;
} birdstep_module;
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index d0c7138ab2..6729163996 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -524,9 +524,9 @@ static PHP_INI_DISP(display_link_nums)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -549,9 +549,9 @@ static PHP_INI_DISP(display_defPW)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -580,9 +580,9 @@ static PHP_INI_DISP(display_binmode)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -611,9 +611,9 @@ static PHP_INI_DISP(display_lrl)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -637,9 +637,9 @@ static PHP_INI_DISP(display_cursortype)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -718,84 +718,84 @@ PHP_MINIT_FUNCTION(odbc)
odbc_module_entry.type = type;
REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT);
/* Define Constants for options
these Constants are defined in <sqlext.h>
*/
- REGISTER_INT_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS);
/* these are for the Data Source type */
- REGISTER_INT_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS);
/*
* register the standard data types
*/
- REGISTER_INT_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
- REGISTER_INT_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS);
/*
* SQLSpecialColumns values
*/
- REGISTER_INT_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS);
/*
* SQLStatistics values
*/
- REGISTER_INT_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS);
#endif
#if defined(HAVE_IBMDB2) && defined(_AIX)
@@ -841,9 +841,9 @@ PHP_MINFO_FUNCTION(odbc)
php_info_print_table_start();
php_info_print_table_header(2, "ODBC Support", "enabled");
- snprintf(buf, sizeof(buf), "%pd", ODBCG(num_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ODBCG(num_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
- snprintf(buf, sizeof(buf), "%pd", ODBCG(num_links));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ODBCG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE);
#ifndef PHP_WIN32
@@ -911,13 +911,13 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
odbc_result *result;
zval *pv_res;
- php_int_t flag;
+ zend_long flag;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &flag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &flag) == FAILURE) {
return;
}
- if (Z_IVAL_P(pv_res)) {
+ if (Z_LVAL_P(pv_res)) {
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (mode) {
result->longreadlen = flag;
@@ -945,14 +945,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
SQLUSMALLINT colfieldid;
int charextraalloc;
- colfieldid = SQL_COLUMN_DISPLAY_SIZE;
- charextraalloc = 0;
result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0);
result->longreadlen = ODBCG(defaultlrl);
result->binmode = ODBCG(defaultbinmode);
for(i = 0; i < result->numcols; i++) {
+ charextraalloc = 0;
+ colfieldid = SQL_COLUMN_DISPLAY_SIZE;
+
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
@@ -1061,9 +1062,9 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
SQLLEN len;
#endif
zval *pv_res;
- php_int_t pv_num;
+ zend_long pv_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
return;
}
@@ -1086,7 +1087,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len);
- RETURN_INT(len);
+ RETURN_LONG(len);
}
/* }}} */
@@ -1147,7 +1148,7 @@ PHP_FUNCTION(odbc_prepare)
{
zval *pv_conn;
char *query;
- int query_len;
+ size_t query_len;
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
@@ -1301,7 +1302,7 @@ PHP_FUNCTION(odbc_execute)
}
rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable);
- params[i-1].vallen = Z_STRSIZE_P(tmp);
+ params[i-1].vallen = Z_STRLEN_P(tmp);
params[i-1].fp = -1;
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter");
@@ -1321,14 +1322,14 @@ PHP_FUNCTION(odbc_execute)
ctype = SQL_C_CHAR;
}
- if (Z_STRSIZE_P(tmp) > 2 &&
+ if (Z_STRLEN_P(tmp) > 2 &&
Z_STRVAL_P(tmp)[0] == '\'' &&
- Z_STRVAL_P(tmp)[Z_STRSIZE_P(tmp) - 1] == '\'') {
+ Z_STRVAL_P(tmp)[Z_STRLEN_P(tmp) - 1] == '\'') {
if (CHECK_ZVAL_NULL_PATH(tmp)) {
RETURN_FALSE;
}
- filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRSIZE_P(tmp) - 2);
+ filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRLEN_P(tmp) - 2);
filename[strlen(filename)] = '\0';
/* Check the basedir */
@@ -1518,13 +1519,13 @@ PHP_FUNCTION(odbc_cursor)
PHP_FUNCTION(odbc_data_source)
{
zval *zv_conn;
- php_int_t zv_fetch_type;
+ zend_long zv_fetch_type;
RETCODE rc = 0; /* assume all is good */
odbc_connection *conn;
UCHAR server_name[100], desc[200];
SQLSMALLINT len1=0, len2=0, fetch_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zv_conn, &zv_fetch_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zv_conn, &zv_fetch_type) == FAILURE) {
return;
}
@@ -1573,7 +1574,7 @@ PHP_FUNCTION(odbc_data_source)
PHP_FUNCTION(odbc_exec)
{
zval *pv_conn;
- php_int_t pv_flags;
+ zend_long pv_flags;
char *query;
int numArgs, query_len;
odbc_result *result = NULL;
@@ -1585,7 +1586,7 @@ PHP_FUNCTION(odbc_exec)
numArgs = ZEND_NUM_ARGS();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) {
return;
}
@@ -1668,9 +1669,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
SQLUSMALLINT RowStatus[1];
SQLLEN rownum;
zval *pv_res, tmp;
- php_int_t pv_row = -1;
+ zend_long pv_row = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) {
return;
}
@@ -1815,14 +1816,14 @@ PHP_FUNCTION(odbc_fetch_into)
char *buf = NULL;
zval *pv_res, *pv_res_arr, tmp;
#ifdef HAVE_SQL_EXTENDED_FETCH
- php_int_t pv_row = 0;
+ zend_long pv_row = 0;
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
SQLLEN rownum = -1;
#endif /* HAVE_SQL_EXTENDED_FETCH */
#ifdef HAVE_SQL_EXTENDED_FETCH
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|i", &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
return;
}
@@ -1919,7 +1920,7 @@ PHP_FUNCTION(odbc_fetch_into)
zend_hash_index_update(Z_ARRVAL_P(pv_res_arr), i, &tmp);
}
if (buf) efree(buf);
- RETURN_INT(result->numcols);
+ RETURN_LONG(result->numcols);
}
/* }}} */
@@ -1964,13 +1965,13 @@ PHP_FUNCTION(odbc_fetch_row)
odbc_result *result;
RETCODE rc;
zval *pv_res;
- php_int_t pv_row = 1;
+ zend_long pv_row = 1;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) {
return;
}
@@ -2035,8 +2036,8 @@ PHP_FUNCTION(odbc_result)
if (Z_TYPE_P(pv_field) == IS_STRING) {
field = Z_STRVAL_P(pv_field);
} else {
- convert_to_int_ex(pv_field);
- field_ind = Z_IVAL_P(pv_field) - 1;
+ convert_to_long_ex(pv_field);
+ field_ind = Z_LVAL_P(pv_field) - 1;
}
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
@@ -2205,7 +2206,7 @@ PHP_FUNCTION(odbc_result_all)
RETCODE rc;
zval *pv_res;
char *pv_format = NULL;
- int i, pv_format_len = 0;
+ size_t i, pv_format_len = 0;
SQLSMALLINT sql_c_type;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLULEN crow;
@@ -2231,7 +2232,7 @@ PHP_FUNCTION(odbc_result_all)
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
php_printf("<h2>No rows found</h2>\n");
- RETURN_INT(0);
+ RETURN_LONG(0);
}
/* Start table tag */
@@ -2315,7 +2316,7 @@ PHP_FUNCTION(odbc_result_all)
}
php_printf("</table>\n");
if (buf) efree(buf);
- RETURN_INT(result->fetched);
+ RETURN_LONG(result->fetched);
}
/* }}} */
@@ -2500,8 +2501,8 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int
void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *db, *uid, *pwd;
- int db_len, uid_len, pwd_len;
- php_int_t pv_opt = SQL_CUR_DEFAULT;
+ size_t db_len, uid_len, pwd_len;
+ zend_long pv_opt = SQL_CUR_DEFAULT;
odbc_connection *db_conn;
char *hashed_details;
int hashed_len, cur_opt;
@@ -2509,7 +2510,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* Now an optional 4th parameter specifying the cursor type
* defaulting to the cursors default
*/
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) {
return;
}
@@ -2615,13 +2616,13 @@ try_and_get_another_connection:
zend_resource *index_ptr, new_index_ptr;
if ((index_ptr = zend_hash_str_find_ptr(&EG(regular_list), hashed_details, hashed_len)) != NULL) {
- int conn_id;
+ zend_ulong conn_id;
zend_resource *p;
if (index_ptr->type != le_index_ptr) {
RETURN_FALSE;
}
- conn_id = (int)index_ptr->ptr;
+ conn_id = (zend_ulong)index_ptr->ptr;
p = zend_hash_index_find_ptr(&EG(regular_list), conn_id); /* check if the connection is still there */
if (p && p->ptr && (p->type == le_conn || p->type == le_pconn)) {
@@ -2709,7 +2710,7 @@ PHP_FUNCTION(odbc_num_rows)
}
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
SQLRowCount(result->stmt, &rows);
- RETURN_INT(rows);
+ RETURN_LONG(rows);
}
/* }}} */
@@ -2774,7 +2775,7 @@ PHP_FUNCTION(odbc_num_fields)
return;
}
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- RETURN_INT(result->numcols);
+ RETURN_LONG(result->numcols);
}
/* }}} */
@@ -2784,9 +2785,9 @@ PHP_FUNCTION(odbc_field_name)
{
odbc_result *result;
zval *pv_res;
- php_int_t pv_num;
+ zend_long pv_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
return;
}
@@ -2819,9 +2820,9 @@ PHP_FUNCTION(odbc_field_type)
char tmp[32];
SQLSMALLINT tmplen;
zval *pv_res;
- php_int_t pv_num;
+ zend_long pv_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) {
return;
}
@@ -2868,7 +2869,7 @@ PHP_FUNCTION(odbc_field_scale)
PHP_FUNCTION(odbc_field_num)
{
char *fname;
- int i, field_ind, fname_len;
+ size_t i, field_ind, fname_len;
odbc_result *result;
zval *pv_res;
@@ -2893,7 +2894,7 @@ PHP_FUNCTION(odbc_field_num)
if (field_ind == -1) {
RETURN_FALSE;
}
- RETURN_INT(field_ind);
+ RETURN_LONG(field_ind);
}
/* }}} */
@@ -2905,9 +2906,9 @@ PHP_FUNCTION(odbc_autocommit)
odbc_connection *conn;
RETCODE rc;
zval *pv_conn;
- php_int_t pv_onoff = 0;
+ zend_long pv_onoff = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_onoff) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_onoff) == FAILURE) {
return;
}
@@ -2928,7 +2929,7 @@ PHP_FUNCTION(odbc_autocommit)
odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status");
RETURN_FALSE;
}
- RETVAL_INT((long)status);
+ RETVAL_LONG((zend_long)status);
}
}
/* }}} */
@@ -2969,14 +2970,14 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (ZEND_NUM_ARGS() == 1) {
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
- ptr = STR_ALLOC(len + 1, 0);
+ ptr = zend_string_alloc(len + 1, 0);
if (mode == 0) {
strlcpy(ptr->val, conn->laststate, len+1);
} else {
strlcpy(ptr->val, conn->lasterrormsg, len+1);
}
} else {
- ptr = STR_ALLOC(len, 0);
+ ptr = zend_string_alloc(len, 0);
if (mode == 0) {
strlcpy(ptr->val, ODBCG(laststate), len+1);
} else {
@@ -3017,9 +3018,9 @@ PHP_FUNCTION(odbc_setoption)
odbc_result *result;
RETCODE rc;
zval *pv_handle;
- php_int_t pv_which, pv_opt, pv_val;
+ zend_long pv_which, pv_opt, pv_val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
return;
}
@@ -3069,7 +3070,7 @@ PHP_FUNCTION(odbc_tables)
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema = NULL, *table = NULL, *type = NULL;
- int cat_len = 0, schema_len = 0, table_len = 0, type_len = 0;
+ size_t cat_len = 0, schema_len = 0, table_len = 0, type_len = 0;
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len,
@@ -3270,7 +3271,7 @@ PHP_FUNCTION(odbc_foreignkeys)
odbc_result *result = NULL;
odbc_connection *conn;
char *pcat = NULL, *pschema, *ptable, *fcat, *fschema, *ftable;
- int pcat_len = 0, pschema_len, ptable_len, fcat_len, fschema_len, ftable_len;
+ size_t pcat_len = 0, pschema_len, ptable_len, fcat_len, fschema_len, ftable_len;
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!sssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len,
@@ -3344,13 +3345,13 @@ PHP_FUNCTION(odbc_foreignkeys)
PHP_FUNCTION(odbc_gettypeinfo)
{
zval *pv_conn;
- php_int_t pv_data_type = SQL_ALL_TYPES;
+ zend_long pv_data_type = SQL_ALL_TYPES;
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
SQLSMALLINT data_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_data_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_data_type) == FAILURE) {
return;
}
@@ -3467,7 +3468,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema = NULL, *proc = NULL, *col = NULL;
- int cat_len = 0, schema_len = 0, proc_len = 0, col_len = 0;
+ size_t cat_len = 0, schema_len = 0, proc_len = 0, col_len = 0;
RETCODE rc;
if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 5) {
@@ -3597,15 +3598,15 @@ PHP_FUNCTION(odbc_procedures)
PHP_FUNCTION(odbc_specialcolumns)
{
zval *pv_conn;
- php_int_t vtype, vscope, vnullable;
+ zend_long vtype, vscope, vnullable;
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema = NULL, *name = NULL;
- int cat_len = 0, schema_len, name_len;
+ size_t cat_len = 0, schema_len, name_len;
SQLUSMALLINT type, scope, nullable;
RETCODE rc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris!ssi", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vscope, &vnullable) == FAILURE) {
return;
}
@@ -3667,7 +3668,7 @@ PHP_FUNCTION(odbc_specialcolumns)
PHP_FUNCTION(odbc_statistics)
{
zval *pv_conn;
- php_int_t vunique, vreserved;
+ zend_long vunique, vreserved;
odbc_result *result = NULL;
odbc_connection *conn;
char *cat = NULL, *schema, *name;
@@ -3675,7 +3676,7 @@ PHP_FUNCTION(odbc_statistics)
SQLUSMALLINT unique, reserved;
RETCODE rc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssii", &pv_conn, &cat, &cat_len, &schema, &schema_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vunique, &vreserved) == FAILURE) {
return;
}
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index bd78e88f52..9219fa87ad 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
index 14b3d6812d..6a7e5c3756 100644
--- a/ext/odbc/php_odbc_includes.h
+++ b/ext/odbc/php_odbc_includes.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -161,7 +161,7 @@ PHP_FUNCTION(solid_fetch_prev);
#define ODBC_TYPE "Birdstep"
#define UNIX
/*
- * Extended Fetch in the Birdstep ODBC API is incapable of returning php_int_t varchar (memo) fields.
+ * Extended Fetch in the Birdstep ODBC API is incapable of returning zend_long varchar (memo) fields.
* So the following line has been commented-out to accommodate. - KNS
*
* #define HAVE_SQL_EXTENDED_FETCH 1
@@ -247,7 +247,7 @@ typedef struct odbc_result {
# if HAVE_SQL_EXTENDED_FETCH
int fetch_abs;
# endif
- php_int_t longreadlen;
+ zend_long longreadlen;
int binmode;
int fetched;
odbc_connection *conn_ptr;
@@ -257,16 +257,16 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc)
char *defDB;
char *defUser;
char *defPW;
- php_int_t allow_persistent;
- php_int_t check_persistent;
- php_int_t max_persistent;
- php_int_t max_links;
- php_int_t num_persistent;
- php_int_t num_links;
+ zend_long allow_persistent;
+ zend_long check_persistent;
+ zend_long max_persistent;
+ zend_long max_links;
+ zend_long num_persistent;
+ zend_long num_links;
int defConn;
- php_int_t defaultlrl;
- php_int_t defaultbinmode;
- php_int_t default_cursortype;
+ zend_long defaultlrl;
+ zend_long defaultbinmode;
+ zend_long default_cursortype;
char laststate[6];
char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
HashTable *resource_list;
diff --git a/ext/odbc/tests/bug68087.phpt b/ext/odbc/tests/bug68087.phpt
new file mode 100644
index 0000000000..3bc18125a6
--- /dev/null
+++ b/ext/odbc/tests/bug68087.phpt
@@ -0,0 +1,57 @@
+--TEST--
+odbc_exec(): Getting accurate date data from query
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+
+include 'config.inc';
+
+$id_1_date = '2014-09-23';
+$id_2_date = '2014-09-24';
+
+$conn = odbc_connect($dsn, $user, $pass);
+
+@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
+
+odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)');
+
+odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date')");
+odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloagain', '$id_2_date')");
+
+$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
+
+while(odbc_fetch_row($res)) {
+ $id = odbc_result($res, "ID");
+ $varchar_col = odbc_result($res, "VARCHAR_COL");
+ $date = odbc_result($res, "DATE_COL");
+
+ if ($id == 1) {
+ if ($date != $id_1_date) {
+ print "Date_1 mismatched\n";
+ } else {
+ print "Date_1 matched\n";
+ }
+ } else {
+ if ($date != $id_2_date) {
+ print "Date_2 mismatched\n";
+ } else {
+ print "Date_2 matched\n";
+ }
+ }
+}
+
+?>
+--EXPECT--
+Date_1 matched
+Date_2 matched
+--CLEAN--
+<?php
+include 'config.inc';
+
+$conn = odbc_connect($dsn, $user, $pass);
+
+odbc_exec($conn, 'DROP TABLE FOO');
+odbc_exec($conn, 'DROP DATABASE odbcTEST');
+
+?>
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index fb7e64bb6d..f43802647b 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -19,10 +19,18 @@
+----------------------------------------------------------------------+
*/
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
#define DEBUG_BLOCKPASS 0
/* Checks if a constant (like "true") may be replaced by its value */
-static int zend_get_persistent_constant(zend_string *name, zval *result, int copy TSRMLS_DC ELS_DC)
+int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy TSRMLS_DC)
{
zend_constant *c;
char *lookup_name;
@@ -106,7 +114,7 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg, zend_optimiz
zend_op *opline;
zend_op *end = op_array->opcodes + op_array->last;
zend_code_block *blocks, *cur_block;
- zend_uint opno = 0;
+ uint32_t opno = 0;
memset(cfg, 0, sizeof(zend_cfg));
blocks = cfg->blocks = zend_arena_calloc(&ctx->arena, op_array->last + 2, sizeof(zend_code_block));
@@ -161,7 +169,7 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg, zend_optimiz
case ZEND_FE_RESET:
case ZEND_NEW:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
START_BLOCK_OP(ZEND_OP2(opline).opline_num);
START_BLOCK_OP(opno + 1);
break;
@@ -196,14 +204,12 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg, zend_optimiz
j = 0;
for (i = 0; i< op_array->last_brk_cont; i++) {
if (op_array->brk_cont_array[i].start >= 0 &&
- (op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_FREE ||
- op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_SWITCH_FREE)) {
+ op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_FREE) {
int parent = op_array->brk_cont_array[i].parent;
while (parent >= 0 &&
op_array->brk_cont_array[parent].start < 0 &&
- op_array->opcodes[op_array->brk_cont_array[parent].brk].opcode != ZEND_FREE &&
- op_array->opcodes[op_array->brk_cont_array[parent].brk].opcode != ZEND_SWITCH_FREE) {
+ op_array->opcodes[op_array->brk_cont_array[parent].brk].opcode != ZEND_FREE) {
parent = op_array->brk_cont_array[parent].parent;
}
op_array->brk_cont_array[i].parent = parent;
@@ -217,8 +223,7 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg, zend_optimiz
j = 0;
for (i = 0; i< op_array->last_brk_cont; i++) {
if (op_array->brk_cont_array[i].start >= 0 &&
- (op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_FREE ||
- op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_SWITCH_FREE)) {
+ op_array->opcodes[op_array->brk_cont_array[i].brk].opcode == ZEND_FREE) {
if (i != j) {
op_array->brk_cont_array[j] = op_array->brk_cont_array[i];
}
@@ -289,7 +294,7 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg, zend_optimiz
case ZEND_FE_RESET:
case ZEND_NEW:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
case ZEND_FE_FETCH:
cur_block->op2_to = &blocks[ZEND_OP2(opline).opline_num];
/* break missing intentionally */
@@ -606,12 +611,12 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
end = opline + block->len;
while ((op_array->T) && (opline < end)) {
/* strip X = QM_ASSIGN(const) */
- if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+ if ((ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN &&
ZEND_OP1_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
opline->opcode != ZEND_CASE && /* CASE _always_ expects variable */
- opline->opcode != ZEND_FETCH_DIM_TMP_VAR && /* in 5.1, FETCH_DIM_TMP_VAR expects T */
+ opline->opcode != ZEND_FETCH_LIST && /* in 5.1, FETCH_DIM_TMP_VAR expects T */
opline->opcode != ZEND_FE_RESET &&
opline->opcode != ZEND_FREE
) {
@@ -619,13 +624,13 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
zval c = ZEND_OP1_LITERAL(src);
VAR_UNSET(opline->op1);
zval_copy_ctor(&c);
- update_op1_const(op_array, opline, &c TSRMLS_CC);
+ zend_optimizer_update_op1_const(op_array, opline, &c TSRMLS_CC);
literal_dtor(&ZEND_OP1_LITERAL(src));
MAKE_NOP(src);
}
/* T = QM_ASSIGN(C), F(T) => NOP, F(C) */
- if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
+ if ((ZEND_OP2_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
VAR_SOURCE(opline->op2) &&
VAR_SOURCE(opline->op2)->opcode == ZEND_QM_ASSIGN &&
ZEND_OP1_TYPE(VAR_SOURCE(opline->op2)) == IS_CONST) {
@@ -633,7 +638,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
zval c = ZEND_OP1_LITERAL(src);
VAR_UNSET(opline->op2);
zval_copy_ctor(&c);
- update_op2_const(op_array, opline, &c TSRMLS_CC);
+ zend_optimizer_update_op2_const(op_array, opline, &c TSRMLS_CC);
literal_dtor(&ZEND_OP1_LITERAL(src));
MAKE_NOP(src);
}
@@ -644,14 +649,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT &&
opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) {
ZEND_OP1_TYPE(opline) = IS_CONST;
- LITERAL_INT(opline->op1, 1);
+ LITERAL_LONG(opline->op1, 1);
}
if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
VAR_SOURCE(opline->op2) &&
VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) {
ZEND_OP2_TYPE(opline) = IS_CONST;
- LITERAL_INT(opline->op2, 1);
+ LITERAL_LONG(opline->op2, 1);
}
/* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
@@ -706,14 +711,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
zend_op *sv = fcall-1;
if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL &&
ZEND_OP1_TYPE(sv) == IS_CONST && Z_TYPE(OPLINE_OP1_LITERAL(sv)) == IS_STRING &&
- Z_IVAL(OPLINE_OP2_LITERAL(sv)) == 1
+ Z_LVAL(OPLINE_OP2_LITERAL(sv)) == 1
) {
zval *arg = &OPLINE_OP1_LITERAL(sv);
- char *fname = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].function_name;
- int flen = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].name_len;
+ char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name;
+ int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len;
if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) {
zval c;
- if(zend_get_persistent_constant(Z_STR_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) {
+ if(zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) {
literal_dtor(arg);
MAKE_NOP(sv);
MAKE_NOP(fcall);
@@ -733,7 +738,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
}
} else if(flen == sizeof("constant")-1 && zend_binary_strcasecmp(fname, flen, "constant", sizeof("constant")-1) == 0) {
zval c;
- if(zend_get_persistent_constant(Z_STR_P(arg), &c, 1 TSRMLS_CC ELS_CC) != 0) {
+ if(zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, 1 TSRMLS_CC ELS_CC) != 0) {
literal_dtor(arg);
MAKE_NOP(sv);
MAKE_NOP(fcall);
@@ -872,10 +877,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
opline->opcode == ZEND_JMPNZ_EX ||
opline->opcode == ZEND_JMPNZ ||
opline->opcode == ZEND_JMPZNZ) &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+ (ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
VAR_SOURCE(opline->op1) != NULL &&
(!used_ext[VAR_NUM(ZEND_OP1(opline).var)] ||
- (ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
+ ((ZEND_RESULT_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
ZEND_RESULT(opline).var == ZEND_OP1(opline).var)) &&
(VAR_SOURCE(opline->op1)->opcode == ZEND_BOOL ||
VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN)) {
@@ -903,21 +908,21 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
convert_to_string_safe(&ZEND_OP1_LITERAL(last_op));
}
- old_len = Z_STRSIZE(ZEND_OP1_LITERAL(last_op));
- l = old_len + Z_STRSIZE(ZEND_OP1_LITERAL(opline));
- if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(last_op)))) {
- zend_string *tmp = STR_ALLOC(l, 0);
+ old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
+ l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
+ zend_string *tmp = zend_string_alloc(l, 0);
memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
} else {
- Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
+ Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_realloc(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
}
Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
- memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline)));
+ memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
zval_dtor(&ZEND_OP1_LITERAL(opline));
Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(opline)))) {
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
@@ -947,21 +952,21 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
opline->opcode = ZEND_ADD_STRING;
}
COPY_NODE(opline->op1, src->op1);
- old_len = Z_STRSIZE(ZEND_OP2_LITERAL(src));
- l = old_len + Z_STRSIZE(ZEND_OP2_LITERAL(opline));
- if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(src)))) {
- zend_string *tmp = STR_ALLOC(l, 0);
+ old_len = Z_STRLEN(ZEND_OP2_LITERAL(src));
+ l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline));
+ if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(src))) {
+ zend_string *tmp = zend_string_alloc(l, 0);
memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len);
Z_STR(ZEND_OP2_LITERAL(last_op)) = tmp;
} else {
- Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0);
+ Z_STR(ZEND_OP2_LITERAL(src)) = zend_string_realloc(Z_STR(ZEND_OP2_LITERAL(src)), l, 0);
}
Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX;
- memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)));
+ memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)));
Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0';
- STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline)));
+ zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline)));
Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(opline)))) {
+ if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(opline))) {
Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
ZVAL_NULL(&ZEND_OP2_LITERAL(src));
@@ -972,7 +977,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
continue;
} else if (opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) {
/* convert ADD_CHAR(C1, C2) to CONCAT(C1, C2) */
- char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline));
+ char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1);
opline->opcode = ZEND_CONCAT;
continue;
@@ -1002,8 +1007,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
int er;
if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) &&
- ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT &&
- Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) ||
+ ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG &&
+ Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) ||
(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_DOUBLE &&
Z_DVAL(ZEND_OP2_LITERAL(opline)) == 0.0))) {
if (RESULT_USED(opline)) {
@@ -1019,7 +1024,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
literal_dtor(&ZEND_OP2_LITERAL(opline));
opline->opcode = ZEND_QM_ASSIGN;
SET_UNUSED(opline->op2);
- update_op1_const(op_array, opline, &result TSRMLS_CC);
+ zend_optimizer_update_op1_const(op_array, opline, &result TSRMLS_CC);
}
EG(error_reporting) = er;
} else if ((opline->opcode == ZEND_BOOL ||
@@ -1039,9 +1044,9 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
ZVAL_NULL(&ZEND_OP1_LITERAL(opline));
}
opline->opcode = ZEND_QM_ASSIGN;
- update_op1_const(op_array, opline, &result TSRMLS_CC);
+ zend_optimizer_update_op1_const(op_array, opline, &result TSRMLS_CC);
} else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+ (ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN) {
/* T = QM_ASSIGN(X), RETURN(T) to RETURN(X) */
@@ -1050,25 +1055,6 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
COPY_NODE(opline->op1, src->op1);
MAKE_NOP(src);
} else if ((opline->opcode == ZEND_ADD_STRING ||
- opline->opcode == ZEND_ADD_CHAR) &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
- VAR_SOURCE(opline->op1) &&
- VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
- /* convert T = INIT_STRING(), T = ADD_STRING(T, X) to T = QM_ASSIGN(X) */
- /* CHECKME: Remove ZEND_ADD_VAR optimization, since some conversions -
- namely, BOOL(false)->string - don't allocate memory but use empty_string
- and ADD_CHAR fails */
- zend_op *src = VAR_SOURCE(opline->op1);
- VAR_UNSET(opline->op1);
- COPY_NODE(opline->op1, opline->op2);
- if (opline->opcode == ZEND_ADD_CHAR) {
- char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline));
- ZVAL_STRINGL(&ZEND_OP1_LITERAL(opline), &c, 1);
- }
- SET_UNUSED(opline->op2);
- MAKE_NOP(src);
- opline->opcode = ZEND_QM_ASSIGN;
- } else if ((opline->opcode == ZEND_ADD_STRING ||
opline->opcode == ZEND_ADD_CHAR ||
opline->opcode == ZEND_ADD_VAR ||
opline->opcode == ZEND_CONCAT) &&
@@ -1077,40 +1063,23 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT &&
ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING &&
- Z_STRSIZE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) {
+ Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) {
/* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */
zend_op *src = VAR_SOURCE(opline->op1);
VAR_UNSET(opline->op1);
COPY_NODE(opline->op1, src->op1);
if (opline->opcode == ZEND_ADD_CHAR) {
- char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline));
+ char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1);
}
opline->opcode = ZEND_CONCAT;
literal_dtor(&ZEND_OP2_LITERAL(src)); /* will take care of empty_string too */
MAKE_NOP(src);
-//??? This optimization can't work anymore because ADD_VAR returns IS_TMP_VAR
-//??? and ZEND_CAST returns IS_VAR.
-//??? BTW: it wan't used for long time, because we don't use INIT_STRING
-#if 0
- } else if (opline->opcode == ZEND_ADD_VAR &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
- VAR_SOURCE(opline->op1) &&
- VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
- /* convert T = INIT_STRING(), T = ADD_VAR(T, X) to T = CAST(STRING, X) */
- zend_op *src = VAR_SOURCE(opline->op1);
- VAR_UNSET(opline->op1);
- COPY_NODE(opline->op1, opline->op2);
- SET_UNUSED(opline->op2);
- MAKE_NOP(src);
- opline->opcode = ZEND_CAST;
- opline->extended_value = IS_STRING;
-#endif
} else if ((opline->opcode == ZEND_ADD_STRING ||
opline->opcode == ZEND_ADD_CHAR ||
opline->opcode == ZEND_ADD_VAR ||
opline->opcode == ZEND_CONCAT) &&
- ZEND_OP1_TYPE(opline) == (IS_TMP_VAR|IS_VAR) &&
+ (ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) &&
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_CAST &&
VAR_SOURCE(opline->op1)->extended_value == IS_STRING) {
@@ -1119,14 +1088,13 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
VAR_UNSET(opline->op1);
COPY_NODE(opline->op1, src->op1);
if (opline->opcode == ZEND_ADD_CHAR) {
- char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline));
+ char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1);
}
opline->opcode = ZEND_CONCAT;
MAKE_NOP(src);
} else if (opline->opcode == ZEND_QM_ASSIGN &&
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
- ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
+ ZEND_OP1_TYPE(opline) == ZEND_RESULT_TYPE(opline) &&
ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
/* strip T = QM_ASSIGN(T) */
MAKE_NOP(opline);
@@ -1264,8 +1232,8 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array)
op_array->opcodes = erealloc(new_opcodes, op_array->last * sizeof(zend_op));
/* adjust early binding list */
- if (op_array->early_binding != (zend_uint)-1) {
- zend_uint *opline_num = &op_array->early_binding;
+ if (op_array->early_binding != (uint32_t)-1) {
+ uint32_t *opline_num = &op_array->early_binding;
zend_op *end;
opline = op_array->opcodes;
@@ -1358,10 +1326,9 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
} else if (0&& block->op1_to != block &&
block->op1_to != blocks &&
op_array->last_try_catch == 0 &&
- target->opcode != ZEND_FREE &&
- target->opcode != ZEND_SWITCH_FREE) {
+ target->opcode != ZEND_FREE) {
/* Block Reordering (saves one JMP on each "for" loop iteration)
- * It is disabled for some cases (ZEND_FREE/ZEND_SWITCH_FREE)
+ * It is disabled for some cases (ZEND_FREE)
* which may break register allocation.
*/
zend_bool can_reorder = 0;
@@ -1441,7 +1408,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
if (block->op2_to) {
zend_uchar same_type = ZEND_OP1_TYPE(last_op);
- zend_uint same_var = VAR_NUM_EX(last_op->op1);
+ uint32_t same_var = VAR_NUM_EX(last_op->op1);
zend_op *target;
zend_op *target_end;
zend_code_block *target_block = block->op2_to;;
@@ -1939,7 +1906,7 @@ static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *
#define PASSES 3
-static void zend_block_optimization(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
+void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
{
zend_cfg cfg;
zend_code_block *cur_block;
@@ -1952,7 +1919,7 @@ static void zend_block_optimization(zend_op_array *op_array, zend_optimizer_ctx
fflush(stderr);
#endif
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
return;
}
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index e941380738..091437e119 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -20,6 +20,15 @@
/* pass 11
* - compact literals table
*/
+
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
#define DEBUG_COMPACT_LITERALS 0
#define LITERAL_VALUE 0x0100
@@ -31,6 +40,7 @@
#define LITERAL_STATIC_PROPERTY 0x0700
#define LITERAL_METHOD 0x0800
#define LITERAL_PROPERTY 0x0900
+#define LITERAL_GLOBAL 0x0A00
#define LITERAL_EX_CLASS 0x4000
#define LITERAL_EX_OBJ 0x2000
@@ -44,7 +54,7 @@
#define LITERAL_NUM_SLOTS(info) ((info & LITERAL_NUM_SLOTS_MASK) >> LITERAL_NUM_SLOTS_SHIFT)
typedef struct _literal_info {
- zend_uint flags; /* bitmask (see defines above) */
+ uint32_t flags; /* bitmask (see defines above) */
union {
int num; /* variable number or class name literal number */
} u;
@@ -71,9 +81,9 @@ static void optimizer_literal_obj_info(literal_info *info,
zend_uchar op_type,
znode_op op,
int constant,
- zend_uint kind,
- zend_uint slots,
- zend_uint related,
+ uint32_t kind,
+ uint32_t slots,
+ uint32_t related,
zend_op_array *op_array)
{
/* For now we merge only $this object properties and methods.
@@ -92,9 +102,9 @@ static void optimizer_literal_class_info(literal_info *info,
zend_uchar op_type,
znode_op op,
int constant,
- zend_uint kind,
- zend_uint slots,
- zend_uint related,
+ uint32_t kind,
+ uint32_t slots,
+ uint32_t related,
zend_op_array *op_array)
{
if (op_type == IS_CONST) {
@@ -104,7 +114,7 @@ static void optimizer_literal_class_info(literal_info *info,
}
}
-static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
+void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
{
zend_op *opline, *end;
int i, j, n, *map, cache_slots;
@@ -269,6 +279,9 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
}
}
break;
+ case ZEND_BIND_GLOBAL:
+ LITERAL_INFO(opline->op2.constant, LITERAL_GLOBAL, 0, 1, 1);
+ break;
default:
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1, 0, 1);
@@ -291,7 +304,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
for (i = 0; i < op_array->last_literal; i++) {
zval zv = op_array->literals[i].constant;
use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC);
- fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv));
+ fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv));
if (use_copy) {
zval_dtor(&zv);
}
@@ -302,7 +315,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
/* Merge equal constants */
j = 0; cache_slots = 0;
- zend_hash_init(&hash, 16, NULL, NULL, 0);
+ zend_hash_init(&hash, op_array->last_literal, NULL, NULL, 0);
map = (int*)zend_arena_alloc(&ctx->arena, op_array->last_literal * sizeof(int));
memset(map, 0, op_array->last_literal * sizeof(int));
for (i = 0; i < op_array->last_literal; i++) {
@@ -345,13 +358,13 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
}
map[i] = l_true;
break;
- case IS_INT:
- if ((pos = zend_hash_index_find(&hash, Z_IVAL(op_array->literals[i]))) != NULL) {
- map[i] = Z_IVAL_P(pos);
+ case IS_LONG:
+ if ((pos = zend_hash_index_find(&hash, Z_LVAL(op_array->literals[i]))) != NULL) {
+ map[i] = Z_LVAL_P(pos);
} else {
map[i] = j;
- ZVAL_INT(&zv, j);
- zend_hash_index_update(&hash, Z_IVAL(op_array->literals[i]), &zv);
+ ZVAL_LONG(&zv, j);
+ zend_hash_index_add_new(&hash, Z_LVAL(op_array->literals[i]), &zv);
if (i != j) {
op_array->literals[j] = op_array->literals[i];
info[j] = info[i];
@@ -361,10 +374,10 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
break;
case IS_DOUBLE:
if ((pos = zend_hash_str_find(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != NULL) {
- map[i] = Z_IVAL_P(pos);
+ map[i] = Z_LVAL_P(pos);
} else {
map[i] = j;
- ZVAL_INT(&zv, j);
+ ZVAL_LONG(&zv, j);
zend_hash_str_add(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), &zv);
if (i != j) {
op_array->literals[j] = op_array->literals[i];
@@ -377,32 +390,32 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
case IS_CONSTANT:
if (info[i].flags & LITERAL_MAY_MERGE) {
if (info[i].flags & LITERAL_EX_OBJ) {
- int key_len = MAX_LENGTH_OF_ZEND_INT + sizeof("->") + Z_STRSIZE(op_array->literals[i]);
- key = STR_ALLOC(key_len, 0);
+ int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]);
+ key = zend_string_alloc(key_len, 0);
key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i]));
} else if (info[i].flags & LITERAL_EX_CLASS) {
int key_len;
zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num];
- key_len = Z_STRSIZE_P(class_name) + sizeof("::") + Z_STRSIZE(op_array->literals[i]);
- key = STR_ALLOC(key_len, 0);
- memcpy(key->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name));
- memcpy(key->val + Z_STRSIZE_P(class_name), "::", sizeof("::") - 1);
- memcpy(key->val + Z_STRSIZE_P(class_name) + sizeof("::") - 1,
+ key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]);
+ key = zend_string_alloc(key_len, 0);
+ memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
+ memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1);
+ memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1,
Z_STRVAL(op_array->literals[i]),
- Z_STRSIZE(op_array->literals[i]) + 1);
+ Z_STRLEN(op_array->literals[i]) + 1);
} else {
- key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRSIZE(op_array->literals[i]), 0);
+ key = zend_string_init(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0);
}
key->h = zend_hash_func(key->val, key->len);
key->h += info[i].flags;
}
if ((info[i].flags & LITERAL_MAY_MERGE) &&
(pos = zend_hash_find(&hash, key)) != NULL &&
- Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_IVAL_P(pos)]) &&
- info[i].flags == info[Z_IVAL_P(pos)].flags) {
+ Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) &&
+ info[i].flags == info[Z_LVAL_P(pos)].flags) {
- STR_RELEASE(key);
- map[i] = Z_IVAL_P(pos);
+ zend_string_release(key);
+ map[i] = Z_LVAL_P(pos);
zval_dtor(&op_array->literals[i]);
n = LITERAL_NUM_RELATED(info[i].flags);
while (n > 1) {
@@ -413,9 +426,9 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
} else {
map[i] = j;
if (info[i].flags & LITERAL_MAY_MERGE) {
- ZVAL_INT(&zv, j);
- zend_hash_add(&hash, key, &zv);
- STR_RELEASE(key);
+ ZVAL_LONG(&zv, j);
+ zend_hash_add_new(&hash, key, &zv);
+ zend_string_release(key);
}
if (i != j) {
op_array->literals[j] = op_array->literals[i];
@@ -472,7 +485,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c
for (i = 0; i < op_array->last_literal; i++) {
zval zv = op_array->literals[i].constant;
use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC);
- fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv));
+ fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv));
if (use_copy) {
zval_dtor(&zv);
}
diff --git a/ext/opcache/Optimizer/nop_removal.c b/ext/opcache/Optimizer/nop_removal.c
index 5f54408d16..651950148c 100644
--- a/ext/opcache/Optimizer/nop_removal.c
+++ b/ext/opcache/Optimizer/nop_removal.c
@@ -23,22 +23,30 @@
* - remove NOPs
*/
-static void nop_removal(zend_op_array *op_array)
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
+void zend_optimizer_nop_removal(zend_op_array *op_array)
{
zend_op *end, *opline;
- zend_uint new_count, i, shift;
+ uint32_t new_count, i, shift;
int j;
- zend_uint *shiftlist;
+ uint32_t *shiftlist;
ALLOCA_FLAG(use_heap);
- shiftlist = (zend_uint *)DO_ALLOCA(sizeof(zend_uint) * op_array->last);
+ shiftlist = (uint32_t *)DO_ALLOCA(sizeof(uint32_t) * op_array->last);
i = new_count = shift = 0;
end = op_array->opcodes + op_array->last;
for (opline = op_array->opcodes; opline < end; opline++) {
/* GOTO target is unresolved yet. We can't optimize. */
if (opline->opcode == ZEND_GOTO &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) {
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
/* TODO: in general we can avoid this restriction */
FREE_ALLOCA(shiftlist);
return;
@@ -89,7 +97,7 @@ static void nop_removal(zend_op_array *op_array)
case ZEND_FE_RESET:
case ZEND_NEW:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
ZEND_OP2(opline).opline_num -= shiftlist[ZEND_OP2(opline).opline_num];
break;
case ZEND_JMPZNZ:
@@ -120,13 +128,13 @@ static void nop_removal(zend_op_array *op_array)
}
/* update early binding list */
- if (op_array->early_binding != (zend_uint)-1) {
- zend_uint *opline_num = &op_array->early_binding;
+ if (op_array->early_binding != (uint32_t)-1) {
+ uint32_t *opline_num = &op_array->early_binding;
do {
*opline_num -= shiftlist[*opline_num];
opline_num = &ZEND_RESULT(&op_array->opcodes[*opline_num]).opline_num;
- } while (*opline_num != (zend_uint)-1);
+ } while (*opline_num != (uint32_t)-1);
}
}
FREE_ALLOCA(shiftlist);
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c
index ead951ac73..aa62a4542d 100644
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@ -20,12 +20,26 @@
/* pass 4
* - optimize INIT_FCALL_BY_NAME to DO_FCALL
*/
+
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
+#define ZEND_OP2_IS_CONST_STRING(opline) \
+ (ZEND_OP2_TYPE(opline) == IS_CONST && \
+ Z_TYPE(op_array->literals[(opline)->op2.constant]) == IS_STRING)
+
typedef struct _optimizer_call_info {
zend_function *func;
zend_op *opline;
} optimizer_call_info;
-static void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC) {
+void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
+{
zend_op *opline = op_array->opcodes;
zend_op *end = opline + op_array->last;
int call = 0;
@@ -42,7 +56,7 @@ static void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx
switch (opline->opcode) {
case ZEND_INIT_FCALL_BY_NAME:
case ZEND_INIT_NS_FCALL_BY_NAME:
- if (ZEND_OP2_TYPE(opline) == IS_CONST) {
+ if (ZEND_OP2_IS_CONST_STRING(opline)) {
zend_function *func;
zval *function_name = &op_array->literals[opline->op2.constant + 1];
if ((func = zend_hash_find_ptr(&ctx->script->function_table,
@@ -78,10 +92,10 @@ static void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx
} else {
ZEND_ASSERT(0);
}
- } else if (opline->extended_value == 0 &&
- call_stack[call].opline &&
+ } else if (call_stack[call].opline &&
call_stack[call].opline->opcode == ZEND_INIT_FCALL_BY_NAME &&
- ZEND_OP2_TYPE(call_stack[call].opline) == IS_CONST) {
+ call_stack[call].opline->extended_value == 0 &&
+ ZEND_OP2_IS_CONST_STRING(call_stack[call].opline)) {
zend_op *fcall = call_stack[call].opline;
diff --git a/ext/opcache/Optimizer/optimize_temp_vars_5.c b/ext/opcache/Optimizer/optimize_temp_vars_5.c
index df5d00a366..a7838cb9dd 100644
--- a/ext/opcache/Optimizer/optimize_temp_vars_5.c
+++ b/ext/opcache/Optimizer/optimize_temp_vars_5.c
@@ -19,6 +19,14 @@
+----------------------------------------------------------------------+
*/
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
#define GET_AVAILABLE_T() \
for (i = 0; i < T; i++) { \
if (!taken_T[i]) { \
@@ -30,7 +38,7 @@
max = i; \
}
-static void optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_ctx *ctx)
+void optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_ctx *ctx)
{
int T = op_array->T;
int offset = op_array->last_var;
diff --git a/ext/opcache/Optimizer/pass10.c b/ext/opcache/Optimizer/pass10.c
deleted file mode 100644
index 7f2004a7dc..0000000000
--- a/ext/opcache/Optimizer/pass10.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-if (((ZEND_OPTIMIZER_PASS_10|ZEND_OPTIMIZER_PASS_5) & OPTIMIZATION_LEVEL) == ZEND_OPTIMIZER_PASS_10) {
- nop_removal(op_array);
-}
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index f98058fd9e..b91ac5b50f 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -27,9 +27,18 @@
* - pre-evaluate constant function calls
*/
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
#define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT)
-if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
+void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC)
+{
int i = 0;
zend_op *opline = op_array->opcodes;
zend_op *end = opline + op_array->last;
@@ -60,13 +69,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
ZEND_OP2_TYPE(opline) == IS_CONST) {
/* binary operation with constant operands */
int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC) = get_binary_op(opline->opcode);
- zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
+ uint32_t tv = ZEND_RESULT(opline).var; /* temporary variable */
zval result;
int er;
if (opline->opcode == ZEND_DIV &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT &&
- Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) {
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG &&
+ Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) {
/* div by 0 */
break;
}
@@ -82,7 +91,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result TSRMLS_CC);
}
break;
@@ -92,7 +101,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
opline->extended_value != IS_OBJECT &&
opline->extended_value != IS_RESOURCE) {
/* cast of constant operand */
- zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
+ zend_uchar type = opline->result_type;
+ uint32_t tv = ZEND_RESULT(opline).var; /* temporary variable */
zval res;
res = ZEND_OP1_LITERAL(opline);
zval_copy_ctor(&res);
@@ -103,8 +113,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
case _IS_BOOL:
convert_to_boolean(&res);
break;
- case IS_INT:
- convert_to_int(&res);
+ case IS_LONG:
+ convert_to_long(&res);
break;
case IS_DOUBLE:
convert_to_double(&res);
@@ -117,11 +127,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
literal_dtor(&ZEND_OP1_LITERAL(opline));
MAKE_NOP(opline);
- if (opline->result_type == IS_TMP_VAR) {
- replace_tmp_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
- } else /* if (opline->result_type == IS_VAR) */ {
- replace_var_by_const(op_array, opline + 1, tv, &res TSRMLS_CC);
- }
+ zend_optimizer_replace_by_const(op_array, opline + 1, type, tv, &res TSRMLS_CC);
} else if (opline->extended_value == _IS_BOOL) {
/* T = CAST(X, IS_BOOL) => T = BOOL(X) */
opline->opcode = ZEND_BOOL;
@@ -135,7 +141,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
/* unary operation on constant operand */
unary_op_type unary_op = get_unary_op(opline->opcode);
zval result;
- zend_uint tv = ZEND_RESULT(opline).var; /* temporary variable */
+ uint32_t tv = ZEND_RESULT(opline).var; /* temporary variable */
int er;
er = EG(error_reporting);
@@ -148,7 +154,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
literal_dtor(&ZEND_OP1_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline + 1, tv, &result TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, tv, &result TSRMLS_CC);
}
break;
@@ -174,7 +180,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
if (next_op->opcode == ZEND_ADD_CHAR) {
final_length += 1;
} else { /* ZEND_ADD_STRING */
- final_length += Z_STRSIZE(ZEND_OP2_LITERAL(next_op));
+ final_length += Z_STRLEN(ZEND_OP2_LITERAL(next_op));
}
next_op++;
}
@@ -182,32 +188,32 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
break;
}
last_op = next_op;
- final_length += (requires_conversion? 1 : Z_STRSIZE(ZEND_OP2_LITERAL(opline)));
- str = STR_ALLOC(final_length, 0);
+ final_length += (requires_conversion? 1 : Z_STRLEN(ZEND_OP2_LITERAL(opline)));
+ str = zend_string_alloc(final_length, 0);
ptr = str->val;
ptr[final_length] = '\0';
if (requires_conversion) { /* ZEND_ADD_CHAR */
- char chval = (char)Z_IVAL(ZEND_OP2_LITERAL(opline));
+ char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline));
ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str);
ptr[0] = chval;
opline->opcode = ZEND_ADD_STRING;
ptr++;
} else { /* ZEND_ADD_STRING */
- memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)));
- STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline)));
+ memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)));
+ zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline)));
Z_STR(ZEND_OP2_LITERAL(opline)) = str;
- ptr += Z_STRSIZE(ZEND_OP2_LITERAL(opline));
+ ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline));
}
- Z_STRSIZE(ZEND_OP2_LITERAL(opline)) = final_length;
+ Z_STRLEN(ZEND_OP2_LITERAL(opline)) = final_length;
next_op = opline + 1;
while (next_op < last_op) {
if (next_op->opcode == ZEND_ADD_STRING) {
- memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRSIZE(ZEND_OP2_LITERAL(next_op)));
- ptr += Z_STRSIZE(ZEND_OP2_LITERAL(next_op));
+ memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRLEN(ZEND_OP2_LITERAL(next_op)));
+ ptr += Z_STRLEN(ZEND_OP2_LITERAL(next_op));
literal_dtor(&ZEND_OP2_LITERAL(next_op));
} else { /* ZEND_ADD_CHAR */
- *ptr = (char)Z_IVAL(ZEND_OP2_LITERAL(next_op));
+ *ptr = (char)Z_LVAL(ZEND_OP2_LITERAL(next_op));
ptr++;
}
MAKE_NOP(next_op);
@@ -227,7 +233,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
if (ZEND_OP1_TYPE(opline) == IS_UNUSED &&
ZEND_OP2_TYPE(opline) == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
- Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
+ Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) {
/* substitute __COMPILER_HALT_OFFSET__ constant */
zend_execute_data *orig_execute_data = EG(current_execute_data);
@@ -238,11 +244,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
fake_execute_data.func = (zend_function*)op_array;
EG(current_execute_data) = &fake_execute_data;
if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) {
- zend_uint tv = ZEND_RESULT(opline).var;
+ uint32_t tv = ZEND_RESULT(opline).var;
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline, tv, offset TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, offset TSRMLS_CC);
}
EG(current_execute_data) = orig_execute_data;
break;
@@ -252,17 +258,20 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
ZEND_OP2_TYPE(opline) == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
/* substitute persistent constants */
- zend_uint tv = ZEND_RESULT(opline).var;
+ uint32_t tv = ZEND_RESULT(opline).var;
zval c;
- if (!zend_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) {
+ if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) {
if (!ctx->constants || !zend_optimizer_get_collected_constant(ctx->constants, &ZEND_OP2_LITERAL(opline), &c)) {
break;
}
}
+ if (Z_TYPE(c) == IS_CONSTANT_AST) {
+ break;
+ }
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline, tv, &c TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c TSRMLS_CC);
}
/* class constant */
@@ -277,7 +286,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
/* for A::B */
if (op_array->scope &&
!strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
- op_array->scope->name->val, Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1)) {
+ op_array->scope->name->val, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
ce = op_array->scope;
} else {
if ((ce = zend_hash_find_ptr(EG(class_table),
@@ -300,14 +309,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
if (ce) {
- zend_uint tv = ZEND_RESULT(opline).var;
+ uint32_t tv = ZEND_RESULT(opline).var;
zval *c, t;
if ((c = zend_hash_find(&ce->constants_table,
Z_STR(ZEND_OP2_LITERAL(opline)))) != NULL) {
ZVAL_DEREF(c);
+ if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
+ break;
+ }
if (ZEND_IS_CONSTANT_TYPE(Z_TYPE_P(c))) {
- if (!zend_get_persistent_constant(Z_STR_P(c), &t, 1 TSRMLS_CC) ||
+ if (!zend_optimizer_get_persistent_constant(Z_STR_P(c), &t, 1 TSRMLS_CC) ||
ZEND_IS_CONSTANT_TYPE(Z_TYPE(t))) {
break;
}
@@ -323,7 +335,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
- replace_tmp_by_const(op_array, opline, tv, &t TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &t TSRMLS_CC);
}
}
}
@@ -334,8 +346,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
if (collect_constants &&
ZEND_OP2_TYPE(opline) == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
- Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 &&
- zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) {
+ Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 &&
+ zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) {
if ((opline+1)->opcode == ZEND_SEND_VAL &&
ZEND_OP1_TYPE(opline+1) == IS_CONST &&
@@ -364,22 +376,22 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
(opline + 2)->opcode == ZEND_DO_FCALL &&
ZEND_OP1_TYPE(opline + 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) == IS_STRING &&
ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- if ((Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 &&
+ if ((Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"function_exists", sizeof("function_exists")-1)) ||
- (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 &&
+ (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"is_callable", sizeof("is_callable")))) {
zend_internal_function *func;
char *lc_name = zend_str_tolower_dup(
- Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)));
+ Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
- if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)))) != NULL &&
+ if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)))) != NULL &&
func->type == ZEND_INTERNAL_FUNCTION &&
func->module->type == MODULE_PERSISTENT) {
zval t;
ZVAL_BOOL(&t, 1);
- if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
+ if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
@@ -388,14 +400,14 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
}
efree(lc_name);
- } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 &&
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"extension_loaded", sizeof("extension_loaded")-1)) {
zval t;
char *lc_name = zend_str_tolower_dup(
- Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)));
+ Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
zend_module_entry *m = zend_hash_str_find_ptr(&module_registry,
- lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)));
+ lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
efree(lc_name);
if (!m) {
@@ -412,22 +424,22 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
}
- if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
+ if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
MAKE_NOP(opline + 1);
MAKE_NOP(opline + 2);
}
- } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 &&
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"defined", sizeof("defined")-1)) {
zval t;
- if (zend_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 0 TSRMLS_CC)) {
+ if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 0 TSRMLS_CC)) {
ZVAL_BOOL(&t, 1);
- if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
+ if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
@@ -435,13 +447,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
MAKE_NOP(opline + 2);
}
}
- } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 &&
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"constant", sizeof("constant")-1)) {
zval t;
- if (zend_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 1 TSRMLS_CC)) {
- if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
+ if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 1 TSRMLS_CC)) {
+ if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
@@ -450,13 +462,13 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
}
} else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 &&
- Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 &&
+ Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
"strlen", sizeof("strlen")-1)) {
zval t;
- ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)));
- if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
+ ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
+ if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
literal_dtor(&ZEND_OP2_LITERAL(opline));
MAKE_NOP(opline);
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
@@ -471,8 +483,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
zval t;
- ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline)));
- replace_tmp_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC);
+ ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline)));
+ zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC);
literal_dtor(&ZEND_OP1_LITERAL(opline));
MAKE_NOP(opline);
}
@@ -480,12 +492,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
case ZEND_DEFINED:
{
zval c;
- zend_uint tv = ZEND_RESULT(opline).var;
- if (!zend_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0 TSRMLS_CC)) {
+ uint32_t tv = ZEND_RESULT(opline).var;
+ if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0 TSRMLS_CC)) {
break;
}
ZVAL_TRUE(&c);
- replace_tmp_by_const(op_array, opline, tv, &c TSRMLS_CC);
+ zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c TSRMLS_CC);
literal_dtor(&ZEND_OP1_LITERAL(opline));
MAKE_NOP(opline);
}
@@ -520,7 +532,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
case ZEND_NEW:
case ZEND_DO_FCALL:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
collect_constants = 0;
break;
case ZEND_FETCH_R:
@@ -535,7 +547,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
opline->op1_type == IS_CONST &&
opline->op2_type == IS_UNUSED &&
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
- (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 ||
+ (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 ||
memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this") - 1) != 0)) {
int var = opline->result.var;
diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c
index 1be6b9cb1c..859bc2f3bc 100644
--- a/ext/opcache/Optimizer/pass2.c
+++ b/ext/opcache/Optimizer/pass2.c
@@ -25,7 +25,16 @@
* - optimize static BRKs and CONTs
*/
-if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
+void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC)
+{
zend_op *opline;
zend_op *end = op_array->opcodes + op_array->last;
@@ -61,8 +70,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
case ZEND_SL:
case ZEND_SR:
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_INT) {
- convert_to_int(&ZEND_OP1_LITERAL(opline));
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
+ convert_to_long(&ZEND_OP1_LITERAL(opline));
}
}
/* break missing *intentionally - the assign_op's may only optimize op2 */
@@ -74,8 +83,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
break;
}
if (ZEND_OP2_TYPE(opline) == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) {
- convert_to_int(&ZEND_OP2_LITERAL(opline));
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
}
}
break;
@@ -183,7 +192,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
if (ZEND_OP2_TYPE(opline) != IS_CONST) {
break;
}
- convert_to_int(&ZEND_OP2_LITERAL(opline));
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
nest_levels = ZEND_OP2_LITERAL(opline).value.lval;
array_offset = ZEND_OP1(opline).opline_num;
@@ -196,8 +205,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
array_offset = jmp_to->parent;
if (--nest_levels > 0) {
if (opline->opcode == ZEND_BRK &&
- (op_array->opcodes[jmp_to->brk].opcode == ZEND_FREE ||
- op_array->opcodes[jmp_to->brk].opcode == ZEND_SWITCH_FREE)) {
+ op_array->opcodes[jmp_to->brk].opcode == ZEND_FREE) {
dont_optimize = 1;
break;
}
diff --git a/ext/opcache/Optimizer/pass3.c b/ext/opcache/Optimizer/pass3.c
index 810eedb646..8d8cb50580 100644
--- a/ext/opcache/Optimizer/pass3.c
+++ b/ext/opcache/Optimizer/pass3.c
@@ -25,6 +25,14 @@
* - change $i++ to ++$i where possible
*/
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
/* compares opcodes with allowing oc1 be _EX of oc2 */
#define SAME_OPCODE_EX(oc1, oc2) ((oc1 == oc2) || (oc1 == ZEND_JMPZ_EX && oc2 == ZEND_JMPZ) || (oc1 == ZEND_JMPNZ_EX && oc2 == ZEND_JMPNZ))
@@ -45,16 +53,17 @@
} \
jmp_hitlist[jmp_hitlist_count++] = ZEND_OP2(&op_array->opcodes[target]).opline_num;
-if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
+void zend_optimizer_pass3(zend_op_array *op_array TSRMLS_DC)
+{
zend_op *opline;
zend_op *end = op_array->opcodes + op_array->last;
- zend_uint *jmp_hitlist;
+ uint32_t *jmp_hitlist;
int jmp_hitlist_count;
int i;
- zend_uint opline_num = 0;
+ uint32_t opline_num = 0;
ALLOCA_FLAG(use_heap);
- jmp_hitlist = (zend_uint *)DO_ALLOCA(sizeof(zend_uint)*op_array->last);
+ jmp_hitlist = (uint32_t *)DO_ALLOCA(sizeof(uint32_t)*op_array->last);
opline = op_array->opcodes;
while (opline < end) {
@@ -153,7 +162,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
break;
case ZEND_JMP:
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
break;
}
@@ -173,8 +182,8 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
break;
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
- if (op_array->has_finally_block) {
+ case ZEND_COALESCE:
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
break;
}
@@ -189,7 +198,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
break;
case ZEND_JMPZ:
case ZEND_JMPNZ:
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
break;
}
@@ -245,7 +254,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
zend_uchar T_type = opline->result_type;
znode_op T = opline->result;
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
break;
}
@@ -379,7 +388,7 @@ continue_jmp_ex_optimization:
break;
case ZEND_JMPZNZ:
- if (op_array->has_finally_block) {
+ if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
break;
}
diff --git a/ext/opcache/Optimizer/pass5.c b/ext/opcache/Optimizer/pass5.c
deleted file mode 100644
index fffcf985d5..0000000000
--- a/ext/opcache/Optimizer/pass5.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-if (ZEND_OPTIMIZER_PASS_5 & OPTIMIZATION_LEVEL) {
- zend_block_optimization(op_array, ctx TSRMLS_CC);
-}
diff --git a/ext/opcache/Optimizer/pass9.c b/ext/opcache/Optimizer/pass9.c
deleted file mode 100644
index 42c2ae1f4d..0000000000
--- a/ext/opcache/Optimizer/pass9.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* pass 9
- *
- * - optimize usage of temporary variables
- */
-
-if (ZEND_OPTIMIZER_PASS_9 & OPTIMIZATION_LEVEL) {
- optimize_temporary_variables(op_array, ctx);
-}
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index a4bf4223a7..70e58f5695 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -27,15 +27,12 @@
#include "zend_execute.h"
#include "zend_vm.h"
-#define OPTIMIZATION_LEVEL \
- ZCG(accel_directives).optimization_level
-
static void zend_optimizer_zval_dtor_wrapper(zval *zvalue)
{
zval_dtor(zvalue);
}
-static void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value)
+void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value)
{
zval val;
@@ -47,7 +44,7 @@ static void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name,
zend_hash_add(ctx->constants, Z_STR_P(name), &val);
}
-static int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value)
+int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value)
{
zval *val;
@@ -58,10 +55,10 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam
return 0;
}
-static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
+int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
{
int i = 0;
- zend_uint_t hash_value = STR_HASH_VAL(name);
+ zend_ulong hash_value = zend_string_hash_val(name);
while (i < op_array->last_var) {
if (op_array->vars[i] == name ||
@@ -75,7 +72,7 @@ static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
i = op_array->last_var;
op_array->last_var++;
op_array->vars = erealloc(op_array->vars, op_array->last_var * sizeof(zend_string*));
- op_array->vars[i] = STR_DUP(name, 0);
+ op_array->vars[i] = zend_string_dup(name, 0);
/* all IS_TMP_VAR and IS_VAR variable numbers have to be adjusted */
{
@@ -114,32 +111,9 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
return i;
}
-# define LITERAL_INT(op, val) do { \
- zval _c; \
- ZVAL_INT(&_c, val); \
- op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
- } while (0)
-
-# define LITERAL_BOOL(op, val) do { \
- zval _c; \
- ZVAL_BOOL(&_c, val); \
- op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
- } while (0)
-
-# define literal_dtor(zv) do { \
- zval_dtor(zv); \
- ZVAL_NULL(zv); \
- } while (0)
-
-#define COPY_NODE(target, src) do { \
- target ## _type = src ## _type; \
- target = src; \
- } while (0)
-
-
-static void update_op1_const(zend_op_array *op_array,
- zend_op *opline,
- zval *val TSRMLS_DC)
+void zend_optimizer_update_op1_const(zend_op_array *op_array,
+ zend_op *opline,
+ zval *val TSRMLS_DC)
{
if (opline->opcode == ZEND_FREE) {
MAKE_NOP(opline);
@@ -153,15 +127,15 @@ static void update_op1_const(zend_op_array *op_array,
case ZEND_FETCH_CONSTANT:
case ZEND_DEFINED:
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline)));
+ zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline)));
Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++;
- zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1]));
+ zend_string_hash_val(Z_STR(op_array->literals[opline->op1.constant+1]));
break;
default:
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline)));
+ zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline)));
break;
}
} else {
@@ -170,21 +144,21 @@ static void update_op1_const(zend_op_array *op_array,
}
}
-static void update_op2_const(zend_op_array *op_array,
- zend_op *opline,
- zval *val TSRMLS_DC)
+void zend_optimizer_update_op2_const(zend_op_array *op_array,
+ zend_op *opline,
+ zval *val TSRMLS_DC)
{
ZEND_OP2_TYPE(opline) = IS_CONST;
if (opline->opcode == ZEND_INIT_FCALL) {
- zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline)));
+ zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline)));
Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++;
return;
}
opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
if (Z_TYPE_P(val) == IS_STRING) {
- STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline)));
+ zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline)));
switch (opline->opcode) {
case ZEND_FETCH_R:
case ZEND_FETCH_W:
@@ -200,15 +174,15 @@ static void update_op2_const(zend_op_array *op_array,
case ZEND_ADD_INTERFACE:
case ZEND_ADD_TRAIT:
Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++;
- zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1]));
+ zend_string_hash_val(Z_STR(op_array->literals[opline->op2.constant+1]));
break;
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_STATIC_METHOD_CALL:
- zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
- STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1]));
+ zend_string_hash_val(Z_STR(op_array->literals[opline->op2.constant+1]));
/* break missing intentionally */
/*case ZEND_FETCH_CONSTANT:*/
case ZEND_ASSIGN_OBJ:
@@ -270,14 +244,14 @@ static void update_op2_const(zend_op_array *op_array,
case ZEND_FETCH_DIM_IS:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_DIM_TMP_VAR:
+ case ZEND_FETCH_LIST:
check_numeric:
{
- zend_uint_t index;
+ zend_ulong index;
if (ZEND_HANDLE_NUMERIC(Z_STR_P(val), index)) {
zval_dtor(val);
- ZVAL_INT(val, index);
+ ZVAL_LONG(val, index);
op_array->literals[opline->op2.constant] = *val;
}
}
@@ -288,15 +262,16 @@ check_numeric:
}
}
-static int replace_var_by_const(zend_op_array *op_array,
- zend_op *opline,
- zend_uint var,
- zval *val TSRMLS_DC)
+int zend_optimizer_replace_by_const(zend_op_array *op_array,
+ zend_op *opline,
+ zend_uchar type,
+ uint32_t var,
+ zval *val TSRMLS_DC)
{
zend_op *end = op_array->opcodes + op_array->last;
while (opline < end) {
- if (ZEND_OP1_TYPE(opline) == IS_VAR &&
+ if (ZEND_OP1_TYPE(opline) == type &&
ZEND_OP1(opline).var == var) {
switch (opline->opcode) {
case ZEND_FETCH_DIM_W:
@@ -318,14 +293,33 @@ static int replace_var_by_const(zend_op_array *op_array,
opline->opcode = ZEND_SEND_VAL;
}
break;
+ /* In most cases IS_TMP_VAR operand may be used only once.
+ * The operands are usually destroyed by the opcode handler.
+ * ZEND_CASE is an exception, that keeps operand unchanged,
+ * and allows its reuse. The number of ZEND_CASE instructions
+ * usually terminated by ZEND_FREE that finally kills the value.
+ */
+ case ZEND_CASE: {
+ zval old_val;
+ ZVAL_COPY_VALUE(&old_val, val);
+ zval_copy_ctor(val);
+ zend_optimizer_update_op1_const(op_array, opline, val TSRMLS_CC);
+ ZVAL_COPY_VALUE(val, &old_val);
+ opline++;
+ continue;
+ }
+ case ZEND_FREE:
+ MAKE_NOP(opline);
+ zval_dtor(val);
+ return 1;
default:
break;
}
- update_op1_const(op_array, opline, val TSRMLS_CC);
+ zend_optimizer_update_op1_const(op_array, opline, val TSRMLS_CC);
break;
}
- if (ZEND_OP2_TYPE(opline) == IS_VAR &&
+ if (ZEND_OP2_TYPE(opline) == type &&
ZEND_OP2(opline).var == var) {
switch (opline->opcode) {
case ZEND_ASSIGN_REF:
@@ -333,7 +327,7 @@ static int replace_var_by_const(zend_op_array *op_array,
default:
break;
}
- update_op2_const(op_array, opline, val TSRMLS_CC);
+ zend_optimizer_update_op2_const(op_array, opline, val TSRMLS_CC);
break;
}
opline++;
@@ -342,66 +336,10 @@ static int replace_var_by_const(zend_op_array *op_array,
return 1;
}
-static void replace_tmp_by_const(zend_op_array *op_array,
- zend_op *opline,
- zend_uint var,
- zval *val
- TSRMLS_DC)
-{
- zend_op *end = op_array->opcodes + op_array->last;
-
- while (opline < end) {
- if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
- ZEND_OP1(opline).var == var) {
-
- /* In most cases IS_TMP_VAR operand may be used only once.
- * The operands are usually destroyed by the opcode handler.
- * ZEND_CASE is an exception, that keeps operand unchanged,
- * and allows its reuse. The number of ZEND_CASE instructions
- * usually terminated by ZEND_FREE that finally kills the value.
- */
- if (opline->opcode == ZEND_CASE) {
- zval old_val;
- ZVAL_COPY_VALUE(&old_val, val);
- zval_copy_ctor(val);
- update_op1_const(op_array, opline, val TSRMLS_CC);
- ZVAL_COPY_VALUE(val, &old_val);
- } else if (opline->opcode == ZEND_FREE) {
- MAKE_NOP(opline);
- break;
- } else {
- update_op1_const(op_array, opline, val TSRMLS_CC);
- val = NULL;
- break;
- }
- }
-
- if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR &&
- ZEND_OP2(opline).var == var) {
-
- update_op2_const(op_array, opline, val TSRMLS_CC);
- /* TMP_VAR may be used only once */
- val = NULL;
- break;
- }
- opline++;
- }
- if (val) {
- zval_dtor(val);
- }
-}
-
-#include "Optimizer/nop_removal.c"
-#include "Optimizer/block_pass.c"
-#include "Optimizer/optimize_temp_vars_5.c"
-#include "Optimizer/compact_literals.c"
-#include "Optimizer/optimize_func_calls.c"
-
static void zend_optimize(zend_op_array *op_array,
zend_optimizer_ctx *ctx TSRMLS_DC)
{
- if (op_array->type == ZEND_EVAL_CODE ||
- (op_array->fn_flags & ZEND_ACC_INTERACTIVE)) {
+ if (op_array->type == ZEND_EVAL_CODE) {
return;
}
@@ -411,7 +349,9 @@ static void zend_optimize(zend_op_array *op_array,
* - optimize series of ADD_STRING and/or ADD_CHAR
* - convert CAST(IS_BOOL,x) into BOOL(x)
*/
-#include "Optimizer/pass1_5.c"
+ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
+ zend_optimizer_pass1(op_array, ctx TSRMLS_CC);
+ }
/* pass 2:
* - convert non-numeric constants to numeric constants in numeric operators
@@ -419,14 +359,18 @@ static void zend_optimize(zend_op_array *op_array,
* - optimize static BRKs and CONTs
* - pre-evaluate constant function calls
*/
-#include "Optimizer/pass2.c"
+ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
+ zend_optimizer_pass2(op_array TSRMLS_CC);
+ }
/* pass 3:
* - optimize $i = $i+expr to $i+=expr
* - optimize series of JMPs
* - change $i++ to ++$i where possible
*/
-#include "Optimizer/pass3.c"
+ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
+ zend_optimizer_pass3(op_array TSRMLS_CC);
+ }
/* pass 4:
* - INIT_FCALL_BY_NAME -> DO_FCALL
@@ -438,23 +382,29 @@ static void zend_optimize(zend_op_array *op_array,
/* pass 5:
* - CFG optimization
*/
-#include "Optimizer/pass5.c"
+ if (ZEND_OPTIMIZER_PASS_5 & OPTIMIZATION_LEVEL) {
+ optimize_cfg(op_array, ctx TSRMLS_CC);
+ }
/* pass 9:
* - Optimize temp variables usage
*/
-#include "Optimizer/pass9.c"
+ if (ZEND_OPTIMIZER_PASS_9 & OPTIMIZATION_LEVEL) {
+ optimize_temporary_variables(op_array, ctx);
+ }
/* pass 10:
* - remove NOPs
*/
-#include "Optimizer/pass10.c"
+ if (((ZEND_OPTIMIZER_PASS_10|ZEND_OPTIMIZER_PASS_5) & OPTIMIZATION_LEVEL) == ZEND_OPTIMIZER_PASS_10) {
+ zend_optimizer_nop_removal(op_array);
+ }
/* pass 11:
* - Compact literals table
*/
if (ZEND_OPTIMIZER_PASS_11 & OPTIMIZATION_LEVEL) {
- optimizer_compact_literals(op_array, ctx TSRMLS_CC);
+ zend_optimizer_compact_literals(op_array, ctx TSRMLS_CC);
}
}
@@ -488,7 +438,7 @@ static void zend_accel_optimize(zend_op_array *op_array,
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
case ZEND_NEW:
case ZEND_FE_RESET:
case ZEND_FE_FETCH:
@@ -526,7 +476,7 @@ static void zend_accel_optimize(zend_op_array *op_array,
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
case ZEND_NEW:
case ZEND_FE_RESET:
case ZEND_FE_FETCH:
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h
index b0ba12abc7..ba91b147c9 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -25,7 +25,7 @@
#include "ZendAccelerator.h"
#define VAR_NUM(v) EX_VAR_TO_NUM(v)
-#define NUM_VAR(v) ((zend_uint)(zend_uintptr_t)EX_VAR_NUM_2(0, v))
+#define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)EX_VAR_NUM_2(0, v))
#define INV_COND(op) ((op) == ZEND_JMPZ ? ZEND_JMPNZ : ZEND_JMPZ)
#define INV_EX_COND(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ : ZEND_JMPZ)
@@ -76,4 +76,55 @@ struct _zend_block_source {
zend_block_source *next;
};
+#define OPTIMIZATION_LEVEL \
+ ZCG(accel_directives).optimization_level
+
+#define LITERAL_LONG(op, val) do { \
+ zval _c; \
+ ZVAL_LONG(&_c, val); \
+ op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
+ } while (0)
+
+#define LITERAL_BOOL(op, val) do { \
+ zval _c; \
+ ZVAL_BOOL(&_c, val); \
+ op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
+ } while (0)
+
+#define literal_dtor(zv) do { \
+ zval_dtor(zv); \
+ ZVAL_NULL(zv); \
+ } while (0)
+
+#define COPY_NODE(target, src) do { \
+ target ## _type = src ## _type; \
+ target = src; \
+ } while (0)
+
+int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
+int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy TSRMLS_DC);
+void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value);
+int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value);
+int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name);
+void zend_optimizer_update_op1_const(zend_op_array *op_array,
+ zend_op *opline,
+ zval *val TSRMLS_DC);
+void zend_optimizer_update_op2_const(zend_op_array *op_array,
+ zend_op *opline,
+ zval *val TSRMLS_DC);
+int zend_optimizer_replace_by_const(zend_op_array *op_array,
+ zend_op *opline,
+ zend_uchar type,
+ uint32_t var,
+ zval *val TSRMLS_DC);
+
+void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC);
+void zend_optimizer_pass2(zend_op_array *op_array TSRMLS_DC);
+void zend_optimizer_pass3(zend_op_array *op_array TSRMLS_DC);
+void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC);
+void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC);
+void optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_ctx *ctx);
+void zend_optimizer_nop_removal(zend_op_array *op_array);
+void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS_DC);
+
#endif
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 46c406d99d..d36827bde6 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -192,13 +192,13 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason T
*/
static ZEND_INI_MH(accel_include_path_on_modify)
{
- int ret = orig_include_path_on_modify(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
ZCG(include_path_key) = NULL;
if (ret == SUCCESS) {
- ZCG(include_path) = new_value;
+ ZCG(include_path) = new_value->val;
if (ZCG(include_path) && *ZCG(include_path)) {
- ZCG(include_path_len) = new_value_length;
+ ZCG(include_path_len) = new_value->len;
if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled))) {
@@ -299,7 +299,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC)
{
/* for now interned strings are supported only for non-ZTS build */
#ifndef ZTS
- zend_uint_t h;
+ zend_ulong h;
uint nIndex;
uint idx;
Bucket *p;
@@ -309,7 +309,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC)
return str;
}
- h = STR_HASH_VAL(str);
+ h = zend_string_hash_val(str);
nIndex = h & ZCSG(interned_strings).nTableMask;
/* check for existing interned string */
@@ -318,7 +318,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC)
p = ZCSG(interned_strings).arData + idx;
if ((p->h == h) && (p->key->len == str->len)) {
if (!memcmp(p->key->val, str->val, str->len)) {
- STR_RELEASE(str);
+ zend_string_release(str);
return p->key;
}
}
@@ -354,7 +354,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC)
ZVAL_STR(&p->val, p->key);
Z_NEXT(p->val) = ZCSG(interned_strings).arHash[nIndex];
ZCSG(interned_strings).arHash[nIndex] = idx;
- STR_RELEASE(str);
+ zend_string_release(str);
return p->key;
#else
return str;
@@ -374,7 +374,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
char s[2];
s[0] = j;
s[1] = 0;
- CG(one_char_string)[j] = accel_new_interned_string(STR_INIT(s, 1, 0) TSRMLS_CC);
+ CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0) TSRMLS_CC);
}
/* function table hash keys */
@@ -384,6 +384,9 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
if (p->key) {
p->key = accel_new_interned_string(p->key TSRMLS_CC);
}
+ if (Z_FUNC(p->val)->common.function_name) {
+ Z_FUNC(p->val)->common.function_name = accel_new_interned_string(Z_FUNC(p->val)->common.function_name TSRMLS_CC);
+ }
}
/* class table hash keys, class names, properties, methods, constants, etc */
@@ -425,6 +428,9 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
if (q->key) {
q->key = accel_new_interned_string(q->key TSRMLS_CC);
}
+ if (Z_FUNC(q->val)->common.function_name) {
+ Z_FUNC(q->val)->common.function_name = accel_new_interned_string(Z_FUNC(q->val)->common.function_name TSRMLS_CC);
+ }
}
for (j = 0; j < ce->constants_table.nNumUsed; j++) {
@@ -1165,10 +1171,6 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
return new_persistent_script;
}
- /* cleanup after calculation */
- new_persistent_script->mem = ZCG(mem);
- new_persistent_script->size = memory_used;
-
/* Copy into shared memory */
new_persistent_script = zend_accel_script_persist(new_persistent_script, &key, key_length TSRMLS_CC);
@@ -1268,8 +1270,8 @@ static void zend_accel_init_auto_globals(TSRMLS_D)
int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0]));
for (i = 0; i < ag_size ; i++) {
- jit_auto_globals_str[i] = STR_INIT(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1);
- STR_HASH_VAL(jit_auto_globals_str[i]);
+ jit_auto_globals_str[i] = zend_string_init(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1);
+ zend_string_hash_val(jit_auto_globals_str[i]);
jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i] TSRMLS_CC);
}
}
@@ -1283,7 +1285,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
zend_op_array *op_array;
int do_bailout = 0;
accel_time_t timestamp = 0;
- zend_uint orig_compiler_options = 0;
+ uint32_t orig_compiler_options = 0;
/* Try to open file */
if (file_handle->type == ZEND_HANDLE_FILENAME) {
@@ -1427,11 +1429,11 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
}
if (file_handle->opened_path) {
- new_persistent_script->full_path = STR_INIT(file_handle->opened_path, strlen(file_handle->opened_path), 0);
+ new_persistent_script->full_path = zend_string_init(file_handle->opened_path, strlen(file_handle->opened_path), 0);
} else {
- new_persistent_script->full_path = STR_INIT(file_handle->filename, strlen(file_handle->filename), 0);
+ new_persistent_script->full_path = zend_string_init(file_handle->filename, strlen(file_handle->filename), 0);
}
- STR_HASH_VAL(new_persistent_script->full_path);
+ zend_string_hash_val(new_persistent_script->full_path);
/* Now persistent_script structure is ready in process memory */
return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory TSRMLS_CC);
@@ -1448,7 +1450,6 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
if (!file_handle->filename ||
!ZCG(enabled) || !accel_startup_ok ||
(!ZCG(counted) && !ZCSG(accelerator_enabled)) ||
- CG(interactive) ||
(ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) ||
(is_stream_path(file_handle->filename) &&
!is_cacheable_stream_path(file_handle->filename))) {
@@ -1581,7 +1582,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
/* If script was not found or invalidated by validate_timestamps */
if (!persistent_script) {
- zend_uint old_const_num = zend_hash_next_free_element(EG(zend_constants));
+ uint32_t old_const_num = zend_hash_next_free_element(EG(zend_constants));
zend_op_array *op_array;
/* Cache miss.. */
@@ -1608,7 +1609,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
}
if (from_shared_memory) {
/* Delete immutable arrays moved into SHM */
- zend_uint new_const_num = zend_hash_next_free_element(EG(zend_constants));
+ uint32_t new_const_num = zend_hash_next_free_element(EG(zend_constants));
while (new_const_num > old_const_num) {
new_const_num--;
zend_hash_index_del(EG(zend_constants), new_const_num);
@@ -1667,7 +1668,6 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
{
if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
- !CG(interactive) &&
!ZCSG(restart_in_progress)) {
/* check if callback is called from include_once or it's a main request */
@@ -1727,7 +1727,6 @@ static char* persistent_zend_resolve_path(const char *filename, int filename_len
{
if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
- !CG(interactive) &&
!ZCSG(restart_in_progress)) {
/* check if callback is called from include_once or it's a main request */
@@ -1916,6 +1915,7 @@ static void accel_activate(void)
* allocated block separately, but we like to call all the destructors and
* callbacks in exactly the same order.
*/
+static void accel_fast_zval_dtor(zval *zvalue);
static void accel_fast_hash_destroy(HashTable *ht)
{
@@ -1925,7 +1925,7 @@ static void accel_fast_hash_destroy(HashTable *ht)
for (idx = 0; idx < ht->nNumUsed; idx++) {
p = ht->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
- ht->pDestructor(&p->val);
+ accel_fast_zval_dtor(&p->val);
}
}
@@ -1939,7 +1939,6 @@ static void accel_fast_zval_dtor(zval *zvalue)
if (Z_ARR_P(zvalue) != &EG(symbol_table)) {
/* break possible cycles */
ZVAL_NULL(zvalue);
- Z_ARRVAL_P(zvalue)->pDestructor = accel_fast_zval_dtor;
accel_fast_hash_destroy(Z_ARRVAL_P(zvalue));
}
}
@@ -1959,7 +1958,7 @@ static void accel_fast_zval_dtor(zval *zvalue)
zend_list_delete(Z_RES_P(zvalue));
}
break;
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
@@ -1981,61 +1980,29 @@ static int accel_clean_non_persistent_function(zval *zv TSRMLS_DC)
return ZEND_HASH_APPLY_STOP;
} else {
if (function->op_array.static_variables) {
- function->op_array.static_variables->pDestructor = accel_fast_zval_dtor;
- accel_fast_hash_destroy(function->op_array.static_variables);
- function->op_array.static_variables = NULL;
- }
- return (--(*function->op_array.refcount) <= 0) ?
- ZEND_HASH_APPLY_REMOVE :
- ZEND_HASH_APPLY_KEEP;
- }
-}
-
-static int accel_cleanup_function_data(zval *zv TSRMLS_DC)
-{
- zend_function *function = Z_PTR_P(zv);
-
- if (function->type == ZEND_USER_FUNCTION) {
- if (function->op_array.static_variables) {
- function->op_array.static_variables->pDestructor = accel_fast_zval_dtor;
accel_fast_hash_destroy(function->op_array.static_variables);
function->op_array.static_variables = NULL;
}
- }
- return 0;
-}
-
-static int accel_clean_non_persistent_class(zval *zv TSRMLS_DC)
-{
- zend_class_entry *ce = Z_PTR_P(zv);
-
- if (ce->type == ZEND_INTERNAL_CLASS) {
- return ZEND_HASH_APPLY_STOP;
- } else {
- if (ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS) {
- zend_hash_apply(&ce->function_table, (apply_func_t) accel_cleanup_function_data TSRMLS_CC);
- }
- if (ce->static_members_table) {
- int i;
-
- for (i = 0; i < ce->default_static_members_count; i++) {
- accel_fast_zval_dtor(&ce->static_members_table[i]);
- ZVAL_UNDEF(&ce->static_members_table[i]);
- }
- ce->static_members_table = NULL;
- }
return ZEND_HASH_APPLY_REMOVE;
}
}
-static int accel_clean_non_persistent_constant(zval *zv TSRMLS_DC)
+static inline void zend_accel_fast_del_bucket(HashTable *ht, uint32_t idx, Bucket *p)
{
- zend_constant *c = Z_PTR_P(zv);
+ uint32_t nIndex = p->h & ht->nTableMask;
+ uint32_t i = ht->arHash[nIndex];
- if (c->flags & CONST_PERSISTENT) {
- return ZEND_HASH_APPLY_STOP;
- } else {
- return ZEND_HASH_APPLY_REMOVE;
+ ht->nNumUsed--;
+ ht->nNumOfElements--;
+ if (idx != i) {
+ Bucket *prev = ht->arData + i;
+ while (Z_NEXT(prev->val) != idx) {
+ i = Z_NEXT(prev->val);
+ prev = ht->arData + i;
+ }
+ Z_NEXT(prev->val) = Z_NEXT(p->val);
+ } else {
+ ht->arHash[p->h & ht->nTableMask] = Z_NEXT(p->val);
}
}
@@ -2057,18 +2024,60 @@ static void zend_accel_fast_shutdown(TSRMLS_D)
EG(symbol_table).ht.pDestructor = old_destructor;
}
zend_hash_init(&EG(symbol_table).ht, 8, NULL, NULL, 0);
- old_destructor = EG(function_table)->pDestructor;
- EG(function_table)->pDestructor = NULL;
- zend_hash_reverse_apply(EG(function_table), (apply_func_t) accel_clean_non_persistent_function TSRMLS_CC);
- EG(function_table)->pDestructor = old_destructor;
- old_destructor = EG(class_table)->pDestructor;
- EG(class_table)->pDestructor = NULL;
- zend_hash_reverse_apply(EG(class_table), (apply_func_t) accel_clean_non_persistent_class TSRMLS_CC);
- EG(class_table)->pDestructor = old_destructor;
- old_destructor = EG(zend_constants)->pDestructor;
- EG(zend_constants)->pDestructor = NULL;
- zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) accel_clean_non_persistent_constant TSRMLS_CC);
- EG(zend_constants)->pDestructor = old_destructor;
+
+ ZEND_HASH_REVERSE_FOREACH(EG(function_table), 0) {
+ zend_function *func = Z_PTR(_p->val);
+
+ if (func->type == ZEND_INTERNAL_FUNCTION) {
+ break;
+ } else {
+ if (func->op_array.static_variables) {
+ accel_fast_hash_destroy(func->op_array.static_variables);
+ }
+ zend_accel_fast_del_bucket(EG(function_table), _idx-1, _p);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_REVERSE_FOREACH(EG(class_table), 0) {
+ zend_class_entry *ce = Z_PTR(_p->val);
+
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ break;
+ } else {
+ if (ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS) {
+ zend_function *func;
+
+ ZEND_HASH_FOREACH_PTR(&ce->function_table, func) {
+ if (func->type == ZEND_USER_FUNCTION) {
+ if (func->op_array.static_variables) {
+ accel_fast_hash_destroy(func->op_array.static_variables);
+ func->op_array.static_variables = NULL;
+ }
+ }
+ } ZEND_HASH_FOREACH_END();
+ }
+ if (ce->static_members_table) {
+ int i;
+
+ for (i = 0; i < ce->default_static_members_count; i++) {
+ accel_fast_zval_dtor(&ce->static_members_table[i]);
+ ZVAL_UNDEF(&ce->static_members_table[i]);
+ }
+ ce->static_members_table = NULL;
+ }
+ zend_accel_fast_del_bucket(EG(class_table), _idx-1, _p);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_REVERSE_FOREACH(EG(zend_constants), 0) {
+ zend_constant *c = Z_PTR(_p->val);
+
+ if (c->flags & CONST_PERSISTENT) {
+ break;
+ } else {
+ zend_accel_fast_del_bucket(EG(zend_constants), _idx-1, _p);
+ }
+ } ZEND_HASH_FOREACH_END();
}
CG(unclean_shutdown) = 1;
}
@@ -2185,13 +2194,13 @@ static int zend_accel_init_shm(TSRMLS_D)
if (ZCG(accel_directives).interned_strings_buffer) {
ZCSG(interned_strings).nTableMask = ZCSG(interned_strings).nTableSize - 1;
ZCSG(interned_strings).arData = zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket));
- ZCSG(interned_strings).arHash = (zend_uint*)zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(zend_uint));
+ ZCSG(interned_strings).arHash = (uint32_t*)zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(uint32_t));
ZCSG(interned_strings_start) = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024));
if (!ZCSG(interned_strings).arData || !ZCSG(interned_strings_start)) {
zend_accel_error(ACCEL_LOG_FATAL, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings");
return FAILURE;
}
- memset(ZCSG(interned_strings).arHash, INVALID_IDX, ZCSG(interned_strings).nTableSize * sizeof(zend_uint));
+ memset(ZCSG(interned_strings).arHash, INVALID_IDX, ZCSG(interned_strings).nTableSize * sizeof(uint32_t));
ZCSG(interned_strings_end) = ZCSG(interned_strings_start) + (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024);
ZCSG(interned_strings_top) = ZCSG(interned_strings_start);
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index c228301362..28c3d21102 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -157,13 +157,15 @@ typedef struct _zend_persistent_script {
zend_op_array main_op_array;
HashTable function_table;
HashTable class_table;
- zend_int_t compiler_halt_offset; /* position of __HALT_COMPILER or -1 */
+ zend_long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */
int ping_auto_globals_mask; /* which autoglobals are used by the script */
accel_time_t timestamp; /* the script modification time */
zend_bool corrupted;
void *mem; /* shared memory area used by script structures */
size_t size; /* size of used shared memory */
+ void *arena_mem; /* part that should be copied into process */
+ size_t arena_size;
/* All entries that shouldn't be counted in the ADLER32
* checksum must be declared in this struct
@@ -173,7 +175,7 @@ typedef struct _zend_persistent_script {
#ifdef ZEND_WIN32
LONGLONG hits;
#else
- zend_uint_t hits;
+ zend_ulong hits;
#endif
unsigned int memory_consumption;
unsigned int checksum;
@@ -182,12 +184,12 @@ typedef struct _zend_persistent_script {
} zend_persistent_script;
typedef struct _zend_accel_directives {
- zend_int_t memory_consumption;
- zend_int_t max_accelerated_files;
+ zend_long memory_consumption;
+ zend_long max_accelerated_files;
double max_wasted_percentage;
char *user_blacklist_filename;
- zend_int_t consistency_checks;
- zend_int_t force_restart_timeout;
+ zend_long consistency_checks;
+ zend_long force_restart_timeout;
zend_bool use_cwd;
zend_bool ignore_dups;
zend_bool validate_timestamps;
@@ -199,18 +201,18 @@ typedef struct _zend_accel_directives {
zend_bool file_override_enabled;
zend_bool inherited_hack;
zend_bool enable_cli;
- zend_uint_t revalidate_freq;
- zend_uint_t file_update_protection;
+ zend_ulong revalidate_freq;
+ zend_ulong file_update_protection;
char *error_log;
#ifdef ZEND_WIN32
char *mmap_base;
#endif
char *memory_model;
- zend_int_t log_verbosity_level;
+ zend_long log_verbosity_level;
- zend_int_t optimization_level;
- zend_int_t max_file_size;
- zend_int_t interned_strings_buffer;
+ zend_long optimization_level;
+ zend_long max_file_size;
+ zend_long interned_strings_buffer;
char *restrict_api;
} zend_accel_directives;
@@ -234,8 +236,10 @@ typedef struct _zend_accel_globals {
time_t request_time;
/* preallocated shared-memory block to save current script */
void *mem;
+ void *arena_mem;
+ zend_persistent_script *current_persistent_script;
/* cache to save hash lookup on the same INCLUDE opcode */
- zend_op *cache_opline;
+ const zend_op *cache_opline;
zend_persistent_script *cache_persistent_script;
/* preallocated buffer for keys */
int key_len;
@@ -244,12 +248,12 @@ typedef struct _zend_accel_globals {
typedef struct _zend_accel_shared_globals {
/* Cache Data Structures */
- zend_uint_t hits;
- zend_uint_t misses;
- zend_uint_t blacklist_misses;
- zend_uint_t oom_restarts; /* number of restarts because of out of memory */
- zend_uint_t hash_restarts; /* number of restarts because of hash overflow */
- zend_uint_t manual_restarts; /* number of restarts scheduled by opcache_reset() */
+ zend_ulong hits;
+ zend_ulong misses;
+ zend_ulong blacklist_misses;
+ zend_ulong oom_restarts; /* number of restarts because of out of memory */
+ zend_ulong hash_restarts; /* number of restarts because of hash overflow */
+ zend_ulong manual_restarts; /* number of restarts scheduled by opcache_reset() */
zend_accel_hash hash; /* hash table for cached scripts */
zend_accel_hash include_paths; /* used "include_path" values */
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index f6e6ca9444..793105b966 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -376,7 +376,15 @@ fi
shared_alloc_shm.c \
shared_alloc_mmap.c \
shared_alloc_posix.c \
- Optimizer/zend_optimizer.c,
+ Optimizer/zend_optimizer.c \
+ Optimizer/pass1_5.c \
+ Optimizer/pass2.c \
+ Optimizer/pass3.c \
+ Optimizer/optimize_func_calls.c \
+ Optimizer/block_pass.c \
+ Optimizer/optimize_temp_vars_5.c \
+ Optimizer/nop_removal.c \
+ Optimizer/compact_literals.c,
shared,,,,yes)
PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
index af160b207c..9a0713d608 100644
--- a/ext/opcache/config.w32
+++ b/ext/opcache/config.w32
@@ -16,7 +16,7 @@ if (PHP_OPCACHE != "no") {
zend_shared_alloc.c \
shared_alloc_win32.c", true);
- ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c", "opcache", "OptimizerObj");
+ ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1_5.c pass2.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c", "opcache", "OptimizerObj");
ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c
index dd3193a100..2a386b812b 100644
--- a/ext/opcache/zend_accelerator_debug.c
+++ b/ext/opcache/zend_accelerator_debug.c
@@ -57,7 +57,7 @@ void zend_accel_error(int type, const char *format, ...)
}
#ifdef ZTS
- fprintf(fLog, "%s (" ZEND_UINT_FMT "): ", time_string, (zend_uint_t)tsrm_thread_id());
+ fprintf(fLog, "%s (" ZEND_ULONG_FMT "): ", time_string, (zend_ulong)tsrm_thread_id());
#else
fprintf(fLog, "%s (%d): ", time_string, getpid());
#endif
diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c
index 71dd997b79..671792239b 100644
--- a/ext/opcache/zend_accelerator_hash.c
+++ b/ext/opcache/zend_accelerator_hash.c
@@ -36,7 +36,7 @@ void zend_accel_hash_clean(zend_accel_hash *accel_hash)
memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
}
-void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size)
+void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
{
uint i;
@@ -71,10 +71,10 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size)
* Returns pointer the actual hash entry on success
* key needs to be already allocated as it is not copied
*/
-zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, zend_uint key_length, zend_bool indirect, void *data)
+zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, uint32_t key_length, zend_bool indirect, void *data)
{
- zend_uint_t hash_value;
- zend_uint_t index;
+ zend_ulong hash_value;
+ zend_ulong index;
zend_accel_hash_entry *entry;
zend_accel_hash_entry *indirect_bucket = NULL;
@@ -140,10 +140,10 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char
/* Returns the data associated with key on success
* Returns NULL if data doesn't exist
*/
-void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key_length)
+void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, uint32_t key_length)
{
- zend_uint_t hash_value;
- zend_uint_t index;
+ zend_ulong hash_value;
+ zend_ulong index;
zend_accel_hash_entry *entry;
hash_value = zend_inline_hash_func(key, key_length);
@@ -168,10 +168,10 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key
/* Returns the hash entry associated with key on success
* Returns NULL if it doesn't exist
*/
-zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, zend_uint key_length)
+zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, uint32_t key_length)
{
- zend_uint_t hash_value;
- zend_uint_t index;
+ zend_ulong hash_value;
+ zend_ulong index;
zend_accel_hash_entry *entry;
hash_value = zend_inline_hash_func(key, key_length);
@@ -193,10 +193,10 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c
return NULL;
}
-int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key_length)
+int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, uint32_t key_length)
{
- zend_uint_t hash_value;
- zend_uint_t index;
+ zend_ulong hash_value;
+ zend_ulong index;
zend_accel_hash_entry *entry, *last_entry=NULL;
hash_value = zend_inline_hash_func(key, key_length);
diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h
index 99e92cd194..5c995b43ee 100644
--- a/ext/opcache/zend_accelerator_hash.h
+++ b/ext/opcache/zend_accelerator_hash.h
@@ -45,9 +45,9 @@
typedef struct _zend_accel_hash_entry zend_accel_hash_entry;
struct _zend_accel_hash_entry {
- zend_uint_t hash_value;
+ zend_ulong hash_value;
char *key;
- zend_uint key_length;
+ uint32_t key_length;
zend_accel_hash_entry *next;
void *data;
zend_bool indirect;
@@ -56,35 +56,35 @@ struct _zend_accel_hash_entry {
typedef struct _zend_accel_hash {
zend_accel_hash_entry **hash_table;
zend_accel_hash_entry *hash_entries;
- zend_uint num_entries;
- zend_uint max_num_entries;
- zend_uint num_direct_entries;
+ uint32_t num_entries;
+ uint32_t max_num_entries;
+ uint32_t num_direct_entries;
} zend_accel_hash;
-void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size);
+void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size);
void zend_accel_hash_clean(zend_accel_hash *accel_hash);
zend_accel_hash_entry* zend_accel_hash_update(
zend_accel_hash *accel_hash,
char *key,
- zend_uint key_length,
+ uint32_t key_length,
zend_bool indirect,
void *data);
void* zend_accel_hash_find(
zend_accel_hash *accel_hash,
char *key,
- zend_uint key_length);
+ uint32_t key_length);
zend_accel_hash_entry* zend_accel_hash_find_entry(
zend_accel_hash *accel_hash,
char *key,
- zend_uint key_length);
+ uint32_t key_length);
int zend_accel_hash_unlink(
zend_accel_hash *accel_hash,
char *key,
- zend_uint key_length);
+ uint32_t key_length);
static inline zend_bool zend_accel_hash_is_full(zend_accel_hash *accel_hash)
{
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index c6720419fa..001c3ee9ed 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -100,8 +100,8 @@ static int validate_api_restriction(TSRMLS_D)
static ZEND_INI_MH(OnUpdateMemoryConsumption)
{
- php_int_t *p;
- php_int_t memsize;
+ zend_long *p;
+ zend_long memsize;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
@@ -109,10 +109,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
- p = (php_int_t *) (base + (size_t)mh_arg1);
- memsize = atoi(new_value);
+ p = (zend_long *) (base + (size_t)mh_arg1);
+ memsize = atoi(new_value->val);
/* sanity check we must use at least 8 MB */
if (memsize < 8) {
const char *new_new_value = "8";
@@ -128,8 +128,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, 1, 1);
}
*p = memsize * (1024 * 1024);
return SUCCESS;
@@ -137,8 +136,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
{
- php_int_t *p;
- php_int_t size;
+ zend_long *p;
+ zend_long size;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
@@ -146,10 +145,10 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
- p = (php_int_t *) (base + (size_t)mh_arg1);
- size = atoi(new_value);
+ p = (zend_long *) (base + (size_t)mh_arg1);
+ size = atoi(new_value->val);
/* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */
if (size < MIN_ACCEL_FILES || size > MAX_ACCEL_FILES) {
@@ -173,8 +172,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
sizeof("opcache.max_accelerated_files")-1)) == NULL) {
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
}
*p = size;
return SUCCESS;
@@ -183,7 +181,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
{
double *p;
- php_int_t percentage;
+ zend_long percentage;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
@@ -191,10 +189,10 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (double *) (base + (size_t)mh_arg1);
- percentage = atoi(new_value);
+ percentage = atoi(new_value->val);
if (percentage <= 0 || percentage > 50) {
const char *new_new_value = "5";
@@ -208,8 +206,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
sizeof("opcache.max_wasted_percentage")-1)) == NULL) {
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
}
*p = (double)percentage / 100.0;
return SUCCESS;
@@ -220,7 +217,7 @@ static ZEND_INI_MH(OnEnable)
if (stage == ZEND_INI_STAGE_STARTUP ||
stage == ZEND_INI_STAGE_SHUTDOWN ||
stage == ZEND_INI_STAGE_DEACTIVATE) {
- return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
/* It may be only temporary disabled */
zend_bool *p;
@@ -231,10 +228,10 @@ static ZEND_INI_MH(OnEnable)
#endif
p = (zend_bool *) (base+(size_t) mh_arg1);
- if ((new_value_length == 2 && strcasecmp("on", new_value) == 0) ||
- (new_value_length == 3 && strcasecmp("yes", new_value) == 0) ||
- (new_value_length == 4 && strcasecmp("true", new_value) == 0) ||
- atoi(new_value) != 0) {
+ if ((new_value->len == 2 && strcasecmp("on", new_value->val) == 0) ||
+ (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) ||
+ (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) ||
+ atoi(new_value->val) != 0) {
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
return FAILURE;
} else {
@@ -315,10 +312,10 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS)
if (ZEND_NUM_ARGS() != 1 ||
zend_get_parameters_array_ex(1, &zfilename) == FAILURE ||
Z_TYPE(zfilename) != IS_STRING ||
- Z_STRSIZE(zfilename) == 0) {
+ Z_STRLEN(zfilename) == 0) {
return 0;
}
- return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRSIZE(zfilename) TSRMLS_CC);
+ return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename) TSRMLS_CC);
}
static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS)
@@ -407,11 +404,11 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
char buf[32];
php_info_print_table_row(2, "Startup", "OK");
php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
- snprintf(buf, sizeof(buf), ZEND_UINT_FMT, (zend_uint_t)ZCSG(hits));
+ snprintf(buf, sizeof(buf), "%pd", (zend_ulong)ZCSG(hits));
php_info_print_table_row(2, "Cache hits", buf);
snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
php_info_print_table_row(2, "Cache misses", buf);
- snprintf(buf, sizeof(buf), "%ld", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
php_info_print_table_row(2, "Used memory", buf);
snprintf(buf, sizeof(buf), "%pd", zend_shared_alloc_get_free_memory());
php_info_print_table_row(2, "Free memory", buf);
@@ -487,17 +484,17 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC)
script = (zend_persistent_script *)cache_entry->data;
array_init(&persistent_script_report);
- add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0));
- add_assoc_int(&persistent_script_report, "hits", (zend_int_t)script->dynamic_members.hits);
- add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption);
+ add_assoc_str(&persistent_script_report, "full_path", zend_string_dup(script->full_path, 0));
+ add_assoc_long(&persistent_script_report, "hits", (zend_long)script->dynamic_members.hits);
+ add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption);
ta = localtime(&script->dynamic_members.last_used);
str = asctime(ta);
len = strlen(str);
if (len > 0 && str[len - 1] == '\n') len--;
add_assoc_stringl(&persistent_script_report, "last_used", str, len);
- add_assoc_int(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used);
+ add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used);
if (ZCG(accel_directives).validate_timestamps) {
- add_assoc_int(&persistent_script_report, "timestamp", (zend_int_t)script->timestamp);
+ add_assoc_long(&persistent_script_report, "timestamp", (zend_long)script->timestamp);
}
timerclear(&exec_time);
timerclear(&fetch_time);
@@ -514,7 +511,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC)
Obtain statistics information regarding code acceleration */
static ZEND_FUNCTION(opcache_get_status)
{
- zend_int_t reqs;
+ zend_long reqs;
zval memory_usage, statistics, scripts;
zend_bool fetch_scripts = 1;
@@ -540,9 +537,9 @@ static ZEND_FUNCTION(opcache_get_status)
/* Memory usage statistics */
array_init(&memory_usage);
- add_assoc_int(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
- add_assoc_int(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory());
- add_assoc_int(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory));
+ add_assoc_long(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
+ add_assoc_long(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory());
+ add_assoc_long(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory));
add_assoc_double(&memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0);
add_assoc_zval(return_value, "memory_usage", &memory_usage);
@@ -550,26 +547,26 @@ static ZEND_FUNCTION(opcache_get_status)
zval interned_strings_usage;
array_init(&interned_strings_usage);
- add_assoc_int(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start));
- add_assoc_int(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
- add_assoc_int(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
- add_assoc_int(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements);
+ add_assoc_long(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start));
+ add_assoc_long(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
+ add_assoc_long(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
+ add_assoc_long(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements);
add_assoc_zval(return_value, "interned_strings_usage", &interned_strings_usage);
}
/* Accelerator statistics */
array_init(&statistics);
- add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries);
- add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries);
- add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries);
- add_assoc_int(&statistics, "hits", (zend_int_t)ZCSG(hits));
- add_assoc_int(&statistics, "start_time", ZCSG(start_time));
- add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time));
- add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts));
- add_assoc_int(&statistics, "hash_restarts", ZCSG(hash_restarts));
- add_assoc_int(&statistics, "manual_restarts", ZCSG(manual_restarts));
- add_assoc_int(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
- add_assoc_int(&statistics, "blacklist_misses", ZCSG(blacklist_misses));
+ add_assoc_long(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries);
+ add_assoc_long(&statistics, "num_cached_keys", ZCSG(hash).num_entries);
+ add_assoc_long(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries);
+ add_assoc_long(&statistics, "hits", (zend_long)ZCSG(hits));
+ add_assoc_long(&statistics, "start_time", ZCSG(start_time));
+ add_assoc_long(&statistics, "last_restart_time", ZCSG(last_restart_time));
+ add_assoc_long(&statistics, "oom_restarts", ZCSG(oom_restarts));
+ add_assoc_long(&statistics, "hash_restarts", ZCSG(hash_restarts));
+ add_assoc_long(&statistics, "manual_restarts", ZCSG(manual_restarts));
+ add_assoc_long(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
+ add_assoc_long(&statistics, "blacklist_misses", ZCSG(blacklist_misses));
reqs = ZCSG(hits)+ZCSG(misses);
add_assoc_double(&statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0);
add_assoc_double(&statistics, "opcache_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0);
@@ -615,17 +612,17 @@ static ZEND_FUNCTION(opcache_get_configuration)
add_assoc_bool(&directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups);
add_assoc_bool(&directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path);
- add_assoc_int(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level);
- add_assoc_int(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption);
- add_assoc_int(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer);
- add_assoc_int(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files);
+ add_assoc_long(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level);
+ add_assoc_long(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption);
+ add_assoc_long(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer);
+ add_assoc_long(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files);
add_assoc_double(&directives, "opcache.max_wasted_percentage", ZCG(accel_directives).max_wasted_percentage);
- add_assoc_int(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks);
- add_assoc_int(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout);
- add_assoc_int(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq);
+ add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks);
+ add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout);
+ add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq);
add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model));
add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename));
- add_assoc_int(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size);
+ add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size);
add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log));
add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory);
@@ -633,7 +630,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
add_assoc_bool(&directives, "opcache.load_comments", ZCG(accel_directives).load_comments);
add_assoc_bool(&directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown);
add_assoc_bool(&directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled);
- add_assoc_int(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level);
+ add_assoc_long(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level);
add_assoc_zval(return_value, "directives", &directives);
@@ -674,7 +671,7 @@ static ZEND_FUNCTION(opcache_reset)
static ZEND_FUNCTION(opcache_invalidate)
{
char *script_name;
- int script_name_len;
+ size_t script_name_len;
zend_bool force = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &script_name, &script_name_len, &force) == FAILURE) {
@@ -695,7 +692,7 @@ static ZEND_FUNCTION(opcache_invalidate)
static ZEND_FUNCTION(opcache_compile_file)
{
char *script_name;
- int script_name_len;
+ size_t script_name_len;
zend_file_handle handle;
zend_op_array *op_array = NULL;
zend_execute_data *orig_execute_data = NULL;
@@ -738,7 +735,7 @@ static ZEND_FUNCTION(opcache_compile_file)
static ZEND_FUNCTION(opcache_is_script_cached)
{
char *script_name;
- int script_name_len;
+ size_t script_name_len;
if (!validate_api_restriction(TSRMLS_C)) {
RETURN_FALSE;
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index c6534ca6c1..ee7be50619 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -27,21 +27,24 @@
#define ZEND_PROTECTED_REFCOUNT (1<<30)
-static zend_uint zend_accel_refcount = ZEND_PROTECTED_REFCOUNT;
+static uint32_t zend_accel_refcount = ZEND_PROTECTED_REFCOUNT;
-#if SIZEOF_SIZE_T <= SIZEOF_ZEND_INT
+#if SIZEOF_SIZE_T <= SIZEOF_ZEND_LONG
/* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */
-# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old), (new))
-# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old))
+# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old), (new))
+# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old))
#else
-# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new))
-# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new)))
+# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_ulong)(zend_uintptr_t)(old), (void**)&(new))
+# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_ulong)(zend_uintptr_t)(old), (void**)&(new)))
#endif
+#define ARENA_REALLOC(ptr) \
+ (void*)(((char*)(ptr)) + ((char*)ZCG(arena_mem) - (char*)ZCG(current_persistent_script)->arena_mem))
+
typedef int (*id_function_t)(void *, void *);
typedef void (*unique_copy_ctor_func_t)(void *pElement);
-static const zend_uint uninitialized_bucket = {INVALID_IDX};
+static const uint32_t uninitialized_bucket = {INVALID_IDX};
static int zend_prepare_function_for_execution(zend_op_array *op_array);
static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind);
@@ -75,7 +78,7 @@ zend_persistent_script* create_persistent_script(void)
zend_persistent_script *persistent_script = (zend_persistent_script *) emalloc(sizeof(zend_persistent_script));
memset(persistent_script, 0, sizeof(zend_persistent_script));
- zend_hash_init(&persistent_script->function_table, 128, NULL, (dtor_func_t) zend_accel_destroy_zend_function, 0);
+ zend_hash_init(&persistent_script->function_table, 128, NULL, ZEND_FUNCTION_DTOR, 0);
/* class_table is usually destroyed by free_persistent_script() that
* overrides destructor. ZEND_CLASS_DTOR may be used by standard
* PHP compiler
@@ -113,7 +116,7 @@ static int compact_hash_table(HashTable *ht)
return 1;
}
- d = (Bucket *)pemalloc(nSize * (sizeof(Bucket) + sizeof(zend_uint)), ht->u.flags & HASH_FLAG_PERSISTENT);
+ d = (Bucket *)pemalloc(nSize * (sizeof(Bucket) + sizeof(uint32_t)), ht->u.flags & HASH_FLAG_PERSISTENT);
if (!d) {
return 0;
}
@@ -129,7 +132,7 @@ static int compact_hash_table(HashTable *ht)
pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
ht->arData = d;
- ht->arHash = (zend_uint *)(d + nSize);
+ ht->arHash = (uint32_t *)(d + nSize);
ht->nTableSize = nSize;
ht->nTableMask = ht->nTableSize - 1;
zend_hash_rehash(ht);
@@ -220,9 +223,9 @@ static void zend_destroy_property_info(zval *zv)
{
zend_property_info *property_info = Z_PTR_P(zv);
- STR_RELEASE(property_info->name);
+ zend_string_release(property_info->name);
if (property_info->doc_comment) {
- STR_RELEASE(property_info->doc_comment);
+ zend_string_release(property_info->doc_comment);
}
}
@@ -232,14 +235,14 @@ static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC)
if (IS_INTERNED(str)) {
ret = str;
- } else if (STR_REFCOUNT(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) {
- ret = STR_DUP(str, 0);
+ } else if (GC_REFCOUNT(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) {
+ ret = zend_string_dup(str, 0);
GC_FLAGS(ret) = GC_FLAGS(str);
- if (STR_REFCOUNT(str) > 1) {
+ if (GC_REFCOUNT(str) > 1) {
accel_xlat_set(str, ret);
}
} else {
- STR_ADDREF(ret);
+ GC_REFCOUNT(ret)++;
}
return ret;
}
@@ -305,35 +308,51 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC)
static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC)
{
- int i;
- zend_ast *node;
-
- if (ast->kind == ZEND_CONST) {
- node = emalloc(sizeof(zend_ast) + sizeof(zval));
- node->kind = ZEND_CONST;
- node->children = 0;
- ZVAL_COPY_VALUE(&node->u.val, &ast->u.val);
- zend_clone_zval(&node->u.val, 0 TSRMLS_CC);
+ uint32_t i;
+
+ if (ast->kind == ZEND_AST_ZVAL) {
+ zend_ast_zval *copy = emalloc(sizeof(zend_ast_zval));
+ copy->kind = ZEND_AST_ZVAL;
+ copy->attr = ast->attr;
+ ZVAL_COPY_VALUE(&copy->val, zend_ast_get_zval(ast));
+ zend_clone_zval(&copy->val, 0 TSRMLS_CC);
+ return (zend_ast *) copy;
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_ast_list *copy = emalloc(
+ sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children);
+ copy->kind = list->kind;
+ copy->attr = list->attr;
+ copy->children = list->children;
+ for (i = 0; i < list->children; i++) {
+ if (list->child[i]) {
+ copy->child[i] = zend_ast_clone(list->child[i] TSRMLS_CC);
+ } else {
+ copy->child[i] = NULL;
+ }
+ }
+ return (zend_ast *) copy;
} else {
- node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- node->kind = ast->kind;
- node->children = ast->children;
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- (&node->u.child)[i] = zend_ast_clone((&ast->u.child)[i] TSRMLS_CC);
+ uint32_t children = zend_ast_get_num_children(ast);
+ zend_ast *copy = emalloc(sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
+ copy->kind = ast->kind;
+ copy->attr = ast->attr;
+ for (i = 0; i < children; i++) {
+ if (ast->child[i]) {
+ copy->child[i] = zend_ast_clone(ast->child[i] TSRMLS_CC);
} else {
- (&node->u.child)[i] = NULL;
+ copy->child[i] = NULL;
}
}
+ return copy;
}
- return node;
}
static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
{
uint idx;
Bucket *p, *q, *r;
- zend_uint_t nIndex;
+ zend_ulong nIndex;
TSRMLS_FETCH();
ht->nTableSize = source->nTableSize;
@@ -348,14 +367,14 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
if (!ht->nTableMask) {
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
return;
}
if (source->u.flags & HASH_FLAG_PACKED) {
ht->u.flags |= HASH_FLAG_PACKED;
ht->arData = (Bucket *) emalloc(ht->nTableSize * sizeof(Bucket));
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
@@ -379,9 +398,9 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
zend_clone_zval(&q->val, bind TSRMLS_CC);
}
} else {
- ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(zend_uint)));
- ht->arHash = (zend_uint*)(ht->arData + ht->nTableSize);
- memset(ht->arHash, INVALID_IDX, sizeof(zend_uint) * ht->nTableSize);
+ ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(uint32_t)));
+ ht->arHash = (uint32_t*)(ht->arData + ht->nTableSize);
+ memset(ht->arHash, INVALID_IDX, sizeof(uint32_t) * ht->nTableSize);
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
@@ -412,7 +431,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
{
uint idx;
Bucket *p, *q;
- zend_uint_t nIndex;
+ zend_ulong nIndex;
zend_class_entry *new_ce;
zend_function *new_prototype;
zend_op_array *new_entry;
@@ -427,14 +446,14 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
if (!ht->nTableMask) {
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
return;
}
ZEND_ASSERT(!(source->u.flags & HASH_FLAG_PACKED));
- ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(zend_uint)));
- ht->arHash = (zend_uint *)(ht->arData + ht->nTableSize);
- memset(ht->arHash, INVALID_IDX, sizeof(zend_uint) * ht->nTableSize);
+ ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(uint32_t)));
+ ht->arHash = (uint32_t *)(ht->arData + ht->nTableSize);
+ memset(ht->arHash, INVALID_IDX, sizeof(uint32_t) * ht->nTableSize);
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
@@ -453,9 +472,8 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
q->key = zend_clone_str(p->key TSRMLS_CC);
/* Copy data */
- ZVAL_PTR(&q->val, (void *) zend_arena_alloc(&CG(arena), sizeof(zend_op_array)));
+ ZVAL_PTR(&q->val, ARENA_REALLOC(Z_PTR(p->val)));
new_entry = (zend_op_array*)Z_PTR(q->val);
- *new_entry = *(zend_op_array*)Z_PTR(p->val);
/* Copy constructor */
/* we use refcount to show that op_array is referenced from several places */
@@ -490,7 +508,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
{
uint idx;
Bucket *p, *q;
- zend_uint_t nIndex;
+ zend_ulong nIndex;
zend_class_entry *new_ce;
zend_property_info *prop_info;
@@ -504,14 +522,14 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
if (!ht->nTableMask) {
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
return;
}
ZEND_ASSERT(!(source->u.flags & HASH_FLAG_PACKED));
- ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(zend_uint)));
- ht->arHash = (zend_uint*)(ht->arData + ht->nTableSize);
- memset(ht->arHash, INVALID_IDX, sizeof(zend_uint) * ht->nTableSize);
+ ht->arData = (Bucket *) emalloc(ht->nTableSize * (sizeof(Bucket) + sizeof(uint32_t)));
+ ht->arHash = (uint32_t*)(ht->arData + ht->nTableSize);
+ memset(ht->arHash, INVALID_IDX, sizeof(uint32_t) * ht->nTableSize);
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
@@ -530,15 +548,14 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
q->key = zend_clone_str(p->key TSRMLS_CC);
/* Copy data */
- ZVAL_PTR(&q->val, (void *) zend_arena_alloc(&CG(arena), sizeof(zend_property_info)));
+ ZVAL_PTR(&q->val, ARENA_REALLOC(Z_PTR(p->val)));
prop_info = Z_PTR(q->val);
- *prop_info = *(zend_property_info*)Z_PTR(p->val);
/* Copy constructor */
prop_info->name = zend_clone_str(prop_info->name TSRMLS_CC);
if (prop_info->doc_comment) {
if (ZCG(accel_directives).load_comments) {
- prop_info->doc_comment = STR_DUP(prop_info->doc_comment, 0);
+ prop_info->doc_comment = zend_string_dup(prop_info->doc_comment, 0);
} else {
prop_info->doc_comment = NULL;
}
@@ -591,8 +608,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
zend_function *new_func;
TSRMLS_FETCH();
- *pce = ce = zend_arena_alloc(&CG(arena), sizeof(zend_class_entry));
- *ce = *old_ce;
+ *pce = ce = ARENA_REALLOC(old_ce);
ce->refcount = 1;
if (old_ce->refcount != 1) {
@@ -642,7 +658,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
}
if (ZEND_CE_DOC_COMMENT(ce)) {
if (ZCG(accel_directives).load_comments) {
- ZEND_CE_DOC_COMMENT(ce) = STR_DUP(ZEND_CE_DOC_COMMENT(ce), 0);
+ ZEND_CE_DOC_COMMENT(ce) = zend_string_dup(ZEND_CE_DOC_COMMENT(ce), 0);
} else {
ZEND_CE_DOC_COMMENT(ce) = NULL;
}
@@ -783,8 +799,7 @@ static void zend_accel_function_hash_copy(HashTable *target, HashTable *source,
}
}
if (pCopyConstructor) {
- Z_PTR_P(t) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
- memcpy(Z_PTR_P(t), Z_PTR(p->val), sizeof(zend_op_array));
+ Z_PTR_P(t) = ARENA_REALLOC(Z_PTR(p->val));
pCopyConstructor(Z_PTR_P(t));
}
}
@@ -860,9 +875,16 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
*op_array = persistent_script->main_op_array;
- if (from_shared_memory) {
+ if (EXPECTED(from_shared_memory)) {
zend_hash_init(&ZCG(bind_hash), 10, NULL, NULL, 0);
+ ZCG(current_persistent_script) = persistent_script;
+ ZCG(arena_mem) = NULL;
+ if (EXPECTED(persistent_script->arena_size)) {
+ ZCG(arena_mem) = zend_arena_alloc(&CG(arena), persistent_script->arena_size);
+ memcpy(ZCG(arena_mem), persistent_script->arena_mem, persistent_script->arena_size);
+ }
+
/* Copy all the necessary stuff from shared memory to regular memory, and protect the shared script */
if (zend_hash_num_elements(&persistent_script->class_table) > 0) {
zend_accel_class_hash_copy(CG(class_table), &persistent_script->class_table, (unique_copy_ctor_func_t) zend_class_copy_ctor TSRMLS_CC);
@@ -883,12 +905,13 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0);
if (!zend_hash_exists(EG(zend_constants), name)) {
- zend_register_int_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC);
+ zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC);
}
- STR_RELEASE(name);
+ zend_string_release(name);
}
zend_hash_destroy(&ZCG(bind_hash));
+ ZCG(current_persistent_script) = NULL;
} else /* if (!from_shared_memory) */ {
if (zend_hash_num_elements(&persistent_script->function_table) > 0) {
zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table, NULL TSRMLS_CC);
@@ -898,14 +921,14 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
}
}
- if (op_array->early_binding != (zend_uint)-1) {
+ if (op_array->early_binding != (uint32_t)-1) {
zend_string *orig_compiled_filename = CG(compiled_filename);
CG(compiled_filename) = persistent_script->full_path;
zend_do_delayed_early_binding(op_array TSRMLS_CC);
CG(compiled_filename) = orig_compiled_filename;
}
- if (!from_shared_memory) {
+ if (UNEXPECTED(!from_shared_memory)) {
free_persistent_script(persistent_script, 0); /* free only hashes */
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 9ea33adff1..3e91740a71 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -36,19 +36,19 @@
#define zend_accel_store_string(str) do { \
zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
if (new_str) { \
- STR_RELEASE(str); \
+ zend_string_release(str); \
str = new_str; \
} else { \
new_str = zend_accel_memdup((void*)str, _STR_HEADER_SIZE + (str)->len + 1); \
- STR_RELEASE(str); \
+ zend_string_release(str); \
str = new_str; \
- STR_HASH_VAL(str); \
+ zend_string_hash_val(str); \
GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
} \
} while (0)
#define zend_accel_memdup_string(str) do { \
str = zend_accel_memdup(str, _STR_HEADER_SIZE + (str)->len + 1); \
- STR_HASH_VAL(str); \
+ zend_string_hash_val(str); \
GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
} while (0)
#define zend_accel_store_interned_string(str) do { \
@@ -67,7 +67,7 @@ typedef void (*zend_persist_func_t)(zval* TSRMLS_DC);
static void zend_persist_zval(zval *z TSRMLS_DC);
static void zend_persist_zval_const(zval *z TSRMLS_DC);
-static const zend_uint uninitialized_bucket = {INVALID_IDX};
+static const uint32_t uninitialized_bucket = {INVALID_IDX};
static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement TSRMLS_DC)
{
@@ -75,19 +75,19 @@ static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement
Bucket *p;
if (!ht->nTableMask) {
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
return;
}
if (ht->u.flags & HASH_FLAG_PACKED) {
zend_accel_store(ht->arData, sizeof(Bucket) * ht->nNumUsed);
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
} else {
Bucket *d = (Bucket*)ZCG(mem);
- zend_uint *h = (zend_uint*)(d + ht->nNumUsed);
+ uint32_t *h = (uint32_t*)(d + ht->nNumUsed);
ZCG(mem) = (void*)(h + ht->nTableSize);
memcpy(d, ht->arData, sizeof(Bucket) * ht->nNumUsed);
- memcpy(h, ht->arHash, sizeof(zend_uint) * ht->nTableSize);
+ memcpy(h, ht->arHash, sizeof(uint32_t) * ht->nTableSize);
efree(ht->arData);
ht->arData = d;
ht->arHash = h;
@@ -112,19 +112,19 @@ static void zend_hash_persist_immutable(HashTable *ht TSRMLS_DC)
Bucket *p;
if (!ht->nTableMask) {
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
return;
}
if (ht->u.flags & HASH_FLAG_PACKED) {
ht->arData = zend_accel_memdup(ht->arData, sizeof(Bucket) * ht->nNumUsed);
- ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->arHash = (uint32_t*)&uninitialized_bucket;
} else {
Bucket *d = (Bucket*)ZCG(mem);
- zend_uint *h = (zend_uint*)(d + ht->nNumUsed);
+ uint32_t *h = (uint32_t*)(d + ht->nNumUsed);
ZCG(mem) = (void*)(h + ht->nTableSize);
memcpy(d, ht->arData, sizeof(Bucket) * ht->nNumUsed);
- memcpy(h, ht->arHash, sizeof(zend_uint) * ht->nTableSize);
+ memcpy(h, ht->arHash, sizeof(uint32_t) * ht->nTableSize);
ht->arData = d;
ht->arHash = h;
}
@@ -144,20 +144,33 @@ static void zend_hash_persist_immutable(HashTable *ht TSRMLS_DC)
static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC)
{
- int i;
+ uint32_t i;
zend_ast *node;
- if (ast->kind == ZEND_CONST) {
- node = zend_accel_memdup(ast, sizeof(zend_ast));
- zend_persist_zval(&node->u.val TSRMLS_CC);
+ if (ast->kind == ZEND_AST_ZVAL) {
+ zend_ast_zval *copy = zend_accel_memdup(ast, sizeof(zend_ast_zval));
+ zend_persist_zval(&copy->val TSRMLS_CC);
+ node = (zend_ast *) copy;
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ zend_ast_list *copy = zend_accel_memdup(ast,
+ sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children);
+ for (i = 0; i < list->children; i++) {
+ if (copy->child[i]) {
+ copy->child[i] = zend_persist_ast(copy->child[i] TSRMLS_CC);
+ }
+ }
+ node = (zend_ast *) copy;
} else {
- node = zend_accel_memdup(ast, sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- for (i = 0; i < ast->children; i++) {
- if ((&node->u.child)[i]) {
- (&node->u.child)[i] = zend_persist_ast((&node->u.child)[i] TSRMLS_CC);
+ uint32_t children = zend_ast_get_num_children(ast);
+ node = zend_accel_memdup(ast, sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
+ for (i = 0; i < children; i++) {
+ if (node->child[i]) {
+ node->child[i] = zend_persist_ast(node->child[i] TSRMLS_CC);
}
}
}
+
efree(ast);
return node;
}
@@ -185,6 +198,7 @@ static void zend_persist_zval(zval *z TSRMLS_DC)
Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array));
zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC);
} else {
+ GC_REMOVE_FROM_BUFFER(Z_ARR_P(z));
zend_accel_store(Z_ARR_P(z), sizeof(zend_array));
zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC);
/* make immutable array */
@@ -238,6 +252,7 @@ static void zend_persist_zval_const(zval *z TSRMLS_DC)
Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array));
zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC);
} else {
+ GC_REMOVE_FROM_BUFFER(Z_ARR_P(z));
zend_accel_store(Z_ARR_P(z), sizeof(zend_array));
zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC);
/* make immutable array */
@@ -292,7 +307,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
fake_execute_data.func = (zend_function*)op_array;
EG(current_execute_data) = &fake_execute_data;
if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) {
- main_persistent_script->compiler_halt_offset = Z_IVAL_P(offset);
+ main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset);
}
EG(current_execute_data) = orig_execute_data;
}
@@ -358,7 +373,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
case ZEND_JMP_SET:
- case ZEND_JMP_SET_VAR:
+ case ZEND_COALESCE:
case ZEND_NEW:
case ZEND_FE_RESET:
case ZEND_FE_FETCH:
@@ -399,7 +414,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
ZEND_ASSERT(new_ptr != NULL);
op_array->arg_info = new_ptr;
} else {
- zend_uint i;
+ uint32_t i;
zend_accel_store(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args);
for (i = 0; i < op_array->num_args; i++) {
@@ -433,7 +448,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
}
} else {
if (!already_stored) {
- STR_RELEASE(op_array->doc_comment);
+ zend_string_release(op_array->doc_comment);
}
op_array->doc_comment = NULL;
}
@@ -471,7 +486,10 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
static void zend_persist_op_array(zval *zv TSRMLS_DC)
{
- Z_PTR_P(zv) = zend_accel_memdup(Z_PTR_P(zv), sizeof(zend_op_array));
+ memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_op_array));
+ zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
+ Z_PTR_P(zv) = ZCG(arena_mem);
+ ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_op_array)));
zend_persist_op_array_ex(Z_PTR_P(zv), NULL TSRMLS_CC);
}
@@ -479,7 +497,10 @@ static void zend_persist_property_info(zval *zv TSRMLS_DC)
{
zend_property_info *prop;
- prop = Z_PTR_P(zv) = zend_accel_memdup(Z_PTR_P(zv), sizeof(zend_property_info));
+ memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_property_info));
+ zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
+ prop = Z_PTR_P(zv) = ZCG(arena_mem);
+ ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_property_info)));
zend_accel_store_interned_string(prop->name);
if (prop->doc_comment) {
if (ZCG(accel_directives).save_comments) {
@@ -488,7 +509,7 @@ static void zend_persist_property_info(zval *zv TSRMLS_DC)
if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) {
zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment);
}
- STR_RELEASE(prop->doc_comment);
+ zend_string_release(prop->doc_comment);
prop->doc_comment = NULL;
}
}
@@ -499,7 +520,10 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC)
zend_class_entry *ce = Z_PTR_P(zv);
if (ce->type == ZEND_USER_CLASS) {
- ce = Z_PTR_P(zv) = zend_accel_memdup(ce, sizeof(zend_class_entry));
+ memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_class_entry));
+ zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
+ ce = Z_PTR_P(zv) = ZCG(arena_mem);
+ ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_class_entry)));
zend_accel_store_interned_string(ce->name);
zend_hash_persist(&ce->function_table, zend_persist_op_array TSRMLS_CC);
if (ce->default_properties_table) {
@@ -532,7 +556,7 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC)
} else {
if (!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) {
zend_shared_alloc_register_xlat_entry(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT(ce));
- STR_RELEASE(ZEND_CE_DOC_COMMENT(ce));
+ zend_string_release(ZEND_CE_DOC_COMMENT(ce));
}
ZEND_CE_DOC_COMMENT(ce) = NULL;
}
@@ -688,13 +712,20 @@ static void zend_accel_persist_class_table(HashTable *class_table TSRMLS_DC)
zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length TSRMLS_DC)
{
+ script->mem = ZCG(mem);
+
zend_shared_alloc_clear_xlat_table();
- zend_hash_persist(&script->function_table, zend_persist_op_array TSRMLS_CC);
- zend_accel_persist_class_table(&script->class_table TSRMLS_CC);
- zend_persist_op_array_ex(&script->main_op_array, script TSRMLS_CC);
+
+ zend_accel_store(script, sizeof(zend_persistent_script));
*key = zend_accel_memdup(*key, key_length + 1);
zend_accel_store_string(script->full_path);
- zend_accel_store(script, sizeof(zend_persistent_script));
+
+ script->arena_mem = ZCG(arena_mem) = ZCG(mem);
+ ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
+
+ zend_accel_persist_class_table(&script->class_table TSRMLS_CC);
+ zend_hash_persist(&script->function_table, zend_persist_op_array TSRMLS_CC);
+ zend_persist_op_array_ex(&script->main_op_array, script TSRMLS_CC);
return script;
}
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index 08e9211350..0a7b835648 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -26,10 +26,10 @@
#include "zend_shared_alloc.h"
#include "zend_operators.h"
-#define START_SIZE() uint memory_used = 0
-#define ADD_DUP_SIZE(m,s) memory_used += zend_shared_memdup_size((void*)m, s)
-#define ADD_SIZE(m) memory_used += ZEND_ALIGNED_SIZE(m)
-#define RETURN_SIZE() return memory_used
+#define ADD_DUP_SIZE(m,s) ZCG(current_persistent_script)->size += zend_shared_memdup_size((void*)m, s)
+#define ADD_SIZE(m) ZCG(current_persistent_script)->size += ZEND_ALIGNED_SIZE(m)
+
+#define ADD_ARENA_SIZE(m) ZCG(current_persistent_script)->arena_size += ZEND_ALIGNED_SIZE(m)
# define ADD_STRING(str) \
ADD_DUP_SIZE((str), _STR_HEADER_SIZE + (str)->len + 1)
@@ -38,7 +38,7 @@
zend_string *tmp = accel_new_interned_string(str TSRMLS_CC); \
if (tmp != (str)) { \
if (do_free) { \
- /*STR_RELEASE(str);*/ \
+ /*zend_string_release(str);*/ \
} \
(str) = tmp; \
} else { \
@@ -47,21 +47,20 @@
} \
} while (0)
-static uint zend_persist_zval_calc(zval *z TSRMLS_DC);
+static void zend_persist_zval_calc(zval *z TSRMLS_DC);
-static uint zend_hash_persist_calc(HashTable *ht, uint (*pPersistElement)(zval *pElement TSRMLS_DC) TSRMLS_DC)
+static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval *pElement TSRMLS_DC) TSRMLS_DC)
{
uint idx;
Bucket *p;
- START_SIZE();
if (!ht->nTableMask) {
- RETURN_SIZE();
+ return;
}
if (ht->u.flags & HASH_FLAG_PACKED) {
ADD_SIZE(sizeof(Bucket) * ht->nNumUsed);
} else {
- ADD_SIZE(sizeof(Bucket) * ht->nNumUsed + sizeof(zend_uint) * ht->nTableSize);
+ ADD_SIZE(sizeof(Bucket) * ht->nNumUsed + sizeof(uint32_t) * ht->nTableSize);
}
for (idx = 0; idx < ht->nNumUsed; idx++) {
@@ -75,43 +74,47 @@ static uint zend_hash_persist_calc(HashTable *ht, uint (*pPersistElement)(zval *
GC_FLAGS(p->key) |= flags;
}
- ADD_SIZE(pPersistElement(&p->val TSRMLS_CC));
+ pPersistElement(&p->val TSRMLS_CC);
}
-
- RETURN_SIZE();
}
-static uint zend_persist_ast_calc(zend_ast *ast TSRMLS_DC)
+static void zend_persist_ast_calc(zend_ast *ast TSRMLS_DC)
{
- int i;
- START_SIZE();
-
- if (ast->kind == ZEND_CONST) {
- ADD_SIZE(sizeof(zend_ast));
- ADD_SIZE(zend_persist_zval_calc(&ast->u.val TSRMLS_CC));
+ uint32_t i;
+
+ if (ast->kind == ZEND_AST_ZVAL) {
+ ADD_SIZE(sizeof(zend_ast_zval));
+ zend_persist_zval_calc(zend_ast_get_zval(ast) TSRMLS_CC);
+ } else if (zend_ast_is_list(ast)) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ ADD_SIZE(sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children);
+ for (i = 0; i < list->children; i++) {
+ if (list->child[i]) {
+ zend_persist_ast_calc(list->child[i] TSRMLS_CC);
+ }
+ }
} else {
- ADD_SIZE(sizeof(zend_ast) + sizeof(zend_ast*) * (ast->children - 1));
- for (i = 0; i < ast->children; i++) {
- if ((&ast->u.child)[i]) {
- ADD_SIZE(zend_persist_ast_calc((&ast->u.child)[i] TSRMLS_CC));
+ uint32_t children = zend_ast_get_num_children(ast);
+ ADD_SIZE(sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
+ for (i = 0; i < children; i++) {
+ if (ast->child[i]) {
+ zend_persist_ast_calc(ast->child[i] TSRMLS_CC);
}
}
}
- RETURN_SIZE();
}
-static uint zend_persist_zval_calc(zval *z TSRMLS_DC)
+static void zend_persist_zval_calc(zval *z TSRMLS_DC)
{
zend_uchar flags;
uint size;
- START_SIZE();
switch (Z_TYPE_P(z)) {
case IS_STRING:
case IS_CONSTANT:
flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
ADD_INTERNED_STRING(Z_STR_P(z), 0);
- if (IS_INTERNED(Z_STR_P(z))) {
+ if (!Z_REFCOUNTED_P(z)) {
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
Z_GC_FLAGS_P(z) |= flags;
@@ -120,38 +123,35 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC)
size = zend_shared_memdup_size(Z_ARR_P(z), sizeof(zend_array));
if (size) {
ADD_SIZE(size);
- ADD_SIZE(zend_hash_persist_calc(Z_ARRVAL_P(z), zend_persist_zval_calc TSRMLS_CC));
+ zend_hash_persist_calc(Z_ARRVAL_P(z), zend_persist_zval_calc TSRMLS_CC);
}
break;
case IS_REFERENCE:
size = zend_shared_memdup_size(Z_REF_P(z), sizeof(zend_reference));
if (size) {
ADD_SIZE(size);
- ADD_SIZE(zend_persist_zval_calc(Z_REFVAL_P(z) TSRMLS_CC));
+ zend_persist_zval_calc(Z_REFVAL_P(z) TSRMLS_CC);
}
break;
case IS_CONSTANT_AST:
size = zend_shared_memdup_size(Z_AST_P(z), sizeof(zend_ast_ref));
if (size) {
ADD_SIZE(size);
- ADD_SIZE(zend_persist_ast_calc(Z_ASTVAL_P(z) TSRMLS_CC));
+ zend_persist_ast_calc(Z_ASTVAL_P(z) TSRMLS_CC);
}
break;
}
- RETURN_SIZE();
}
-static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
+static void zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
{
- START_SIZE();
-
if (op_array->type != ZEND_USER_FUNCTION) {
- return 0;
+ return;
}
if (op_array->static_variables) {
ADD_DUP_SIZE(op_array->static_variables, sizeof(HashTable));
- ADD_SIZE(zend_hash_persist_calc(op_array->static_variables, zend_persist_zval_calc TSRMLS_CC));
+ zend_hash_persist_calc(op_array->static_variables, zend_persist_zval_calc TSRMLS_CC);
}
if (zend_shared_alloc_get_xlat_entry(op_array->opcodes)) {
@@ -162,7 +162,7 @@ static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
op_array->function_name = new_name;
}
}
- RETURN_SIZE();
+ return;
}
if (op_array->literals) {
@@ -170,7 +170,7 @@ static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
zval *end = p + op_array->last_literal;
ADD_DUP_SIZE(op_array->literals, sizeof(zval) * op_array->last_literal);
while (p < end) {
- ADD_SIZE(zend_persist_zval_calc(p TSRMLS_CC));
+ zend_persist_zval_calc(p TSRMLS_CC);
p++;
}
}
@@ -194,7 +194,7 @@ static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
}
if (op_array->arg_info) {
- zend_uint i;
+ uint32_t i;
ADD_DUP_SIZE(op_array->arg_info, sizeof(zend_arg_info) * op_array->num_args);
for (i = 0; i < op_array->num_args; i++) {
@@ -230,46 +230,39 @@ static uint zend_persist_op_array_calc_ex(zend_op_array *op_array TSRMLS_DC)
ADD_INTERNED_STRING(op_array->vars[i], 0);
}
}
-
- RETURN_SIZE();
}
-static uint zend_persist_op_array_calc(zval *zv TSRMLS_DC)
+static void zend_persist_op_array_calc(zval *zv TSRMLS_DC)
{
- START_SIZE();
- ADD_SIZE(sizeof(zend_op_array));
- ADD_SIZE(zend_persist_op_array_calc_ex(Z_PTR_P(zv) TSRMLS_CC));
- RETURN_SIZE();
+ ADD_ARENA_SIZE(sizeof(zend_op_array));
+ zend_persist_op_array_calc_ex(Z_PTR_P(zv) TSRMLS_CC);
}
-static uint zend_persist_property_info_calc(zval *zv TSRMLS_DC)
+static void zend_persist_property_info_calc(zval *zv TSRMLS_DC)
{
zend_property_info *prop = Z_PTR_P(zv);
- START_SIZE();
- ADD_SIZE(sizeof(zend_property_info));
+ ADD_ARENA_SIZE(sizeof(zend_property_info));
ADD_INTERNED_STRING(prop->name, 0);
if (ZCG(accel_directives).save_comments && prop->doc_comment) {
ADD_STRING(prop->doc_comment);
}
- RETURN_SIZE();
}
-static uint zend_persist_class_entry_calc(zval *zv TSRMLS_DC)
+static void zend_persist_class_entry_calc(zval *zv TSRMLS_DC)
{
zend_class_entry *ce = Z_PTR_P(zv);
- START_SIZE();
if (ce->type == ZEND_USER_CLASS) {
- ADD_DUP_SIZE(ce, sizeof(zend_class_entry));
+ ADD_ARENA_SIZE(sizeof(zend_class_entry));
ADD_INTERNED_STRING(ce->name, 0);
- ADD_SIZE(zend_hash_persist_calc(&ce->function_table, zend_persist_op_array_calc TSRMLS_CC));
+ zend_hash_persist_calc(&ce->function_table, zend_persist_op_array_calc TSRMLS_CC);
if (ce->default_properties_table) {
int i;
ADD_SIZE(sizeof(zval) * ce->default_properties_count);
for (i = 0; i < ce->default_properties_count; i++) {
- ADD_SIZE(zend_persist_zval_calc(&ce->default_properties_table[i] TSRMLS_CC));
+ zend_persist_zval_calc(&ce->default_properties_table[i] TSRMLS_CC);
}
}
if (ce->default_static_members_table) {
@@ -277,10 +270,10 @@ static uint zend_persist_class_entry_calc(zval *zv TSRMLS_DC)
ADD_SIZE(sizeof(zval) * ce->default_static_members_count);
for (i = 0; i < ce->default_static_members_count; i++) {
- ADD_SIZE(zend_persist_zval_calc(&ce->default_static_members_table[i] TSRMLS_CC));
+ zend_persist_zval_calc(&ce->default_static_members_table[i] TSRMLS_CC);
}
}
- ADD_SIZE(zend_hash_persist_calc(&ce->constants_table, zend_persist_zval_calc TSRMLS_CC));
+ zend_hash_persist_calc(&ce->constants_table, zend_persist_zval_calc TSRMLS_CC);
if (ZEND_CE_FILENAME(ce)) {
ADD_STRING(ZEND_CE_FILENAME(ce));
@@ -289,7 +282,7 @@ static uint zend_persist_class_entry_calc(zval *zv TSRMLS_DC)
ADD_STRING(ZEND_CE_DOC_COMMENT(ce));
}
- ADD_SIZE(zend_hash_persist_calc(&ce->properties_info, zend_persist_property_info_calc TSRMLS_CC));
+ zend_hash_persist_calc(&ce->properties_info, zend_persist_property_info_calc TSRMLS_CC);
if (ce->trait_aliases) {
int i = 0;
@@ -336,24 +329,32 @@ static uint zend_persist_class_entry_calc(zval *zv TSRMLS_DC)
ADD_SIZE(sizeof(zend_trait_precedence*) * (i + 1));
}
}
- RETURN_SIZE();
}
-static uint zend_accel_persist_class_table_calc(HashTable *class_table TSRMLS_DC)
+static void zend_accel_persist_class_table_calc(HashTable *class_table TSRMLS_DC)
{
- return zend_hash_persist_calc(class_table, zend_persist_class_entry_calc TSRMLS_CC);
+ zend_hash_persist_calc(class_table, zend_persist_class_entry_calc TSRMLS_CC);
}
uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length TSRMLS_DC)
{
- START_SIZE();
+ new_persistent_script->mem = NULL;
+ new_persistent_script->size = 0;
+ new_persistent_script->arena_mem = NULL;
+ new_persistent_script->arena_size = 0;
+ ZCG(current_persistent_script) = new_persistent_script;
- ADD_SIZE(zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc TSRMLS_CC));
- ADD_SIZE(zend_accel_persist_class_table_calc(&new_persistent_script->class_table TSRMLS_CC));
- ADD_SIZE(zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array TSRMLS_CC));
+ ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
ADD_DUP_SIZE(key, key_length + 1);
ADD_STRING(new_persistent_script->full_path);
- ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
- RETURN_SIZE();
+ zend_accel_persist_class_table_calc(&new_persistent_script->class_table TSRMLS_CC);
+ zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc TSRMLS_CC);
+ zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array TSRMLS_CC);
+
+ new_persistent_script->size += new_persistent_script->arena_size;
+
+ ZCG(current_persistent_script) = NULL;
+
+ return new_persistent_script->size;
}
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 8a60d75736..43a0263ee5 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -288,7 +288,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
#define MIN_FREE_MEMORY 64*1024
#define SHARED_ALLOC_FAILED() do { \
- zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_int_t)size, (zend_int_t)ZSMMG(shared_free)); \
+ zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_long)size, (zend_long)ZSMMG(shared_free)); \
if (zend_shared_alloc_get_largest_free_block() < MIN_FREE_MEMORY) { \
ZSMMG(memory_exhausted) = 1; \
} \
@@ -327,7 +327,7 @@ int zend_shared_memdup_size(void *source, size_t size)
{
void *old_p;
- if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) {
+ if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)source)) != NULL) {
/* we already duplicated this pointer */
return 0;
}
@@ -339,11 +339,11 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML
{
void *old_p, *retval;
- if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) {
+ if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)source)) != NULL) {
/* we already duplicated this pointer */
return old_p;
}
- retval = ZCG(mem);;
+ retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
if (free_source) {
@@ -431,14 +431,14 @@ void zend_shared_alloc_clear_xlat_table(void)
void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
{
- zend_hash_index_update_ptr(&xlat_table, (zend_uint_t)old, (void*)new);
+ zend_hash_index_update_ptr(&xlat_table, (zend_ulong)old, (void*)new);
}
void *zend_shared_alloc_get_xlat_entry(const void *old)
{
void *retval;
- if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)old)) == NULL) {
+ if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)old)) == NULL) {
return NULL;
}
return retval;
diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h
index b16b1a30dd..ec7cc14d07 100644
--- a/ext/opcache/zend_shared_alloc.h
+++ b/ext/opcache/zend_shared_alloc.h
@@ -130,7 +130,7 @@ int zend_shared_memdup_size(void *p, size_t size);
typedef union _align_test {
void *ptr;
double dbl;
- zend_int_t lng;
+ zend_long lng;
} align_test;
#if ZEND_GCC_VERSION >= 2000
diff --git a/ext/openssl/config0.m4 b/ext/openssl/config0.m4
index a97114f808..701e488385 100644
--- a/ext/openssl/config0.m4
+++ b/ext/openssl/config0.m4
@@ -8,6 +8,9 @@ PHP_ARG_WITH(openssl, for OpenSSL support,
PHP_ARG_WITH(kerberos, for Kerberos support,
[ --with-kerberos[=DIR] OPENSSL: Include Kerberos support], no, no)
+PHP_ARG_WITH(system-ciphers, whether to use system default cipher list instead of hardcoded value,
+[ --with-system-ciphers OPENSSL: Use system default cipher list instead of hardcoded value], no, no)
+
if test "$PHP_OPENSSL" != "no"; then
PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.c, $ext_shared)
PHP_SUBST(OPENSSL_SHARED_LIBADD)
@@ -25,4 +28,7 @@ if test "$PHP_OPENSSL" != "no"; then
], [
AC_MSG_ERROR([OpenSSL check failed. Please check config.log for more information.])
])
+ if test "$PHP_SYSTEM_CIPHERS" != "no"; then
+ AC_DEFINE(USE_OPENSSL_SYSTEM_CIPHERS,1,[ Use system default cipher list instead of hardcoded value ])
+ fi
fi
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 527c1cc0e7..c4b155b478 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -669,7 +669,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
add_next_index_stringl(data, (char *)to_add, to_add_len);
} else if (Z_TYPE_P(data) == IS_STRING) {
array_init(&tmp);
- add_next_index_str(&tmp, STR_COPY(Z_STR_P(data)));
+ add_next_index_str(&tmp, zend_string_copy(Z_STR_P(data)));
add_next_index_stringl(&tmp, (char *)to_add, to_add_len);
zend_hash_str_update(Z_ARRVAL(subitem), sname, strlen(sname), &tmp);
}
@@ -844,12 +844,12 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */
varname = defval
#define SET_OPTIONAL_LONG_ARG(key, varname, defval) \
- if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_INT) \
- varname = Z_IVAL_P(item); \
+ if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_LONG) \
+ varname = Z_LVAL_P(item); \
else \
varname = defval
-static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo);
+static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(zend_long algo);
int openssl_spki_cleanup(const char *src, char *dest);
@@ -905,8 +905,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
}
if (req->priv_key_encrypt && optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher")-1)) != NULL
- && Z_TYPE_P(item) == IS_INT) {
- php_int_t cipher_algo = Z_IVAL_P(item);
+ && Z_TYPE_P(item) == IS_LONG) {
+ zend_long cipher_algo = Z_LVAL_P(item);
const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo);
if (cipher == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm for private key.");
@@ -1012,7 +1012,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see
}
/* }}} */
-static EVP_MD * php_openssl_get_evp_md_from_algo(php_int_t algo) { /* {{{ */
+static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */
EVP_MD *mdtype;
switch (algo) {
@@ -1058,7 +1058,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(php_int_t algo) { /* {{{ */
}
/* }}} */
-static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo) { /* {{{ */
+static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(zend_long algo) { /* {{{ */
switch (algo) {
#ifndef OPENSSL_NO_RC2
case PHP_OPENSSL_CIPHER_RC2_40:
@@ -1130,86 +1130,86 @@ PHP_MINIT_FUNCTION(openssl)
ssl_stream_data_index = SSL_get_ex_new_index(0, "PHP stream index", NULL, NULL, NULL);
REGISTER_STRING_CONSTANT("OPENSSL_VERSION_TEXT", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT);
/* purposes for cert purpose checking */
- REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT);
#ifdef X509_PURPOSE_ANY
- REGISTER_INT_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT);
#endif
/* signature algorithm constants */
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT);
#ifdef HAVE_OPENSSL_MD2_H
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT);
#endif
/* flags for S/MIME */
- REGISTER_INT_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT);
/* Informational stream wrapper constants */
REGISTER_STRING_CONSTANT("OPENSSL_DEFAULT_STREAM_CIPHERS", OPENSSL_DEFAULT_STREAM_CIPHERS, CONST_CS|CONST_PERSISTENT);
/* Ciphers */
#ifndef OPENSSL_NO_RC2
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT);
#endif
#ifndef OPENSSL_NO_DES
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT);
#endif
#ifndef OPENSSL_NO_AES
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT);
#endif
/* Values for key types */
- REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT);
#ifndef NO_DSA
- REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT);
#ifdef HAVE_EVP_PKEY_EC
- REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT);
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
/* SNI support included in OpenSSL >= 0.9.8j */
- REGISTER_INT_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT);
#endif
/* Determine default SSL configuration file */
@@ -1361,7 +1361,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso
/* force it to be a string and check if it refers to a file */
convert_to_string_ex(val);
- if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
+ if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
/* read cert from the named file */
BIO *in;
@@ -1378,7 +1378,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso
} else {
BIO *in;
- in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val));
if (in == NULL) {
return NULL;
}
@@ -1408,7 +1408,7 @@ PHP_FUNCTION(openssl_x509_export_to_file)
BIO * bio_out;
zend_resource *certresource;
char * filename;
- int filename_len;
+ size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zp|b", &zcert, &filename, &filename_len, &notext) == FAILURE) {
return;
@@ -1448,12 +1448,12 @@ PHP_FUNCTION(openssl_x509_export_to_file)
outputting results to var */
PHP_FUNCTION(openssl_spki_new)
{
- int challenge_len;
+ size_t challenge_len;
char * challenge = NULL, * spkstr = NULL;
zend_string * s = NULL;
zend_resource *keyresource = NULL;
const char *spkac = "SPKAC=";
- php_int_t algo = OPENSSL_ALGO_MD5;
+ zend_long algo = OPENSSL_ALGO_MD5;
zval *method = NULL;
zval * zpkey = NULL;
@@ -1474,8 +1474,8 @@ PHP_FUNCTION(openssl_spki_new)
}
if (method != NULL) {
- if (Z_TYPE_P(method) == IS_INT) {
- algo = Z_IVAL_P(method);
+ if (Z_TYPE_P(method) == IS_LONG) {
+ algo = Z_LVAL_P(method);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Algorithm must be of supported type");
goto cleanup;
@@ -1513,7 +1513,7 @@ PHP_FUNCTION(openssl_spki_new)
goto cleanup;
}
- s = STR_ALLOC(strlen(spkac) + strlen(spkstr), 0);
+ s = zend_string_alloc(strlen(spkac) + strlen(spkstr), 0);
sprintf(s->val, "%s%s", spkac, spkstr);
s->len = strlen(s->val);
@@ -1537,7 +1537,7 @@ cleanup:
}
if (keyresource == NULL && s != NULL) {
- STR_RELEASE(s);
+ zend_string_release(s);
}
}
/* }}} */
@@ -1546,7 +1546,8 @@ cleanup:
Verifies spki returns boolean */
PHP_FUNCTION(openssl_spki_verify)
{
- int spkstr_len, i = 0;
+ size_t spkstr_len;
+ int i = 0;
char *spkstr = NULL, * spkstr_cleaned = NULL;
EVP_PKEY *pkey = NULL;
@@ -1606,7 +1607,7 @@ cleanup:
Exports public key from existing spki to var */
PHP_FUNCTION(openssl_spki_export)
{
- int spkstr_len;
+ size_t spkstr_len;
char *spkstr = NULL, * spkstr_cleaned = NULL, * s = NULL;
EVP_PKEY *pkey = NULL;
@@ -1666,7 +1667,7 @@ cleanup:
Exports spkac challenge from existing spki to var */
PHP_FUNCTION(openssl_spki_export_challenge)
{
- int spkstr_len;
+ size_t spkstr_len;
char *spkstr = NULL, * spkstr_cleaned = NULL;
NETSCAPE_SPKI *spki = NULL;
@@ -1776,9 +1777,9 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_b
}
if (raw) {
- ret = STR_INIT((char*)md, n, 0);
+ ret = zend_string_init((char*)md, n, 0);
} else {
- ret = STR_ALLOC(n * 2, 0);
+ ret = zend_string_alloc(n * 2, 0);
make_digest_ex(ret->val, md, n);
ret->val[n * 2] = '\0';
}
@@ -1793,7 +1794,7 @@ PHP_FUNCTION(openssl_x509_fingerprint)
zend_resource *certresource;
zend_bool raw_output = 0;
char *method = "sha1";
- int method_len;
+ size_t method_len;
zend_string *fingerprint;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|sb", &zcert, &method, &method_len, &raw_output) == FAILURE) {
@@ -1958,22 +1959,22 @@ PHP_FUNCTION(openssl_x509_parse)
}
add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC);
- add_assoc_int(return_value, "version", X509_get_version(cert));
+ add_assoc_long(return_value, "version", X509_get_version(cert));
add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)));
add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));
add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert));
- add_assoc_int(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC));
- add_assoc_int(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC));
+ add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC));
+ add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC));
tmpstr = (char *)X509_alias_get0(cert, NULL);
if (tmpstr) {
add_assoc_string(return_value, "alias", tmpstr);
}
/*
- add_assoc_int(return_value, "signaturetypeLONG", X509_get_signature_type(cert));
+ add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert));
add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)));
add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)));
*/
@@ -2137,15 +2138,16 @@ PHP_FUNCTION(openssl_x509_checkpurpose)
X509 * cert = NULL;
zend_resource *certresource = NULL;
STACK_OF(X509) * untrustedchain = NULL;
- php_int_t purpose;
+ zend_long purpose;
char * untrusted = NULL;
- int untrusted_len = 0, ret;
+ size_t untrusted_len = 0;
+ int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) {
return;
}
- RETVAL_INT(-1);
+ RETVAL_LONG(-1);
if (untrusted) {
untrustedchain = load_all_certs_from_file(untrusted);
@@ -2165,7 +2167,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose)
ret = check_cert(cainfo, cert, untrustedchain, purpose);
if (ret != 0 && ret != 1) {
- RETVAL_INT(ret);
+ RETVAL_LONG(ret);
} else {
RETVAL_BOOL(ret);
}
@@ -2193,7 +2195,7 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC)
X509_LOOKUP * dir_lookup, * file_lookup;
int ndirs = 0, nfiles = 0;
zval * item;
- php_stat_t sb;
+ zend_stat_t sb;
store = X509_STORE_new();
@@ -2353,9 +2355,9 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
PKCS12 * p12 = NULL;
char * filename;
char * friendly_name = NULL;
- int filename_len;
+ size_t filename_len;
char * pass;
- int pass_len;
+ size_t pass_len;
zval *zcert = NULL, *zpkey = NULL, *args = NULL;
EVP_PKEY *priv_key = NULL;
zend_resource *certresource, *keyresource;
@@ -2438,7 +2440,7 @@ PHP_FUNCTION(openssl_pkcs12_export)
EVP_PKEY *priv_key = NULL;
zend_resource *certresource, *keyresource;
char * pass;
- int pass_len;
+ size_t pass_len;
char * friendly_name = NULL;
zval * item;
STACK_OF(X509) *ca = NULL;
@@ -2505,7 +2507,7 @@ PHP_FUNCTION(openssl_pkcs12_read)
{
zval *zout = NULL, zextracerts, zcert, zpkey;
char *pass, *zp12;
- int pass_len, zp12_len;
+ size_t pass_len, zp12_len;
PKCS12 * p12 = NULL;
EVP_PKEY * pkey = NULL;
X509 * cert = NULL;
@@ -2768,7 +2770,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r
return NULL;
}
- if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
+ if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
filename = Z_STRVAL_P(val) + (sizeof("file://") - 1);
}
if (filename) {
@@ -2777,7 +2779,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r
}
in = BIO_new_file(filename, "r");
} else {
- in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val));
}
csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL);
BIO_free(in);
@@ -2793,7 +2795,8 @@ PHP_FUNCTION(openssl_csr_export_to_file)
X509_REQ * csr;
zval * zcsr = NULL;
zend_bool notext = 1;
- char * filename = NULL; int filename_len;
+ char * filename = NULL;
+ size_t filename_len;
BIO * bio_out;
zend_resource *csr_resource;
@@ -2881,8 +2884,8 @@ PHP_FUNCTION(openssl_csr_export)
PHP_FUNCTION(openssl_csr_sign)
{
zval * zcert = NULL, *zcsr, *zpkey, *args = NULL;
- php_int_t num_days;
- php_int_t serial = Z_I(0);
+ zend_long num_days;
+ zend_long serial = Z_L(0);
X509 * cert = NULL, *new_cert = NULL;
X509_REQ * csr;
EVP_PKEY * key = NULL, *priv_key = NULL;
@@ -2890,7 +2893,7 @@ PHP_FUNCTION(openssl_csr_sign)
int i;
struct php_x509_request req;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zi|a!i", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE)
return;
RETVAL_FALSE;
@@ -3260,7 +3263,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p
}
convert_to_string_ex(val);
- if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
+ if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
filename = Z_STRVAL_P(val) + (sizeof("file://") - 1);
}
/* it's an X509 file/cert of some kind, and we need to extract the data from that */
@@ -3274,7 +3277,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p
if (filename) {
in = BIO_new_file(filename, "r");
} else {
- in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val));
}
if (in == NULL) {
TMP_CLEAN;
@@ -3292,7 +3295,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p
}
in = BIO_new_file(filename, "r");
} else {
- in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val));
}
if (in == NULL) {
@@ -3455,7 +3458,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
#define OPENSSL_PKEY_GET_BN(_type, _name) do { \
if (pkey->pkey._type->_name != NULL) { \
int len = BN_num_bytes(pkey->pkey._type->_name); \
- zend_string *str = STR_ALLOC(len, 0); \
+ zend_string *str = zend_string_alloc(len, 0); \
BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str->val); \
str->val[len] = 0; \
add_assoc_str(&_type, #_name, str); \
@@ -3468,7 +3471,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
Z_TYPE_P(bn) == IS_STRING) { \
_type->_name = BN_bin2bn( \
(unsigned char*)Z_STRVAL_P(bn), \
- Z_STRSIZE_P(bn), NULL); \
+ Z_STRLEN_P(bn), NULL); \
} \
} while (0);
@@ -3587,8 +3590,10 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
{
struct php_x509_request req;
zval * zpkey, * args = NULL;
- char * passphrase = NULL; int passphrase_len = 0;
- char * filename = NULL; int filename_len = 0;
+ char * passphrase = NULL;
+ size_t passphrase_len = 0;
+ char * filename = NULL;
+ size_t filename_len = 0;
zend_resource *key_resource = NULL;
EVP_PKEY * key;
BIO * bio_out = NULL;
@@ -3647,7 +3652,7 @@ PHP_FUNCTION(openssl_pkey_export)
{
struct php_x509_request req;
zval * zpkey, * args = NULL, *out;
- char * passphrase = NULL; int passphrase_len = 0;
+ char * passphrase = NULL; size_t passphrase_len = 0;
zend_resource *key_resource = NULL;
EVP_PKEY * key;
BIO * bio_out = NULL;
@@ -3745,7 +3750,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
zval *cert;
EVP_PKEY *pkey;
char * passphrase = "";
- int passphrase_len = sizeof("")-1;
+ size_t passphrase_len = sizeof("")-1;
zend_resource *res;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &cert, &passphrase, &passphrase_len) == FAILURE) {
@@ -3771,7 +3776,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
BIO *out;
unsigned int pbio_len;
char *pbio;
- php_int_t ktype;
+ zend_long ktype;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &key) == FAILURE) {
return;
@@ -3785,7 +3790,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
pbio_len = BIO_get_mem_data(out, &pbio);
array_init(return_value);
- add_assoc_int(return_value, "bits", EVP_PKEY_bits(pkey));
+ add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey));
add_assoc_stringl(return_value, "key", pbio, pbio_len);
/*TODO: Use the real values once the openssl constants are used
* See the enum at the top of this file
@@ -3854,7 +3859,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
ktype = -1;
break;
}
- add_assoc_int(return_value, "type", ktype);
+ add_assoc_long(return_value, "type", ktype);
BIO_free(out);
}
@@ -3868,15 +3873,18 @@ PHP_FUNCTION(openssl_pkey_get_details)
Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */
PHP_FUNCTION(openssl_pbkdf2)
{
- php_int_t key_length = 0, iterations = 0;
- char *password; int password_len;
- char *salt; int salt_len;
- char *method; int method_len = 0;
+ zend_long key_length = 0, iterations = 0;
+ char *password;
+ size_t password_len;
+ char *salt;
+ size_t salt_len;
+ char *method;
+ size_t method_len = 0;
zend_string *out_buffer;
const EVP_MD *digest;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssii|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s",
&password, &password_len,
&salt, &salt_len,
&key_length, &iterations,
@@ -3899,13 +3907,13 @@ PHP_FUNCTION(openssl_pbkdf2)
RETURN_FALSE;
}
- out_buffer = STR_ALLOC(key_length, 0);
+ out_buffer = zend_string_alloc(key_length, 0);
if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, (unsigned char*)out_buffer->val) == 1) {
out_buffer->val[key_length] = 0;
RETURN_STR(out_buffer);
} else {
- STR_RELEASE(out_buffer);
+ zend_string_release(out_buffer);
RETURN_FALSE;
}
}
@@ -3925,15 +3933,19 @@ PHP_FUNCTION(openssl_pkcs7_verify)
STACK_OF(X509) *others = NULL;
PKCS7 * p7 = NULL;
BIO * in = NULL, * datain = NULL, * dataout = NULL;
- php_int_t flags = 0;
- char * filename; int filename_len;
- char * extracerts = NULL; int extracerts_len = 0;
- char * signersfilename = NULL; int signersfilename_len = 0;
- char * datafilename = NULL; int datafilename_len = 0;
+ zend_long flags = 0;
+ char * filename;
+ size_t filename_len;
+ char * extracerts = NULL;
+ size_t extracerts_len = 0;
+ char * signersfilename = NULL;
+ size_t signersfilename_len = 0;
+ char * datafilename = NULL;
+ size_t datafilename_len = 0;
- RETVAL_INT(-1);
+ RETVAL_LONG(-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|papp", &filename, &filename_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|papp", &filename, &filename_len,
&flags, &signersfilename, &signersfilename_len, &cainfo,
&extracerts, &extracerts_len, &datafilename, &datafilename_len) == FAILURE) {
return;
@@ -4007,7 +4019,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
sk_X509_free(signers);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename);
- RETVAL_INT(-1);
+ RETVAL_LONG(-1);
}
}
goto clean_exit;
@@ -4031,19 +4043,21 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
zval * zrecipcerts, * zheaders = NULL;
STACK_OF(X509) * recipcerts = NULL;
BIO * infile = NULL, * outfile = NULL;
- php_int_t flags = 0;
+ zend_long flags = 0;
PKCS7 * p7 = NULL;
zval * zcertval;
X509 * cert;
const EVP_CIPHER *cipher = NULL;
- php_int_t cipherid = PHP_OPENSSL_CIPHER_DEFAULT;
+ zend_long cipherid = PHP_OPENSSL_CIPHER_DEFAULT;
zend_string * strindex;
- char * infilename = NULL; int infilename_len;
- char * outfilename = NULL; int outfilename_len;
+ char * infilename = NULL;
+ size_t infilename_len;
+ char * outfilename = NULL;
+ size_t outfilename_len;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ii", &infilename, &infilename_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ll", &infilename, &infilename_len,
&outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE)
return;
@@ -4157,17 +4171,20 @@ PHP_FUNCTION(openssl_pkcs7_sign)
zval * hval;
X509 * cert = NULL;
EVP_PKEY * privkey = NULL;
- php_int_t flags = PKCS7_DETACHED;
+ zend_long flags = PKCS7_DETACHED;
PKCS7 * p7 = NULL;
BIO * infile = NULL, * outfile = NULL;
STACK_OF(X509) *others = NULL;
zend_resource *certresource = NULL, *keyresource = NULL;
zend_string * strindex;
- char * infilename; int infilename_len;
- char * outfilename; int outfilename_len;
- char * extracertsfilename = NULL; int extracertsfilename_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|ip",
+ char * infilename;
+ size_t infilename_len;
+ char * outfilename;
+ size_t outfilename_len;
+ char * extracertsfilename = NULL;
+ size_t extracertsfilename_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|lp",
&infilename, &infilename_len, &outfilename, &outfilename_len,
&zcert, &zprivkey, &zheaders, &flags, &extracertsfilename,
&extracertsfilename_len) == FAILURE) {
@@ -4263,8 +4280,10 @@ PHP_FUNCTION(openssl_pkcs7_decrypt)
zend_resource *certresval, *keyresval;
BIO * in = NULL, * out = NULL, * datain = NULL;
PKCS7 * p7 = NULL;
- char * infilename; int infilename_len;
- char * outfilename; int outfilename_len;
+ char * infilename;
+ size_t infilename_len;
+ char * outfilename;
+ size_t outfilename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppz|z", &infilename, &infilename_len,
&outfilename, &outfilename_len, &recipcert, &recipkey) == FAILURE) {
@@ -4333,10 +4352,10 @@ PHP_FUNCTION(openssl_private_encrypt)
int successful = 0;
zend_resource *keyresource = NULL;
char * data;
- int data_len;
- php_int_t padding = RSA_PKCS1_PADDING;
+ size_t data_len;
+ zend_long padding = RSA_PKCS1_PADDING;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
return;
}
RETVAL_FALSE;
@@ -4349,7 +4368,7 @@ PHP_FUNCTION(openssl_private_encrypt)
}
cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = STR_ALLOC(cryptedlen, 0);
+ cryptedbuf = zend_string_alloc(cryptedlen, 0);
switch (pkey->type) {
case EVP_PKEY_RSA:
@@ -4367,12 +4386,12 @@ PHP_FUNCTION(openssl_private_encrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
if (cryptedbuf) {
- STR_RELEASE(cryptedbuf);
+ zend_string_release(cryptedbuf);
}
if (keyresource == NULL) {
EVP_PKEY_free(pkey);
@@ -4390,12 +4409,12 @@ PHP_FUNCTION(openssl_private_decrypt)
zend_string *cryptedbuf = NULL;
unsigned char *crypttemp;
int successful = 0;
- php_int_t padding = RSA_PKCS1_PADDING;
+ zend_long padding = RSA_PKCS1_PADDING;
zend_resource *keyresource = NULL;
char * data;
- int data_len;
+ size_t data_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
return;
}
RETVAL_FALSE;
@@ -4418,7 +4437,7 @@ PHP_FUNCTION(openssl_private_decrypt)
pkey->pkey.rsa,
padding);
if (cryptedlen != -1) {
- cryptedbuf = STR_ALLOC(cryptedlen, 0);
+ cryptedbuf = zend_string_alloc(cryptedlen, 0);
memcpy(cryptedbuf->val, crypttemp, cryptedlen);
successful = 1;
}
@@ -4432,7 +4451,7 @@ PHP_FUNCTION(openssl_private_decrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4441,7 +4460,7 @@ PHP_FUNCTION(openssl_private_decrypt)
EVP_PKEY_free(pkey);
}
if (cryptedbuf) {
- STR_RELEASE(cryptedbuf);
+ zend_string_release(cryptedbuf);
}
}
/* }}} */
@@ -4456,11 +4475,11 @@ PHP_FUNCTION(openssl_public_encrypt)
zend_string *cryptedbuf;
int successful = 0;
zend_resource *keyresource = NULL;
- php_int_t padding = RSA_PKCS1_PADDING;
+ zend_long padding = RSA_PKCS1_PADDING;
char * data;
- int data_len;
+ size_t data_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
return;
RETVAL_FALSE;
@@ -4471,7 +4490,7 @@ PHP_FUNCTION(openssl_public_encrypt)
}
cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = STR_ALLOC(cryptedlen, 0);
+ cryptedbuf = zend_string_alloc(cryptedlen, 0);
switch (pkey->type) {
case EVP_PKEY_RSA:
@@ -4490,7 +4509,7 @@ PHP_FUNCTION(openssl_public_encrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
@@ -4498,7 +4517,7 @@ PHP_FUNCTION(openssl_public_encrypt)
EVP_PKEY_free(pkey);
}
if (cryptedbuf) {
- STR_RELEASE(cryptedbuf);
+ zend_string_release(cryptedbuf);
}
}
/* }}} */
@@ -4514,11 +4533,11 @@ PHP_FUNCTION(openssl_public_decrypt)
unsigned char *crypttemp;
int successful = 0;
zend_resource *keyresource = NULL;
- php_int_t padding = RSA_PKCS1_PADDING;
+ zend_long padding = RSA_PKCS1_PADDING;
char * data;
- int data_len;
+ size_t data_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
return;
}
RETVAL_FALSE;
@@ -4541,7 +4560,7 @@ PHP_FUNCTION(openssl_public_decrypt)
pkey->pkey.rsa,
padding);
if (cryptedlen != -1) {
- cryptedbuf = STR_ALLOC(cryptedlen, 0);
+ cryptedbuf = zend_string_alloc(cryptedlen, 0);
memcpy(cryptedbuf->val, crypttemp, cryptedlen);
successful = 1;
}
@@ -4557,13 +4576,13 @@ PHP_FUNCTION(openssl_public_decrypt)
if (successful) {
zval_dtor(crypted);
cryptedbuf->val[cryptedlen] = '\0';
- ZVAL_STR(crypted, cryptedbuf);
+ ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
}
if (cryptedbuf) {
- STR_RELEASE(cryptedbuf);
+ zend_string_release(cryptedbuf);
}
if (keyresource == NULL) {
EVP_PKEY_free(pkey);
@@ -4601,10 +4620,10 @@ PHP_FUNCTION(openssl_sign)
zend_string *sigbuf;
zend_resource *keyresource = NULL;
char * data;
- int data_len;
+ size_t data_len;
EVP_MD_CTX md_ctx;
zval *method = NULL;
- php_int_t signature_algo = OPENSSL_ALGO_SHA1;
+ zend_long signature_algo = OPENSSL_ALGO_SHA1;
const EVP_MD *mdtype;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|z", &data, &data_len, &signature, &key, &method) == FAILURE) {
@@ -4616,9 +4635,9 @@ PHP_FUNCTION(openssl_sign)
RETURN_FALSE;
}
- if (method == NULL || Z_TYPE_P(method) == IS_INT) {
+ if (method == NULL || Z_TYPE_P(method) == IS_LONG) {
if (method != NULL) {
- signature_algo = Z_IVAL_P(method);
+ signature_algo = Z_LVAL_P(method);
}
mdtype = php_openssl_get_evp_md_from_algo(signature_algo);
} else if (Z_TYPE_P(method) == IS_STRING) {
@@ -4633,7 +4652,7 @@ PHP_FUNCTION(openssl_sign)
}
siglen = EVP_PKEY_size(pkey);
- sigbuf = STR_ALLOC(siglen, 0);
+ sigbuf = zend_string_alloc(siglen, 0);
EVP_SignInit(&md_ctx, mdtype);
EVP_SignUpdate(&md_ctx, data, data_len);
@@ -4641,7 +4660,7 @@ PHP_FUNCTION(openssl_sign)
zval_dtor(signature);
sigbuf->val[siglen] = '\0';
sigbuf->len = siglen;
- ZVAL_STR(signature, sigbuf);
+ ZVAL_NEW_STR(signature, sigbuf);
RETVAL_TRUE;
} else {
efree(sigbuf);
@@ -4664,18 +4683,20 @@ PHP_FUNCTION(openssl_verify)
EVP_MD_CTX md_ctx;
const EVP_MD *mdtype;
zend_resource *keyresource = NULL;
- char * data; int data_len;
- char * signature; int signature_len;
+ char * data;
+ size_t data_len;
+ char * signature;
+ size_t signature_len;
zval *method = NULL;
- php_int_t signature_algo = OPENSSL_ALGO_SHA1;
+ zend_long signature_algo = OPENSSL_ALGO_SHA1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z", &data, &data_len, &signature, &signature_len, &key, &method) == FAILURE) {
return;
}
- if (method == NULL || Z_TYPE_P(method) == IS_INT) {
+ if (method == NULL || Z_TYPE_P(method) == IS_LONG) {
if (method != NULL) {
- signature_algo = Z_IVAL_P(method);
+ signature_algo = Z_LVAL_P(method);
}
mdtype = php_openssl_get_evp_md_from_algo(signature_algo);
} else if (Z_TYPE_P(method) == IS_STRING) {
@@ -4703,7 +4724,7 @@ PHP_FUNCTION(openssl_verify)
if (keyresource == NULL) {
EVP_PKEY_free(pkey);
}
- RETURN_INT(err);
+ RETURN_LONG(err);
}
/* }}} */
@@ -4717,9 +4738,10 @@ PHP_FUNCTION(openssl_seal)
zend_resource ** key_resources; /* so we know what to cleanup */
int i, len1, len2, *eksl, nkeys;
unsigned char *buf = NULL, **eks;
- char * data; int data_len;
+ char * data;
+ size_t data_len;
char *method =NULL;
- int method_len = 0;
+ size_t method_len = 0;
const EVP_CIPHER *cipher;
EVP_CIPHER_CTX ctx;
@@ -4790,7 +4812,7 @@ PHP_FUNCTION(openssl_seal)
if (len1 + len2 > 0) {
zval_dtor(sealdata);
buf[len1 + len2] = '\0';
- ZVAL_STR(sealdata, STR_INIT((char*)buf, len1 + len2, 0));
+ ZVAL_NEW_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0));
efree(buf);
zval_dtor(ekeys);
@@ -4815,7 +4837,7 @@ PHP_FUNCTION(openssl_seal)
} else {
efree(buf);
}
- RETVAL_INT(len1 + len2);
+ RETVAL_LONG(len1 + len2);
EVP_CIPHER_CTX_cleanup(&ctx);
clean_exit:
@@ -4844,10 +4866,12 @@ PHP_FUNCTION(openssl_open)
unsigned char *buf;
zend_resource *keyresource = NULL;
EVP_CIPHER_CTX ctx;
- char * data; int data_len;
- char * ekey; int ekey_len;
+ char * data;
+ size_t data_len;
+ char * ekey;
+ size_t ekey_len;
char *method =NULL;
- int method_len = 0;
+ size_t method_len = 0;
const EVP_CIPHER *cipher;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/sz|s", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len) == FAILURE) {
@@ -4879,7 +4903,7 @@ PHP_FUNCTION(openssl_open)
} else {
zval_dtor(opendata);
buf[len1 + len2] = '\0';
- ZVAL_STR(opendata, STR_INIT((char*)buf, len1 + len2, 0));
+ ZVAL_NEW_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0));
efree(buf);
RETVAL_TRUE;
}
@@ -4946,7 +4970,7 @@ PHP_FUNCTION(openssl_digest)
{
zend_bool raw_output = 0;
char *data, *method;
- int data_len, method_len;
+ size_t data_len, method_len;
const EVP_MD *mdtype;
EVP_MD_CTX md_ctx;
unsigned int siglen;
@@ -4962,7 +4986,7 @@ PHP_FUNCTION(openssl_digest)
}
siglen = EVP_MD_size(mdtype);
- sigbuf = STR_ALLOC(siglen, 0);
+ sigbuf = zend_string_alloc(siglen, 0);
EVP_DigestInit(&md_ctx, mdtype);
EVP_DigestUpdate(&md_ctx, (unsigned char *)data, data_len);
@@ -4973,15 +4997,15 @@ PHP_FUNCTION(openssl_digest)
RETVAL_STR(sigbuf);
} else {
int digest_str_len = siglen * 2;
- zend_string *digest_str = STR_ALLOC(digest_str_len, 0);
+ zend_string *digest_str = zend_string_alloc(digest_str_len, 0);
make_digest_ex(digest_str->val, (unsigned char*)sigbuf->val, siglen);
digest_str->val[digest_str_len] = '\0';
- STR_RELEASE(sigbuf);
+ zend_string_release(sigbuf);
RETVAL_STR(digest_str);
}
} else {
- STR_RELEASE(sigbuf);
+ zend_string_release(sigbuf);
RETVAL_FALSE;
}
}
@@ -5025,9 +5049,9 @@ static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_requir
Encrypts given data with given method and key, returns raw or base64 encoded string */
PHP_FUNCTION(openssl_encrypt)
{
- php_int_t options = 0;
+ zend_long options = 0;
char *data, *method, *password, *iv = "";
- int data_len, method_len, password_len, iv_len = 0, max_iv_len;
+ size_t data_len, method_len, password_len, iv_len = 0, max_iv_len;
const EVP_CIPHER *cipher_type;
EVP_CIPHER_CTX cipher_ctx;
int i=0, outlen, keylen;
@@ -5035,7 +5059,7 @@ PHP_FUNCTION(openssl_encrypt)
unsigned char *key;
zend_bool free_iv;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) {
return;
}
cipher_type = EVP_get_cipherbyname(method);
@@ -5057,10 +5081,10 @@ PHP_FUNCTION(openssl_encrypt)
if (iv_len <= 0 && max_iv_len > 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Using an empty Initialization Vector (iv) is potentially insecure and not recommended");
}
- free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len TSRMLS_CC);
+ free_iv = php_openssl_validate_iv(&iv, (int *)&iv_len, max_iv_len TSRMLS_CC);
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
- outbuf = STR_ALLOC(outlen, 0);
+ outbuf = zend_string_alloc(outlen, 0);
EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL);
if (password_len > keylen) {
@@ -5084,11 +5108,11 @@ PHP_FUNCTION(openssl_encrypt)
zend_string *base64_str;
base64_str = php_base64_encode((unsigned char*)outbuf->val, outlen);
- STR_RELEASE(outbuf);
+ zend_string_release(outbuf);
RETVAL_STR(base64_str);
}
} else {
- STR_RELEASE(outbuf);
+ zend_string_release(outbuf);
RETVAL_FALSE;
}
if (key != (unsigned char*)password) {
@@ -5105,9 +5129,9 @@ PHP_FUNCTION(openssl_encrypt)
Takes raw or base64 encoded string and dectupt it using given method and key */
PHP_FUNCTION(openssl_decrypt)
{
- php_int_t options = 0;
+ zend_long options = 0;
char *data, *method, *password, *iv = "";
- int data_len, method_len, password_len, iv_len = 0;
+ size_t data_len, method_len, password_len, iv_len = 0;
const EVP_CIPHER *cipher_type;
EVP_CIPHER_CTX cipher_ctx;
int i, outlen, keylen;
@@ -5116,7 +5140,7 @@ PHP_FUNCTION(openssl_decrypt)
zend_string *base64_str = NULL;
zend_bool free_iv;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) {
return;
}
@@ -5150,10 +5174,10 @@ PHP_FUNCTION(openssl_decrypt)
key = (unsigned char*)password;
}
- free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type) TSRMLS_CC);
+ free_iv = php_openssl_validate_iv(&iv, (int *)&iv_len, EVP_CIPHER_iv_length(cipher_type) TSRMLS_CC);
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
- outbuf = STR_ALLOC(outlen, 0);
+ outbuf = zend_string_alloc(outlen, 0);
EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL);
if (password_len > keylen) {
@@ -5171,7 +5195,7 @@ PHP_FUNCTION(openssl_decrypt)
outbuf->len = outlen;
RETVAL_STR(outbuf);
} else {
- STR_RELEASE(outbuf);
+ zend_string_release(outbuf);
RETVAL_FALSE;
}
if (key != (unsigned char*)password) {
@@ -5181,7 +5205,7 @@ PHP_FUNCTION(openssl_decrypt)
efree(iv);
}
if (base64_str) {
- STR_RELEASE(base64_str);
+ zend_string_release(base64_str);
}
EVP_CIPHER_CTX_cleanup(&cipher_ctx);
}
@@ -5191,7 +5215,7 @@ PHP_FUNCTION(openssl_decrypt)
PHP_FUNCTION(openssl_cipher_iv_length)
{
char *method;
- int method_len;
+ size_t method_len;
const EVP_CIPHER *cipher_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &method, &method_len) == FAILURE) {
@@ -5209,7 +5233,7 @@ PHP_FUNCTION(openssl_cipher_iv_length)
RETURN_FALSE;
}
- RETURN_INT(EVP_CIPHER_iv_length(cipher_type));
+ RETURN_LONG(EVP_CIPHER_iv_length(cipher_type));
}
/* }}} */
@@ -5220,7 +5244,7 @@ PHP_FUNCTION(openssl_dh_compute_key)
{
zval *key;
char *pub_str;
- int pub_len;
+ size_t pub_len;
EVP_PKEY *pkey;
BIGNUM *pub;
zend_string *data;
@@ -5236,7 +5260,7 @@ PHP_FUNCTION(openssl_dh_compute_key)
pub = BN_bin2bn((unsigned char*)pub_str, pub_len, NULL);
- data = STR_ALLOC(DH_size(pkey->pkey.dh), 0);
+ data = zend_string_alloc(DH_size(pkey->pkey.dh), 0);
len = DH_compute_key((unsigned char*)data->val, pub, pkey->pkey.dh);
if (len >= 0) {
@@ -5244,7 +5268,7 @@ PHP_FUNCTION(openssl_dh_compute_key)
data->val[len] = 0;
RETVAL_STR(data);
} else {
- STR_RELEASE(data);
+ zend_string_release(data);
RETVAL_FALSE;
}
@@ -5256,12 +5280,12 @@ PHP_FUNCTION(openssl_dh_compute_key)
Returns a string of the length specified filled with random pseudo bytes */
PHP_FUNCTION(openssl_random_pseudo_bytes)
{
- php_int_t buffer_length;
+ zend_long buffer_length;
zend_string *buffer = NULL;
zval *zstrong_result_returned = NULL;
int strong_result = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z/", &buffer_length, &zstrong_result_returned) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z/", &buffer_length, &zstrong_result_returned) == FAILURE) {
return;
}
@@ -5274,13 +5298,13 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
ZVAL_BOOL(zstrong_result_returned, 0);
}
- buffer = STR_ALLOC(buffer_length, 0);
+ buffer = zend_string_alloc(buffer_length, 0);
#ifdef PHP_WIN32
strong_result = 1;
/* random/urandom equivalent on Windows */
if (php_win32_get_random_bytes((unsigned char*)buffer->val, (size_t) buffer_length) == FAILURE){
- STR_RELEASE(buffer);
+ zend_string_release(buffer);
if (zstrong_result_returned) {
ZVAL_BOOL(zstrong_result_returned, 0);
}
@@ -5288,7 +5312,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
}
#else
if ((strong_result = RAND_pseudo_bytes((unsigned char*)buffer->val, buffer_length)) < 0) {
- STR_RELEASE(buffer);
+ zend_string_release(buffer);
if (zstrong_result_returned) {
ZVAL_BOOL(zstrong_result_returned, 0);
}
diff --git a/ext/openssl/openssl.dsp b/ext/openssl/openssl.dsp
deleted file mode 100644
index 857666a6a3..0000000000
--- a/ext/openssl/openssl.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="openssl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=openssl - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak" CFG="openssl - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "openssl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "openssl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "openssl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_OPENSSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib ssleay32.lib libeay32.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_openssl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "openssl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_OPENSSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib ssleay32.lib libeay32.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_openssl.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "openssl - Win32 Release_TS"
-# Name "openssl - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\openssl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xp_ssl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_openssl.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/openssl/openssl.mak b/ext/openssl/openssl.mak
index a0c6fa483e..9bc053b662 100644
--- a/ext/openssl/openssl.mak
+++ b/ext/openssl/openssl.mak
@@ -4,7 +4,7 @@ PROJECT_ROOT = ..\..
# Module details
MODULE_NAME = php_ossl
-MODULE_DESC = "PHP 5 - OpenSSL Extension"
+MODULE_DESC = "PHP 7 - OpenSSL Extension"
VMAJ = 1
VMIN = 0
VREV = 0
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 968919eb64..08a9656b71 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/openssl/tests/bug65729.pem b/ext/openssl/tests/bug65729.pem
index dbeed6efd3..918445712e 100644
--- a/ext/openssl/tests/bug65729.pem
+++ b/ext/openssl/tests/bug65729.pem
@@ -1,28 +1,32 @@
------BEGIN CERTIFICATE-----
-MIICCTCCAXICCQDNMI29sowT7TANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJT
-RzESMBAGA1UECBMJVGVzdHZpbGxlMREwDwYDVQQKEwhkYXRpYmJhdzETMBEGA1UE
-AxQKKi50ZXN0LmNvbTAeFw0xMzA5MjEwNzUyMjRaFw0xNDA5MjEwNzUyMjRaMEkx
-CzAJBgNVBAYTAlNHMRIwEAYDVQQIEwlUZXN0dmlsbGUxETAPBgNVBAoTCGRhdGli
-YmF3MRMwEQYDVQQDFAoqLnRlc3QuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
-iQKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK03oAd1jTe
-Vd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOXZPG3UViD
-rtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQABMA0GCSqG
-SIb3DQEBBQUAA4GBAAS07u/Ke+EhEHidz6CG3Qcr+zg483JKRgZFyGz+YUKyyKKy
-fmLs7JieGJxYQjOmIpj/6X9Gnb2HjIPDnI6A+MV1emXDTnnmsgf2/lZGcthhpZn2
-rMbj9bI0iH6HwOVGtp4ZJA5fB7nj3J+gWNTCQzDDOxwX36d2LL9ua+UMnk/g
------END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCdzVnic8K5W4SVbwVuqezcTjeqVLoQ91vVNZB0Jnsuz6q3DoK0
-3oAd1jTeVd0k+MQDbXpHoc37lA4+8z/g5Bs0UXxNx+nkbFTE7Ba2/G24caI9/cOX
-ZPG3UViDrtqXKL6h5/umqRG9Dt5liF2MVP9XFAesVC7B8+Ca+PbPlQoYzwIDAQAB
-AoGAeyzTwKPDl5QMRejHQL57GOwlH1vLcXrjv+VzwHZZKQ0IoKM++5fCQYf29KXp
-XPahaluGW2u9sWa8R/7wGcd0Q4RtquGzsgT3+AQsIc5KfIamyOyDaRVM/ymX3fWg
-gHIU7OOzB+ihOU8sHyRIwfbk01/kmrBXLRj8E31sy3i3PIECQQDQQYE+aN7Acrdt
-yN5CaqvbkiCGjRvASlemiTzPosgOtndyp21w1gakJwKYhYDk1N6A6Qb8REMZqM/U
-wFypldV/AkEAwfq6NFuhpGL6hDA7MvlyY1KiZ0cHetPUX+PgdNqy2DA+1Sv4i7gm
-Wd/uA651K7aPXuUaf9dKtPCmZwI4M6SEsQJBALW89HTqP7niYoDEEnITdPaghxHk
-gptERUln6lGo1L1CLus3gSI/JHyMLo+7scgAnEwTD62GRKhX0Ubwt+ymfTECQAY5
-fHYnppU20+EgBxZIqOIFCc8UmWnYmE0Ha/Fz/x8u1SVUBuK84wYpSGL32yyu7ATY
-hzQo/W229zABAzqtAdECQQCUdB7IBFpPnsfv/EUBFX7X/7zAc9JpACmu9It5ju8C
-KIsMuz/02D+TQoJNjdAngBM+4AJDIaGFgTMIfaDMh5L7
+MIICXgIBAAKBgQDU8RgB8O2uR3ApjlxEX5rpCI+gIaZ3h0RBAF9rNA/s0pPTtX/e
+NGJgDyuT/TF6mcv0I/0/s2WSmIE50NW6tgWZ7RoBdVw/MiByPt6vK1aDrggbycN/
+C6RrxrEsdZe3E9CDZCFM1br8/8tnV19Ju80g8zY2MgDjAjSkeXN5yp3kgQIDAQAB
+AoGBANFKKRt3TlRVmHLvndYB1YKmzGtJx5CBXV85247FO8W67lpNcGDYQbxCDMXG
+PARQ9vl9CeK7EuDzjUdi7z40uujUOJtsLbMP6ikwKFi/tA2cW1yoLionZ3JkfyEr
+4Uu8kkkIut0VLX8uuVz/Y03lt8Uzc+GvD2DPhkSQn80f10SFAkEA94EcjwFcwuVi
+QofgOPbf7qfOoWDsXYhlMU9g1CaPJiMcMcvgoLK3V514oMDxlkvuLujlYeG9NvRS
+tREluGsbywJBANxARX5MSzAkFRNZNZKDUvifdC0BA2Dqzd2iOJRcTdcebGENd7+e
+oub/9lVLGrX7T4U2en8IXwJV4UHxwoQLz2MCQQCI1Bj8ui0VFgj/bOy5sUnVP3IN
+Z27kuo3u98o5HuQOmmRw5xxU2thfGJBilqg4hdu0lU6SkWCwq9u5fDRVQumHAkAM
+mJBg3LQgGLAr3xo1OtVv6o6WVEyBKmyDlFdwBKde+hpwoniKuOPQGitYTWdFqQ2v
+LKJsyWnFlGvBfbYGHzbJAkEA17SgCf7Wx7NxuLCSMj/rd25ul0jlIrjx6+/HfyLb
++T2SXXU4g2DBiPngrfJ9jX8QGoLpZiBGcwX3QxssX5FgJQ==
-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICvDCCAiWgAwIBAgIJANOyJnvPEioVMA0GCSqGSIb3DQEBBQUAMEkxCzAJBgNV
+BAYTAlNHMRIwEAYDVQQIEwlUZXN0dmlsbGUxETAPBgNVBAoTCGRhdGliYmF3MRMw
+EQYDVQQDFAoqLnRlc3QuY29tMB4XDTE0MTAxNTEzMDg1OFoXDTM0MTAxMDEzMDg1
+OFowSTELMAkGA1UEBhMCU0cxEjAQBgNVBAgTCVRlc3R2aWxsZTERMA8GA1UEChMI
+ZGF0aWJiYXcxEzARBgNVBAMUCioudGVzdC5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD
+gY0AMIGJAoGBANTxGAHw7a5HcCmOXERfmukIj6AhpneHREEAX2s0D+zSk9O1f940
+YmAPK5P9MXqZy/Qj/T+zZZKYgTnQ1bq2BZntGgF1XD8yIHI+3q8rVoOuCBvJw38L
+pGvGsSx1l7cT0INkIUzVuvz/y2dXX0m7zSDzNjYyAOMCNKR5c3nKneSBAgMBAAGj
+gaswgagwHQYDVR0OBBYEFErHO0eHLp9YvBWVvvhty/jGie5wMHkGA1UdIwRyMHCA
+FErHO0eHLp9YvBWVvvhty/jGie5woU2kSzBJMQswCQYDVQQGEwJTRzESMBAGA1UE
+CBMJVGVzdHZpbGxlMREwDwYDVQQKEwhkYXRpYmJhdzETMBEGA1UEAxQKKi50ZXN0
+LmNvbYIJANOyJnvPEioVMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA
+gMv2HUUp0FMTYQ6tL9YgNUNARukxJzGDWweo4/YuNSgI+Ljpye4Nf1MpyDWfhZGc
+QbUhfm5CdEvcBzZBtI0lLXs61yGdLnDH/6QHViXP2rlH0yeAABw8+wSdxuiZN1yR
+ed4pNXU+tczgW2Ri2+T0ScOZd0XommKHrQnu2T9mMBY=
+-----END CERTIFICATE-----
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 06810cdbd8..df2b6dd58e 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,7 @@
#include "ext/standard/file.h"
#include "ext/standard/url.h"
#include "streams/php_streams_int.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_openssl.h"
#include "php_network.h"
#include <openssl/ssl.h>
@@ -69,7 +69,7 @@
/* Simplify ssl context option retrieval */
#define GET_VER_OPT(name) (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", name)) != NULL)
#define GET_VER_OPT_STRING(name, str) if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_P(val); }
-#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_int_ex(val); num = Z_IVAL_P(val); }
+#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_long_ex(val); num = Z_LVAL_P(val); }
/* Used for peer verification in windows */
#define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i)))
@@ -89,9 +89,9 @@ typedef struct _php_openssl_sni_cert_t {
/* Provides leaky bucket handhsake renegotiation rate-limiting */
typedef struct _php_openssl_handshake_bucket_t {
- php_int_t prev_handshake;
- php_int_t limit;
- php_int_t window;
+ zend_long prev_handshake;
+ zend_long limit;
+ zend_long window;
float tokens;
unsigned should_close;
} php_openssl_handshake_bucket_t;
@@ -146,7 +146,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init
int err = SSL_get_error(sslsock->ssl_handle, nr_bytes);
char esbuf[512];
smart_str ebuf = {0};
- php_uint_t ecode;
+ zend_ulong ecode;
int retry = 1;
switch(err) {
@@ -230,7 +230,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */
SSL *ssl;
int err, depth, ret;
zval *val;
- php_uint_t allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH;
+ zend_ulong allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH;
TSRMLS_FETCH();
@@ -254,7 +254,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */
/* check the depth */
GET_VER_OPT_LONG("verify_depth", allowed_depth);
- if ((php_uint_t)depth > allowed_depth) {
+ if ((zend_ulong)depth > allowed_depth) {
ret = 0;
X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_CHAIN_TOO_LONG);
}
@@ -271,7 +271,7 @@ static int php_x509_fingerprint_cmp(X509 *peer, const char *method, const char *
fingerprint = php_openssl_x509_fingerprint(peer, method, 0 TSRMLS_CC);
if (fingerprint) {
result = strcmp(expected, fingerprint->val);
- STR_RELEASE(fingerprint);
+ zend_string_release(fingerprint);
}
return result;
@@ -282,7 +282,7 @@ static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val TSRMLS_DC)
if (Z_TYPE_P(val) == IS_STRING) {
const char *method = NULL;
- switch (Z_STRSIZE_P(val)) {
+ switch (Z_STRLEN_P(val)) {
case 32:
method = "md5";
break;
@@ -513,9 +513,9 @@ static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */
GET_VER_OPT_STRING("passphrase", passphrase);
if (passphrase) {
- if (Z_STRSIZE_P(val) < num - 1) {
- memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)+1);
- return Z_STRSIZE_P(val);
+ if (Z_STRLEN_P(val) < num - 1) {
+ memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)+1);
+ return Z_STRLEN_P(val);
}
}
return 0;
@@ -880,7 +880,7 @@ static int set_local_cert(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ */
}
/* }}} */
-static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is_client TSRMLS_DC) /* {{{ */
+static const SSL_METHOD *php_select_crypto_method(zend_long method_value, int is_client TSRMLS_DC) /* {{{ */
{
if (method_value == STREAM_CRYPTO_METHOD_SSLv2) {
#ifndef OPENSSL_NO_SSL2
@@ -891,7 +891,13 @@ static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is
return NULL;
#endif
} else if (method_value == STREAM_CRYPTO_METHOD_SSLv3) {
+#ifndef OPENSSL_NO_SSL3
return is_client ? SSLv3_client_method() : SSLv3_server_method();
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return NULL;
+#endif
} else if (method_value == STREAM_CRYPTO_METHOD_TLSv1_0) {
return is_client ? TLSv1_client_method() : TLSv1_server_method();
} else if (method_value == STREAM_CRYPTO_METHOD_TLSv1_1) {
@@ -918,9 +924,9 @@ static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is
}
/* }}} */
-static php_int_t php_get_crypto_method_ctx_flags(php_int_t method_flags TSRMLS_DC) /* {{{ */
+static zend_long php_get_crypto_method_ctx_flags(zend_long method_flags TSRMLS_DC) /* {{{ */
{
- php_int_t ssl_ctx_options = SSL_OP_ALL;
+ zend_long ssl_ctx_options = SSL_OP_ALL;
#ifndef OPENSSL_NO_SSL2
if (!(method_flags & STREAM_CRYPTO_METHOD_SSLv2)) {
@@ -956,7 +962,7 @@ static void limit_handshake_reneg(const SSL *ssl) /* {{{ */
php_stream *stream;
php_openssl_netstream_data_t *sslsock;
struct timeval now;
- php_int_t elapsed_time;
+ zend_long elapsed_time;
stream = php_openssl_get_stream_from_ssl_handle(ssl);
sslsock = (php_openssl_netstream_data_t*)stream->abstract;
@@ -1025,15 +1031,15 @@ static void info_callback(const SSL *ssl, int where, int ret) /* {{{ */
static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_data_t *sslsock) /* {{{ */
{
zval *val;
- php_int_t limit = OPENSSL_DEFAULT_RENEG_LIMIT;
- php_int_t window = OPENSSL_DEFAULT_RENEG_WINDOW;
+ zend_long limit = OPENSSL_DEFAULT_RENEG_LIMIT;
+ zend_long window = OPENSSL_DEFAULT_RENEG_WINDOW;
if (PHP_STREAM_CONTEXT(stream) &&
NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream),
"ssl", "reneg_limit"))
) {
- convert_to_int(val);
- limit = Z_IVAL_P(val);
+ convert_to_long(val);
+ limit = Z_LVAL_P(val);
}
/* No renegotiation rate-limiting */
@@ -1045,8 +1051,8 @@ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_da
NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream),
"ssl", "reneg_window"))
) {
- convert_to_int(val);
- window = Z_IVAL_P(val);
+ convert_to_long(val);
+ window = Z_LVAL_P(val);
}
sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t),
@@ -1070,7 +1076,7 @@ static int set_server_rsa_key(php_stream *stream, SSL_CTX *ctx TSRMLS_DC) /* {{{
RSA* rsa;
if ((val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size")) != NULL) {
- rsa_key_size = (int) Z_IVAL_P(val);
+ rsa_key_size = (int) Z_LVAL_P(val);
if ((rsa_key_size != 1) && (rsa_key_size & (rsa_key_size - 1))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "RSA key size requires a power of 2: %d", rsa_key_size);
rsa_key_size = 2048;
@@ -1171,7 +1177,8 @@ static int set_server_specific_opts(php_stream *stream, SSL_CTX *ctx TSRMLS_DC)
return FAILURE;
}
#else
- if (SUCCESS == php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "ecdh_curve", &val)) {
+ val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "ecdh_curve");
+ if (val != NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"ECDH curve support not compiled into the OpenSSL lib against which PHP is linked");
@@ -1255,7 +1262,7 @@ static int enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *s
zval *val;
zval *current;
zend_string *key;
- php_uint_t key_index;
+ zend_ulong key_index;
int i = 0;
char resolved_path_buff[MAXPATHLEN];
SSL_CTX *ctx;
@@ -1446,13 +1453,16 @@ int php_openssl_setup_crypto(php_stream *stream,
}
GET_VER_OPT_STRING("ciphers", cipherlist);
+#ifndef USE_OPENSSL_SYSTEM_CIPHERS
if (!cipherlist) {
cipherlist = OPENSSL_DEFAULT_STREAM_CIPHERS;
}
- if (SSL_CTX_set_cipher_list(sslsock->ctx, cipherlist) != 1) {
- return FAILURE;
+#endif
+ if (cipherlist) {
+ if (SSL_CTX_set_cipher_list(sslsock->ctx, cipherlist) != 1) {
+ return FAILURE;
+ }
}
-
if (FAILURE == set_local_cert(sslsock->ctx, stream TSRMLS_CC)) {
return FAILURE;
}
@@ -1534,7 +1544,7 @@ static zend_array *capture_session_meta(SSL *ssl_handle) /* {{{ */
array_init(&meta_arr);
add_assoc_string(&meta_arr, "protocol", proto_str);
add_assoc_string(&meta_arr, "cipher_name", (char *) SSL_CIPHER_get_name(cipher));
- add_assoc_int(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL));
+ add_assoc_long(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL));
add_assoc_string(&meta_arr, "cipher_version", SSL_CIPHER_get_version(cipher));
return Z_ARR(meta_arr);
@@ -1768,59 +1778,13 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
}
/* }}} */
-static void php_openssl_stream_wait_for_data(php_netstream_data_t *sock)
-{
- int retval;
- struct timeval *ptimeout;
-
- if (sock->socket == -1) {
- return;
- }
-
- sock->timeout_event = 0;
-
- if (sock->timeout.tv_sec == -1)
- ptimeout = NULL;
- else
- ptimeout = &sock->timeout;
-
- while(1) {
- retval = php_pollfd_for(sock->socket, PHP_POLLREADABLE, ptimeout);
-
- if (retval == 0)
- sock->timeout_event = 1;
-
- if (retval >= 0)
- break;
-
- if (php_socket_errno() != EINTR)
- break;
- }
-}
-
static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */
{
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
- php_netstream_data_t *sock;
int nr_bytes = 0;
if (sslsock->ssl_active) {
int retry = 1;
- sock = (php_netstream_data_t*)stream->abstract;
-
- /* The SSL_read() function will block indefinitely waiting for data on a blocking
- socket. If we don't poll for readability first this operation has the potential
- to hang forever. To avoid this scenario we poll with a timeout before performing
- the actual read. If it times out we're finished.
- */
- if (sock->is_blocked) {
- php_openssl_stream_wait_for_data(sock);
- if (sock->timeout_event) {
- stream->eof = 1;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL read operation timed out");
- return nr_bytes;
- }
- }
do {
nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
@@ -2167,13 +2131,13 @@ php_stream_ops php_openssl_socket_ops = {
php_openssl_sockop_set_option,
};
-static php_int_t get_crypto_method(php_stream_context *ctx, php_int_t crypto_method)
+static zend_long get_crypto_method(php_stream_context *ctx, zend_long crypto_method)
{
zval *val;
if (ctx && (val = php_stream_context_get_option(ctx, "ssl", "crypto_method")) != NULL) {
- convert_to_int_ex(val);
- crypto_method = (php_int_t)Z_IVAL_P(val);
+ convert_to_long_ex(val);
+ crypto_method = (zend_long)Z_LVAL_P(val);
crypto_method |= STREAM_CRYPTO_IS_CLIENT;
}
@@ -2262,8 +2226,13 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
#endif
} else if (strncmp(proto, "sslv3", protolen) == 0) {
+#ifdef OPENSSL_NO_SSL3
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return NULL;
+#else
sslsock->enable_on_connect = 1;
sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
+#endif
} else if (strncmp(proto, "tls", protolen) == 0) {
sslsock->enable_on_connect = 1;
sslsock->method = get_crypto_method(context, STREAM_CRYPTO_METHOD_TLS_CLIENT);
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index d0ca4deaa5..11ad1018ec 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -204,213 +204,213 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
/* Wait Constants */
#ifdef WNOHANG
- REGISTER_INT_CONSTANT("WNOHANG", (php_int_t) WNOHANG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WNOHANG", (zend_long) WNOHANG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef WUNTRACED
- REGISTER_INT_CONSTANT("WUNTRACED", (php_int_t) WUNTRACED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WUNTRACED", (zend_long) WUNTRACED, CONST_CS | CONST_PERSISTENT);
#endif
/* Signal Constants */
- REGISTER_INT_CONSTANT("SIG_IGN", (php_int_t) SIG_IGN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIG_DFL", (php_int_t) SIG_DFL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIG_ERR", (php_int_t) SIG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGHUP", (php_int_t) SIGHUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGINT", (php_int_t) SIGINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGQUIT", (php_int_t) SIGQUIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGILL", (php_int_t) SIGILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGTRAP", (php_int_t) SIGTRAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGABRT", (php_int_t) SIGABRT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_IGN", (zend_long) SIG_IGN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_DFL", (zend_long) SIG_DFL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_ERR", (zend_long) SIG_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGHUP", (zend_long) SIGHUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGINT", (zend_long) SIGINT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGQUIT", (zend_long) SIGQUIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGILL", (zend_long) SIGILL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGTRAP", (zend_long) SIGTRAP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGABRT", (zend_long) SIGABRT, CONST_CS | CONST_PERSISTENT);
#ifdef SIGIOT
- REGISTER_INT_CONSTANT("SIGIOT", (php_int_t) SIGIOT, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_INT_CONSTANT("SIGBUS", (php_int_t) SIGBUS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGFPE", (php_int_t) SIGFPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGKILL", (php_int_t) SIGKILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGUSR1", (php_int_t) SIGUSR1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGSEGV", (php_int_t) SIGSEGV, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGUSR2", (php_int_t) SIGUSR2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGPIPE", (php_int_t) SIGPIPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGALRM", (php_int_t) SIGALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGTERM", (php_int_t) SIGTERM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGIOT", (zend_long) SIGIOT, CONST_CS | CONST_PERSISTENT);
+#endif
+ REGISTER_LONG_CONSTANT("SIGBUS", (zend_long) SIGBUS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGFPE", (zend_long) SIGFPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGKILL", (zend_long) SIGKILL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGUSR1", (zend_long) SIGUSR1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGSEGV", (zend_long) SIGSEGV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGUSR2", (zend_long) SIGUSR2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGPIPE", (zend_long) SIGPIPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGALRM", (zend_long) SIGALRM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGTERM", (zend_long) SIGTERM, CONST_CS | CONST_PERSISTENT);
#ifdef SIGSTKFLT
- REGISTER_INT_CONSTANT("SIGSTKFLT",(php_int_t) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGSTKFLT",(zend_long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGCLD
- REGISTER_INT_CONSTANT("SIGCLD", (php_int_t) SIGCLD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGCLD", (zend_long) SIGCLD, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGCHLD
- REGISTER_INT_CONSTANT("SIGCHLD", (php_int_t) SIGCHLD, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_INT_CONSTANT("SIGCONT", (php_int_t) SIGCONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGSTOP", (php_int_t) SIGSTOP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGTSTP", (php_int_t) SIGTSTP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGTTIN", (php_int_t) SIGTTIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGTTOU", (php_int_t) SIGTTOU, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGURG", (php_int_t) SIGURG , CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGXCPU", (php_int_t) SIGXCPU, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGXFSZ", (php_int_t) SIGXFSZ, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGVTALRM",(php_int_t) SIGVTALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGPROF", (php_int_t) SIGPROF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGWINCH", (php_int_t) SIGWINCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGCHLD", (zend_long) SIGCHLD, CONST_CS | CONST_PERSISTENT);
+#endif
+ REGISTER_LONG_CONSTANT("SIGCONT", (zend_long) SIGCONT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGSTOP", (zend_long) SIGSTOP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGTSTP", (zend_long) SIGTSTP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGTTIN", (zend_long) SIGTTIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGTTOU", (zend_long) SIGTTOU, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGURG", (zend_long) SIGURG , CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGXCPU", (zend_long) SIGXCPU, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGXFSZ", (zend_long) SIGXFSZ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGVTALRM",(zend_long) SIGVTALRM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGPROF", (zend_long) SIGPROF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGWINCH", (zend_long) SIGWINCH, CONST_CS | CONST_PERSISTENT);
#ifdef SIGPOLL
- REGISTER_INT_CONSTANT("SIGPOLL", (php_int_t) SIGPOLL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGPOLL", (zend_long) SIGPOLL, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SIGIO", (php_int_t) SIGIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGIO", (zend_long) SIGIO, CONST_CS | CONST_PERSISTENT);
#ifdef SIGPWR
- REGISTER_INT_CONSTANT("SIGPWR", (php_int_t) SIGPWR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGPWR", (zend_long) SIGPWR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGSYS
- REGISTER_INT_CONSTANT("SIGSYS", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIGBABY", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGSYS", (zend_long) SIGSYS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIGBABY", (zend_long) SIGSYS, CONST_CS | CONST_PERSISTENT);
#endif
#if HAVE_GETPRIORITY || HAVE_SETPRIORITY
- REGISTER_INT_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT);
#endif
/* {{{ "how" argument for sigprocmask */
#ifdef HAVE_SIGPROCMASK
- REGISTER_INT_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT);
#endif
/* }}} */
/* {{{ si_code */
#if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
- REGISTER_INT_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT);
#ifdef SI_NOINFO
- REGISTER_INT_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SI_KERNEL
- REGISTER_INT_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT);
#ifdef SI_SIGIO
- REGISTER_INT_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SI_TKILL
- REGISTER_INT_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT);
#endif
/* si_code for SIGCHILD */
#ifdef CLD_EXITED
- REGISTER_INT_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_KILLED
- REGISTER_INT_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_DUMPED
- REGISTER_INT_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_TRAPPED
- REGISTER_INT_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_STOPPED
- REGISTER_INT_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_CONTINUED
- REGISTER_INT_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT);
#endif
/* si_code for SIGTRAP */
#ifdef TRAP_BRKPT
- REGISTER_INT_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef TRAP_TRACE
- REGISTER_INT_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT);
#endif
/* si_code for SIGPOLL */
#ifdef POLL_IN
- REGISTER_INT_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_OUT
- REGISTER_INT_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_MSG
- REGISTER_INT_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_ERR
- REGISTER_INT_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_PRI
- REGISTER_INT_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_HUP
- REGISTER_INT_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLOPC
- REGISTER_INT_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLOPN
- REGISTER_INT_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLADR
- REGISTER_INT_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLTRP
- REGISTER_INT_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_PRVOPC
- REGISTER_INT_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_PRVREG
- REGISTER_INT_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_COPROC
- REGISTER_INT_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_BADSTK
- REGISTER_INT_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_INTDIV
- REGISTER_INT_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_INTOVF
- REGISTER_INT_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTDIV
- REGISTER_INT_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTOVF
- REGISTER_INT_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTUND
- REGISTER_INT_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTRES
- REGISTER_INT_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTINV
- REGISTER_INT_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTSUB
- REGISTER_INT_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SEGV_MAPERR
- REGISTER_INT_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SEGV_ACCERR
- REGISTER_INT_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef BUS_ADRALN
- REGISTER_INT_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef BUS_ADRERR
- REGISTER_INT_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef BUS_OBJERR
- REGISTER_INT_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT);
#endif
#endif /* HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT */
/* }}} */
@@ -548,7 +548,7 @@ PHP_FUNCTION(pcntl_fork)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
}
- RETURN_INT((long) id);
+ RETURN_LONG((zend_long) id);
}
/* }}} */
@@ -556,12 +556,12 @@ PHP_FUNCTION(pcntl_fork)
Set an alarm clock for delivery of a signal*/
PHP_FUNCTION(pcntl_alarm)
{
- php_int_t seconds;
+ zend_long seconds;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &seconds) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
return;
- RETURN_INT ((php_int_t) alarm(seconds));
+ RETURN_LONG ((zend_long) alarm(seconds));
}
/* }}} */
@@ -569,17 +569,17 @@ PHP_FUNCTION(pcntl_alarm)
Waits on or returns the status of a forked child as defined by the waitpid() system call */
PHP_FUNCTION(pcntl_waitpid)
{
- php_int_t pid, options = 0;
+ zend_long pid, options = 0;
zval *z_status = NULL;
int status;
pid_t child_id;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", &pid, &z_status, &options) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &pid, &z_status, &options) == FAILURE)
return;
- convert_to_int_ex(z_status);
+ convert_to_long_ex(z_status);
- status = Z_IVAL_P(z_status);
+ status = Z_LVAL_P(z_status);
child_id = waitpid((pid_t) pid, &status, options);
@@ -587,9 +587,9 @@ PHP_FUNCTION(pcntl_waitpid)
PCNTL_G(last_error) = errno;
}
- Z_IVAL_P(z_status) = status;
+ Z_LVAL_P(z_status) = status;
- RETURN_INT((php_int_t) child_id);
+ RETURN_LONG((zend_long) child_id);
}
/* }}} */
@@ -597,17 +597,17 @@ PHP_FUNCTION(pcntl_waitpid)
Waits on or returns the status of a forked child as defined by the waitpid() system call */
PHP_FUNCTION(pcntl_wait)
{
- php_int_t options = 0;
+ zend_long options = 0;
zval *z_status = NULL;
int status;
pid_t child_id;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|i", &z_status, &options) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|l", &z_status, &options) == FAILURE)
return;
- convert_to_int_ex(z_status);
+ convert_to_long_ex(z_status);
- status = Z_IVAL_P(z_status);
+ status = Z_LVAL_P(z_status);
#ifdef HAVE_WAIT3
if(options) {
child_id = wait3(&status, options, NULL);
@@ -622,9 +622,9 @@ PHP_FUNCTION(pcntl_wait)
PCNTL_G(last_error) = errno;
}
- Z_IVAL_P(z_status) = status;
+ Z_LVAL_P(z_status) = status;
- RETURN_INT((php_int_t) child_id);
+ RETURN_LONG((zend_long) child_id);
}
/* }}} */
@@ -633,9 +633,9 @@ PHP_FUNCTION(pcntl_wait)
PHP_FUNCTION(pcntl_wifexited)
{
#ifdef WIFEXITED
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
@@ -651,9 +651,9 @@ PHP_FUNCTION(pcntl_wifexited)
PHP_FUNCTION(pcntl_wifstopped)
{
#ifdef WIFSTOPPED
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
@@ -669,9 +669,9 @@ PHP_FUNCTION(pcntl_wifstopped)
PHP_FUNCTION(pcntl_wifsignaled)
{
#ifdef WIFSIGNALED
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
@@ -687,13 +687,13 @@ PHP_FUNCTION(pcntl_wifsignaled)
PHP_FUNCTION(pcntl_wexitstatus)
{
#ifdef WEXITSTATUS
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
- RETURN_INT(WEXITSTATUS(status_word));
+ RETURN_LONG(WEXITSTATUS(status_word));
#else
RETURN_FALSE;
#endif
@@ -705,13 +705,13 @@ PHP_FUNCTION(pcntl_wexitstatus)
PHP_FUNCTION(pcntl_wtermsig)
{
#ifdef WTERMSIG
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
- RETURN_INT(WTERMSIG(status_word));
+ RETURN_LONG(WTERMSIG(status_word));
#else
RETURN_FALSE;
#endif
@@ -723,13 +723,13 @@ PHP_FUNCTION(pcntl_wtermsig)
PHP_FUNCTION(pcntl_wstopsig)
{
#ifdef WSTOPSIG
- php_int_t status_word;
+ zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
return;
}
- RETURN_INT(WSTOPSIG(status_word));
+ RETURN_LONG(WSTOPSIG(status_word));
#else
RETURN_FALSE;
#endif
@@ -750,8 +750,8 @@ PHP_FUNCTION(pcntl_exec)
int pair_length;
zend_string *key;
char *path;
- int path_len;
- php_uint_t key_num;
+ size_t path_len;
+ zend_ulong key_num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
return;
@@ -788,22 +788,22 @@ PHP_FUNCTION(pcntl_exec)
ZEND_HASH_FOREACH_KEY_VAL(envs_hash, key_num, key, element) {
if (envi >= envc) break;
if (!key) {
- key = zend_int_to_str(key_num);
+ key = zend_long_to_str(key_num);
} else {
- STR_ADDREF(key);
+ zend_string_addref(key);
}
convert_to_string_ex(element);
/* Length of element + equal sign + length of key + null */
- pair_length = Z_STRSIZE_P(element) + key->len + 2;
+ pair_length = Z_STRLEN_P(element) + key->len + 2;
*pair = emalloc(pair_length);
strlcpy(*pair, key->val, key->len + 1);
strlcat(*pair, "=", pair_length);
strlcat(*pair, Z_STRVAL_P(element), pair_length);
/* Cleanup */
- STR_RELEASE(key);
+ zend_string_release(key);
envi++;
pair++;
} ZEND_HASH_FOREACH_END();
@@ -837,10 +837,10 @@ PHP_FUNCTION(pcntl_signal)
{
zval *handle;
zend_string *func_name;
- php_int_t signo;
+ zend_long signo;
zend_bool restart_syscalls = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
return;
}
@@ -863,12 +863,12 @@ PHP_FUNCTION(pcntl_signal)
}
/* Special long value case for SIG_DFL and SIG_IGN */
- if (Z_TYPE_P(handle) == IS_INT) {
- if (Z_IVAL_P(handle) != (php_int_t) SIG_DFL && Z_IVAL_P(handle) != (php_int_t) SIG_IGN) {
+ if (Z_TYPE_P(handle) == IS_LONG) {
+ if (Z_LVAL_P(handle) != (zend_long) SIG_DFL && Z_LVAL_P(handle) != (zend_long) SIG_IGN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified");
RETURN_FALSE;
}
- if (php_signal(signo, (Sigfunc *) Z_IVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
+ if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
RETURN_FALSE;
@@ -879,10 +879,10 @@ PHP_FUNCTION(pcntl_signal)
if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) {
PCNTL_G(last_error) = EINVAL;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name->val);
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
/* Add the function name to our signal table */
if (zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle)) {
@@ -912,11 +912,11 @@ PHP_FUNCTION(pcntl_signal_dispatch)
Examine and change blocked signals */
PHP_FUNCTION(pcntl_sigprocmask)
{
- php_int_t how, signo;
+ zend_long how, signo;
zval *user_set, *user_oldset = NULL, *user_signo;
sigset_t set, oldset;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ia|z/", &how, &user_set, &user_oldset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|z/", &how, &user_set, &user_oldset) == FAILURE) {
return;
}
@@ -927,11 +927,11 @@ PHP_FUNCTION(pcntl_sigprocmask)
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) {
- if (Z_TYPE_P(user_signo) != IS_INT) {
+ if (Z_TYPE_P(user_signo) != IS_LONG) {
SEPARATE_ZVAL(user_signo);
- convert_to_int_ex(user_signo);
+ convert_to_long_ex(user_signo);
}
- signo = Z_IVAL_P(user_signo);
+ signo = Z_LVAL_P(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
@@ -956,7 +956,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
if (sigismember(&oldset, signo) != 1) {
continue;
}
- add_next_index_int(user_oldset, signo);
+ add_next_index_long(user_oldset, signo);
}
}
@@ -969,14 +969,14 @@ PHP_FUNCTION(pcntl_sigprocmask)
static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{{ */
{
zval *user_set, *user_signo, *user_siginfo = NULL;
- php_int_t tv_sec = 0, tv_nsec = 0;
+ zend_long tv_sec = 0, tv_nsec = 0;
sigset_t set;
int signo;
siginfo_t siginfo;
struct timespec timeout;
if (timedwait) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ii", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) {
return;
}
} else {
@@ -992,11 +992,11 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) {
- if (Z_TYPE_P(user_signo) != IS_INT) {
+ if (Z_TYPE_P(user_signo) != IS_LONG) {
SEPARATE_ZVAL(user_signo);
- convert_to_int_ex(user_signo);
+ convert_to_long_ex(user_signo);
}
- signo = Z_IVAL_P(user_signo);
+ signo = Z_LVAL_P(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
@@ -1031,41 +1031,41 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
} else {
zend_hash_clean(Z_ARRVAL_P(user_siginfo));
}
- add_assoc_int_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo);
- add_assoc_int_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno);
- add_assoc_int_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code);
+ add_assoc_long_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo);
+ add_assoc_long_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno);
+ add_assoc_long_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code);
switch(signo) {
#ifdef SIGCHLD
case SIGCHLD:
- add_assoc_int_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status);
+ add_assoc_long_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status);
# ifdef si_utime
add_assoc_double_ex(user_siginfo, "utime", sizeof("utime")-1, siginfo.si_utime);
# endif
# ifdef si_stime
add_assoc_double_ex(user_siginfo, "stime", sizeof("stime")-1, siginfo.si_stime);
# endif
- add_assoc_int_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid);
- add_assoc_int_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid);
+ add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid);
+ add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid);
break;
#endif
case SIGILL:
case SIGFPE:
case SIGSEGV:
case SIGBUS:
- add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (php_int_t)siginfo.si_addr);
+ add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (zend_long)siginfo.si_addr);
break;
#ifdef SIGPOLL
case SIGPOLL:
- add_assoc_int_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band);
+ add_assoc_long_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band);
# ifdef si_fd
- add_assoc_int_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd);
+ add_assoc_long_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd);
# endif
break;
#endif
}
}
- RETURN_INT(signo);
+ RETURN_LONG(signo);
}
/* }}} */
@@ -1091,11 +1091,11 @@ PHP_FUNCTION(pcntl_sigtimedwait)
Get the priority of any process */
PHP_FUNCTION(pcntl_getpriority)
{
- php_int_t who = PRIO_PROCESS;
- php_int_t pid = getpid();
+ zend_long who = PRIO_PROCESS;
+ zend_long pid = getpid();
int pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &pid, &who) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) {
RETURN_FALSE;
}
@@ -1120,7 +1120,7 @@ PHP_FUNCTION(pcntl_getpriority)
RETURN_FALSE;
}
- RETURN_INT(pri);
+ RETURN_LONG(pri);
}
/* }}} */
#endif
@@ -1130,11 +1130,11 @@ PHP_FUNCTION(pcntl_getpriority)
Change the priority of any process */
PHP_FUNCTION(pcntl_setpriority)
{
- php_int_t who = PRIO_PROCESS;
- php_int_t pid = getpid();
- php_int_t pri;
+ zend_long who = PRIO_PROCESS;
+ zend_long pid = getpid();
+ zend_long pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &pri, &pid, &who) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &pri, &pid, &who) == FAILURE) {
RETURN_FALSE;
}
@@ -1169,7 +1169,7 @@ PHP_FUNCTION(pcntl_setpriority)
Retrieve the error number set by the last pcntl function which failed. */
PHP_FUNCTION(pcntl_get_last_error)
{
- RETURN_INT(PCNTL_G(last_error));
+ RETURN_LONG(PCNTL_G(last_error));
}
/* }}} */
@@ -1177,9 +1177,9 @@ PHP_FUNCTION(pcntl_get_last_error)
Retrieve the system error message associated with the given errno. */
PHP_FUNCTION(pcntl_strerror)
{
- php_int_t error;
+ zend_long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) {
RETURN_FALSE;
}
@@ -1242,7 +1242,7 @@ void pcntl_signal_dispatch()
while (queue) {
if ((handle = zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo)) != NULL) {
ZVAL_NULL(&retval);
- ZVAL_INT(&param, queue->signo);
+ ZVAL_LONG(&param, queue->signo);
/* Call php signal handler - Note that we do not report errors, and we ignore the return value */
/* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index ed1811f5d6..d02d6867f4 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -61,7 +61,7 @@ PHP_FUNCTION(pcntl_setpriority);
struct php_pcntl_pending_signal {
struct php_pcntl_pending_signal *next;
- php_int_t signo;
+ zend_long signo;
};
ZEND_BEGIN_MODULE_GLOBALS(pcntl)
@@ -77,7 +77,7 @@ ZEND_END_MODULE_GLOBALS(pcntl)
#define PCNTL_G(v) (pcntl_globals.v)
#endif
-#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_INT_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT)
+#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT)
#endif /* PHP_PCNTL_H */
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 9f308d793c..aa2139342c 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
index 5c61b10396..fc69fac756 100644
--- a/ext/pcntl/php_signal.h
+++ b/ext/pcntl/php_signal.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index d7c7c56a93..67857da2c7 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,7 @@
#include "php_globals.h"
#include "php_pcre.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
@@ -143,20 +143,20 @@ static PHP_MINIT_FUNCTION(pcre)
{
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT);
return SUCCESS;
@@ -527,7 +527,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset,
/* Add (match, offset) to the return value */
add_next_index_stringl(&match_pair, str, len);
- add_next_index_int(&match_pair, offset);
+ add_next_index_long(&match_pair, offset);
if (name) {
zval_add_ref(&match_pair);
@@ -544,11 +544,11 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
zend_string *subject; /* String to match against */
pcre_cache_entry *pce; /* Compiled regular expression */
zval *subpats = NULL; /* Array for subpatterns */
- php_int_t flags = 0; /* Match control flags */
- php_int_t start_offset = 0; /* Where the new search starts */
+ zend_long flags = 0; /* Match control flags */
+ zend_long start_offset = 0; /* Where the new search starts */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ii", &regex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ll", &regex,
&subject, &subpats, &flags, &start_offset) == FAILURE) {
RETURN_FALSE;
}
@@ -558,8 +558,8 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
Z_PARAM_STR(subject)
Z_PARAM_OPTIONAL
Z_PARAM_ZVAL_EX(subpats, 0, 1)
- Z_PARAM_INT(flags)
- Z_PARAM_INT(start_offset)
+ Z_PARAM_LONG(flags)
+ Z_PARAM_LONG(start_offset)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
#endif
@@ -782,7 +782,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
}
/* Add MARK, if available */
if (mark) {
- add_assoc_string(&result_set, "MARK", (char *) mark);
+ add_assoc_string_ex(&result_set, "MARK", sizeof("MARK") - 1, (char *)mark);
}
/* And add it to the output array */
zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &result_set);
@@ -822,7 +822,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
}
/* Add MARK, if available */
if (mark) {
- add_assoc_string(subpats, "MARK", (char *) mark);
+ add_assoc_string_ex(subpats, "MARK", sizeof("MARK") - 1, (char *)mark);
}
}
@@ -887,7 +887,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
/* Did we encounter an error? */
if (PCRE_G(error_code) == PHP_PCRE_NO_ERROR) {
- RETVAL_INT(matched);
+ RETVAL_LONG(matched);
} else {
RETVAL_FALSE;
}
@@ -983,7 +983,7 @@ static zend_string *preg_do_repl_func(zval *function, char *subject, int *offset
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function");
}
- result_str = STR_INIT(&subject[offsets[0]], offsets[1] - offsets[0], 0);
+ result_str = zend_string_init(&subject[offsets[0]], offsets[1] - offsets[0], 0);
}
zval_ptr_dtor(&args[0]);
@@ -1034,7 +1034,7 @@ static zend_string *preg_do_eval(char *eval_str, int eval_str_len, char *subject
if (match_len) {
esc_match = php_addslashes(match, match_len, 0 TSRMLS_CC);
} else {
- esc_match = STR_INIT(match, match_len, 0);
+ esc_match = zend_string_init(match, match_len, 0);
}
} else {
esc_match = STR_EMPTY_ALLOC();
@@ -1044,7 +1044,7 @@ static zend_string *preg_do_eval(char *eval_str, int eval_str_len, char *subject
segment = walk;
/* Clean up and reassign */
- STR_RELEASE(esc_match);
+ zend_string_release(esc_match);
continue;
}
}
@@ -1141,7 +1141,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
}
} else {
replace = Z_STRVAL_P(replace_val);
- replace_len = Z_STRSIZE_P(replace_val);
+ replace_len = Z_STRLEN_P(replace_val);
replace_end = replace + replace_len;
}
@@ -1171,7 +1171,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
}
alloc_len = 2 * subject_len;
- result = STR_ALLOC(alloc_len * sizeof(char), 0);
+ result = zend_string_alloc(alloc_len * sizeof(char), 0);
/* Initialize */
match = NULL;
@@ -1241,7 +1241,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
if (new_len > alloc_len) {
alloc_len = alloc_len + 2 * new_len;
- result = STR_REALLOC(result, alloc_len, 0);
+ result = zend_string_realloc(result, alloc_len, 0);
}
/* copy the part of the string before the match */
memcpy(&result->val[result_len], piece, match-piece);
@@ -1255,7 +1255,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
if (eval || is_callable_replace) {
memcpy(walkbuf, eval_result->val, eval_result->len);
result_len += eval_result->len;
- if (eval_result) STR_RELEASE(eval_result);
+ if (eval_result) zend_string_release(eval_result);
} else { /* do regular backreference copying */
walk = replace;
walk_last = 0;
@@ -1300,7 +1300,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
new_len = result_len + subject_len - start_offset;
if (new_len > alloc_len) {
alloc_len = new_len; /* now we know exactly how long it is */
- result = STR_REALLOC(result, alloc_len, 0);
+ result = zend_string_realloc(result, alloc_len, 0);
}
/* stick that last bit of string on our output */
memcpy(&result->val[result_len], piece, subject_len - start_offset);
@@ -1310,7 +1310,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
}
} else {
pcre_handle_exec_error(count TSRMLS_CC);
- STR_FREE(result);
+ zend_string_free(result);
result = NULL;
break;
}
@@ -1351,7 +1351,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
empty_replace;
zend_string *result;
zend_string *subject_str = zval_get_string(subject);
- zend_uint replace_idx;
+ uint32_t replace_idx;
/* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */
ZVAL_EMPTY_STRING(&empty_replace);
@@ -1398,15 +1398,15 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
is_callable_replace,
limit,
replace_count TSRMLS_CC)) != NULL) {
- STR_RELEASE(subject_str);
+ zend_string_release(subject_str);
subject_str = result;
} else {
- STR_RELEASE(subject_str);
- STR_RELEASE(regex_str);
+ zend_string_release(subject_str);
+ zend_string_release(regex_str);
return NULL;
}
- STR_RELEASE(regex_str);
+ zend_string_release(regex_str);
} ZEND_HASH_FOREACH_END();
return subject_str;
@@ -1418,7 +1418,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
is_callable_replace,
limit,
replace_count TSRMLS_CC);
- STR_RELEASE(subject_str);
+ zend_string_release(subject_str);
return result;
}
}
@@ -1434,16 +1434,16 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
*subject_entry,
*zcount = NULL;
int limit_val = -1;
- php_int_t limit = -1;
+ zend_long limit = -1;
zend_string *result;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_string *callback_name;
int replace_count=0, old_replace_count;
#ifndef FAST_ZPP
/* Get function parameters and do error-checking. */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|iz/", &regex, &replace, &subject, &limit, &zcount) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", &regex, &replace, &subject, &limit, &zcount) == FAILURE) {
return;
}
#else
@@ -1452,7 +1452,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
Z_PARAM_ZVAL(replace)
Z_PARAM_ZVAL(subject)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(limit)
+ Z_PARAM_LONG(limit)
Z_PARAM_ZVAL_EX(zcount, 0, 1)
ZEND_PARSE_PARAMETERS_END();
#endif
@@ -1469,11 +1469,11 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
if (is_callable_replace) {
if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%s', to be a valid callback", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
ZVAL_DUP(return_value, subject);
return;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
}
if (ZEND_NUM_ARGS() > 3) {
@@ -1502,7 +1502,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
add_index_str(return_value, num_key, result);
}
} else {
- STR_RELEASE(result);
+ zend_string_release(result);
}
}
} ZEND_HASH_FOREACH_END();
@@ -1512,13 +1512,13 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
if (!is_filter || replace_count > old_replace_count) {
RETVAL_STR(result);
} else {
- STR_RELEASE(result);
+ zend_string_release(result);
}
}
}
if (ZEND_NUM_ARGS() > 4) {
zval_dtor(zcount);
- ZVAL_INT(zcount, replace_count);
+ ZVAL_LONG(zcount, replace_count);
}
}
@@ -1554,13 +1554,13 @@ static PHP_FUNCTION(preg_split)
{
zend_string *regex; /* Regular expression */
zend_string *subject; /* String to match against */
- php_int_t limit_val = -1;/* Integer value of limit */
- php_int_t flags = 0; /* Match control flags */
+ zend_long limit_val = -1;/* Integer value of limit */
+ zend_long flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get function parameters and do error checking */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", &regex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", &regex,
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
RETURN_FALSE;
}
@@ -1569,8 +1569,8 @@ static PHP_FUNCTION(preg_split)
Z_PARAM_STR(regex)
Z_PARAM_STR(subject)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(limit_val)
- Z_PARAM_INT(flags)
+ Z_PARAM_LONG(limit_val)
+ Z_PARAM_LONG(flags)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
#endif
@@ -1701,9 +1701,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
if (pce->compile_options & PCRE_UTF8) {
if (re_bump == NULL) {
int dummy;
- zend_string *regex = STR_INIT("/./us", sizeof("/./us")-1, 0);
+ zend_string *regex = zend_string_init("/./us", sizeof("/./us")-1, 0);
re_bump = pcre_get_compiled_regex(regex, &extra_bump, &dummy TSRMLS_CC);
- STR_RELEASE(regex);
+ zend_string_release(regex);
if (re_bump == NULL) {
RETURN_FALSE;
}
@@ -1764,10 +1764,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
Quote regular expression characters plus an optional character */
static PHP_FUNCTION(preg_quote)
{
- int in_str_len;
+ size_t in_str_len;
char *in_str; /* Input string argument */
char *in_str_end; /* End of the input string */
- int delim_len = 0;
+ size_t delim_len = 0;
char *delim = NULL; /* Additional delimiter argument */
zend_string *out_str; /* Output string with quoted characters */
char *p, /* Iterator for input string */
@@ -1804,7 +1804,7 @@ static PHP_FUNCTION(preg_quote)
/* Allocate enough memory so that even if each character
is quoted, we won't run out of room */
- out_str = STR_SAFE_ALLOC(4, in_str_len, 0, 0);
+ out_str = zend_string_safe_alloc(4, in_str_len, 0, 0);
/* Go through the string and quote necessary characters */
for (p = in_str, q = out_str->val; p != in_str_end; p++) {
@@ -1851,7 +1851,7 @@ static PHP_FUNCTION(preg_quote)
*q = '\0';
/* Reallocate string and return it */
- out_str = STR_REALLOC(out_str, q - out_str->val, 0);
+ out_str = zend_string_realloc(out_str, q - out_str->val, 0);
RETURN_STR(out_str);
}
/* }}} */
@@ -1862,12 +1862,12 @@ static PHP_FUNCTION(preg_grep)
{
zend_string *regex; /* Regular expression */
zval *input; /* Input array */
- php_int_t flags = 0; /* Match control flags */
+ zend_long flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get arguments and do error checking */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|i", &regex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", &regex,
&input, &flags) == FAILURE) {
return;
}
@@ -1876,7 +1876,7 @@ static PHP_FUNCTION(preg_grep)
Z_PARAM_STR(regex)
Z_PARAM_ARRAY(input)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(flags)
+ Z_PARAM_LONG(flags)
ZEND_PARSE_PARAMETERS_END();
#endif
@@ -1898,7 +1898,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
int size_offsets; /* Size of the offsets array */
int count = 0; /* Count of matched subpatterns */
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_bool invert; /* Whether to return non-matching
entries */
ALLOCA_FLAG(use_heap);
@@ -1943,7 +1943,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
count = size_offsets/3;
} else if (count < 0 && count != PCRE_ERROR_NOMATCH) {
pcre_handle_exec_error(count TSRMLS_CC);
- STR_RELEASE(subject_str);
+ zend_string_release(subject_str);
break;
}
@@ -1961,7 +1961,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
}
}
- STR_RELEASE(subject_str);
+ zend_string_release(subject_str);
} ZEND_HASH_FOREACH_END();
/* Clean up */
@@ -1986,7 +1986,7 @@ static PHP_FUNCTION(preg_last_error)
ZEND_PARSE_PARAMETERS_END();
#endif
- RETURN_INT(PCRE_G(error_code));
+ RETURN_LONG(PCRE_G(error_code));
}
/* }}} */
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index fb90395f75..cd6621372f 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index 440f5a7e0c..61c68ff46d 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -179,7 +179,7 @@ static PHP_GINIT_FUNCTION(pdo)
PDO_API int php_pdo_register_driver(pdo_driver_t *driver) /* {{{ */
{
if (driver->api_version != PDO_DRIVER_API) {
- zend_error(E_ERROR, "PDO: driver %s requires PDO API version %ld; this is PDO version %d",
+ zend_error(E_ERROR, "PDO: driver %s requires PDO API version %pd; this is PDO version %d",
driver->driver_name, driver->api_version, PDO_DRIVER_API);
return FAILURE;
}
@@ -208,7 +208,7 @@ pdo_driver_t *pdo_find_driver(const char *name, int namelen) /* {{{ */
}
/* }}} */
-PDO_API int php_pdo_parse_data_source(const char *data_source, php_uint_t data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */
+PDO_API int php_pdo_parse_data_source(const char *data_source, zend_ulong data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */
{
int i, j;
int valstart = -1;
@@ -314,7 +314,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */
char buffer[65];
char outbuf[65] = "";
register char *p;
- php_int_t long_val;
+ zend_long long_val;
char *dst = outbuf;
if (i64 < 0) {
@@ -331,15 +331,15 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */
p = &buffer[sizeof(buffer)-1];
*p = '\0';
- while ((pdo_uint64_t)i64 > (pdo_uint64_t)PHP_INT_MAX) {
+ while ((pdo_uint64_t)i64 > (pdo_uint64_t)ZEND_LONG_MAX) {
pdo_uint64_t quo = (pdo_uint64_t)i64 / (unsigned int)10;
unsigned int rem = (unsigned int)(i64 - quo*10U);
*--p = digit_vec[rem];
i64 = (pdo_int64_t)quo;
}
- long_val = (php_int_t)i64;
+ long_val = (zend_long)i64;
while (long_val != 0) {
- php_int_t quo = long_val / 10;
+ zend_long quo = long_val / 10;
*--p = digit_vec[(unsigned int)(long_val - quo * 10)];
long_val = quo;
}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 576b81762e..aca52ebf20 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -36,7 +36,7 @@
#include "zend_object_handlers.h"
#include "zend_hash.h"
-static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC);
+static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC);
void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp TSRMLS_DC) /* {{{ */
{
@@ -85,7 +85,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate
array_init(&info);
add_next_index_string(&info, *pdo_err);
- add_next_index_int(&info, 0);
+ add_next_index_long(&info, 0);
zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info TSRMLS_CC);
zval_ptr_dtor(&info);
@@ -103,7 +103,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{
pdo_error_type *pdo_err = &dbh->error_code;
const char *msg = "<<Unknown>>";
char *supp = NULL;
- php_int_t native_code = 0;
+ zend_long native_code = 0;
zend_string *message = NULL;
zval info;
@@ -131,11 +131,11 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{
zval *item;
if ((item = zend_hash_index_find(Z_ARRVAL(info), 1)) != NULL) {
- native_code = Z_IVAL_P(item);
+ native_code = Z_LVAL_P(item);
}
if ((item = zend_hash_index_find(Z_ARRVAL(info), 2)) != NULL) {
- supp = estrndup(Z_STRVAL_P(item), Z_STRSIZE_P(item));
+ supp = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item));
}
}
}
@@ -169,7 +169,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{
}
if (message) {
- STR_RELEASE(message);
+ zend_string_release(message);
}
if (supp) {
@@ -200,10 +200,10 @@ static PHP_METHOD(PDO, dbh_constructor)
pdo_dbh_t *dbh = NULL;
zend_bool is_persistent = 0;
char *data_source;
- int data_source_len;
+ size_t data_source_len;
char *colon;
char *username=NULL, *password=NULL;
- int usernamelen, passwordlen;
+ size_t usernamelen, passwordlen;
pdo_driver_t *driver = NULL;
zval *options = NULL;
char alt_dsn[512];
@@ -277,7 +277,7 @@ static PHP_METHOD(PDO, dbh_constructor)
if ((v = zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_PERSISTENT)) != NULL) {
if (Z_TYPE_P(v) == IS_STRING &&
- !is_numeric_string(Z_STRVAL_P(v), Z_STRSIZE_P(v), NULL, NULL, 0) && Z_STRSIZE_P(v) > 0) {
+ !is_numeric_string(Z_STRVAL_P(v), Z_STRLEN_P(v), NULL, NULL, 0) && Z_STRLEN_P(v) > 0) {
/* user specified key */
plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source,
username ? username : "",
@@ -285,8 +285,8 @@ static PHP_METHOD(PDO, dbh_constructor)
Z_STRVAL_P(v));
is_persistent = 1;
} else {
- convert_to_int_ex(v);
- is_persistent = Z_IVAL_P(v) ? 1 : 0;
+ convert_to_long_ex(v);
+ is_persistent = Z_LVAL_P(v) ? 1 : 0;
plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source,
username ? username : "",
password ? password : "");
@@ -350,7 +350,7 @@ static PHP_METHOD(PDO, dbh_constructor)
dbh->default_fetch_type = PDO_FETCH_BOTH;
}
- dbh->auto_commit = pdo_attr_ival(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC);
+ dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC);
if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory");
@@ -385,7 +385,7 @@ static PHP_METHOD(PDO, dbh_constructor)
options:
if (options) {
zval *attr_value;
- php_uint_t long_key;
+ zend_ulong long_key;
zend_string *str_key = NULL;
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), long_key, str_key, attr_value) {
@@ -425,7 +425,7 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
return object;
} /* }}} */
-static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args TSRMLS_DC) /* {{{ */
+static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args TSRMLS_DC) /* {{{ */
{
zval query_string;
zval z_key;
@@ -466,10 +466,8 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
} else if (!Z_ISUNDEF(retval)) {
zval_ptr_dtor(&retval);
}
-
- if (fci.params) {
- efree(fci.params);
- }
+
+ zend_fcall_info_args_clear(&fci, 1);
}
}
/* }}} */
@@ -480,7 +478,7 @@ static PHP_METHOD(PDO, prepare)
{
pdo_stmt_t *stmt;
char *statement;
- int statement_len;
+ size_t statement_len;
zval *options = NULL, *opt, *item, ctor_args;
zend_class_entry *dbstmt_ce, *pce;
pdo_dbh_object_t *dbh_obj = Z_PDO_OBJECT_P(getThis());
@@ -558,7 +556,7 @@ static PHP_METHOD(PDO, prepare)
ZVAL_UNDEF(&stmt->lazy_object_ref);
if (dbh->methods->preparer(dbh, statement, statement_len, stmt, options TSRMLS_CC)) {
- pdo_stmt_construct(stmt, return_value, dbstmt_ce, &ctor_args TSRMLS_CC);
+ pdo_stmt_construct(execute_data, stmt, return_value, dbstmt_ce, &ctor_args TSRMLS_CC);
return;
}
@@ -675,11 +673,11 @@ static PHP_METHOD(PDO, inTransaction)
}
/* }}} */
-static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC) /* {{{ */
+static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC) /* {{{ */
{
-#define PDO_INT_PARAM_CHECK \
- if (Z_TYPE_P(value) != IS_INT && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \
+#define PDO_LONG_PARAM_CHECK \
+ if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \
pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \
PDO_HANDLE_DBH_ERR(); \
return FAILURE; \
@@ -687,13 +685,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR
switch (attr) {
case PDO_ATTR_ERRMODE:
- PDO_INT_PARAM_CHECK;
- convert_to_int(value);
- switch (Z_IVAL_P(value)) {
+ PDO_LONG_PARAM_CHECK;
+ convert_to_long(value);
+ switch (Z_LVAL_P(value)) {
case PDO_ERRMODE_SILENT:
case PDO_ERRMODE_WARNING:
case PDO_ERRMODE_EXCEPTION:
- dbh->error_mode = Z_IVAL_P(value);
+ dbh->error_mode = Z_LVAL_P(value);
return SUCCESS;
default:
pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode" TSRMLS_CC);
@@ -703,13 +701,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR
return FAILURE;
case PDO_ATTR_CASE:
- PDO_INT_PARAM_CHECK;
- convert_to_int(value);
- switch (Z_IVAL_P(value)) {
+ PDO_LONG_PARAM_CHECK;
+ convert_to_long(value);
+ switch (Z_LVAL_P(value)) {
case PDO_CASE_NATURAL:
case PDO_CASE_UPPER:
case PDO_CASE_LOWER:
- dbh->desired_case = Z_IVAL_P(value);
+ dbh->desired_case = Z_LVAL_P(value);
return SUCCESS;
default:
pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode" TSRMLS_CC);
@@ -719,35 +717,35 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR
return FAILURE;
case PDO_ATTR_ORACLE_NULLS:
- PDO_INT_PARAM_CHECK;
- convert_to_int(value);
- dbh->oracle_nulls = Z_IVAL_P(value);
+ PDO_LONG_PARAM_CHECK;
+ convert_to_long(value);
+ dbh->oracle_nulls = Z_LVAL_P(value);
return SUCCESS;
case PDO_ATTR_DEFAULT_FETCH_MODE:
if (Z_TYPE_P(value) == IS_ARRAY) {
zval *tmp;
- if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_INT) {
- if (Z_IVAL_P(tmp) == PDO_FETCH_INTO || Z_IVAL_P(tmp) == PDO_FETCH_CLASS) {
+ if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
+ if (Z_LVAL_P(tmp) == PDO_FETCH_INTO || Z_LVAL_P(tmp) == PDO_FETCH_CLASS) {
pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC);
return FAILURE;
}
}
} else {
- PDO_INT_PARAM_CHECK;
+ PDO_LONG_PARAM_CHECK;
}
- convert_to_int(value);
- if (Z_IVAL_P(value) == PDO_FETCH_USE_DEFAULT) {
+ convert_to_long(value);
+ if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) {
pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC);
return FAILURE;
}
- dbh->default_fetch_type = Z_IVAL_P(value);
+ dbh->default_fetch_type = Z_LVAL_P(value);
return SUCCESS;
case PDO_ATTR_STRINGIFY_FETCHES:
- PDO_INT_PARAM_CHECK;
- convert_to_int(value);
- dbh->stringify = Z_IVAL_P(value) ? 1 : 0;
+ PDO_LONG_PARAM_CHECK;
+ convert_to_long(value);
+ dbh->stringify = Z_LVAL_P(value) ? 1 : 0;
return SUCCESS;
case PDO_ATTR_STATEMENT_CLASS: {
@@ -835,10 +833,10 @@ fail:
static PHP_METHOD(PDO, setAttribute)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis());
- php_int_t attr;
+ zend_long attr;
zval *value;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz", &attr, &value)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &attr, &value)) {
RETURN_FALSE;
}
@@ -857,9 +855,9 @@ static PHP_METHOD(PDO, setAttribute)
static PHP_METHOD(PDO, getAttribute)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis());
- php_int_t attr;
+ zend_long attr;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) {
RETURN_FALSE;
}
@@ -872,27 +870,27 @@ static PHP_METHOD(PDO, getAttribute)
RETURN_BOOL(dbh->is_persistent);
case PDO_ATTR_CASE:
- RETURN_INT(dbh->desired_case);
+ RETURN_LONG(dbh->desired_case);
case PDO_ATTR_ORACLE_NULLS:
- RETURN_INT(dbh->oracle_nulls);
+ RETURN_LONG(dbh->oracle_nulls);
case PDO_ATTR_ERRMODE:
- RETURN_INT(dbh->error_mode);
+ RETURN_LONG(dbh->error_mode);
case PDO_ATTR_DRIVER_NAME:
RETURN_STRINGL((char*)dbh->driver->driver_name, dbh->driver->driver_name_len);
case PDO_ATTR_STATEMENT_CLASS:
array_init(return_value);
- add_next_index_str(return_value, STR_COPY(dbh->def_stmt_ce->name));
+ add_next_index_str(return_value, zend_string_copy(dbh->def_stmt_ce->name));
if (!Z_ISUNDEF(dbh->def_stmt_ctor_args)) {
if (Z_REFCOUNTED(dbh->def_stmt_ctor_args)) Z_ADDREF(dbh->def_stmt_ctor_args);
add_next_index_zval(return_value, &dbh->def_stmt_ctor_args);
}
return;
case PDO_ATTR_DEFAULT_FETCH_MODE:
- RETURN_INT(dbh->default_fetch_type);
+ RETURN_LONG(dbh->default_fetch_type);
default:
break;
}
@@ -923,8 +921,8 @@ static PHP_METHOD(PDO, exec)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis());
char *statement;
- int statement_len;
- php_int_t ret;
+ size_t statement_len;
+ zend_long ret;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &statement, &statement_len)) {
RETURN_FALSE;
@@ -941,7 +939,7 @@ static PHP_METHOD(PDO, exec)
PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
} else {
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
}
/* }}} */
@@ -952,7 +950,7 @@ static PHP_METHOD(PDO, lastInsertId)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis());
char *name = NULL;
- int namelen;
+ size_t namelen;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &name, &namelen)) {
RETURN_FALSE;
@@ -1058,7 +1056,7 @@ static PHP_METHOD(PDO, query)
{
pdo_stmt_t *stmt;
char *statement;
- int statement_len;
+ size_t statement_len;
pdo_dbh_object_t *dbh_obj = Z_PDO_OBJECT_P(getThis());
pdo_dbh_t *dbh = dbh_obj->inner;
@@ -1111,7 +1109,7 @@ static PHP_METHOD(PDO, query)
stmt->executed = 1;
}
if (ret) {
- pdo_stmt_construct(stmt, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args TSRMLS_CC);
+ pdo_stmt_construct(execute_data, stmt, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args TSRMLS_CC);
return;
}
}
@@ -1135,12 +1133,12 @@ static PHP_METHOD(PDO, quote)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis());
char *str;
- int str_len;
- php_int_t paramtype = PDO_PARAM_STR;
+ size_t str_len;
+ zend_long paramtype = PDO_PARAM_STR;
char *qstr;
int qlen;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &paramtype)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &paramtype)) {
RETURN_FALSE;
}
@@ -1259,7 +1257,7 @@ const zend_function_entry pdo_dbh_functions[] = /* {{{ */ {
static void cls_method_dtor(zval *el) /* {{{ */ {
zend_function *func = (zend_function*)Z_PTR_P(el);
if (func->common.function_name) {
- STR_RELEASE(func->common.function_name);
+ zend_string_release(func->common.function_name);
}
efree(func);
}
@@ -1271,7 +1269,7 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC)
const zend_function_entry *funcs;
zend_function func;
zend_internal_function *ifunc = (zend_internal_function*)&func;
- int namelen;
+ size_t namelen;
char *lc_name;
pdo_dbh_t *dbh = dbh_obj->inner;
@@ -1291,7 +1289,7 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC)
while (funcs->fname) {
ifunc->type = ZEND_INTERNAL_FUNCTION;
ifunc->handler = funcs->handler;
- ifunc->function_name = STR_INIT(funcs->fname, strlen(funcs->fname), 0);
+ ifunc->function_name = zend_string_init(funcs->fname, strlen(funcs->fname), 0);
ifunc->scope = dbh_obj->std.ce;
ifunc->prototype = NULL;
if (funcs->flags) {
@@ -1337,7 +1335,7 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m
pdo_dbh_object_t *dbh_obj = php_pdo_dbh_fetch_object(*object);
zend_string *lc_method_name;
- lc_method_name = STR_INIT(method_name->val, method_name->len, 0);
+ lc_method_name = zend_string_init(method_name->val, method_name->len, 0);
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
if ((fbc = std_object_handlers.get_method(object, method_name, key TSRMLS_CC)) == NULL) {
@@ -1355,7 +1353,7 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m
}
out:
- STR_RELEASE(lc_method_name);
+ zend_string_release(lc_method_name);
return fbc;
}
@@ -1382,100 +1380,100 @@ void pdo_dbh_init(TSRMLS_D)
pdo_dbh_object_handlers.get_method = dbh_method_get;
pdo_dbh_object_handlers.compare_objects = dbh_compare;
- REGISTER_PDO_CLASS_CONST_INT("PARAM_BOOL", (php_int_t)PDO_PARAM_BOOL);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_NULL", (php_int_t)PDO_PARAM_NULL);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_INT", (php_int_t)PDO_PARAM_INT);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_STR", (php_int_t)PDO_PARAM_STR);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_LOB", (php_int_t)PDO_PARAM_LOB);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_STMT", (php_int_t)PDO_PARAM_STMT);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_INPUT_OUTPUT", (php_int_t)PDO_PARAM_INPUT_OUTPUT);
-
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_ALLOC", (php_int_t)PDO_PARAM_EVT_ALLOC);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FREE", (php_int_t)PDO_PARAM_EVT_FREE);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_PRE", (php_int_t)PDO_PARAM_EVT_EXEC_PRE);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_POST", (php_int_t)PDO_PARAM_EVT_EXEC_POST);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_PRE", (php_int_t)PDO_PARAM_EVT_FETCH_PRE);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_POST", (php_int_t)PDO_PARAM_EVT_FETCH_POST);
- REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_NORMALIZE", (php_int_t)PDO_PARAM_EVT_NORMALIZE);
-
- REGISTER_PDO_CLASS_CONST_INT("FETCH_LAZY", (php_int_t)PDO_FETCH_LAZY);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ASSOC", (php_int_t)PDO_FETCH_ASSOC);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_NUM", (php_int_t)PDO_FETCH_NUM);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_BOTH", (php_int_t)PDO_FETCH_BOTH);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_OBJ", (php_int_t)PDO_FETCH_OBJ);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_BOUND", (php_int_t)PDO_FETCH_BOUND);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_COLUMN", (php_int_t)PDO_FETCH_COLUMN);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASS", (php_int_t)PDO_FETCH_CLASS);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_INTO", (php_int_t)PDO_FETCH_INTO);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_FUNC", (php_int_t)PDO_FETCH_FUNC);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_GROUP", (php_int_t)PDO_FETCH_GROUP);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_UNIQUE", (php_int_t)PDO_FETCH_UNIQUE);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_KEY_PAIR", (php_int_t)PDO_FETCH_KEY_PAIR);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASSTYPE", (php_int_t)PDO_FETCH_CLASSTYPE);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (zend_long)PDO_PARAM_BOOL);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (zend_long)PDO_PARAM_NULL);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_INT", (zend_long)PDO_PARAM_INT);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_STR", (zend_long)PDO_PARAM_STR);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_LOB", (zend_long)PDO_PARAM_LOB);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_STMT", (zend_long)PDO_PARAM_STMT);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_INPUT_OUTPUT", (zend_long)PDO_PARAM_INPUT_OUTPUT);
+
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_ALLOC", (zend_long)PDO_PARAM_EVT_ALLOC);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FREE", (zend_long)PDO_PARAM_EVT_FREE);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_PRE", (zend_long)PDO_PARAM_EVT_EXEC_PRE);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_POST", (zend_long)PDO_PARAM_EVT_EXEC_POST);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_PRE", (zend_long)PDO_PARAM_EVT_FETCH_PRE);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_POST", (zend_long)PDO_PARAM_EVT_FETCH_POST);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_NORMALIZE", (zend_long)PDO_PARAM_EVT_NORMALIZE);
+
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (zend_long)PDO_FETCH_LAZY);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC", (zend_long)PDO_FETCH_ASSOC);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (zend_long)PDO_FETCH_NUM);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOTH", (zend_long)PDO_FETCH_BOTH);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_OBJ", (zend_long)PDO_FETCH_OBJ);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOUND", (zend_long)PDO_FETCH_BOUND);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_COLUMN", (zend_long)PDO_FETCH_COLUMN);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASS", (zend_long)PDO_FETCH_CLASS);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_INTO", (zend_long)PDO_FETCH_INTO);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (zend_long)PDO_FETCH_FUNC);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP", (zend_long)PDO_FETCH_GROUP);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE", (zend_long)PDO_FETCH_UNIQUE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR", (zend_long)PDO_FETCH_KEY_PAIR);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE", (zend_long)PDO_FETCH_CLASSTYPE);
#if PHP_VERSION_ID >= 50100
- REGISTER_PDO_CLASS_CONST_INT("FETCH_SERIALIZE",(php_int_t)PDO_FETCH_SERIALIZE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(zend_long)PDO_FETCH_SERIALIZE);
#endif
- REGISTER_PDO_CLASS_CONST_INT("FETCH_PROPS_LATE", (php_int_t)PDO_FETCH_PROPS_LATE);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_NAMED", (php_int_t)PDO_FETCH_NAMED);
-
- REGISTER_PDO_CLASS_CONST_INT("ATTR_AUTOCOMMIT", (php_int_t)PDO_ATTR_AUTOCOMMIT);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_PREFETCH", (php_int_t)PDO_ATTR_PREFETCH);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_TIMEOUT", (php_int_t)PDO_ATTR_TIMEOUT);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_ERRMODE", (php_int_t)PDO_ATTR_ERRMODE);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_VERSION", (php_int_t)PDO_ATTR_SERVER_VERSION);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_CLIENT_VERSION", (php_int_t)PDO_ATTR_CLIENT_VERSION);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_INFO", (php_int_t)PDO_ATTR_SERVER_INFO);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_CONNECTION_STATUS", (php_int_t)PDO_ATTR_CONNECTION_STATUS);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_CASE", (php_int_t)PDO_ATTR_CASE);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR_NAME", (php_int_t)PDO_ATTR_CURSOR_NAME);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR", (php_int_t)PDO_ATTR_CURSOR);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_ORACLE_NULLS", (php_int_t)PDO_ATTR_ORACLE_NULLS);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_PERSISTENT", (php_int_t)PDO_ATTR_PERSISTENT);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_STATEMENT_CLASS", (php_int_t)PDO_ATTR_STATEMENT_CLASS);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_TABLE_NAMES", (php_int_t)PDO_ATTR_FETCH_TABLE_NAMES);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_CATALOG_NAMES", (php_int_t)PDO_ATTR_FETCH_CATALOG_NAMES);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_DRIVER_NAME", (php_int_t)PDO_ATTR_DRIVER_NAME);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_STRINGIFY_FETCHES", (php_int_t)PDO_ATTR_STRINGIFY_FETCHES);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_MAX_COLUMN_LEN", (php_int_t)PDO_ATTR_MAX_COLUMN_LEN);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_EMULATE_PREPARES", (php_int_t)PDO_ATTR_EMULATE_PREPARES);
- REGISTER_PDO_CLASS_CONST_INT("ATTR_DEFAULT_FETCH_MODE", (php_int_t)PDO_ATTR_DEFAULT_FETCH_MODE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE", (zend_long)PDO_FETCH_PROPS_LATE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_NAMED", (zend_long)PDO_FETCH_NAMED);
+
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_AUTOCOMMIT", (zend_long)PDO_ATTR_AUTOCOMMIT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_PREFETCH", (zend_long)PDO_ATTR_PREFETCH);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_TIMEOUT", (zend_long)PDO_ATTR_TIMEOUT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_ERRMODE", (zend_long)PDO_ATTR_ERRMODE);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_VERSION", (zend_long)PDO_ATTR_SERVER_VERSION);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CLIENT_VERSION", (zend_long)PDO_ATTR_CLIENT_VERSION);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_INFO", (zend_long)PDO_ATTR_SERVER_INFO);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CONNECTION_STATUS", (zend_long)PDO_ATTR_CONNECTION_STATUS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CASE", (zend_long)PDO_ATTR_CASE);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR_NAME", (zend_long)PDO_ATTR_CURSOR_NAME);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR", (zend_long)PDO_ATTR_CURSOR);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_ORACLE_NULLS", (zend_long)PDO_ATTR_ORACLE_NULLS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_PERSISTENT", (zend_long)PDO_ATTR_PERSISTENT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_STATEMENT_CLASS", (zend_long)PDO_ATTR_STATEMENT_CLASS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_TABLE_NAMES", (zend_long)PDO_ATTR_FETCH_TABLE_NAMES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_CATALOG_NAMES", (zend_long)PDO_ATTR_FETCH_CATALOG_NAMES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_DRIVER_NAME", (zend_long)PDO_ATTR_DRIVER_NAME);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_STRINGIFY_FETCHES", (zend_long)PDO_ATTR_STRINGIFY_FETCHES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN", (zend_long)PDO_ATTR_MAX_COLUMN_LEN);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_EMULATE_PREPARES", (zend_long)PDO_ATTR_EMULATE_PREPARES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_DEFAULT_FETCH_MODE", (zend_long)PDO_ATTR_DEFAULT_FETCH_MODE);
- REGISTER_PDO_CLASS_CONST_INT("ERRMODE_SILENT", (php_int_t)PDO_ERRMODE_SILENT);
- REGISTER_PDO_CLASS_CONST_INT("ERRMODE_WARNING", (php_int_t)PDO_ERRMODE_WARNING);
- REGISTER_PDO_CLASS_CONST_INT("ERRMODE_EXCEPTION", (php_int_t)PDO_ERRMODE_EXCEPTION);
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (zend_long)PDO_ERRMODE_SILENT);
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (zend_long)PDO_ERRMODE_WARNING);
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_EXCEPTION", (zend_long)PDO_ERRMODE_EXCEPTION);
- REGISTER_PDO_CLASS_CONST_INT("CASE_NATURAL", (php_int_t)PDO_CASE_NATURAL);
- REGISTER_PDO_CLASS_CONST_INT("CASE_LOWER", (php_int_t)PDO_CASE_LOWER);
- REGISTER_PDO_CLASS_CONST_INT("CASE_UPPER", (php_int_t)PDO_CASE_UPPER);
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_NATURAL", (zend_long)PDO_CASE_NATURAL);
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_LOWER", (zend_long)PDO_CASE_LOWER);
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_UPPER", (zend_long)PDO_CASE_UPPER);
- REGISTER_PDO_CLASS_CONST_INT("NULL_NATURAL", (php_int_t)PDO_NULL_NATURAL);
- REGISTER_PDO_CLASS_CONST_INT("NULL_EMPTY_STRING", (php_int_t)PDO_NULL_EMPTY_STRING);
- REGISTER_PDO_CLASS_CONST_INT("NULL_TO_STRING", (php_int_t)PDO_NULL_TO_STRING);
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_NATURAL", (zend_long)PDO_NULL_NATURAL);
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_EMPTY_STRING", (zend_long)PDO_NULL_EMPTY_STRING);
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_TO_STRING", (zend_long)PDO_NULL_TO_STRING);
REGISTER_PDO_CLASS_CONST_STRING("ERR_NONE", PDO_ERR_NONE);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_NEXT", (php_int_t)PDO_FETCH_ORI_NEXT);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_PRIOR", (php_int_t)PDO_FETCH_ORI_PRIOR);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_FIRST", (php_int_t)PDO_FETCH_ORI_FIRST);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_LAST", (php_int_t)PDO_FETCH_ORI_LAST);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_ABS", (php_int_t)PDO_FETCH_ORI_ABS);
- REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_REL", (php_int_t)PDO_FETCH_ORI_REL);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_NEXT", (zend_long)PDO_FETCH_ORI_NEXT);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_PRIOR", (zend_long)PDO_FETCH_ORI_PRIOR);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_FIRST", (zend_long)PDO_FETCH_ORI_FIRST);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_LAST", (zend_long)PDO_FETCH_ORI_LAST);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_ABS", (zend_long)PDO_FETCH_ORI_ABS);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_REL", (zend_long)PDO_FETCH_ORI_REL);
- REGISTER_PDO_CLASS_CONST_INT("CURSOR_FWDONLY", (php_int_t)PDO_CURSOR_FWDONLY);
- REGISTER_PDO_CLASS_CONST_INT("CURSOR_SCROLL", (php_int_t)PDO_CURSOR_SCROLL);
+ REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (zend_long)PDO_CURSOR_FWDONLY);
+ REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (zend_long)PDO_CURSOR_SCROLL);
#if 0
- REGISTER_PDO_CLASS_CONST_INT("ERR_CANT_MAP", (php_int_t)PDO_ERR_CANT_MAP);
- REGISTER_PDO_CLASS_CONST_INT("ERR_SYNTAX", (php_int_t)PDO_ERR_SYNTAX);
- REGISTER_PDO_CLASS_CONST_INT("ERR_CONSTRAINT", (php_int_t)PDO_ERR_CONSTRAINT);
- REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_FOUND", (php_int_t)PDO_ERR_NOT_FOUND);
- REGISTER_PDO_CLASS_CONST_INT("ERR_ALREADY_EXISTS", (php_int_t)PDO_ERR_ALREADY_EXISTS);
- REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_IMPLEMENTED", (php_int_t)PDO_ERR_NOT_IMPLEMENTED);
- REGISTER_PDO_CLASS_CONST_INT("ERR_MISMATCH", (php_int_t)PDO_ERR_MISMATCH);
- REGISTER_PDO_CLASS_CONST_INT("ERR_TRUNCATED", (php_int_t)PDO_ERR_TRUNCATED);
- REGISTER_PDO_CLASS_CONST_INT("ERR_DISCONNECTED", (php_int_t)PDO_ERR_DISCONNECTED);
- REGISTER_PDO_CLASS_CONST_INT("ERR_NO_PERM", (php_int_t)PDO_ERR_NO_PERM);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (zend_long)PDO_ERR_CANT_MAP);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (zend_long)PDO_ERR_SYNTAX);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (zend_long)PDO_ERR_CONSTRAINT);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (zend_long)PDO_ERR_NOT_FOUND);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (zend_long)PDO_ERR_ALREADY_EXISTS);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (zend_long)PDO_ERR_NOT_IMPLEMENTED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (zend_long)PDO_ERR_MISMATCH);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (zend_long)PDO_ERR_TRUNCATED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (zend_long)PDO_ERR_DISCONNECTED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (zend_long)PDO_ERR_NO_PERM);
#endif
}
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index 6530e2222c..9dd7305723 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -1,7 +1,7 @@
/* Generated by re2c 0.13.5 */
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -406,10 +406,10 @@ yy45:
struct placeholder {
char *pos;
+ char *quoted; /* quoted value */
int len;
int bindno;
int qlen; /* quoted length of value */
- char *quoted; /* quoted value */
int freeq;
struct placeholder *next;
};
@@ -561,12 +561,12 @@ safe:
ret = -1;
strncpy(stmt->error_code, stmt->dbh->error_code, 6);
if (buf) {
- STR_RELEASE(buf);
+ zend_string_release(buf);
}
goto clean_up;
}
if (buf) {
- STR_RELEASE(buf);
+ zend_string_release(buf);
}
} else {
pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC);
@@ -586,12 +586,12 @@ safe:
case IS_FALSE:
case IS_TRUE:
- convert_to_int(&tmp_param);
+ convert_to_long(&tmp_param);
/* fall through */
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
convert_to_string(&tmp_param);
- plc->qlen = Z_STRSIZE(tmp_param);
+ plc->qlen = Z_STRLEN(tmp_param);
plc->quoted = estrdup(Z_STRVAL(tmp_param));
plc->freeq = 1;
break;
@@ -599,7 +599,7 @@ safe:
default:
convert_to_string(&tmp_param);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param),
- Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen,
+ Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
@@ -618,7 +618,7 @@ safe:
parameter = &param->parameter;
}
plc->quoted = Z_STRVAL_P(parameter);
- plc->qlen = Z_STRSIZE_P(parameter);
+ plc->qlen = Z_STRLEN_P(parameter);
}
newbuffer_len += plc->qlen;
}
@@ -769,7 +769,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
bind placeholders are at least 2 characters, so
the accommodate their own "'s
*/
- newbuffer_len += padding * Z_STRSIZE_P(param->parameter);
+ newbuffer_len += padding * Z_STRLEN_P(param->parameter);
}
zend_hash_move_forward(params);
}
@@ -805,16 +805,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
/* quote the bind value if necessary */
if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRSIZE_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
+ Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
{
memcpy(ptr, quotedstr, quotedstrlen);
ptr += quotedstrlen;
*outquery_len += quotedstrlen;
efree(quotedstr);
} else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter));
- ptr += Z_STRSIZE_P(param->parameter);
- *outquery_len += (Z_STRSIZE_P(param->parameter));
+ memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
+ ptr += Z_STRLEN_P(param->parameter);
+ *outquery_len += (Z_STRLEN_P(param->parameter));
}
}
else {
@@ -841,16 +841,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
/* quote the bind value if necessary */
if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRSIZE_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
+ Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
{
memcpy(ptr, quotedstr, quotedstrlen);
ptr += quotedstrlen;
*outquery_len += quotedstrlen;
efree(quotedstr);
} else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter));
- ptr += Z_STRSIZE_P(param->parameter);
- *outquery_len += (Z_STRSIZE_P(param->parameter));
+ memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
+ ptr += Z_STRLEN_P(param->parameter);
+ *outquery_len += (Z_STRLEN_P(param->parameter));
}
}
else {
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 8effb4f5e7..79e167ba1d 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -223,12 +223,12 @@ safe:
ret = -1;
strncpy(stmt->error_code, stmt->dbh->error_code, 6);
if (buf) {
- STR_RELEASE(buf);
+ zend_string_release(buf);
}
goto clean_up;
}
if (buf) {
- STR_RELEASE(buf);
+ zend_string_release(buf);
}
} else {
pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC);
@@ -248,12 +248,12 @@ safe:
case IS_FALSE:
case IS_TRUE:
- convert_to_int(&tmp_param);
+ convert_to_long(&tmp_param);
/* fall through */
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
convert_to_string(&tmp_param);
- plc->qlen = Z_STRSIZE(tmp_param);
+ plc->qlen = Z_STRLEN(tmp_param);
plc->quoted = estrdup(Z_STRVAL(tmp_param));
plc->freeq = 1;
break;
@@ -261,7 +261,7 @@ safe:
default:
convert_to_string(&tmp_param);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param),
- Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen,
+ Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
@@ -280,7 +280,7 @@ safe:
parameter = &param->parameter;
}
plc->quoted = Z_STRVAL_P(parameter);
- plc->qlen = Z_STRSIZE_P(parameter);
+ plc->qlen = Z_STRLEN_P(parameter);
}
newbuffer_len += plc->qlen;
}
@@ -431,7 +431,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
bind placeholders are at least 2 characters, so
the accommodate their own "'s
*/
- newbuffer_len += padding * Z_STRSIZE_P(param->parameter);
+ newbuffer_len += padding * Z_STRLEN_P(param->parameter);
}
zend_hash_move_forward(params);
}
@@ -467,16 +467,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
/* quote the bind value if necessary */
if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRSIZE_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
+ Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
{
memcpy(ptr, quotedstr, quotedstrlen);
ptr += quotedstrlen;
*outquery_len += quotedstrlen;
efree(quotedstr);
} else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter));
- ptr += Z_STRSIZE_P(param->parameter);
- *outquery_len += (Z_STRSIZE_P(param->parameter));
+ memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
+ ptr += Z_STRLEN_P(param->parameter);
+ *outquery_len += (Z_STRLEN_P(param->parameter));
}
}
else {
@@ -503,16 +503,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char
/* quote the bind value if necessary */
if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRSIZE_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
+ Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
{
memcpy(ptr, quotedstr, quotedstrlen);
ptr += quotedstrlen;
*outquery_len += quotedstrlen;
efree(quotedstr);
} else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter));
- ptr += Z_STRSIZE_P(param->parameter);
- *outquery_len += (Z_STRSIZE_P(param->parameter));
+ memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
+ ptr += Z_STRLEN_P(param->parameter);
+ *outquery_len += (Z_STRLEN_P(param->parameter));
}
}
else {
diff --git a/ext/pdo/pdo_sqlstate.c b/ext/pdo/pdo_sqlstate.c
index e3585844c6..94829a01a2 100644
--- a/ext/pdo/pdo_sqlstate.c
+++ b/ext/pdo/pdo_sqlstate.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 8402491f3c..705d08bacf 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -138,7 +138,7 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
if (!param->name) {
/* do the reverse; map the parameter number to the name */
if ((name = zend_hash_index_find_ptr(stmt->bound_param_map, param->paramno)) != NULL) {
- param->name = STR_INIT(name, strlen(name), 0);
+ param->name = zend_string_init(name, strlen(name), 0);
return 1;
}
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC);
@@ -279,7 +279,7 @@ static void param_dtor(zval *el) /* {{{ */
}
if (param->name) {
- STR_RELEASE(param->name);
+ zend_string_release(param->name);
}
if (!Z_ISUNDEF(param->parameter)) {
@@ -328,8 +328,8 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
convert_to_string(parameter);
}
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) {
- convert_to_int(parameter);
- } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_INT) {
+ convert_to_long(parameter);
+ } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) {
convert_to_boolean(parameter);
}
@@ -363,18 +363,18 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
if (param->name) {
if (is_param && param->name->val[0] != ':') {
- zend_string *temp = STR_ALLOC(param->name->len + 1, 0);
+ zend_string *temp = zend_string_alloc(param->name->len + 1, 0);
temp->val[0] = ':';
memmove(temp->val + 1, param->name->val, param->name->len + 1);
param->name = temp;
} else {
- param->name = STR_INIT(param->name->val, param->name->len, 0);
+ param->name = zend_string_init(param->name->val, param->name->len, 0);
}
}
if (is_param && !rewrite_name_to_position(stmt, param TSRMLS_CC)) {
if (param->name) {
- STR_RELEASE(param->name);
+ zend_string_release(param->name);
param->name = NULL;
}
return 0;
@@ -388,7 +388,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s
if (!stmt->methods->param_hook(stmt, param, PDO_PARAM_EVT_NORMALIZE
TSRMLS_CC)) {
if (param->name) {
- STR_RELEASE(param->name);
+ zend_string_release(param->name);
param->name = NULL;
}
return 0;
@@ -447,7 +447,7 @@ static PHP_METHOD(PDOStatement, execute)
struct pdo_bound_param_data param;
zval *tmp;
zend_string *key = NULL;
- php_uint_t num_index;
+ zend_ulong num_index;
if (stmt->bound_params) {
zend_hash_destroy(stmt->bound_params);
@@ -544,7 +544,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
{
struct pdo_column_data *col;
char *value = NULL;
- php_size_t value_len = 0;
+ size_t value_len = 0;
int caller_frees = 0;
int type, new_type;
@@ -571,8 +571,8 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
break;
case PDO_PARAM_INT:
- if (value && value_len == sizeof(php_int_t)) {
- ZVAL_INT(dest, *(php_int_t*)value);
+ if (value && value_len == sizeof(zend_long)) {
+ ZVAL_LONG(dest, *(zend_long*)value);
break;
}
ZVAL_NULL(dest);
@@ -639,7 +639,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
if (type != new_type) {
switch (new_type) {
case PDO_PARAM_INT:
- convert_to_int_ex(dest);
+ convert_to_long_ex(dest);
break;
case PDO_PARAM_BOOL:
convert_to_boolean_ex(dest);
@@ -661,7 +661,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
if (stmt->dbh->stringify) {
switch (Z_TYPE_P(dest)) {
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
convert_to_string(dest);
break;
@@ -674,7 +674,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
}
/* }}} */
-static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset, int do_bind TSRMLS_DC) /* {{{ */
+static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset, int do_bind TSRMLS_DC) /* {{{ */
{
if (!stmt->executed) {
return 0;
@@ -832,7 +832,7 @@ static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) /
/* perform a fetch. If do_bind is true, update any bound columns.
* If return_value is not null, store values into it according to HOW. */
-static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, php_int_t offset, zval *return_all TSRMLS_DC) /* {{{ */
+static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all TSRMLS_DC) /* {{{ */
{
int flags, idx, old_arg_count = 0;
zend_class_entry *ce = NULL, *old_ce = NULL;
@@ -978,7 +978,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
ZVAL_COPY(return_value, &stmt->fetch.into);
- if (zend_get_class_entry(Z_OBJ_P(return_value) TSRMLS_CC) == ZEND_STANDARD_CLASS_DEF_PTR) {
+ if (Z_OBJ_P(return_value)->ce == ZEND_STANDARD_CLASS_DEF_PTR) {
how = PDO_FETCH_OBJ;
}
break;
@@ -1032,8 +1032,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
zval tmp;
fetch_value(stmt, &tmp, ++i, NULL TSRMLS_CC);
- if (Z_TYPE(val) == IS_INT) {
- zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_IVAL(val), &tmp);
+ if (Z_TYPE(val) == IS_LONG) {
+ zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_LVAL(val), &tmp);
} else {
convert_to_string(&val);
zend_symtable_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_STR(val), &tmp);
@@ -1110,7 +1110,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
php_unserialize_data_t var_hash;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRSIZE(val), NULL TSRMLS_CC) == FAILURE) {
+ if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL TSRMLS_CC) == FAILURE) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data" TSRMLS_CC);
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return 0;
@@ -1121,7 +1121,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
zval_ptr_dtor(&val);
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC);
return 0;
- } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRSIZE(val) : 0, NULL TSRMLS_CC) == FAILURE) {
+ } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL TSRMLS_CC) == FAILURE) {
zval_ptr_dtor(&val);
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC);
zval_dtor(return_value);
@@ -1213,7 +1213,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
}
/* }}} */
-static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, php_int_t mode, int fetch_all TSRMLS_DC) /* {{{ */
+static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all TSRMLS_DC) /* {{{ */
{
int flags = mode & PDO_FETCH_FLAGS;
@@ -1269,12 +1269,12 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, php_int_t mode, int fetch_all
Fetches the next row and returns it, or false if there are no more rows */
static PHP_METHOD(PDOStatement, fetch)
{
- php_int_t how = PDO_FETCH_USE_DEFAULT;
- php_int_t ori = PDO_FETCH_ORI_NEXT;
- php_int_t off = 0;
+ zend_long how = PDO_FETCH_USE_DEFAULT;
+ zend_long ori = PDO_FETCH_ORI_NEXT;
+ zend_long off = 0;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iii", &how,
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lll", &how,
&ori, &off)) {
RETURN_FALSE;
}
@@ -1296,9 +1296,9 @@ static PHP_METHOD(PDOStatement, fetch)
Fetches the next row and returns it as an object. */
static PHP_METHOD(PDOStatement, fetchObject)
{
- php_int_t how = PDO_FETCH_CLASS;
- php_int_t ori = PDO_FETCH_ORI_NEXT;
- php_int_t off = 0;
+ zend_long how = PDO_FETCH_CLASS;
+ zend_long ori = PDO_FETCH_ORI_NEXT;
+ zend_long off = 0;
zend_string *class_name = NULL;
zend_class_entry *old_ce;
zval old_ctor_args, *ctor_args = NULL;
@@ -1361,10 +1361,10 @@ static PHP_METHOD(PDOStatement, fetchObject)
Returns a data of the specified column in the result set. */
static PHP_METHOD(PDOStatement, fetchColumn)
{
- php_int_t col_n = 0;
+ zend_long col_n = 0;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &col_n)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &col_n)) {
RETURN_FALSE;
}
@@ -1383,7 +1383,7 @@ static PHP_METHOD(PDOStatement, fetchColumn)
Returns an array of all of the results. */
static PHP_METHOD(PDOStatement, fetchAll)
{
- php_int_t how = PDO_FETCH_USE_DEFAULT;
+ zend_long how = PDO_FETCH_USE_DEFAULT;
zval data, *return_all;
zval *arg2;
zend_class_entry *old_ce;
@@ -1391,7 +1391,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
int error = 0, flags, old_arg_count;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|izz", &how, &arg2, &ctor_args)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lzz", &how, &arg2, &ctor_args)) {
RETURN_FALSE;
}
@@ -1470,8 +1470,8 @@ static PHP_METHOD(PDOStatement, fetchAll)
stmt->fetch.column = how & PDO_FETCH_GROUP ? -1 : 0;
break;
case 2:
- convert_to_int(arg2);
- stmt->fetch.column = Z_IVAL_P(arg2);
+ convert_to_long(arg2);
+ stmt->fetch.column = Z_LVAL_P(arg2);
break;
case 3:
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC);
@@ -1545,15 +1545,15 @@ static PHP_METHOD(PDOStatement, fetchAll)
static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */
{
struct pdo_bound_param_data param = {0};
- php_int_t param_type = PDO_PARAM_STR;
+ zend_long param_type = PDO_PARAM_STR;
zval *parameter;
param.paramno = -1;
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "iz|iiz!", &param.paramno, &parameter, &param_type, &param.max_value_len,
+ "lz|llz!", &param.paramno, &parameter, &param_type, &param.max_value_len,
&param.driver_params)) {
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|iiz!", &param.name,
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|llz!", &param.name,
&parameter, &param_type, &param.max_value_len,
&param.driver_params)) {
return 0;
@@ -1584,15 +1584,15 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt,
static PHP_METHOD(PDOStatement, bindValue)
{
struct pdo_bound_param_data param = {0};
- php_int_t param_type = PDO_PARAM_STR;
+ zend_long param_type = PDO_PARAM_STR;
zval *parameter;
PHP_STMT_GET_OBJ;
param.paramno = -1;
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
- "iz/|i", &param.paramno, &parameter, &param_type)) {
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", &param.name,
+ "lz/|l", &param.paramno, &parameter, &param_type)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", &param.name,
&parameter, &param_type)) {
RETURN_FALSE;
}
@@ -1643,7 +1643,7 @@ static PHP_METHOD(PDOStatement, rowCount)
{
PHP_STMT_GET_OBJ;
- RETURN_INT(stmt->row_count);
+ RETURN_LONG(stmt->row_count);
}
/* }}} */
@@ -1703,11 +1703,11 @@ static PHP_METHOD(PDOStatement, errorInfo)
Set an attribute */
static PHP_METHOD(PDOStatement, setAttribute)
{
- php_int_t attr;
+ zend_long attr;
zval *value = NULL;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz!", &attr, &value)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) {
RETURN_FALSE;
}
@@ -1733,7 +1733,7 @@ fail:
/* {{{ proto mixed PDOStatement::getAttribute(long attribute)
Get an attribute */
-static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, php_int_t attr)
+static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, zend_long attr)
{
switch (attr) {
case PDO_ATTR_EMULATE_PREPARES:
@@ -1745,10 +1745,10 @@ static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, php_int_t
static PHP_METHOD(PDOStatement, getAttribute)
{
- php_int_t attr;
+ zend_long attr;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) {
RETURN_FALSE;
}
@@ -1790,7 +1790,7 @@ static PHP_METHOD(PDOStatement, columnCount)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- RETURN_INT(stmt->column_count);
+ RETURN_LONG(stmt->column_count);
}
/* }}} */
@@ -1798,11 +1798,11 @@ static PHP_METHOD(PDOStatement, columnCount)
Returns meta data for a numbered column */
static PHP_METHOD(PDOStatement, getColumnMeta)
{
- php_int_t colno;
+ zend_long colno;
struct pdo_column_data *col;
PHP_STMT_GET_OBJ;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &colno)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colno)) {
RETURN_FALSE;
}
if(colno < 0) {
@@ -1824,11 +1824,11 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
/* add stock items */
col = &stmt->columns[colno];
add_assoc_string(return_value, "name", col->name);
- add_assoc_int(return_value, "len", col->maxlen); /* FIXME: unsigned ? */
- add_assoc_int(return_value, "precision", col->precision);
+ add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */
+ add_assoc_long(return_value, "precision", col->precision);
if (col->param_type != PDO_PARAM_ZVAL) {
/* if param_type is PDO_PARAM_ZVAL the driver has to provide correct data */
- add_assoc_int(return_value, "pdo_type", col->param_type);
+ add_assoc_long(return_value, "pdo_type", col->param_type);
}
}
/* }}} */
@@ -1838,7 +1838,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip)
{
- php_int_t mode = PDO_FETCH_BOTH;
+ zend_long mode = PDO_FETCH_BOTH;
int flags = 0, argc = ZEND_NUM_ARGS() - skip;
zval *args;
zend_class_entry *cep;
@@ -1868,11 +1868,11 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in
retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args);
if (SUCCESS == retval) {
- if (Z_TYPE(args[skip]) != IS_INT) {
+ if (Z_TYPE(args[skip]) != IS_LONG) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer" TSRMLS_CC);
retval = FAILURE;
} else {
- mode = Z_IVAL(args[skip]);
+ mode = Z_LVAL(args[skip]);
flags = mode & PDO_FETCH_FLAGS;
retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC);
@@ -1906,10 +1906,10 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in
case PDO_FETCH_COLUMN:
if (argc != 2) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument" TSRMLS_CC);
- } else if (Z_TYPE(args[skip+1]) != IS_INT) {
+ } else if (Z_TYPE(args[skip+1]) != IS_LONG) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer" TSRMLS_CC);
} else {
- stmt->fetch.column = Z_IVAL(args[skip+1]);
+ stmt->fetch.column = Z_LVAL(args[skip+1]);
retval = SUCCESS;
}
break;
@@ -2119,16 +2119,16 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0);
if (stmt->bound_params) {
- php_uint_t num;
+ zend_ulong num;
zend_string *key = NULL;
ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) {
if (key) {
php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", key->len, key->len, key->val);
} else {
- php_stream_printf(out TSRMLS_CC, "Key: Position #%ld:\n", num);
+ php_stream_printf(out TSRMLS_CC, "Key: Position #%pd:\n", num);
}
- php_stream_printf(out TSRMLS_CC, "paramno=%ld\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
+ php_stream_printf(out TSRMLS_CC, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
param->paramno, param->name? param->name->len : 0, param->name? param->name->len : 0,
param->name ? param->name->val : "",
param->is_param,
@@ -2215,7 +2215,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str
zend_string *lc_method_name;
zend_object *object = *object_pp;
- lc_method_name = STR_ALLOC(method_name->len, 0);
+ lc_method_name = zend_string_alloc(method_name->len, 0);
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
if ((fbc = zend_hash_find_ptr(&object->ce->function_table, lc_method_name)) == NULL) {
@@ -2241,7 +2241,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str
}
out:
- STR_RELEASE(lc_method_name);
+ zend_string_release(lc_method_name);
return fbc;
}
@@ -2267,7 +2267,7 @@ static zend_object *dbstmt_clone_obj(zval *zobject TSRMLS_DC)
}
zend_object_handlers pdo_dbstmt_object_handlers;
-static int pdo_row_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
+static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC);
void pdo_stmt_init(TSRMLS_D)
{
@@ -2372,7 +2372,7 @@ zend_object *pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC)
struct php_pdo_iterator {
zend_object_iterator iter;
- php_uint_t key;
+ zend_ulong key;
zval fetch_ahead;
};
@@ -2413,7 +2413,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_D
if (I->key == (ulong)-1) {
ZVAL_NULL(key);
} else {
- ZVAL_INT(key, I->key);
+ ZVAL_LONG(key, I->key);
}
}
@@ -2489,9 +2489,9 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
ZVAL_NULL(rv);
if (stmt) {
- if (Z_TYPE_P(member) == IS_INT) {
- if (Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count) {
- fetch_value(stmt, rv, Z_IVAL_P(member), NULL TSRMLS_CC);
+ if (Z_TYPE_P(member) == IS_LONG) {
+ if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) {
+ fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC);
}
} else {
convert_to_string(member);
@@ -2543,8 +2543,8 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
int colno = -1;
if (stmt) {
- if (Z_TYPE_P(member) == IS_INT) {
- return Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count;
+ if (Z_TYPE_P(member) == IS_LONG) {
+ return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
} else {
convert_to_string(member);
@@ -2606,15 +2606,15 @@ static union _zend_function *row_method_get(
zend_function *fbc;
zend_string *lc_method_name;
- lc_method_name = STR_ALLOC(method_name->len, 0);
+ lc_method_name = zend_string_alloc(method_name->len, 0);
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
if ((fbc = zend_hash_find_ptr(&pdo_row_ce->function_table, lc_method_name)) == NULL) {
- STR_RELEASE(lc_method_name);
+ zend_string_release(lc_method_name);
return NULL;
}
- STR_RELEASE(lc_method_name);
+ zend_string_release(lc_method_name);
return fbc;
}
@@ -2628,7 +2628,7 @@ static union _zend_function *row_get_ctor(zend_object *object TSRMLS_DC)
static zend_internal_function ctor = {0};
ctor.type = ZEND_INTERNAL_FUNCTION;
- ctor.function_name = STR_INIT("__construct", sizeof("__construct") - 1, 0);
+ ctor.function_name = zend_string_init("__construct", sizeof("__construct") - 1, 0);
ctor.scope = pdo_row_ce;
ctor.handler = ZEND_FN(dbstmt_constructor);
ctor.fn_flags = ZEND_ACC_PUBLIC;
@@ -2636,18 +2636,9 @@ static union _zend_function *row_get_ctor(zend_object *object TSRMLS_DC)
return (union _zend_function*)&ctor;
}
-static zend_class_entry *row_get_ce(const zend_object *object TSRMLS_DC)
+static zend_string *row_get_classname(const zend_object *object TSRMLS_DC)
{
- return pdo_row_ce;
-}
-
-static zend_string *row_get_classname(const zend_object *object, int parent TSRMLS_DC)
-{
- if (parent) {
- return NULL;
- } else {
- return STR_INIT("PDORow", sizeof("PDORow") - 1, 0);
- }
+ return zend_string_init("PDORow", sizeof("PDORow") - 1, 0);
}
static int row_compare(zval *object1, zval *object2 TSRMLS_DC)
@@ -2675,7 +2666,6 @@ zend_object_handlers pdo_row_object_handlers = {
row_method_get,
row_call_method,
row_get_ctor,
- row_get_ce,
row_get_classname,
row_compare,
NULL, /* cast */
@@ -2700,7 +2690,7 @@ zend_object *pdo_row_new(zend_class_entry *ce TSRMLS_DC)
return &row->std;
}
-static int pdo_row_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC)
+static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PDORow instances may not be serialized");
return FAILURE;
diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h
index 2072dd3469..ce5b3a229d 100644
--- a/ext/pdo/php_pdo.h
+++ b/ext/pdo/php_pdo.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -49,7 +49,7 @@ PHP_MSHUTDOWN_FUNCTION(pdo);
PHP_MINFO_FUNCTION(pdo);
ZEND_BEGIN_MODULE_GLOBALS(pdo)
- php_int_t global_value;
+ zend_long global_value;
ZEND_END_MODULE_GLOBALS(pdo)
#ifdef ZTS
@@ -58,13 +58,13 @@ ZEND_END_MODULE_GLOBALS(pdo)
# define PDOG(v) (pdo_globals.v)
#endif
-#define REGISTER_PDO_CLASS_CONST_INT(const_name, value) \
- zend_declare_class_constant_int(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
+#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
+ zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
#define REGISTER_PDO_CONST_LONG(const_name, value) { \
zend_class_entry **pce; \
if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \
- zend_declare_class_constant_int(*pce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); \
+ zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); \
} \
#define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index b7f7f46250..de9780e226 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -194,13 +194,13 @@ enum pdo_null_handling {
};
/* {{{ utils for reading attributes set as driver_options */
-static inline php_int_t pdo_attr_ival(zval *options, enum pdo_attribute_type option_name, php_int_t defval TSRMLS_DC)
+static inline zend_long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, zend_long defval TSRMLS_DC)
{
zval *v;
if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) {
- convert_to_int_ex(v);
- return Z_IVAL_P(v);
+ convert_to_long_ex(v);
+ return Z_LVAL_P(v);
}
return defval;
}
@@ -210,7 +210,7 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio
if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) {
convert_to_string_ex(v);
- return estrndup(Z_STRVAL_P(v), Z_STRSIZE_P(v));
+ return estrndup(Z_STRVAL_P(v), Z_STRLEN_P(v));
}
return defval ? estrdup(defval) : NULL;
}
@@ -220,8 +220,8 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio
* initialized */
typedef struct {
const char *driver_name;
- php_uint_t driver_name_len;
- php_uint_t api_version; /* needs to be compatible with PDO */
+ zend_ulong driver_name_len;
+ zend_ulong api_version; /* needs to be compatible with PDO */
#define PDO_DRIVER_HEADER(name) \
#name, sizeof(#name)-1, \
@@ -244,10 +244,10 @@ typedef struct {
typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh TSRMLS_DC);
/* prepare a statement and stash driver specific portion into stmt */
-typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC);
+typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC);
/* execute a statement (that does not return a result set) */
-typedef php_int_t (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC);
+typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC);
/* quote a string */
typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC);
@@ -256,7 +256,7 @@ typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unqu
typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC);
/* setting of attributes */
-typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC);
+typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC);
/* return last insert id. NULL indicates error condition, otherwise, the return value
* MUST be an emalloc'd NULL terminated string. */
@@ -271,7 +271,7 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned
typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC);
/* fetching of attributes */
-typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC);
+typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC);
/* checking/pinging persistent connections; return SUCCESS if the connection
* is still alive and ready to be used, FAILURE otherwise.
@@ -329,7 +329,7 @@ typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt TSRMLS_DC);
* more rows. The ori and offset params modify which row should be returned,
* if the stmt represents a scrollable cursor */
typedef int (*pdo_stmt_fetch_func)(pdo_stmt_t *stmt,
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC);
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC);
/* queries information about the type of a column, by index (0 based).
* Driver should populate stmt->columns[colno] with appropriate info */
@@ -341,7 +341,7 @@ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC)
* If the driver sets caller_frees, ptr should point to emalloc'd memory
* and PDO will free it as soon as it is done using it.
*/
-typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC);
+typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC);
/* hook for bound params */
enum pdo_param_event {
@@ -357,10 +357,10 @@ enum pdo_param_event {
typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC);
/* setting of attributes */
-typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC);
+typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC);
/* fetching of attributes */
-typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC);
+typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC);
/* retrieves meta data for a numbered column.
* Returns SUCCESS/FAILURE.
@@ -390,7 +390,7 @@ typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *va
* or
* 'flags' => array('not_null', 'mysql:some_flag'); // to add data to an existing key
*/
-typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC);
+typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC);
/* advances the statement to the next rowset of the batch.
* If it returns 1, PDO will tear down its idea of columns
@@ -469,7 +469,7 @@ struct _pdo_dbh_t {
/* data source string used to open this handle */
const char *data_source;
- php_uint_t data_source_len;
+ zend_ulong data_source_len;
/* the global error code. */
pdo_error_type error_code;
@@ -528,10 +528,10 @@ static inline pdo_dbh_object_t *php_pdo_dbh_fetch_object(zend_object *obj) {
/* describes a column */
struct pdo_column_data {
char *name;
- int namelen;
- php_uint_t maxlen;
+ zend_ulong maxlen;
+ zend_ulong precision;
enum pdo_param_type param_type;
- php_uint_t precision;
+ int namelen;
/* don't touch this unless your name is dbdo */
void *dbdo_data;
@@ -539,18 +539,21 @@ struct pdo_column_data {
/* describes a bound parameter */
struct pdo_bound_param_data {
- php_int_t paramno; /* if -1, then it has a name, and we don't know the index *yet* */
- zend_string *name;
-
- php_int_t max_value_len; /* as a hint for pre-allocation */
-
zval parameter; /* the variable itself */
- enum pdo_param_type param_type; /* desired or suggested type */
zval driver_params; /* optional parameter(s) for the driver */
+
+ zend_long paramno; /* if -1, then it has a name, and we don't know the index *yet* */
+ zend_string *name;
+
+ zend_long max_value_len; /* as a hint for pre-allocation */
+
void *driver_data;
pdo_stmt_t *stmt; /* for convenience in dtor */
+
+ enum pdo_param_type param_type; /* desired or suggested variable type */
+
int is_param; /* parameter or column ? */
};
@@ -591,7 +594,7 @@ struct _pdo_stmt_t {
HashTable *bound_columns;
/* not always meaningful */
- php_int_t row_count;
+ zend_long row_count;
/* used to hold the statement's current query */
char *query_string;
@@ -607,7 +610,7 @@ struct _pdo_stmt_t {
/* for lazy fetches, we always return the same lazy object handle.
* Let's keep it here. */
zval lazy_object_ref;
- php_uint_t refcount;
+ zend_ulong refcount;
/* defaults for fetches */
enum pdo_fetch_type default_fetch_type;
@@ -669,7 +672,7 @@ struct pdo_data_src_parser {
};
PDO_API int php_pdo_parse_data_source(const char *data_source,
- php_uint_t data_source_len, struct pdo_data_src_parser *parsed,
+ zend_ulong data_source_len, struct pdo_data_src_parser *parsed,
int nparams);
PDO_API zend_class_entry *php_pdo_get_dbh_ce(void);
diff --git a/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h
index 60bb89a8f8..e89a2b8811 100644
--- a/ext/pdo/php_pdo_error.h
+++ b/ext/pdo/php_pdo_error.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h
index 27cca7c29f..23de705ec1 100644
--- a/ext/pdo/php_pdo_int.h
+++ b/ext/pdo/php_pdo_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index f329435e23..40d4114879 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -60,12 +60,12 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS
spprintf(&message, 0, "%s [%d] (severity %d) [%s]",
msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : "");
- add_next_index_int(info, einfo->dberr);
+ add_next_index_long(info, einfo->dberr);
// TODO: avoid reallocation ???
add_next_index_string(info, message);
efree(message);
- add_next_index_int(info, einfo->oserr);
- add_next_index_int(info, einfo->severity);
+ add_next_index_long(info, einfo->oserr);
+ add_next_index_long(info, einfo->severity);
if (einfo->oserrstr) {
add_next_index_string(info, einfo->oserrstr);
}
@@ -93,7 +93,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
return 0;
}
-static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
+static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
pdo_dblib_stmt *S = ecalloc(1, sizeof(*S));
@@ -107,7 +107,7 @@ static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_
return 1;
}
-static php_int_t dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC)
+static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC)
{
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
RETCODE ret, resret;
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index fa071c0e26..a29405b24e 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -171,7 +171,7 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
}
static int pdo_dblib_stmt_fetch(pdo_stmt_t *stmt,
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC)
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC)
{
RETCODE ret;
@@ -213,7 +213,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
}
static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
- php_uint_t *len, int *caller_frees TSRMLS_DC)
+ zend_ulong *len, int *caller_frees TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
@@ -287,7 +287,7 @@ static int pdo_dblib_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
return 1;
}
-static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC)
+static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
pdo_dblib_db_handle *H = S->H;
@@ -303,13 +303,13 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zva
if(!dbtypeinfo) return FAILURE;
- add_assoc_int(return_value, "max_length", dbcollen(H->link, colno+1) );
- add_assoc_int(return_value, "precision", (int) dbtypeinfo->precision );
- add_assoc_int(return_value, "scale", (int) dbtypeinfo->scale );
+ add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) );
+ add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision );
+ add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale );
add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1));
add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1)));
- add_assoc_int(return_value, "native_type_id", dbcoltype(H->link, colno+1));
- add_assoc_int(return_value, "native_usertype_id", dbcolutype(H->link, colno+1));
+ add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1));
+ add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1));
return 1;
}
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 2801ece8f1..3afd885df5 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_dblib/php_pdo_dblib.h b/ext/pdo_dblib/php_pdo_dblib.h
index f7de387b96..5198976d25 100644
--- a/ext/pdo_dblib/php_pdo_dblib.h
+++ b/ext/pdo_dblib/php_pdo_dblib.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index df15b229e0..e247b5c19e 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index fb3979863b..298d2539e3 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -33,11 +33,11 @@
#include "php_pdo_firebird.h"
#include "php_pdo_firebird_int.h"
-static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, php_int_t, XSQLDA*, isc_stmt_handle*,
+static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, zend_long, XSQLDA*, isc_stmt_handle*,
HashTable* TSRMLS_DC);
/* map driver specific error message to PDO error */
-void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC) /* {{{ */
+void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line TSRMLS_DC) /* {{{ */
{
#if 0
pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H
@@ -132,7 +132,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
/* }}} */
/* called by PDO to prepare an SQL query */
-static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */
+static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */
pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
@@ -218,7 +218,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t s
/* }}} */
/* called by PDO to execute a statement that doesn't produce a result set */
-static php_int_t firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) /* {{{ */
+static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) /* {{{ */
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
isc_stmt_handle stmt = NULL;
@@ -391,12 +391,12 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
/* }}} */
/* used by prepare and exec to allocate a statement handle and prepare the SQL */
-static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */
+static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */
XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC)
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
char *c, *new_sql, in_quote, in_param, pname[64], *ppname;
- php_int_t l, pindex = -1;
+ zend_long l, pindex = -1;
/* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */
if (sql_len > 65536) {
@@ -448,7 +448,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_
*ppname++ = 0;
if (named_params) {
zval tmp;
- ZVAL_INT(&tmp, pindex);
+ ZVAL_LONG(&tmp, pindex);
zend_hash_str_update(named_params, pname, (unsigned int)(ppname - pname - 1), &tmp);
}
}
@@ -470,7 +470,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_
/* }}} */
/* called by PDO to set a driver-specific dbh attribute */
-static int firebird_handle_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */
+static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) /* {{{ */
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
@@ -545,7 +545,7 @@ static void firebird_info_cb(void *arg, char const *s) /* {{{ */
/* }}} */
/* called by PDO to get a driver-specific dbh attribute */
-static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */
+static int firebird_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) /* {{{ */
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
@@ -553,7 +553,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *v
char tmp[512];
case PDO_ATTR_AUTOCOMMIT:
- ZVAL_INT(val,dbh->auto_commit);
+ ZVAL_LONG(val,dbh->auto_commit);
return 1;
case PDO_ATTR_CONNECTION_STATUS:
@@ -606,10 +606,10 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
const ISC_STATUS *s = H->isc_status;
char buf[400];
- php_int_t i = 0, l, sqlcode = isc_sqlcode(s);
+ zend_long i = 0, l, sqlcode = isc_sqlcode(s);
if (sqlcode) {
- add_next_index_int(info, sqlcode);
+ add_next_index_long(info, sqlcode);
while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) {
i += l;
@@ -617,7 +617,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval
}
add_next_index_string(info, buf);
} else if (H->last_app_error) {
- add_next_index_int(info, -999);
+ add_next_index_long(info, -999);
add_next_index_string(info, const_cast(H->last_app_error));
}
return 1;
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index bf6431c09e..d46a67d504 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -88,7 +88,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
- php_uint_t affected_rows = 0;
+ zend_ulong affected_rows = 0;
static char info_count[] = {isc_info_sql_records};
char result[64];
@@ -153,7 +153,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
/* called by PDO to fetch the next row from a statement */
static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC)
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
@@ -219,7 +219,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{
/* fetch a blob into a fetch buffer */
static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */
- php_uint_t *len, ISC_QUAD *blob_id TSRMLS_DC)
+ zend_ulong *len, ISC_QUAD *blob_id TSRMLS_DC)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
@@ -263,7 +263,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ *
/* we've found the blob's length, now fetch! */
if (*len) {
- php_uint_t cur_len;
+ zend_ulong cur_len;
unsigned short seg_len;
ISC_STATUS stat;
@@ -296,7 +296,7 @@ fetch_blob_end:
/* }}} */
static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */
- php_uint_t *len, int *caller_frees TSRMLS_DC)
+ zend_ulong *len, int *caller_frees TSRMLS_DC)
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
XSQLVAR const *var = &S->out_sqlda.sqlvar[colno];
@@ -413,7 +413,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
pdo_firebird_db_handle *H = S->H;
isc_blob_handle h = NULL;
- php_uint_t put_cnt = 0, rem_cnt;
+ zend_ulong put_cnt = 0, rem_cnt;
unsigned short chunk_size;
int result = 1;
@@ -425,7 +425,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T
SEPARATE_ZVAL(param);
convert_to_string_ex(param);
- for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) {
+ for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) {
chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt;
@@ -467,7 +467,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
/* try to determine the index by looking in the named_params hash */
if ((index = zend_hash_find(S->named_params, param->name)) != NULL) {
- param->paramno = Z_IVAL_P(index);
+ param->paramno = Z_LVAL_P(index);
} else {
/* ... or by looking in the input descriptor */
int i;
@@ -495,7 +495,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
switch (event_type) {
char *value;
- php_uint_t value_len;
+ zend_ulong value_len;
int caller_frees;
zval *parameter;
@@ -549,11 +549,11 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
switch (Z_TYPE_P(parameter)) {
int force_null;
- case IS_INT:
+ case IS_LONG:
/* keep the allow-NULL flag */
- var->sqltype = (sizeof(php_int_t) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1);
- var->sqldata = (void*)&Z_IVAL_P(parameter);
- var->sqllen = sizeof(php_int_t);
+ var->sqltype = (sizeof(zend_long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1);
+ var->sqldata = (void*)&Z_LVAL_P(parameter);
+ var->sqllen = sizeof(zend_long);
break;
case IS_DOUBLE:
/* keep the allow-NULL flag */
@@ -574,13 +574,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
case SQL_TIMESTAMP:
case SQL_TYPE_DATE:
case SQL_TYPE_TIME:
- force_null = (Z_STRSIZE_P(parameter) == 0);
+ force_null = (Z_STRLEN_P(parameter) == 0);
}
if (!force_null) {
/* keep the allow-NULL flag */
var->sqltype = SQL_TEXT | (var->sqltype & 1);
var->sqldata = Z_STRVAL_P(parameter);
- var->sqllen = Z_STRSIZE_P(parameter);
+ var->sqllen = Z_STRLEN_P(parameter);
break;
}
case IS_NULL:
@@ -626,7 +626,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
}
case PDO_PARAM_INT:
if (value) {
- ZVAL_INT(parameter, *(php_int_t*)value);
+ ZVAL_LONG(parameter, *(zend_long*)value);
break;
}
case PDO_PARAM_EVT_NORMALIZE:
@@ -654,7 +654,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
}
/* }}} */
-static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */
+static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) /* {{{ */
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
@@ -675,7 +675,7 @@ static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *v
}
/* }}} */
-static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */
+static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) /* {{{ */
{
pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data;
diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c
index e81b7c553f..4e2c816460 100644
--- a/ext/pdo_firebird/pdo_firebird.c
+++ b/ext/pdo_firebird/pdo_firebird.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -62,9 +62,9 @@ ZEND_GET_MODULE(pdo_firebird)
PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */
{
- REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_DATE_FORMAT", (php_int_t) PDO_FB_ATTR_DATE_FORMAT);
- REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIME_FORMAT", (php_int_t) PDO_FB_ATTR_TIME_FORMAT);
- REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIMESTAMP_FORMAT", (php_int_t) PDO_FB_ATTR_TIMESTAMP_FORMAT);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (zend_long) PDO_FB_ATTR_DATE_FORMAT);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (zend_long) PDO_FB_ATTR_TIME_FORMAT);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (zend_long) PDO_FB_ATTR_TIMESTAMP_FORMAT);
php_pdo_register_driver(&pdo_firebird_driver);
diff --git a/ext/pdo_firebird/php_pdo_firebird.h b/ext/pdo_firebird/php_pdo_firebird.h
index f7e9f17f12..3f1fc9a76c 100644
--- a/ext/pdo_firebird/php_pdo_firebird.h
+++ b/ext/pdo_firebird/php_pdo_firebird.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h
index 831fa59726..18670fee18 100644
--- a/ext/pdo_firebird/php_pdo_firebird_int.h
+++ b/ext/pdo_firebird/php_pdo_firebird_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,7 +35,7 @@
#define SHORT_MAX (1 << (8*sizeof(short)-1))
-#if SIZEOF_ZEND_INT == 8 && !defined(PHP_WIN32)
+#if SIZEOF_ZEND_LONG == 8 && !defined(PHP_WIN32)
# define LL_MASK "l"
# define LL_LIT(lit) lit ## L
#else
@@ -128,7 +128,7 @@ extern pdo_driver_t pdo_firebird_driver;
extern struct pdo_stmt_methods firebird_stmt_methods;
-void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC);
+void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line TSRMLS_DC);
enum {
PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 8dd981f42e..7e4945a7b8 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -129,7 +129,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in
}
if (einfo->errcode) {
- add_next_index_int(info, einfo->errcode);
+ add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg);
}
@@ -161,7 +161,7 @@ static int mysql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
/* }}} */
/* {{{ mysql_handle_preparer */
-static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
+static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt));
@@ -235,12 +235,12 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_
#else
S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND));
S->in_null = ecalloc(S->num_params, sizeof(my_bool));
- S->in_length = ecalloc(S->num_params, sizeof(php_uint_t));
+ S->in_length = ecalloc(S->num_params, sizeof(zend_ulong));
#endif
}
dbh->alloc_own_columns = 1;
- S->max_length = pdo_attr_ival(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC);
+ S->max_length = pdo_attr_lval(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC);
PDO_DBG_RETURN(1);
@@ -253,7 +253,7 @@ end:
/* }}} */
/* {{{ mysql_handle_doer */
-static php_int_t mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC)
+static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC)
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
PDO_DBG_ENTER("mysql_handle_doer");
@@ -368,7 +368,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh TSRMLS_DC)
/* }}} */
/* {{{ pdo_mysql_set_attribute */
-static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC)
+static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
{
PDO_DBG_ENTER("pdo_mysql_set_attribute");
PDO_DBG_INF_FMT("dbh=%p", dbh);
@@ -400,13 +400,13 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSR
PDO_DBG_RETURN(1);
#ifndef PDO_USE_MYSQLND
case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
- convert_to_int(val);
- if (Z_IVAL_P(val) < 0) {
+ convert_to_long(val);
+ if (Z_LVAL_P(val) < 0) {
/* TODO: Johannes, can we throw a warning here? */
((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024;
PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size);
} else {
- ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_IVAL_P(val);
+ ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val);
}
PDO_DBG_RETURN(1);
break;
@@ -419,7 +419,7 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSR
/* }}} */
/* {{{ pdo_mysql_get_attribute */
-static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC)
+static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC)
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
@@ -456,20 +456,20 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_
}
break;
case PDO_ATTR_AUTOCOMMIT:
- ZVAL_INT(return_value, dbh->auto_commit);
+ ZVAL_LONG(return_value, dbh->auto_commit);
break;
case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
- ZVAL_INT(return_value, H->buffered);
+ ZVAL_LONG(return_value, H->buffered);
break;
case PDO_MYSQL_ATTR_DIRECT_QUERY:
- ZVAL_INT(return_value, H->emulate_prepare);
+ ZVAL_LONG(return_value, H->emulate_prepare);
break;
#ifndef PDO_USE_MYSQLND
case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
- ZVAL_INT(return_value, H->max_buffer_size);
+ ZVAL_LONG(return_value, H->max_buffer_size);
break;
#endif
@@ -596,30 +596,30 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
/* handle MySQL options */
if (driver_options) {
- php_int_t connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
- php_int_t local_infile = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC);
+ zend_long connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
+ zend_long local_infile = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC);
char *init_cmd = NULL;
#ifndef PDO_USE_MYSQLND
char *default_file = NULL, *default_group = NULL;
#endif
- php_int_t compress = 0;
+ zend_long compress = 0;
char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL;
- H->buffered = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC);
+ H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC);
- H->emulate_prepare = pdo_attr_ival(driver_options,
+ H->emulate_prepare = pdo_attr_lval(driver_options,
PDO_MYSQL_ATTR_DIRECT_QUERY, H->emulate_prepare TSRMLS_CC);
- H->emulate_prepare = pdo_attr_ival(driver_options,
+ H->emulate_prepare = pdo_attr_lval(driver_options,
PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare TSRMLS_CC);
#ifndef PDO_USE_MYSQLND
- H->max_buffer_size = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC);
+ H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC);
#endif
- if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) {
+ if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) {
connect_opts |= CLIENT_FOUND_ROWS;
}
- if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) {
+ if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) {
connect_opts |= CLIENT_IGNORE_SPACE;
}
@@ -648,7 +648,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
* mysqlnd doesn't support reconnect, thus we don't have "|| defined(PDO_USE_MYSQLND)"
*/
{
- php_int_t reconnect = 1;
+ zend_long reconnect = 1;
mysql_options(H->server, MYSQL_OPT_RECONNECT, (const char*)&reconnect);
}
#endif
@@ -682,7 +682,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
efree(default_group);
}
#endif
- compress = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC);
+ compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC);
if (compress) {
if (mysql_options(H->server, MYSQL_OPT_COMPRESS, 0)) {
pdo_mysql_error(dbh);
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 17a6345432..20d3ede0f6 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -116,10 +116,10 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
{
- php_int_t row_count;
+ zend_long row_count;
pdo_mysql_stmt *S = stmt->driver_data;
- row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt);
- if (row_count != (php_int_t)-1) {
+ row_count = (zend_long) mysql_stmt_affected_rows(S->stmt);
+ if (row_count != (zend_long)-1) {
stmt->row_count = row_count;
}
}
@@ -146,12 +146,12 @@ static int pdo_mysql_fill_stmt_from_result(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
PDO_DBG_RETURN(0);
}
- stmt->row_count = (php_int_t) mysql_num_rows(S->result);
+ stmt->row_count = (zend_long) mysql_num_rows(S->result);
stmt->column_count = (int) mysql_num_fields(S->result);
S->fields = mysql_fetch_fields(S->result);
} else {
/* this was a DML or DDL query (INSERT, UPDATE, DELETE, ... */
- stmt->row_count = (php_int_t) row_count;
+ stmt->row_count = (zend_long) row_count;
}
PDO_DBG_RETURN(1);
@@ -200,7 +200,7 @@ static int pdo_mysql_stmt_execute_prepared_libmysql(pdo_stmt_t *stmt TSRMLS_DC)
stmt->column_count = (int)mysql_num_fields(S->result);
S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND));
S->out_null = ecalloc(stmt->column_count, sizeof(my_bool));
- S->out_length = ecalloc(stmt->column_count, sizeof(php_uint_t));
+ S->out_length = ecalloc(stmt->column_count, sizeof(zend_ulong));
/* summon memory to hold the row */
for (i = 0; i < stmt->column_count; i++) {
@@ -343,7 +343,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
pdo_mysql_db_handle *H = S->H;
#if PDO_USE_MYSQLND
- php_int_t row_count;
+ zend_long row_count;
#endif
PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset");
PDO_DBG_INF_FMT("stmt=%p", S->stmt);
@@ -393,8 +393,8 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
}
}
}
- row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt);
- if (row_count != (php_int_t)-1) {
+ row_count = (zend_long) mysql_stmt_affected_rows(S->stmt);
+ if (row_count != (zend_long)-1) {
stmt->row_count = row_count;
}
PDO_DBG_RETURN(1);
@@ -550,10 +550,10 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
case IS_STRING:
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_VAR_STRING);
break;
- case IS_INT:
-#if SIZEOF_ZEND_INT==8
+ case IS_LONG:
+#if SIZEOF_ZEND_LONG==8
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONGLONG);
-#elif SIZEOF_ZEND_INT==4
+#elif SIZEOF_ZEND_LONG==4
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONG);
#endif /* SIZEOF_LONG */
break;
@@ -576,13 +576,13 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
case IS_STRING:
b->buffer_type = MYSQL_TYPE_STRING;
b->buffer = Z_STRVAL_P(parameter);
- b->buffer_length = Z_STRSIZE_P(parameter);
- *b->length = Z_STRSIZE_P(parameter);
+ b->buffer_length = Z_STRLEN_P(parameter);
+ *b->length = Z_STRLEN_P(parameter);
PDO_DBG_RETURN(1);
- case IS_INT:
+ case IS_LONG:
b->buffer_type = MYSQL_TYPE_LONG;
- b->buffer = &Z_IVAL_P(parameter);
+ b->buffer = &Z_LVAL_P(parameter);
PDO_DBG_RETURN(1);
case IS_DOUBLE:
@@ -608,7 +608,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
}
/* }}} */
-static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) /* {{{ */
+static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) /* {{{ */
{
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
#if PDO_USE_MYSQLND
@@ -722,7 +722,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{
}
/* }}} */
-static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) /* {{{ */
+static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC) /* {{{ */
{
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
@@ -823,7 +823,7 @@ static char *type_to_name_native(int type) /* {{{ */
#undef PDO_MYSQL_NATIVE_TYPE_NAME
} /* }}} */
-static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) /* {{{ */
+static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC) /* {{{ */
{
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
const MYSQL_FIELD *F;
@@ -879,10 +879,10 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *retu
#if SIZEOF_LONG==8
case MYSQL_TYPE_LONGLONG:
#endif
- add_assoc_int(return_value, "pdo_type", PDO_PARAM_INT);
+ add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT);
break;
default:
- add_assoc_int(return_value, "pdo_type", PDO_PARAM_STR);
+ add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
break;
}
#endif
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index f57e06ca37..d9c04470a4 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -106,25 +106,25 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
{
REGISTER_INI_ENTRIES();
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_USE_BUFFERED_QUERY", (php_int_t)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_LOCAL_INFILE", (php_int_t)PDO_MYSQL_ATTR_LOCAL_INFILE);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_INIT_COMMAND", (php_int_t)PDO_MYSQL_ATTR_INIT_COMMAND);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY", (zend_long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE", (zend_long)PDO_MYSQL_ATTR_LOCAL_INFILE);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND", (zend_long)PDO_MYSQL_ATTR_INIT_COMMAND);
#ifndef PDO_USE_MYSQLND
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_MAX_BUFFER_SIZE", (php_int_t)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_FILE", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_FILE);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_GROUP", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MAX_BUFFER_SIZE", (zend_long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE", (zend_long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (zend_long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP);
#endif
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_COMPRESS", (php_int_t)PDO_MYSQL_ATTR_COMPRESS);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_DIRECT_QUERY", (php_int_t)PDO_MYSQL_ATTR_DIRECT_QUERY);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_FOUND_ROWS", (php_int_t)PDO_MYSQL_ATTR_FOUND_ROWS);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_IGNORE_SPACE", (php_int_t)PDO_MYSQL_ATTR_IGNORE_SPACE);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_KEY", (php_int_t)PDO_MYSQL_ATTR_SSL_KEY);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CERT", (php_int_t)PDO_MYSQL_ATTR_SSL_CERT);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CA", (php_int_t)PDO_MYSQL_ATTR_SSL_CA);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CAPATH", (php_int_t)PDO_MYSQL_ATTR_SSL_CAPATH);
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CIPHER", (php_int_t)PDO_MYSQL_ATTR_SSL_CIPHER);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (zend_long)PDO_MYSQL_ATTR_COMPRESS);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (zend_long)PDO_MYSQL_ATTR_DIRECT_QUERY);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS", (zend_long)PDO_MYSQL_ATTR_FOUND_ROWS);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE", (zend_long)PDO_MYSQL_ATTR_IGNORE_SPACE);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_KEY", (zend_long)PDO_MYSQL_ATTR_SSL_KEY);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CERT", (zend_long)PDO_MYSQL_ATTR_SSL_CERT);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (zend_long)PDO_MYSQL_ATTR_SSL_CA);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (zend_long)PDO_MYSQL_ATTR_SSL_CAPATH);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (zend_long)PDO_MYSQL_ATTR_SSL_CIPHER);
#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
- REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SERVER_PUBLIC_KEY", (php_int_t)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY);
+ REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (zend_long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY);
#endif
diff --git a/ext/pdo_mysql/php_pdo_mysql.h b/ext/pdo_mysql/php_pdo_mysql.h
index e4d37c88ab..b5f6afd9eb 100644
--- a/ext/pdo_mysql/php_pdo_mysql.h
+++ b/ext/pdo_mysql/php_pdo_mysql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index fe2d216a5f..f6cdb0a8f2 100644
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -106,7 +106,7 @@ typedef struct {
unsigned fetch_table_names:1;
unsigned _reserved:31;
#if !PDO_USE_MYSQLND
- php_uint_t max_buffer_size;
+ zend_ulong max_buffer_size;
#endif
pdo_mysql_error_info einfo;
@@ -122,9 +122,9 @@ typedef struct {
const MYSQL_FIELD *fields;
MYSQL_ROW current_data;
#if PDO_USE_MYSQLND
- php_uint_t *current_lengths;
+ zend_ulong *current_lengths;
#else
- php_int_t *current_lengths;
+ zend_long *current_lengths;
#endif
pdo_mysql_error_info einfo;
#if PDO_USE_MYSQLND
@@ -136,11 +136,11 @@ typedef struct {
PDO_MYSQL_PARAM_BIND *params;
#ifndef PDO_USE_MYSQLND
my_bool *in_null;
- php_uint_t *in_length;
+ zend_ulong *in_length;
#endif
PDO_MYSQL_PARAM_BIND *bound_result;
my_bool *out_null;
- php_uint_t *out_length;
+ zend_ulong *out_length;
unsigned int params_given;
unsigned max_length:1;
} pdo_mysql_stmt;
diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
index 22d36183cb..fb7e9a9d0a 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
@@ -30,4 +30,4 @@ MySQLPDOTest::skip();
}
?>
--EXPECTF--
-done! \ No newline at end of file
+done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
index 224684b878..0beca905cd 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
@@ -93,4 +93,4 @@ array(1) {
Warning: PDO::prepare(): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unknown_column' in 'field list' in %s on line %d
-Fatal error: Call to a member function execute() on boolean in %s on line %d
+Catchable fatal error: Call to a member function execute() on boolean in %s on line %d
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
index b7b0ab6294..fc5554722f 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
@@ -36,4 +36,4 @@ Warning: PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number: mixed named
Warning: PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
-Fatal error: Call to a member function execute() on boolean in %s on line %d
+Catchable fatal error: Call to a member function execute() on boolean in %s on line %d
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
index c16ce5dd1c..36295e9c5e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
@@ -56,4 +56,4 @@ Testing native PS...
Warning: PDO::prepare(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d
-Fatal error: Call to a member function execute() on boolean in %s on line %d
+Catchable fatal error: Call to a member function execute() on boolean in %s on line %d
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
index 52ecc912d4..278cd4e7f8 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
@@ -99,4 +99,4 @@ Native Prepared Statements...
Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near '%SSELECT label FROM test ORDER BY id ASC LIMIT 1' at line %d in %s on line %d
-Fatal error: Call to a member function errorInfo() on boolean in %s on line %d
+Catchable fatal error: Call to a member function errorInfo() on boolean in %s on line %d \ No newline at end of file
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 279fda7439..9132999461 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -49,7 +49,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info
}
if (einfo->errcode) {
- add_next_index_int(info, einfo->errcode);
+ add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg);
}
@@ -258,7 +258,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd
int ret;
#if HAVE_OCISTMTFETCH2
- S->exec_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR,
+ S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL ?
OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT;
#else
@@ -302,7 +302,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd
}
- prefetch = pdo_oci_sanitize_prefetch(pdo_attr_ival(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC));
+ prefetch = pdo_oci_sanitize_prefetch(pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC));
if (prefetch) {
H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0,
OCI_ATTR_PREFETCH_ROWS, H->err);
@@ -456,9 +456,9 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_
dbh->in_txn = 0;
}
- convert_to_int(val);
+ convert_to_long(val);
- dbh->auto_commit = Z_IVAL_P(val);
+ dbh->auto_commit = Z_LVAL_P(val);
return 1;
} else {
return 0;
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index 226e3ee493..7c86a23dcc 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -209,7 +209,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv
/* regular string bind */
convert_to_string(param->parameter);
*bufpp = Z_STRVAL_P(param->parameter);
- *alenp = Z_STRSIZE_P(param->parameter);
+ *alenp = Z_STRLEN_P(param->parameter);
}
*piecep = OCI_ONE_PIECE;
@@ -244,11 +244,11 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d
convert_to_string(param->parameter);
zval_dtor(param->parameter);
- Z_STRSIZE_P(param->parameter) = param->max_value_len;
- Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRSIZE_P(param->parameter)+1);
+ Z_STRLEN_P(param->parameter) = param->max_value_len;
+ Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRLEN_P(param->parameter)+1);
P->used_for_output = 1;
- P->actual_len = Z_STRSIZE_P(param->parameter);
+ P->actual_len = Z_STRLEN_P(param->parameter);
*alenpp = &P->actual_len;
*bufpp = Z_STRVAL_P(param->parameter);
*piecep = OCI_ONE_PIECE;
@@ -360,7 +360,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
&& Z_STRVAL_P(param->parameter) != empty_string
#endif
) {
- Z_STRSIZE_P(param->parameter) = P->actual_len;
+ Z_STRLEN_P(param->parameter) = P->actual_len;
Z_STRVAL_P(param->parameter) = erealloc(Z_STRVAL_P(param->parameter), P->actual_len+1);
Z_STRVAL_P(param->parameter)[P->actual_len] = '\0';
}
@@ -410,7 +410,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
} else if (Z_TYPE_P(param->parameter) == IS_STRING) {
/* stick the string into the LOB */
consume = Z_STRVAL_P(param->parameter);
- n = Z_STRSIZE_P(param->parameter);
+ n = Z_STRLEN_P(param->parameter);
if (n) {
OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE);
while (n) {
diff --git a/ext/pdo_oci/pdo_oci.c b/ext/pdo_oci/pdo_oci.c
index 8eabb7e7c5..896f392664 100644
--- a/ext/pdo_oci/pdo_oci.c
+++ b/ext/pdo_oci/pdo_oci.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_oci/php_pdo_oci.h b/ext/pdo_oci/php_pdo_oci.h
index 3299dfe269..3448638fc1 100644
--- a/ext/pdo_oci/php_pdo_oci.h
+++ b/ext/pdo_oci/php_pdo_oci.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h
index 4979aadb13..36d45d0af7 100644
--- a/ext/pdo_oci/php_pdo_oci_int.h
+++ b/ext/pdo_oci/php_pdo_oci_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 3a7bf0a37b..c0034d43ea 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -48,7 +48,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf
einfo->what, einfo->last_error,
einfo->file, einfo->line);
- add_next_index_int(info, einfo->last_error);
+ add_next_index_long(info, einfo->last_error);
add_next_index_str(info, message);
add_next_index_string(info, einfo->last_state);
@@ -142,7 +142,7 @@ static int odbc_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
return 0;
}
-static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
+static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
RETCODE rc;
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
@@ -181,7 +181,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_l
return 0;
}
- cursor_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC);
+ cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC);
if (cursor_type != PDO_CURSOR_FWDONLY) {
rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
@@ -220,7 +220,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_l
return 1;
}
-static php_int_t odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC)
+static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC)
{
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
RETCODE rc;
@@ -336,7 +336,7 @@ static int odbc_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
return 1;
}
-static int odbc_handle_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC)
+static int odbc_handle_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
{
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
switch (attr) {
@@ -351,7 +351,7 @@ static int odbc_handle_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS
}
}
-static int odbc_handle_get_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC)
+static int odbc_handle_get_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
{
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
switch (attr) {
@@ -431,7 +431,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D
}
/* set up the cursor library, if needed, or if configured explicitly */
- cursor_lib = pdo_attr_ival(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC);
+ cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC);
rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_INTEGER);
if (rc != SQL_SUCCESS && cursor_lib != SQL_CUR_USE_IF_NEEDED) {
pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS");
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 7e2b958a53..7491ec685d 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -58,7 +58,7 @@ static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype)
}
static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
- php_uint_t buflen, php_uint_t *outlen)
+ zend_ulong buflen, zend_ulong *outlen)
{
#ifdef PHP_WIN32
if (is_unicode && buflen) {
@@ -93,7 +93,7 @@ static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf,
}
static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf,
- php_uint_t buflen, php_uint_t *outlen)
+ zend_ulong buflen, zend_ulong *outlen)
{
#ifdef PHP_WIN32
if (is_unicode && buflen) {
@@ -190,16 +190,16 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
}
if (Z_TYPE_P(parameter) != IS_RESOURCE) {
/* they passed in a string */
- php_uint_t ulen;
+ zend_ulong ulen;
convert_to_string(parameter);
switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode,
Z_STRVAL_P(parameter),
- Z_STRSIZE_P(parameter),
+ Z_STRLEN_P(parameter),
&ulen)) {
case PDO_ODBC_CONV_NOT_REQUIRED:
SQLPutData(S->stmt, Z_STRVAL_P(parameter),
- Z_STRSIZE_P(parameter));
+ Z_STRLEN_P(parameter));
break;
case PDO_ODBC_CONV_OK:
SQLPutData(S->stmt, S->convbuf, ulen);
@@ -447,10 +447,10 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
} else {
convert_to_string(parameter);
if (P->outbuf) {
- P->len = Z_STRSIZE_P(parameter);
+ P->len = Z_STRLEN_P(parameter);
memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len);
} else {
- P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter));
+ P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter));
}
}
} else if (Z_TYPE_P(parameter) == IS_NULL || PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL) {
@@ -458,14 +458,14 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
} else {
convert_to_string(parameter);
if (P->outbuf) {
- php_uint_t ulen;
+ zend_ulong ulen;
switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode,
Z_STRVAL_P(parameter),
- Z_STRSIZE_P(parameter),
+ Z_STRLEN_P(parameter),
&ulen)) {
case PDO_ODBC_CONV_FAIL:
case PDO_ODBC_CONV_NOT_REQUIRED:
- P->len = Z_STRSIZE_P(parameter);
+ P->len = Z_STRLEN_P(parameter);
memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len);
break;
case PDO_ODBC_CONV_OK:
@@ -474,7 +474,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
break;
}
} else {
- P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter));
+ P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter));
}
}
return 1;
@@ -483,9 +483,9 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
P = param->driver_data;
if (P->outbuf) {
- php_uint_t ulen;
+ zend_ulong ulen;
char *srcbuf;
- php_uint_t srclen = 0;
+ zend_ulong srclen = 0;
if (Z_ISREF(param->parameter)) {
parameter = Z_REFVAL(param->parameter);
@@ -512,9 +512,9 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
break;
}
- ZVAL_NEW_STR(parameter, STR_ALLOC(srclen, 0));
+ ZVAL_NEW_STR(parameter, zend_string_alloc(srclen, 0));
memcpy(Z_STRVAL_P(parameter), srcbuf, srclen);
- Z_STRVAL_P(parameter)[Z_STRSIZE_P(parameter)] = '\0';
+ Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0';
}
}
return 1;
@@ -524,7 +524,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
}
static int odbc_stmt_fetch(pdo_stmt_t *stmt,
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC)
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC)
{
RETCODE rc;
SQLSMALLINT odbcori;
@@ -628,15 +628,15 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
return 1;
}
-static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC)
+static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC)
{
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
pdo_odbc_column *C = &S->cols[colno];
- php_uint_t ulen;
+ zend_ulong ulen;
/* if it is a column containing "long" data, perform late binding now */
if (C->is_long) {
- php_uint_t used = 0;
+ zend_ulong used = 0;
char *buf;
RETCODE rc;
@@ -755,7 +755,7 @@ in_data:
return 1;
}
-static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC)
+static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC)
{
SQLRETURN rc;
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
@@ -763,7 +763,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRML
switch (attr) {
case PDO_ATTR_CURSOR_NAME:
convert_to_string(val);
- rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val));
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
return 1;
@@ -782,7 +782,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRML
}
}
-static int odbc_stmt_get_attr(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC)
+static int odbc_stmt_get_attr(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC)
{
SQLRETURN rc;
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index f78b1af8ec..914b8bc980 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -136,11 +136,11 @@ PHP_MINIT_FUNCTION(pdo_odbc)
}
#endif
- REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY);
- REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8);
- REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED);
- REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER);
- REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC);
+ REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY);
+ REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8);
+ REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED);
+ REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER);
+ REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC);
return SUCCESS;
}
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index cd01ae45e5..52e8e6f8e7 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index c467ecf83a..0d6d488b65 100644
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -135,7 +135,7 @@ typedef struct {
typedef struct {
char *data;
- php_uint_t datalen;
+ zend_ulong datalen;
SQLLEN fetched_len;
SWORD coltype;
char colname[128];
@@ -150,7 +150,7 @@ typedef struct {
pdo_odbc_db_handle *H;
pdo_odbc_errinfo einfo;
char *convbuf;
- php_uint_t convbufsize;
+ zend_ulong convbufsize;
unsigned going_long:1;
unsigned assume_utf8:1;
unsigned _spare:30;
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
index fc7aa827ab..5ca4b07a23 100644
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ b/ext/pdo_pgsql/pdo_pgsql.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -85,13 +85,13 @@ ZEND_GET_MODULE(pdo_pgsql)
*/
PHP_MINIT_FUNCTION(pdo_pgsql)
{
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_IDLE", (php_int_t)PGSQL_TRANSACTION_IDLE);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_ACTIVE", (php_int_t)PGSQL_TRANSACTION_ACTIVE);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INTRANS", (php_int_t)PGSQL_TRANSACTION_INTRANS);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INERROR", (php_int_t)PGSQL_TRANSACTION_INERROR);
- REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_UNKNOWN", (php_int_t)PGSQL_TRANSACTION_UNKNOWN);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
+ REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
php_pdo_register_driver(&pdo_pgsql_driver);
return SUCCESS;
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 809ee34f7c..327d70218b 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -113,7 +113,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in
pdo_pgsql_error_info *einfo = &H->einfo;
if (einfo->errcode) {
- add_next_index_int(info, einfo->errcode);
+ add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg);
}
@@ -151,8 +151,8 @@ static int pgsql_lob_flush(php_stream *stream TSRMLS_DC)
return 0;
}
-static int pgsql_lob_seek(php_stream *stream, php_off_t offset, int whence,
- php_off_t *newoffset TSRMLS_DC)
+static int pgsql_lob_seek(php_stream *stream, zend_off_t offset, int whence,
+ zend_off_t *newoffset TSRMLS_DC)
{
struct pdo_pgsql_lob_self *self = (struct pdo_pgsql_lob_self*)stream->abstract;
int pos = lo_lseek(self->conn, self->lfd, offset, whence);
@@ -214,7 +214,7 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
+static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt));
@@ -229,7 +229,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_
stmt->driver_data = S;
stmt->methods = &pgsql_stmt_methods;
- scrollable = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR,
+ scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL;
if (scrollable) {
@@ -239,14 +239,14 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_
spprintf(&S->cursor_name, 0, "pdo_crsr_%08x", ++H->stmt_counter);
emulate = 1;
} else if (driver_options) {
- if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) {
+ if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) {
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead");
emulate = 1;
}
- if (pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) {
+ if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) {
emulate = 1;
}
- if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) {
+ if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) {
execute_only = 1;
}
} else {
@@ -287,11 +287,11 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_
return 1;
}
-static php_int_t pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC)
+static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
PGresult *res;
- php_int_t ret = 1;
+ zend_long ret = 1;
ExecStatusType qs;
if (!(res = PQexec(H->server, sql))) {
@@ -307,9 +307,9 @@ static php_int_t pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sq
}
H->pgoid = PQoidValue(res);
if (qs == PGRES_COMMAND_OK) {
- ZEND_ATOI(ret, PQcmdTuples(res));
+ ZEND_ATOL(ret, PQcmdTuples(res));
} else {
- ret = Z_I(0);
+ ret = Z_L(0);
}
PQclear(res);
@@ -354,7 +354,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned
if (H->pgoid == InvalidOid) {
return NULL;
}
- *len = spprintf(&id, 0, ZEND_INT_FMT, (php_int_t) H->pgoid);
+ *len = spprintf(&id, 0, ZEND_LONG_FMT, (zend_long) H->pgoid);
} else {
PGresult *res;
ExecStatusType status;
@@ -377,7 +377,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned
return id;
}
-static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC)
+static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
@@ -522,7 +522,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
zval *pg_rows;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL, *pg_fields = NULL;
- int table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
+ size_t table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
char *query;
PGresult *pgsql_result;
@@ -577,12 +577,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
int query_len;
convert_to_string_ex(tmp);
- if (buffer_len < Z_STRSIZE_P(tmp)) {
- buffer_len = Z_STRSIZE_P(tmp);
+ if (buffer_len < Z_STRLEN_P(tmp)) {
+ buffer_len = Z_STRLEN_P(tmp);
query = erealloc(query, buffer_len + 2); /* room for \n\0 */
}
- memcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
- query_len = Z_STRSIZE_P(tmp);
+ memcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ query_len = Z_STRLEN_P(tmp);
if (query[query_len - 1] != '\n') {
query[query_len++] = '\n';
}
@@ -631,7 +631,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile)
pdo_pgsql_db_handle *H;
char *table_name, *filename, *pg_delim = NULL, *pg_null_as = NULL, *pg_fields = NULL;
- int table_name_len, filename_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
+ size_t table_name_len, filename_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
char *query;
PGresult *pgsql_result;
ExecStatusType status;
@@ -730,7 +730,7 @@ static PHP_METHOD(PDO, pgsqlCopyToFile)
pdo_pgsql_db_handle *H;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL, *pg_fields = NULL, *filename = NULL;
- int table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len, filename_len;
+ size_t table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len, filename_len;
char *query;
PGresult *pgsql_result;
@@ -825,7 +825,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray)
pdo_pgsql_db_handle *H;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL, *pg_fields = NULL;
- int table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
+ size_t table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len;
char *query;
PGresult *pgsql_result;
@@ -910,7 +910,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate)
lfd = lo_creat(H->server, INV_READ|INV_WRITE);
if (lfd != InvalidOid) {
- zend_string *buf = strpprintf(0, ZEND_UINT_FMT, (php_int_t) lfd);
+ zend_string *buf = strpprintf(0, ZEND_ULONG_FMT, (zend_long) lfd);
RETURN_STR(buf);
}
@@ -930,9 +930,9 @@ static PHP_METHOD(PDO, pgsqlLOBOpen)
Oid oid;
int lfd;
char *oidstr;
- int oidstrlen;
+ size_t oidstrlen;
char *modestr = "rb";
- int modestrlen;
+ size_t modestrlen;
int mode = INV_READ;
char *end_ptr;
@@ -981,7 +981,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
pdo_pgsql_db_handle *H;
Oid oid;
char *oidstr, *end_ptr;
- int oidlen;
+ size_t oidlen;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&oidstr, &oidlen)) {
@@ -1015,11 +1015,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
{
pdo_dbh_t *dbh;
pdo_pgsql_db_handle *H;
- php_int_t result_type = PDO_FETCH_USE_DEFAULT;
- php_int_t ms_timeout = 0;
+ zend_long result_type = PDO_FETCH_USE_DEFAULT;
+ zend_long ms_timeout = 0;
PGnotify *pgsql_notify;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll",
&result_type, &ms_timeout)) {
RETURN_FALSE;
}
@@ -1060,11 +1060,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
array_init(return_value);
if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) {
add_index_string(return_value, 0, pgsql_notify->relname);
- add_index_int(return_value, 1, pgsql_notify->be_pid);
+ add_index_long(return_value, 1, pgsql_notify->be_pid);
}
if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) {
add_assoc_string(return_value, "message", pgsql_notify->relname);
- add_assoc_int(return_value, "pid", pgsql_notify->be_pid);
+ add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
}
PQfreemem(pgsql_notify);
@@ -1083,7 +1083,7 @@ static PHP_METHOD(PDO, pgsqlGetPid)
H = (pdo_pgsql_db_handle *)dbh->driver_data;
- RETURN_INT(PQbackendPID(H->server));
+ RETURN_LONG(PQbackendPID(H->server));
}
/* }}} */
@@ -1111,23 +1111,23 @@ static const zend_function_entry *pdo_pgsql_get_driver_methods(pdo_dbh_t *dbh, i
}
}
-static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC)
+static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
switch (attr) {
case PDO_ATTR_EMULATE_PREPARES:
- convert_to_int(val);
- H->emulate_prepares = Z_IVAL_P(val);
+ convert_to_long(val);
+ H->emulate_prepares = Z_LVAL_P(val);
return 1;
case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT:
- convert_to_int(val);
+ convert_to_long(val);
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead");
- H->disable_native_prepares = Z_IVAL_P(val);
+ H->disable_native_prepares = Z_LVAL_P(val);
return 1;
case PDO_PGSQL_ATTR_DISABLE_PREPARES:
- convert_to_int(val);
- H->disable_prepares = Z_IVAL_P(val);
+ convert_to_long(val);
+ H->disable_prepares = Z_LVAL_P(val);
return 1;
default:
return 0;
@@ -1158,7 +1158,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
int ret = 0;
char *conn_str, *p, *e;
char *tmp_pass;
- php_int_t connect_timeout = 30;
+ zend_long connect_timeout = 30;
H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent);
dbh->driver_data = H;
@@ -1176,7 +1176,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
}
if (driver_options) {
- connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
+ connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC);
}
if (dbh->password) {
@@ -1204,13 +1204,13 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
/* support both full connection string & connection string + login and/or password */
if (dbh->username && dbh->password) {
- spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%ld", dbh->data_source, dbh->username, tmp_pass, connect_timeout);
+ spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%pd", dbh->data_source, dbh->username, tmp_pass, connect_timeout);
} else if (dbh->username) {
- spprintf(&conn_str, 0, "%s user=%s connect_timeout=%ld", dbh->data_source, dbh->username, connect_timeout);
+ spprintf(&conn_str, 0, "%s user=%s connect_timeout=%pd", dbh->data_source, dbh->username, connect_timeout);
} else if (dbh->password) {
- spprintf(&conn_str, 0, "%s password=%s connect_timeout=%ld", dbh->data_source, tmp_pass, connect_timeout);
+ spprintf(&conn_str, 0, "%s password=%s connect_timeout=%pd", dbh->data_source, tmp_pass, connect_timeout);
} else {
- spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
+ spprintf(&conn_str, 0, "%s connect_timeout=%pd", (char *) dbh->data_source, connect_timeout);
}
H->server = PQconnectdb(conn_str);
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index eb13548558..05b8f79b27 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -230,10 +230,10 @@ stmt_retry:
}
if (status == PGRES_COMMAND_OK) {
- ZEND_ATOI(stmt->row_count, PQcmdTuples(S->result));
+ ZEND_ATOL(stmt->row_count, PQcmdTuples(S->result));
H->pgoid = PQoidValue(S->result);
} else {
- stmt->row_count = (php_int_t)PQntuples(S->result);
+ stmt->row_count = (zend_long)PQntuples(S->result);
}
return 1;
@@ -256,14 +256,14 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
/* decode name from $1, $2 into 0, 1 etc. */
if (param->name) {
if (param->name->val[0] == '$') {
- ZEND_ATOI(param->paramno, param->name->val + 1);
+ ZEND_ATOL(param->paramno, param->name->val + 1);
} else {
/* resolve parameter name to rewritten name */
char *namevar;
if (stmt->bound_param_map && (namevar = zend_hash_find_ptr(stmt->bound_param_map,
param->name)) != NULL) {
- ZEND_ATOI(param->paramno, namevar + 1);
+ ZEND_ATOL(param->paramno, namevar + 1);
param->paramno--;
} else {
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", param->name->val TSRMLS_CC);
@@ -359,7 +359,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
//SEPARATE_ZVAL_IF_NOT_REF(&param->parameter);
convert_to_string_ex(parameter);
S->param_values[param->paramno] = Z_STRVAL_P(parameter);
- S->param_lengths[param->paramno] = Z_STRSIZE_P(parameter);
+ S->param_lengths[param->paramno] = Z_STRLEN_P(parameter);
S->param_formats[param->paramno] = 0;
}
@@ -391,7 +391,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
}
static int pgsql_stmt_fetch(pdo_stmt_t *stmt,
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC)
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC)
{
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
@@ -480,7 +480,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
break;
case INT8OID:
- if (sizeof(php_int_t)>=8) {
+ if (sizeof(zend_long)>=8) {
cols[colno].param_type = PDO_PARAM_INT;
} else {
cols[colno].param_type = PDO_PARAM_STR;
@@ -498,7 +498,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
return 1;
}
-static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC)
+static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC)
{
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
struct pdo_column_data *cols = stmt->columns;
@@ -519,9 +519,9 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_
switch (cols[colno].param_type) {
case PDO_PARAM_INT:
- ZEND_ATOI(S->cols[colno].intval, *ptr);
+ ZEND_ATOL(S->cols[colno].intval, *ptr);
*ptr = (char *) &(S->cols[colno].intval);
- *len = sizeof(php_int_t);
+ *len = sizeof(zend_long);
break;
case PDO_PARAM_BOOL:
@@ -577,7 +577,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_
return 1;
}
-static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC)
+static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC)
{
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
PGresult *res;
@@ -593,7 +593,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *r
}
array_init(return_value);
- add_assoc_int(return_value, "pgsql:oid", S->cols[colno].pgsql_type);
+ add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type);
/* Fetch metadata from Postgres system catalogue */
spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type);
diff --git a/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h
index 9c01d9886c..31d89096ad 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h
index 0462daff1f..722d63706e 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql_int.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,7 +54,7 @@ typedef struct {
typedef struct {
char *def;
Oid pgsql_type;
- php_int_t intval;
+ zend_long intval;
zend_bool boolval;
} pdo_pgsql_column;
diff --git a/ext/pdo_pgsql/tests/getnotify.phpt b/ext/pdo_pgsql/tests/getnotify.phpt
index c093e0357a..c54a31604d 100644
--- a/ext/pdo_pgsql/tests/getnotify.phpt
+++ b/ext/pdo_pgsql/tests/getnotify.phpt
@@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
// Test second parameter, should wait 2 seconds because no notify is queued
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
-var_dump((microtime(1) - $t) >= 1);
+$diff = microtime(1) - $t;
+var_dump($diff >= 1 || 1 - abs($diff) < .01);
var_dump($notify);
// Test second parameter, should return immediately because a notify is queued
$db->exec("NOTIFY notifies_phpt");
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
-var_dump((microtime(1) - $t) < 1);
+$diff = microtime(1) - $t;
+var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
var_dump(count($notify));
?>
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 33cffee821..0014de4e3b 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_sqlite/php_pdo_sqlite.h b/ext/pdo_sqlite/php_pdo_sqlite.h
index 607b3ddedb..9413e1bb70 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h
index 188856a3d1..133893bf8f 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite_int.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 50887b4bb3..413b50b9d4 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -92,7 +92,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i
pdo_sqlite_error_info *einfo = &H->einfo;
if (einfo->errcode) {
- add_next_index_int(info, einfo->errcode);
+ add_next_index_long(info, einfo->errcode);
add_next_index_string(info, einfo->errmsg);
}
@@ -175,7 +175,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
+static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
{
pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt));
@@ -187,7 +187,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql
stmt->methods = &sqlite_stmt_methods;
stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED;
- if (PDO_CURSOR_FWDONLY != pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
+ if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
H->einfo.errcode = SQLITE_ERROR;
pdo_sqlite_error(dbh);
return 0;
@@ -203,7 +203,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql
return 0;
}
-static php_int_t sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC)
+static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC)
{
pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
char *errmsg = NULL;
@@ -280,7 +280,7 @@ static int sqlite_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
return 1;
}
-static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC)
+static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC)
{
switch (attr) {
case PDO_ATTR_CLIENT_VERSION:
@@ -295,14 +295,14 @@ static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return
return 1;
}
-static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC)
+static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC)
{
pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
switch (attr) {
case PDO_ATTR_TIMEOUT:
- convert_to_int(val);
- sqlite3_busy_timeout(H->db, Z_IVAL_P(val) * 1000);
+ convert_to_long(val);
+ sqlite3_busy_timeout(H->db, Z_LVAL_P(val) * 1000);
return 1;
}
return 0;
@@ -351,14 +351,14 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb,
}
ZVAL_REF(&zargs[0], agg_context);
}
- ZVAL_INT(&zargs[1], sqlite3_aggregate_count(context));
+ ZVAL_LONG(&zargs[1], sqlite3_aggregate_count(context));
}
for (i = 0; i < argc; i++) {
/* get the value */
switch (sqlite3_value_type(argv[i])) {
case SQLITE_INTEGER:
- ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i]));
+ ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i]));
break;
case SQLITE_FLOAT:
@@ -399,8 +399,8 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb,
* or if we are finalizing an aggregate */
if (!Z_ISUNDEF(retval)) {
switch (Z_TYPE(retval)) {
- case IS_INT:
- sqlite3_result_int(context, Z_IVAL(retval));
+ case IS_LONG:
+ sqlite3_result_int(context, Z_LVAL(retval));
break;
case IS_NULL:
@@ -413,7 +413,7 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb,
default:
convert_to_string_ex(&retval);
- sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT);
+ sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT);
break;
}
} else {
@@ -496,13 +496,13 @@ static int php_sqlite3_collation_callback(void *context,
if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc TSRMLS_CC)) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback");
} else if (!Z_ISUNDEF(retval)) {
- if (Z_TYPE(retval) != IS_INT) {
- convert_to_int_ex(&retval);
+ if (Z_TYPE(retval) != IS_LONG) {
+ convert_to_long_ex(&retval);
}
ret = 0;
- if (Z_IVAL(retval) > 0) {
+ if (Z_LVAL(retval) > 0) {
ret = 1;
- } else if (Z_IVAL(retval) < 0) {
+ } else if (Z_LVAL(retval) < 0) {
ret = -1;
}
zval_ptr_dtor(&retval);
@@ -521,14 +521,14 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
struct pdo_sqlite_func *func;
zval *callback;
char *func_name;
- int func_name_len;
- php_int_t argc = -1;
+ size_t func_name_len;
+ zend_long argc = -1;
zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l",
&func_name, &func_name_len, &callback, &argc)) {
RETURN_FALSE;
}
@@ -538,10 +538,10 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val);
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
RETURN_FALSE;
}
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
@@ -591,14 +591,14 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
struct pdo_sqlite_func *func;
zval *step_callback, *fini_callback;
char *func_name;
- int func_name_len;
- php_int_t argc = -1;
+ size_t func_name_len;
+ zend_long argc = -1;
zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
int ret;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l",
&func_name, &func_name_len, &step_callback, &fini_callback, &argc)) {
RETURN_FALSE;
}
@@ -608,16 +608,16 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
if (!zend_is_callable(step_callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val);
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
RETURN_FALSE;
}
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
if (!zend_is_callable(fini_callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val);
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
RETURN_FALSE;
}
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
@@ -652,7 +652,7 @@ static PHP_METHOD(SQLite, sqliteCreateCollation)
struct pdo_sqlite_collation *collation;
zval *callback;
char *collation_name;
- int collation_name_len;
+ size_t collation_name_len;
zend_string *cbname = NULL;
pdo_dbh_t *dbh;
pdo_sqlite_db_handle *H;
@@ -668,10 +668,10 @@ static PHP_METHOD(SQLite, sqliteCreateCollation)
if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val);
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
RETURN_FALSE;
}
- STR_RELEASE(cbname);
+ zend_string_release(cbname);
H = (pdo_sqlite_db_handle *)dbh->driver_data;
@@ -792,7 +792,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS
{
pdo_sqlite_db_handle *H;
int i, ret = 0;
- php_int_t timeout = 60;
+ zend_long timeout = 60;
char *filename;
H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent);
@@ -823,7 +823,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS
}
if (driver_options) {
- timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC);
+ timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC);
}
sqlite3_busy_timeout(H->db, timeout * 1000);
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index ee6879544a..378d8bb337 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -117,13 +117,13 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
return 1;
}
} else {
- convert_to_int(parameter);
-#if PHP_INT_MAX > 2147483647
- if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) {
+ convert_to_long(parameter);
+#if ZEND_LONG_MAX > 2147483647
+ if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) {
return 1;
}
#else
- if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) {
+ if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) {
return 1;
}
#endif
@@ -159,7 +159,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
if (SQLITE_OK == sqlite3_bind_blob(S->stmt, param->paramno + 1,
Z_STRVAL_P(parameter),
- Z_STRSIZE_P(parameter),
+ Z_STRLEN_P(parameter),
SQLITE_STATIC)) {
return 1;
}
@@ -180,7 +180,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
convert_to_string(parameter);
if (SQLITE_OK == sqlite3_bind_text(S->stmt, param->paramno + 1,
Z_STRVAL_P(parameter),
- Z_STRSIZE_P(parameter),
+ Z_STRLEN_P(parameter),
SQLITE_STATIC)) {
return 1;
}
@@ -198,7 +198,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
}
static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt,
- enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC)
+ enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC)
{
pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
int i;
@@ -259,7 +259,7 @@ static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
return 1;
}
-static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC)
+static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC)
{
pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
if (!S->stmt) {
@@ -288,7 +288,7 @@ static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_
}
}
-static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC)
+static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC)
{
pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
const char *str;
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index d1fc89d69e..207764b165 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,7 +35,7 @@
#include "php.h"
#include "php_ini.h"
#include "ext/standard/php_standard.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/ereg/php_regex.h"
#ifdef PHP_WIN32
# include "win32/time.h"
@@ -63,21 +63,21 @@
#define PGSQL_STATUS_LONG 1
#define PGSQL_STATUS_STRING 2
-#define PGSQL_MAX_LENGTH_OF_ZEND_INT 30
+#define PGSQL_MAX_LENGTH_OF_LONG 30
#define PGSQL_MAX_LENGTH_OF_DOUBLE 60
-#if PHP_INT_MAX < UINT_MAX
+#if ZEND_LONG_MAX < UINT_MAX
#define PGSQL_RETURN_OID(oid) do { \
- if (oid > PHP_INT_MAX) { \
+ if (oid > ZEND_LONG_MAX) { \
smart_str s = {0}; \
smart_str_append_unsigned(&s, oid); \
smart_str_0(&s); \
RETURN_STR(s.s); \
} \
- RETURN_INT((php_int_t)oid); \
+ RETURN_LONG((zend_long)oid); \
} while(0)
#else
-#define PGSQL_RETURN_OID(oid) RETURN_INT((php_int_t)oid)
+#define PGSQL_RETURN_OID(oid) RETURN_LONG((zend_long)oid)
#endif
#if HAVE_PQSETNONBLOCKING
@@ -877,9 +877,9 @@ static char *php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le
#endif
/* {{{ _php_pgsql_trim_message */
-static char * _php_pgsql_trim_message(const char *message, int *len)
+static char * _php_pgsql_trim_message(const char *message, size_t *len)
{
- register int i = strlen(message)-1;
+ register size_t i = strlen(message)-1;
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
--i;
@@ -964,11 +964,11 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message)
TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
- notice->message = _php_pgsql_trim_message(message, (int *)&notice->len);
+ notice->message = _php_pgsql_trim_message(message, &notice->len);
if (PGG(log_notices)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
}
- zend_hash_index_update_ptr(&PGG(notices), (php_uint_t)resource_id, notice);
+ zend_hash_index_update_ptr(&PGG(notices), (zend_ulong)resource_id, notice);
}
}
/* }}} */
@@ -1113,88 +1113,88 @@ PHP_MINIT_FUNCTION(pgsql)
REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT);
#endif
/* For connection option */
- REGISTER_INT_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT);
/* For pg_fetch_array() */
- REGISTER_INT_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT);
/* For pg_connection_status() */
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT);
#ifdef CONNECTION_SSL_STARTUP
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT);
/* For pg_connect_poll() */
- REGISTER_INT_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT);
#if HAVE_PGTRANSACTIONSTATUS
/* For pg_transaction_status() */
- REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT);
#endif
#if HAVE_PQSETERRORVERBOSITY
/* For pg_set_error_verbosity() */
- REGISTER_INT_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT);
#endif
/* For lo_seek() */
- REGISTER_INT_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
/* For pg_result_status() return value type */
- REGISTER_INT_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT);
/* For pg_result_status() return value */
- REGISTER_INT_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT);
#if HAVE_PQRESULTERRORFIELD
/* For pg_result_error_field() field codes */
- REGISTER_INT_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT);
#ifdef PG_DIAG_INTERNAL_POSITION
- REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef PG_DIAG_INTERNAL_QUERY
- REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT);
#endif
/* pg_convert options */
- REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT);
/* pg_insert/update/delete/select options */
- REGISTER_INT_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
@@ -1254,9 +1254,9 @@ PHP_MINFO_FUNCTION(pgsql)
php_info_print_table_row(2, "SSL support", "disabled");
#endif
#endif /* HAVE_PG_CONFIG_H */
- snprintf(buf, sizeof(buf), "%pd", PGG(num_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_persistent));
php_info_print_table_row(2, "Active Persistent Links", buf);
- snprintf(buf, sizeof(buf), "%pd", PGG(num_links));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_end();
@@ -1288,16 +1288,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections
* can re-use this connection. Bug #39979
*/
- if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_INT) {
- if (Z_IVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) {
+ if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_LONG) {
+ if (Z_LVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) {
continue;
- } else if (Z_IVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) {
- smart_str_append_int(&str, Z_IVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW);
+ } else if (Z_LVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) {
+ smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW);
}
}
convert_to_string_ex(&args[i]);
smart_str_appendc(&str, '_');
- smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRSIZE(args[i]));
+ smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i]));
}
smart_str_0(&str);
@@ -1306,8 +1306,8 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
connstring = Z_STRVAL(args[0]);
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */
connstring = Z_STRVAL(args[0]);
- convert_to_int_ex(&args[1]);
- connect_type = Z_IVAL(args[1]);
+ convert_to_long_ex(&args[1]);
+ connect_type = Z_LVAL(args[1]);
} else {
host = Z_STRVAL(args[0]);
port = Z_STRVAL(args[1]);
@@ -1527,7 +1527,7 @@ PHP_FUNCTION(pg_connect_poll)
return;
}
- if (pgsql_link == NULL && id == -1) {
+ if (pgsql_link == NULL) {
RETURN_FALSE;
}
@@ -1535,7 +1535,7 @@ PHP_FUNCTION(pg_connect_poll)
ret = PQconnectPoll(pgsql);
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1642,7 +1642,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
array_init(return_value);
add_assoc_string(return_value, "client", PG_VERSION);
#if HAVE_PQPROTOCOLVERSION
- add_assoc_int(return_value, "protocol", PQprotocolVersion(pgsql));
+ add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql));
#if HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3) {
/* 8.0 or grater supports protorol version 3 */
@@ -1748,7 +1748,7 @@ PHP_FUNCTION(pg_parameter_status)
int id;
PGconn *pgsql;
char *param;
- int len;
+ size_t len;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &param, &len) == SUCCESS) {
id = -1;
@@ -1818,7 +1818,8 @@ PHP_FUNCTION(pg_query)
{
zval *pgsql_link = NULL;
char *query;
- int id = -1, query_len, argc = ZEND_NUM_ARGS();
+ int id = -1, argc = ZEND_NUM_ARGS();
+ size_t query_len;
int leftover = 0;
PGconn *pgsql;
PGresult *pgsql_result;
@@ -1918,7 +1919,8 @@ PHP_FUNCTION(pg_query_params)
zval *pgsql_link = NULL;
zval *pv_param_arr, *tmp;
char *query;
- int query_len, id = -1, argc = ZEND_NUM_ARGS();
+ size_t query_len;
+ int id = -1, argc = ZEND_NUM_ARGS();
int leftover = 0;
int num_params = 0;
char **params = NULL;
@@ -1977,7 +1979,7 @@ PHP_FUNCTION(pg_query_params)
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
- params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val));
+ params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val));
zval_ptr_dtor(&tmp_val);
}
i++;
@@ -2035,7 +2037,8 @@ PHP_FUNCTION(pg_prepare)
{
zval *pgsql_link = NULL;
char *query, *stmtname;
- int query_len, stmtname_len, id = -1, argc = ZEND_NUM_ARGS();
+ size_t query_len, stmtname_len;
+ int id = -1, argc = ZEND_NUM_ARGS();
int leftover = 0;
PGconn *pgsql;
PGresult *pgsql_result;
@@ -2119,7 +2122,8 @@ PHP_FUNCTION(pg_execute)
zval *pgsql_link = NULL;
zval *pv_param_arr, *tmp;
char *stmtname;
- int stmtname_len, id = -1, argc = ZEND_NUM_ARGS();
+ size_t stmtname_len;
+ int id = -1, argc = ZEND_NUM_ARGS();
int leftover = 0;
int num_params = 0;
char **params = NULL;
@@ -2178,7 +2182,7 @@ PHP_FUNCTION(pg_execute)
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
- params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val));
+ params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val));
zval_ptr_dtor(&tmp_val);
}
@@ -2252,17 +2256,17 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty
switch (entry_type) {
case PHP_PG_NUM_ROWS:
- RETVAL_INT(PQntuples(pgsql_result));
+ RETVAL_LONG(PQntuples(pgsql_result));
break;
case PHP_PG_NUM_FIELDS:
- RETVAL_INT(PQnfields(pgsql_result));
+ RETVAL_LONG(PQnfields(pgsql_result));
break;
case PHP_PG_CMD_TUPLES:
#if HAVE_PQCMDTUPLES
- RETVAL_INT(atoi(PQcmdTuples(pgsql_result)));
+ RETVAL_LONG(atoi(PQcmdTuples(pgsql_result)));
#else
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build");
- RETVAL_INT(0);
+ RETVAL_LONG(0);
#endif
break;
default:
@@ -2301,7 +2305,7 @@ PHP_FUNCTION(pg_affected_rows)
Returns the last notice set by the backend */
PHP_FUNCTION(pg_last_notice)
{
- zval *pgsql_link;
+ zval *pgsql_link = NULL;
PGconn *pg_link;
int id = -1;
php_pgsql_notice *notice;
@@ -2309,10 +2313,15 @@ PHP_FUNCTION(pg_last_notice)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
return;
}
+
+ if (pgsql_link == NULL) {
+ RETURN_FALSE;
+ }
+
/* Just to check if user passed valid resoruce */
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if ((notice = zend_hash_index_find_ptr(&PGG(notices), Z_RES_HANDLE_P(pgsql_link))) == NULL) {
+ if ((notice = zend_hash_index_find_ptr(&PGG(notices), (zend_ulong)Z_RES_HANDLE_P(pgsql_link))) == NULL) {
RETURN_FALSE;
}
RETURN_STRINGL(notice->message, notice->len);
@@ -2387,14 +2396,14 @@ PHP_FUNCTION(pg_field_table)
{
zval *result;
pgsql_result_handle *pg_result;
- php_int_t fnum = -1;
+ zend_long fnum = -1;
zend_bool return_oid = 0;
Oid oid;
smart_str hash_key = {0};
char *table_name;
zend_resource *field_table;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|b", &result, &fnum, &return_oid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b", &result, &fnum, &return_oid) == FAILURE) {
return;
}
@@ -2412,15 +2421,15 @@ PHP_FUNCTION(pg_field_table)
}
if (return_oid) {
-#if UINT_MAX > PHP_INT_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */
- if (oid > PHP_INT_MAX) {
+#if UINT_MAX > ZEND_LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */
+ if (oid > ZEND_LONG_MAX) {
smart_str oidstr = {0};
smart_str_append_unsigned(&oidstr, oid);
smart_str_0(&oidstr);
RETURN_STR(oidstr.s);
} else
#endif
- RETURN_INT((php_int_t)oid);
+ RETURN_LONG((zend_long)oid);
}
/* try to lookup the table name in the resource list */
@@ -2480,12 +2489,12 @@ PHP_FUNCTION(pg_field_table)
static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
- php_int_t field;
+ zend_long field;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
Oid oid;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) {
return;
}
@@ -2503,7 +2512,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
RETURN_STRING(PQfname(pgsql_result, field));
break;
case PHP_PG_FIELD_SIZE:
- RETURN_INT(PQfsize(pgsql_result, field));
+ RETURN_LONG(PQfsize(pgsql_result, field));
break;
case PHP_PG_FIELD_TYPE: {
char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC);
@@ -2514,8 +2523,8 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
case PHP_PG_FIELD_TYPE_OID:
oid = PQftype(pgsql_result, field);
-#if UINT_MAX > PHP_INT_MAX
- if (oid > PHP_INT_MAX) {
+#if UINT_MAX > ZEND_LONG_MAX
+ if (oid > ZEND_LONG_MAX) {
smart_str s = {0};
smart_str_append_unsigned(&s, oid);
smart_str_0(&s);
@@ -2523,7 +2532,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
} else
#endif
{
- RETURN_INT((long)oid);
+ RETURN_LONG((zend_long)oid);
}
break;
default:
@@ -2570,7 +2579,7 @@ PHP_FUNCTION(pg_field_num)
{
zval *result;
char *field;
- int field_len;
+ size_t field_len;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
@@ -2582,7 +2591,7 @@ PHP_FUNCTION(pg_field_num)
pgsql_result = pg_result->result;
- RETURN_INT(PQfnumber(pgsql_result, field));
+ RETURN_LONG(PQfnumber(pgsql_result, field));
}
/* }}} */
@@ -2591,7 +2600,7 @@ PHP_FUNCTION(pg_field_num)
PHP_FUNCTION(pg_fetch_result)
{
zval *result, *field=NULL;
- php_int_t row;
+ zend_long row;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
@@ -2601,7 +2610,7 @@ PHP_FUNCTION(pg_fetch_result)
return;
}
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) {
return;
}
}
@@ -2621,7 +2630,7 @@ PHP_FUNCTION(pg_fetch_result)
pgsql_row = row;
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
- row, Z_IVAL_P(result));
+ row, Z_LVAL_P(result));
RETURN_FALSE;
}
}
@@ -2630,8 +2639,8 @@ PHP_FUNCTION(pg_fetch_result)
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
break;
default:
- convert_to_int_ex(field);
- field_offset = Z_IVAL_P(field);
+ convert_to_long_ex(field);
+ field_offset = Z_LVAL_P(field);
break;
}
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
@@ -2649,13 +2658,13 @@ PHP_FUNCTION(pg_fetch_result)
/* }}} */
/* {{{ void php_pgsql_fetch_hash */
-static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int into_object)
+static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int into_object)
{
zval *result, *zrow = NULL;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int i, num_fields, pgsql_row, use_row;
- php_int_t row = -1;
+ zend_long row = -1;
char *field_name;
zval *ctor_params = NULL;
zend_class_entry *ce = NULL;
@@ -2677,15 +2686,15 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_
}
result_type = PGSQL_ASSOC;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!i", &result, &zrow, &result_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!l", &result, &zrow, &result_type) == FAILURE) {
return;
}
}
if (zrow == NULL) {
row = -1;
} else {
- convert_to_int(zrow);
- row = Z_IVAL_P(zrow);
+ convert_to_long(zrow);
+ row = Z_LVAL_P(zrow);
if (row < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The row parameter must be greater or equal to zero");
RETURN_FALSE;
@@ -2707,7 +2716,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_
pg_result->row = pgsql_row;
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
- row, Z_IVAL_P(result));
+ row, Z_LVAL_P(result));
RETURN_FALSE;
}
} else {
@@ -2732,7 +2741,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_
} else {
char *element = PQgetvalue(pgsql_result, pgsql_row, i);
if (element) {
- const uint element_len = strlen(element);
+ const size_t element_len = strlen(element);
if (result_type & PGSQL_NUM) {
add_index_stringl(return_value, i, element, element_len);
@@ -2876,11 +2885,11 @@ PHP_FUNCTION(pg_fetch_all_columns)
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- php_int_t colno=0;
+ zend_long colno=0;
int pg_numrows, pg_row;
size_t num_fields;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &colno) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &colno) == FAILURE) {
RETURN_FALSE;
}
@@ -2915,10 +2924,10 @@ PHP_FUNCTION(pg_fetch_all_columns)
PHP_FUNCTION(pg_result_seek)
{
zval *result;
- php_int_t row;
+ zend_long row;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &row) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) {
return;
}
@@ -2942,7 +2951,7 @@ PHP_FUNCTION(pg_result_seek)
static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result, *field;
- php_int_t row;
+ zend_long row;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
@@ -2952,7 +2961,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
return;
}
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) {
return;
}
}
@@ -2972,7 +2981,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
pgsql_row = row;
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
- row, Z_IVAL_P(result));
+ row, Z_LVAL_P(result));
RETURN_FALSE;
}
}
@@ -2983,8 +2992,8 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
break;
default:
- convert_to_int_ex(field);
- field_offset = Z_IVAL_P(field);
+ convert_to_long_ex(field);
+ field_offset = Z_LVAL_P(field);
break;
}
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
@@ -2994,10 +3003,10 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch (entry_type) {
case PHP_PG_DATA_LENGTH:
- RETVAL_INT(PQgetlength(pgsql_result, pgsql_row, field_offset));
+ RETVAL_LONG(PQgetlength(pgsql_result, pgsql_row, field_offset));
break;
case PHP_PG_DATA_ISNULL:
- RETVAL_INT(PQgetisnull(pgsql_result, pgsql_row, field_offset))
+ RETVAL_LONG(PQgetisnull(pgsql_result, pgsql_row, field_offset))
break;
}
}
@@ -3077,7 +3086,7 @@ PHP_FUNCTION(pg_last_oid)
PHP_FUNCTION(pg_trace)
{
char *z_filename, *mode = "w";
- int z_filename_len, mode_len;
+ size_t z_filename_len, mode_len;
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
@@ -3179,19 +3188,19 @@ PHP_FUNCTION(pg_lo_create)
{
char *end_ptr;
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
- if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) {
+ if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
}
break;
- case IS_INT:
- if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) {
+ case IS_LONG:
+ if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
- wanted_oid = (Oid)Z_IVAL_P(oid);
+ wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
@@ -3220,9 +3229,9 @@ PHP_FUNCTION(pg_lo_create)
PHP_FUNCTION(pg_lo_unlink)
{
zval *pgsql_link = NULL;
- php_int_t oid_long;
+ zend_long oid_long;
char *oid_string, *end_ptr;
- int oid_strlen;
+ size_t oid_strlen;
PGconn *pgsql;
Oid oid;
int id = -1;
@@ -3239,7 +3248,7 @@ PHP_FUNCTION(pg_lo_unlink)
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ri", &pgsql_link, &oid_long) == SUCCESS) {
+ "rl", &pgsql_link, &oid_long) == SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@ -3290,9 +3299,9 @@ PHP_FUNCTION(pg_lo_unlink)
PHP_FUNCTION(pg_lo_open)
{
zval *pgsql_link = NULL;
- php_int_t oid_long;
+ zend_long oid_long;
char *oid_string, *end_ptr, *mode_string;
- int oid_strlen, mode_strlen;
+ size_t oid_strlen, mode_strlen;
PGconn *pgsql;
Oid oid;
int id = -1, pgsql_mode=0, pgsql_lofd;
@@ -3311,7 +3320,7 @@ PHP_FUNCTION(pg_lo_open)
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ris", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
+ "rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@ -3437,12 +3446,12 @@ PHP_FUNCTION(pg_lo_close)
PHP_FUNCTION(pg_lo_read)
{
zval *pgsql_id;
- php_int_t len;
+ zend_long len;
int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes, argc = ZEND_NUM_ARGS();
zend_string *buf;
pgLofp *pgsql;
- if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &pgsql_id, &len) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &pgsql_id, &len) == FAILURE) {
return;
}
@@ -3452,9 +3461,9 @@ PHP_FUNCTION(pg_lo_read)
buf_len = len;
}
- buf = STR_ALLOC(buf_len, 0);
+ buf = zend_string_alloc(buf_len, 0);
if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf->val, buf->len))<0) {
- STR_FREE(buf);
+ zend_string_free(buf);
RETURN_FALSE;
}
@@ -3470,23 +3479,23 @@ PHP_FUNCTION(pg_lo_write)
{
zval *pgsql_id;
char *str;
- php_int_t z_len;
- int str_len, nbytes;
- int len;
+ zend_long z_len;
+ size_t str_len, nbytes;
+ size_t len;
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &pgsql_id, &str, &str_len, &z_len) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) {
return;
}
if (argc > 2) {
if (z_len > str_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %ld", str_len, z_len);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
RETURN_FALSE;
}
if (z_len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Buffer size must be larger than 0, but %ld was specified", z_len);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Buffer size must be larger than 0, but %pd was specified", z_len);
RETURN_FALSE;
}
len = z_len;
@@ -3501,7 +3510,7 @@ PHP_FUNCTION(pg_lo_write)
RETURN_FALSE;
}
- RETURN_INT(nbytes);
+ RETURN_LONG(nbytes);
}
/* }}} */
@@ -3526,7 +3535,7 @@ PHP_FUNCTION(pg_lo_read_all)
PHPWRITE(buf, nbytes);
tbytes += nbytes;
}
- RETURN_INT(tbytes);
+ RETURN_LONG(tbytes);
}
/* }}} */
@@ -3536,7 +3545,8 @@ PHP_FUNCTION(pg_lo_import)
{
zval *pgsql_link = NULL, *oid = NULL;
char *file_in;
- int id = -1, name_len;
+ int id = -1;
+ size_t name_len;
int argc = ZEND_NUM_ARGS();
PGconn *pgsql;
Oid returned_oid;
@@ -3579,19 +3589,19 @@ PHP_FUNCTION(pg_lo_import)
{
char *end_ptr;
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
- if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) {
+ if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
}
break;
- case IS_INT:
- if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) {
+ case IS_LONG:
+ if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
- wanted_oid = (Oid)Z_IVAL_P(oid);
+ wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
@@ -3623,16 +3633,17 @@ PHP_FUNCTION(pg_lo_export)
{
zval *pgsql_link = NULL;
char *file_out, *oid_string, *end_ptr;
- int oid_strlen;
- int id = -1, name_len;
- php_int_t oid_long;
+ size_t oid_strlen;
+ int id = -1;
+ size_t name_len;
+ zend_long oid_long;
Oid oid;
PGconn *pgsql;
int argc = ZEND_NUM_ARGS();
/* allow string to handle large OID value correctly */
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rip", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) {
+ "rlp", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@ -3649,7 +3660,7 @@ PHP_FUNCTION(pg_lo_export)
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ip", &oid_long, &file_out, &name_len) == SUCCESS) {
+ "lp", &oid_long, &file_out, &name_len) == SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@ -3679,7 +3690,7 @@ PHP_FUNCTION(pg_lo_export)
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ipr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
+ "lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used");
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
@@ -3714,11 +3725,11 @@ PHP_FUNCTION(pg_lo_export)
PHP_FUNCTION(pg_lo_seek)
{
zval *pgsql_id = NULL;
- php_int_t result, offset = 0, whence = SEEK_CUR;
+ zend_long result, offset = 0, whence = SEEK_CUR;
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &pgsql_id, &offset, &whence) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) {
return;
}
if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
@@ -3750,7 +3761,7 @@ PHP_FUNCTION(pg_lo_seek)
PHP_FUNCTION(pg_lo_tell)
{
zval *pgsql_id = NULL;
- long offset = 0;
+ zend_long offset = 0;
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
@@ -3769,7 +3780,7 @@ PHP_FUNCTION(pg_lo_tell)
#else
offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd);
#endif
- RETURN_INT(offset);
+ RETURN_LONG(offset);
}
/* }}} */
@@ -3784,7 +3795,7 @@ PHP_FUNCTION(pg_lo_truncate)
int argc = ZEND_NUM_ARGS();
int result;
- if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_id, &size) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_id, &size) == FAILURE) {
return;
}
@@ -3814,18 +3825,18 @@ PHP_FUNCTION(pg_lo_truncate)
PHP_FUNCTION(pg_set_error_verbosity)
{
zval *pgsql_link = NULL;
- php_int_t verbosity;
+ zend_long verbosity;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
if (argc == 1) {
- if (zend_parse_parameters(argc TSRMLS_CC, "i", &verbosity) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) {
return;
}
id = PGG(default_link)? PGG(default_link)->handle : -1;
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_link, &verbosity) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) {
return;
}
}
@@ -3837,7 +3848,7 @@ PHP_FUNCTION(pg_set_error_verbosity)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) {
- RETURN_INT(PQsetErrorVerbosity(pgsql, verbosity));
+ RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity));
} else {
RETURN_FALSE;
}
@@ -3851,7 +3862,7 @@ PHP_FUNCTION(pg_set_error_verbosity)
PHP_FUNCTION(pg_set_client_encoding)
{
char *encoding;
- int encoding_len;
+ size_t encoding_len;
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
@@ -3874,7 +3885,7 @@ PHP_FUNCTION(pg_set_client_encoding)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- RETURN_INT(PQsetClientEncoding(pgsql, encoding));
+ RETURN_LONG(PQsetClientEncoding(pgsql, encoding));
}
/* }}} */
@@ -3952,7 +3963,8 @@ PHP_FUNCTION(pg_put_line)
{
char *query;
zval *pgsql_link = NULL;
- int query_len, id = -1;
+ size_t query_len;
+ int id = -1;
PGconn *pgsql;
int result = 0, argc = ZEND_NUM_ARGS();
@@ -3989,7 +4001,7 @@ PHP_FUNCTION(pg_copy_to)
{
zval *pgsql_link;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
- int table_name_len, pg_delim_len, pg_null_as_len, free_pg_null = 0;
+ size_t table_name_len, pg_delim_len, pg_null_as_len, free_pg_null = 0;
char *query;
int id = -1;
PGconn *pgsql;
@@ -4126,7 +4138,7 @@ PHP_FUNCTION(pg_copy_from)
zval *pgsql_link = NULL, *pg_rows;
zval *tmp;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
- int table_name_len, pg_delim_len, pg_null_as_len;
+ size_t table_name_len, pg_delim_len, pg_null_as_len;
int pg_null_as_free = 0;
char *query;
int id = -1;
@@ -4175,10 +4187,10 @@ PHP_FUNCTION(pg_copy_from)
#if HAVE_PQPUTCOPYDATA
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) {
convert_to_string_ex(tmp);
- query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2);
- strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2);
- if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') {
- strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2);
+ query = (char *)emalloc(Z_STRLEN_P(tmp) + 2);
+ strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2);
+ if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
+ strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
}
if (PQputCopyData(pgsql, query, strlen(query)) != 1) {
efree(query);
@@ -4194,10 +4206,10 @@ PHP_FUNCTION(pg_copy_from)
#else
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) {
convert_to_string_ex(tmp);
- query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2);
- strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2);
- if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') {
- strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2);
+ query = (char *)emalloc(Z_STRLEN_P(tmp) + 2);
+ strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2);
+ if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
+ strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
}
if (PQputline(pgsql, query)==EOF) {
efree(query);
@@ -4268,18 +4280,18 @@ PHP_FUNCTION(pg_escape_string)
break;
}
- to = STR_ALLOC(from->len * 2, 0);
+ to = zend_string_alloc(from->len * 2, 0);
#ifdef HAVE_PQESCAPE_CONN
if (pgsql_link != NULL || id != -1) {
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- to->len = (int) PQescapeStringConn(pgsql, to->val, from->val, (size_t)from->len, NULL);
+ to->len = PQescapeStringConn(pgsql, to->val, from->val, from->len, NULL);
} else
#endif
{
- to->len = (int) PQescapeString(to->val, from->val, (size_t)from->len);
+ to->len = PQescapeString(to->val, from->val, from->len);
}
- to = STR_REALLOC(to, to->len, 0);
+ to = zend_string_realloc(to, to->len, 0);
RETURN_STR(to);
}
/* }}} */
@@ -4290,7 +4302,8 @@ PHP_FUNCTION(pg_escape_bytea)
{
char *from = NULL, *to = NULL;
size_t to_len;
- int from_len, id = -1;
+ size_t from_len;
+ int id = -1;
#ifdef HAVE_PQESCAPE_BYTEA_CONN
PGconn *pgsql;
#endif
@@ -4437,7 +4450,7 @@ PHP_FUNCTION(pg_unescape_bytea)
{
char *from = NULL, *to = NULL, *tmp = NULL;
size_t to_len;
- int from_len;
+ size_t from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&from, &from_len) == FAILURE) {
return;
@@ -4465,7 +4478,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
char *from = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
- int from_len;
+ size_t from_len;
int id = -1;
char *tmp;
@@ -4559,12 +4572,12 @@ PHP_FUNCTION(pg_result_error)
PHP_FUNCTION(pg_result_error_field)
{
zval *result;
- php_int_t fieldcode;
+ zend_long fieldcode;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
char *field = NULL;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ri",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rl",
&result, &fieldcode) == FAILURE) {
RETURN_FALSE;
}
@@ -4613,7 +4626,7 @@ PHP_FUNCTION(pg_connection_status)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- RETURN_INT(PQstatus(pgsql));
+ RETURN_LONG(PQstatus(pgsql));
}
/* }}} */
@@ -4634,7 +4647,7 @@ PHP_FUNCTION(pg_transaction_status)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- RETURN_INT(PQtransactionStatus(pgsql));
+ RETURN_LONG(PQtransactionStatus(pgsql));
}
#endif
@@ -4709,10 +4722,10 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch(entry_type) {
case PHP_PG_ASYNC_IS_BUSY:
PQconsumeInput(pgsql);
- RETVAL_INT(PQisBusy(pgsql));
+ RETVAL_LONG(PQisBusy(pgsql));
break;
case PHP_PG_ASYNC_REQUEST_CANCEL:
- RETVAL_INT(PQrequestCancel(pgsql));
+ RETVAL_LONG(PQrequestCancel(pgsql));
while ((pgsql_result = PQgetResult(pgsql))) {
PQclear(pgsql_result);
}
@@ -4761,7 +4774,7 @@ PHP_FUNCTION(pg_send_query)
{
zval *pgsql_link;
char *query;
- int len;
+ size_t len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
@@ -4819,7 +4832,7 @@ PHP_FUNCTION(pg_send_query)
} else if (ret == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
@@ -4833,7 +4846,8 @@ PHP_FUNCTION(pg_send_query_params)
int num_params = 0;
char **params = NULL;
char *query;
- int query_len, id = -1;
+ size_t query_len;
+ int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
@@ -4842,7 +4856,7 @@ PHP_FUNCTION(pg_send_query_params)
return;
}
- if (pgsql_link == NULL && id == -1) {
+ if (pgsql_link == NULL) {
RETURN_FALSE;
}
@@ -4879,7 +4893,7 @@ PHP_FUNCTION(pg_send_query_params)
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
- params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val));
+ params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val));
zval_ptr_dtor(&tmp_val);
}
@@ -4924,7 +4938,7 @@ PHP_FUNCTION(pg_send_query_params)
} else if (ret == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
@@ -4937,7 +4951,8 @@ PHP_FUNCTION(pg_send_prepare)
{
zval *pgsql_link;
char *query, *stmtname;
- int stmtname_len, query_len, id = -1;
+ size_t stmtname_len, query_len;
+ int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
@@ -4946,7 +4961,7 @@ PHP_FUNCTION(pg_send_prepare)
return;
}
- if (pgsql_link == NULL && id == -1) {
+ if (pgsql_link == NULL) {
RETURN_FALSE;
}
@@ -4998,7 +5013,7 @@ PHP_FUNCTION(pg_send_prepare)
} else if (ret == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
@@ -5014,7 +5029,8 @@ PHP_FUNCTION(pg_send_execute)
int num_params = 0;
char **params = NULL;
char *stmtname;
- int stmtname_len, id = -1;
+ size_t stmtname_len;
+ int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
@@ -5023,7 +5039,7 @@ PHP_FUNCTION(pg_send_execute)
return;
}
- if (pgsql_link == NULL && id == -1) {
+ if (pgsql_link == NULL) {
RETURN_FALSE;
}
@@ -5060,7 +5076,7 @@ PHP_FUNCTION(pg_send_execute)
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
- params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val));
+ params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val));
zval_ptr_dtor(&tmp_val);
}
@@ -5104,7 +5120,7 @@ PHP_FUNCTION(pg_send_execute)
} else if (ret == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
}
/* }}} */
@@ -5144,12 +5160,12 @@ PHP_FUNCTION(pg_get_result)
PHP_FUNCTION(pg_result_status)
{
zval *result;
- php_int_t result_type = PGSQL_STATUS_LONG;
+ zend_long result_type = PGSQL_STATUS_LONG;
ExecStatusType status;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
&result, &result_type) == FAILURE) {
RETURN_FALSE;
}
@@ -5159,7 +5175,7 @@ PHP_FUNCTION(pg_result_status)
pgsql_result = pg_result->result;
if (result_type == PGSQL_STATUS_LONG) {
status = PQresultStatus(pgsql_result);
- RETURN_INT((int)status);
+ RETURN_LONG((int)status);
}
else if (result_type == PGSQL_STATUS_STRING) {
RETURN_STRING(PQcmdStatus(pgsql_result));
@@ -5177,11 +5193,11 @@ PHP_FUNCTION(pg_get_notify)
{
zval *pgsql_link;
int id = -1;
- php_int_t result_type = PGSQL_ASSOC;
+ zend_long result_type = PGSQL_ASSOC;
PGconn *pgsql;
PGnotify *pgsql_notify;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
&pgsql_link, &result_type) == FAILURE) {
RETURN_FALSE;
}
@@ -5202,7 +5218,7 @@ PHP_FUNCTION(pg_get_notify)
array_init(return_value);
if (result_type & PGSQL_NUM) {
add_index_string(return_value, 0, pgsql_notify->relname);
- add_index_int(return_value, 1, pgsql_notify->be_pid);
+ add_index_long(return_value, 1, pgsql_notify->be_pid);
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
#else
@@ -5215,7 +5231,7 @@ PHP_FUNCTION(pg_get_notify)
}
if (result_type & PGSQL_ASSOC) {
add_assoc_string(return_value, "message", pgsql_notify->relname);
- add_assoc_int(return_value, "pid", pgsql_notify->be_pid);
+ add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
#else
@@ -5245,7 +5261,7 @@ PHP_FUNCTION(pg_get_pid)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- RETURN_INT(PQbackendPID(pgsql));
+ RETURN_LONG(PQbackendPID(pgsql));
}
/* }}} */
@@ -5384,7 +5400,7 @@ PHP_FUNCTION(pg_flush)
switch (ret) {
case 0: RETURN_TRUE; break;
- case 1: RETURN_INT(0); break;
+ case 1: RETURN_LONG(0); break;
default: RETURN_FALSE;
}
}
@@ -5468,26 +5484,26 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
char *name;
array_init(&elem);
/* pg_attribute.attnum */
- add_assoc_int(&elem, "num", atoi(PQgetvalue(pg_result,i,1)));
+ add_assoc_long_ex(&elem, "num", sizeof("num") - 1, atoi(PQgetvalue(pg_result, i, 1)));
/* pg_type.typname */
- add_assoc_string(&elem, "type", PQgetvalue(pg_result,i,2));
+ add_assoc_string_ex(&elem, "type", sizeof("type") - 1, PQgetvalue(pg_result, i, 2));
/* pg_attribute.attlen */
- add_assoc_int(&elem, "len", atoi(PQgetvalue(pg_result,i,3)));
+ add_assoc_long_ex(&elem, "len", sizeof("len") - 1, atoi(PQgetvalue(pg_result,i,3)));
/* pg_attribute.attnonull */
- add_assoc_bool(&elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t"));
+ add_assoc_bool_ex(&elem, "not null", sizeof("not null") - 1, !strcmp(PQgetvalue(pg_result, i, 4), "t"));
/* pg_attribute.atthasdef */
- add_assoc_bool(&elem, "has default", !strcmp(PQgetvalue(pg_result,i,5), "t"));
+ add_assoc_bool_ex(&elem, "has default", sizeof("has default") - 1, !strcmp(PQgetvalue(pg_result,i,5), "t"));
/* pg_attribute.attndims */
- add_assoc_int(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6)));
+ add_assoc_long_ex(&elem, "array dims", sizeof("array dims") - 1, atoi(PQgetvalue(pg_result, i, 6)));
/* pg_type.typtype */
- add_assoc_bool(&elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e"));
+ add_assoc_bool_ex(&elem, "is enum", sizeof("is enum") - 1, !strcmp(PQgetvalue(pg_result, i, 7), "e"));
if (extended) {
/* pg_type.typtype */
- add_assoc_bool(&elem, "is base", !strcmp(PQgetvalue(pg_result,i,7), "b"));
- add_assoc_bool(&elem, "is composite", !strcmp(PQgetvalue(pg_result,i,7), "c"));
- add_assoc_bool(&elem, "is pesudo", !strcmp(PQgetvalue(pg_result,i,7), "p"));
+ add_assoc_bool_ex(&elem, "is base", sizeof("is base") - 1, !strcmp(PQgetvalue(pg_result, i, 7), "b"));
+ add_assoc_bool_ex(&elem, "is composite", sizeof("is composite") - 1, !strcmp(PQgetvalue(pg_result, i, 7), "c"));
+ add_assoc_bool_ex(&elem, "is pesudo", sizeof("is pesudo") - 1, !strcmp(PQgetvalue(pg_result, i, 7), "p"));
/* pg_description.description */
- add_assoc_string(&elem, "description", PQgetvalue(pg_result,i,8));
+ add_assoc_string_ex(&elem, "description", sizeof("description") - 1, PQgetvalue(pg_result, i, 8));
}
/* pg_attribute.attname */
name = PQgetvalue(pg_result,i,0);
@@ -5506,7 +5522,7 @@ PHP_FUNCTION(pg_meta_data)
{
zval *pgsql_link;
char *table_name;
- uint table_name_len;
+ size_t table_name_len;
zend_bool extended=0;
PGconn *pgsql;
int id = -1;
@@ -5625,7 +5641,7 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
regmatch_t *subs;
int regopt = REG_EXTENDED;
int regerr, ret = SUCCESS;
- int i;
+ size_t i;
/* Check invalid chars for POSIX regex */
for (i = 0; i < str_len; i++) {
@@ -5678,14 +5694,14 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
smart_str_appendc(&str, 'E');
smart_str_appendc(&str, '\'');
- smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRSIZE_P(src));
+ smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
smart_str_appendc(&str, '\'');
smart_str_0(&str);
if (should_free) {
zval_ptr_dtor(src);
}
- ZVAL_STR(src, str.s);
+ ZVAL_NEW_STR(src, str.s);
return SUCCESS;
}
@@ -5708,10 +5724,10 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
/* {{{ php_pgsql_convert
* check and convert array values (fieldname=>vlaue pair) for sql
*/
-PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt TSRMLS_DC)
{
zend_string *field = NULL;
- php_uint_t num_idx = -1;
+ zend_ulong num_idx = -1;
zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val;
int err = 0, skip_field;
php_pgsql_data_type data_type;
@@ -5774,7 +5790,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
/* enums need to be treated like strings */
data_type = PG_TEXT;
} else {
- data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRSIZE_P(type));
+ data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRLEN_P(type));
}
switch(data_type)
@@ -5782,7 +5798,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_BOOL:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRING(&new_val, "NULL");
}
else {
@@ -5807,8 +5823,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
break;
- case IS_INT:
- if (Z_IVAL_P(val)) {
+ case IS_LONG:
+ if (Z_LVAL_P(val)) {
ZVAL_STRINGL(&new_val, "'t'", sizeof("'t'")-1);
}
else {
@@ -5843,27 +5859,27 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_INT8:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
}
}
break;
case IS_DOUBLE:
ZVAL_DOUBLE(&new_val, Z_DVAL_P(val));
- convert_to_int_ex(&new_val);
+ convert_to_long_ex(&new_val);
break;
- case IS_INT:
- ZVAL_INT(&new_val, Z_IVAL_P(val));
+ case IS_LONG:
+ ZVAL_LONG(&new_val, Z_LVAL_P(val));
break;
case IS_NULL:
@@ -5885,12 +5901,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_FLOAT8:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
@@ -5899,8 +5915,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
break;
- case IS_INT:
- ZVAL_INT(&new_val, Z_IVAL_P(val));
+ case IS_LONG:
+ ZVAL_LONG(&new_val, Z_LVAL_P(val));
break;
case IS_DOUBLE:
@@ -5941,7 +5957,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_UNKNOWN:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
if (opt & PGSQL_CONV_FORCE_NULL) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
} else {
@@ -5951,17 +5967,17 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
else {
zend_string *str;
/* PostgreSQL ignores \0 */
- str = STR_ALLOC(Z_STRSIZE_P(val) * 2, 0);
+ str = zend_string_alloc(Z_STRLEN_P(val) * 2, 0);
/* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */
- str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL);
- str = STR_REALLOC(str, str->len, 0);
- ZVAL_STR(&new_val, str);
+ str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
+ str = zend_string_realloc(str, str->len, 0);
+ ZVAL_NEW_STR(&new_val, str);
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
break;
- case IS_INT:
- ZVAL_INT(&new_val, Z_IVAL_P(val));
+ case IS_LONG:
+ ZVAL_LONG(&new_val, Z_LVAL_P(val));
convert_to_string_ex(&new_val);
break;
@@ -5988,28 +6004,28 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
/* these are the actallay a integer */
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
- convert_to_int_ex(&new_val);
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
+ convert_to_long_ex(&new_val);
}
}
break;
case IS_DOUBLE:
ZVAL_DOUBLE(&new_val, Z_DVAL_P(val));
- convert_to_int_ex(&new_val);
+ convert_to_long_ex(&new_val);
break;
- case IS_INT:
- ZVAL_INT(&new_val, Z_IVAL_P(val));
+ case IS_LONG:
+ ZVAL_LONG(&new_val, Z_LVAL_P(val));
break;
case IS_NULL:
@@ -6029,16 +6045,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_INET:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* better regex? IPV6 and IPV4 */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
}
@@ -6062,13 +6078,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_TIMESTAMP_WITH_TIMEZONE:
switch(Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
} else if (!strcasecmp(Z_STRVAL_P(val), "now()")) {
ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1);
} else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
} else {
ZVAL_STRING(&new_val, Z_STRVAL_P(val));
@@ -6093,16 +6109,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_DATE:
switch(Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
}
@@ -6124,16 +6140,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_TIME:
switch(Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
}
@@ -6155,7 +6171,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_INTERVAL:
switch(Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRING(&new_val, "NULL");
}
else {
@@ -6176,7 +6192,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10
sec'.
*/
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val),
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val),
"^(@?[ \\t]+)?("
/* Textual time units and their abbreviations: */
@@ -6234,7 +6250,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_BYTEA:
switch (Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRING(&new_val, "NULL");
}
else {
@@ -6242,22 +6258,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
size_t to_len;
smart_str s = {0};
#ifdef HAVE_PQESCAPE_BYTEA_CONN
- tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRSIZE_P(val), &to_len);
+ tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRLEN_P(val), &to_len);
#else
- tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRSIZE_P(val), &to_len);
+ tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRLEN_P(val), &to_len);
#endif
ZVAL_STRINGL(&new_val, (char *)tmp, to_len - 1); /* PQescapeBytea's to_len includes additional '\0' */
PQfreemem(tmp);
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
- smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRSIZE(new_val));
+ smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val));
smart_str_0(&s);
zval_ptr_dtor(&new_val);
- ZVAL_STR(&new_val, s.s);
+ ZVAL_NEW_STR(&new_val, s.s);
}
break;
- case IS_INT:
- ZVAL_INT(&new_val, Z_IVAL_P(val));
+ case IS_LONG:
+ ZVAL_LONG(&new_val, Z_LVAL_P(val));
convert_to_string_ex(&new_val);
break;
@@ -6283,15 +6299,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
case PG_MACADDR:
switch(Z_TYPE_P(val)) {
case IS_STRING:
- if (Z_STRSIZE_P(val) == 0) {
+ if (Z_STRLEN_P(val) == 0) {
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
}
else {
- ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
}
}
@@ -6351,13 +6367,13 @@ PHP_FUNCTION(pg_convert)
{
zval *pgsql_link, *values;
char *table_name;
- int table_name_len;
- php_uint_t option = 0;
+ size_t table_name_len;
+ zend_ulong option = 0;
PGconn *pg_link;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "rsa|i", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
+ "rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
return;
}
if (option & ~PGSQL_CONV_OPTS) {
@@ -6382,7 +6398,7 @@ PHP_FUNCTION(pg_convert)
}
/* }}} */
-static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt TSRMLS_DC) /* {{{ */
+static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt TSRMLS_DC) /* {{{ */
{
if (opt & PGSQL_DML_ASYNC) {
if (PQsendQuery(pg_link, querystr->s->val)) {
@@ -6441,14 +6457,14 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* {{{ php_pgsql_insert
*/
-PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, php_uint_t opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
{
zval *val, converted;
char buf[256];
char *tmp;
smart_str querystr = {0};
int ret = FAILURE;
- php_uint_t num_idx;
+ zend_ulong num_idx;
zend_string *fld;
assert(pg_link != NULL);
@@ -6502,18 +6518,18 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
if (opt & PGSQL_DML_ESCAPE) {
size_t new_len;
char *tmp;
- tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1);
- new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL);
+ tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1);
+ new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
smart_str_appendc(&querystr, '\'');
smart_str_appendl(&querystr, tmp, new_len);
smart_str_appendc(&querystr, '\'');
efree(tmp);
} else {
- smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRLEN_P(val));
}
break;
- case IS_INT:
- smart_str_append_int(&querystr, Z_IVAL_P(val));
+ case IS_LONG:
+ smart_str_append_long(&querystr, Z_LVAL_P(val));
break;
case IS_DOUBLE:
smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)));
@@ -6562,8 +6578,8 @@ PHP_FUNCTION(pg_insert)
{
zval *pgsql_link, *values;
char *table;
- int table_len;
- php_uint_t option = PGSQL_DML_EXEC, return_sql;
+ size_t table_len;
+ zend_ulong option = PGSQL_DML_EXEC, return_sql;
PGconn *pg_link;
PGresult *pg_result;
ExecStatusType status;
@@ -6571,7 +6587,7 @@ PHP_FUNCTION(pg_insert)
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i",
+ if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
&pgsql_link, &table, &table_len, &values, &option) == FAILURE) {
return;
}
@@ -6641,11 +6657,11 @@ PHP_FUNCTION(pg_insert)
}
/* }}} */
-static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, ulong opt TSRMLS_DC) /* {{{ */
+static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, zend_ulong opt TSRMLS_DC) /* {{{ */
{
char *tmp;
char buf[256];
- php_uint_t num_idx;
+ zend_ulong num_idx;
zend_string *fld;
zval *val;
@@ -6671,18 +6687,18 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
case IS_STRING:
if (opt & PGSQL_DML_ESCAPE) {
size_t new_len;
- tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1);
- new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL);
+ tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1);
+ new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
smart_str_appendc(querystr, '\'');
smart_str_appendl(querystr, tmp, new_len);
smart_str_appendc(querystr, '\'');
efree(tmp);
} else {
- smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val));
+ smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRLEN_P(val));
}
break;
- case IS_INT:
- smart_str_append_int(querystr, Z_IVAL_P(val));
+ case IS_LONG:
+ smart_str_append_long(querystr, Z_LVAL_P(val));
break;
case IS_DOUBLE:
smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf)-1));
@@ -6706,7 +6722,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
/* {{{ php_pgsql_update
*/
-PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
{
zval var_converted, ids_converted;
smart_str querystr = {0};
@@ -6778,13 +6794,13 @@ PHP_FUNCTION(pg_update)
{
zval *pgsql_link, *values, *ids;
char *table;
- int table_len;
- php_uint_t option = PGSQL_DML_EXEC;
+ size_t table_len;
+ zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|i",
+ if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|l",
&pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) {
return;
}
@@ -6810,7 +6826,7 @@ PHP_FUNCTION(pg_update)
/* {{{ php_pgsql_delete
*/
-PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
{
zval ids_converted;
smart_str querystr = {0};
@@ -6868,13 +6884,13 @@ PHP_FUNCTION(pg_delete)
{
zval *pgsql_link, *ids;
char *table;
- int table_len;
- php_uint_t option = PGSQL_DML_EXEC;
+ size_t table_len;
+ zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i",
+ if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
}
@@ -6936,7 +6952,7 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS
/* {{{ php_pgsql_select
*/
-PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
{
zval ids_converted;
smart_str querystr = {0};
@@ -6998,13 +7014,13 @@ PHP_FUNCTION(pg_select)
{
zval *pgsql_link, *ids;
char *table;
- int table_len;
- php_uint_t option = PGSQL_DML_EXEC;
+ size_t table_len;
+ zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i",
+ if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
}
diff --git a/ext/pgsql/pgsql.dsp b/ext/pgsql/pgsql.dsp
deleted file mode 100644
index 098469f36d..0000000000
--- a/ext/pgsql/pgsql.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pgsql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pgsql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak" CFG="pgsql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pgsql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pgsql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\include\pgsql" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /D "HAVE_PG_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php5ts.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../Release/pgsql.dll" /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\php_build\include\pgsql" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /D "HAVE_PG_CONFIG_H" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"../../Debug/pgsql.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\PostgreSQL\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\include\pgsql" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D ZEND_DEBUG=0 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /D "HAVE_PG_CONFIG_H" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpq.lib php5ts.lib /nologo /dll /machine:I386 /out:"../../Release_TS/php_pgsql.dll" /libpath:"..\..\..\php_build\postgresql\src\interfaces\libpq\Release" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\php_build\include\pgsql" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D "ZTS" /D ZEND_DEBUG=1 /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "HAVE_PQCMDTUPLES" /D "HAVE_PQCLIENTENCODING" /D "HAVE_PQESCAPE" /D "HAVE_PG_CONFIG_H" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libpq.lib /nologo /dll /debug /machine:I386 /out:"../../Debug_TS/pgsql.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "pgsql - Win32 Release"
-# Name "pgsql - Win32 Debug"
-# Name "pgsql - Win32 Release_TS"
-# Name "pgsql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pgsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pgsql.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index d090a08797..661c02f77f 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -211,11 +211,11 @@ PHP_FUNCTION(pg_select);
/* exported functions */
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_bool extended TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, php_uint_t opt TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, php_uint_t opt, zend_string **sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, php_uint_t opt , zend_string **sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, php_uint_t opt, zend_string **sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, zend_ulong opt, zend_string **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, zend_ulong opt, zend_string **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, zend_ulong opt, zend_string **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
/* internal functions */
@@ -309,10 +309,10 @@ static php_stream_ops php_stream_pgsql_fd_ops = {
};
ZEND_BEGIN_MODULE_GLOBALS(pgsql)
- php_int_t num_links,num_persistent;
- php_int_t max_links,max_persistent;
- php_int_t allow_persistent;
- php_int_t auto_reset_persistent;
+ zend_long num_links,num_persistent;
+ zend_long max_links,max_persistent;
+ zend_long allow_persistent;
+ zend_long auto_reset_persistent;
int le_lofp,le_string;
int ignore_notices,log_notices;
HashTable notices; /* notice message for each connection */
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index 53e6175ecb..b8875891b0 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -58,7 +58,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{
/**
* Used for seeking on a phar directory handle
*/
-static int phar_dir_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */
+static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */
{
HashTable *data = (HashTable *)stream->abstract;
@@ -95,7 +95,7 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D
size_t to_read;
HashTable *data = (HashTable *)stream->abstract;
zend_string *str_key;
- php_uint_t unused;
+ zend_ulong unused;
if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &str_key, &unused, 0, &data->nInternalPointer)) {
return 0;
@@ -184,7 +184,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC)
char *entry, *found, *save;
zend_string *str_key;
uint keylen;
- php_uint_t unused;
+ zend_ulong unused;
ALLOC_HASHTABLE(data);
zend_hash_init(data, 64, NULL, NULL, 0);
@@ -306,7 +306,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
php_stream *ret;
char *internal_file, *error;
zend_string *str_key;
- php_uint_t unused;
+ zend_ulong unused;
phar_archive_data *phar;
phar_entry_info *entry = NULL;
uint host_len;
@@ -550,7 +550,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
php_url *resource = NULL;
uint host_len;
zend_string *str_key;
- php_uint_t unused;
+ zend_ulong unused;
uint path_len;
/* pre-readonly check, we need to know if this is a data phar */
diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h
index 27d236aca4..f9a300a63c 100644
--- a/ext/phar/dirstream.h
+++ b/ext/phar/dirstream.h
@@ -31,7 +31,7 @@ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count T
static size_t phar_dir_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC);
static int phar_dir_flush(php_stream *stream TSRMLS_DC);
-static int phar_dir_seek( php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC);
+static int phar_dir_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC);
#else
php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
#endif
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index b548516fc7..6d6cbc4918 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -26,7 +26,7 @@
PHAR_FUNC(phar_opendir) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
zval *zcontext = NULL;
if (!PHAR_G(intercepted)) {
@@ -94,12 +94,12 @@ skip_phar:
PHAR_FUNC(phar_file_get_contents) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
zend_string *contents;
zend_bool use_include_path = 0;
php_stream *stream;
- php_int_t offset = -1;
- php_int_t maxlen = PHP_STREAM_COPY_ALL;
+ zend_long offset = -1;
+ zend_long maxlen = PHP_STREAM_COPY_ALL;
zval *zcontext = NULL;
if (!PHAR_G(intercepted)) {
@@ -112,7 +112,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
}
/* Parse arguments */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
goto skip_phar;
}
@@ -205,7 +205,7 @@ phar_it:
if (contents && contents->len > 0) {
RETVAL_STR(contents);
} else if (contents) {
- STR_RELEASE(contents);
+ zend_string_release(contents);
RETVAL_EMPTY_STRING();
} else {
RETVAL_FALSE;
@@ -224,7 +224,7 @@ skip_phar:
PHAR_FUNC(phar_readfile) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
int size = 0;
zend_bool use_include_path = 0;
zval *zcontext = NULL;
@@ -307,7 +307,7 @@ notfound:
}
size = php_stream_passthru(stream);
php_stream_close(stream);
- RETURN_INT(size);
+ RETURN_LONG(size);
}
skip_phar:
@@ -320,7 +320,7 @@ skip_phar:
PHAR_FUNC(phar_fopen) /* {{{ */
{
char *filename, *mode;
- int filename_len, mode_len;
+ size_t filename_len, mode_len;
zend_bool use_include_path = 0;
zval *zcontext = NULL;
php_stream *stream;
@@ -339,7 +339,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
}
if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
char *arch, *entry, *fname;
- int arch_len, entry_len, fname_len;
+ size_t arch_len, entry_len, fname_len;
php_stream_context *context = NULL;
char *name;
phar_archive_data *phar;
@@ -349,7 +349,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
goto skip_phar;
}
fname_len = strlen(fname);
- if (FAILURE == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_split_fname(fname, fname_len, &arch, (int *)&arch_len, &entry, (int *)&entry_len, 2, 0 TSRMLS_CC)) {
goto skip_phar;
}
@@ -371,7 +371,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
name = entry;
}
} else {
- entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), (int *)&entry_len, 1 TSRMLS_CC);
if (entry[0] == '/') {
if (!zend_hash_str_exists(&(phar->manifest), entry + 1, entry_len - 1)) {
/* this file is not in the phar, use the original path */
@@ -433,7 +433,7 @@ skip_phar:
/* {{{ php_stat
*/
-static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC)
+static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC)
{
zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev,
stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks;
@@ -477,32 +477,32 @@ static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TS
switch (type) {
case FS_PERMS:
- RETURN_INT((php_int_t)stat_sb->st_mode);
+ RETURN_LONG((zend_long)stat_sb->st_mode);
case FS_INODE:
- RETURN_INT((php_int_t)stat_sb->st_ino);
+ RETURN_LONG((zend_long)stat_sb->st_ino);
case FS_SIZE:
- RETURN_INT((php_int_t)stat_sb->st_size);
+ RETURN_LONG((zend_long)stat_sb->st_size);
case FS_OWNER:
- RETURN_INT((php_int_t)stat_sb->st_uid);
+ RETURN_LONG((zend_long)stat_sb->st_uid);
case FS_GROUP:
- RETURN_INT((php_int_t)stat_sb->st_gid);
+ RETURN_LONG((zend_long)stat_sb->st_gid);
case FS_ATIME:
#ifdef NETWARE
- RETURN_INT((php_int_t)stat_sb->st_atime.tv_sec);
+ RETURN_LONG((zend_long)stat_sb->st_atime.tv_sec);
#else
- RETURN_INT((php_int_t)stat_sb->st_atime);
+ RETURN_LONG((zend_long)stat_sb->st_atime);
#endif
case FS_MTIME:
#ifdef NETWARE
- RETURN_INT((php_int_t)stat_sb->st_mtime.tv_sec);
+ RETURN_LONG((zend_long)stat_sb->st_mtime.tv_sec);
#else
- RETURN_INT((php_int_t)stat_sb->st_mtime);
+ RETURN_LONG((zend_long)stat_sb->st_mtime);
#endif
case FS_CTIME:
#ifdef NETWARE
- RETURN_INT((php_int_t)stat_sb->st_ctime.tv_sec);
+ RETURN_LONG((zend_long)stat_sb->st_ctime.tv_sec);
#else
- RETURN_INT((php_int_t)stat_sb->st_ctime);
+ RETURN_LONG((zend_long)stat_sb->st_ctime);
#endif
case FS_TYPE:
if (S_ISLNK(stat_sb->st_mode)) {
@@ -533,36 +533,36 @@ static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TS
case FS_STAT:
array_init(return_value);
- ZVAL_INT(&stat_dev, stat_sb->st_dev);
- ZVAL_INT(&stat_ino, stat_sb->st_ino);
- ZVAL_INT(&stat_mode, stat_sb->st_mode);
- ZVAL_INT(&stat_nlink, stat_sb->st_nlink);
- ZVAL_INT(&stat_uid, stat_sb->st_uid);
- ZVAL_INT(&stat_gid, stat_sb->st_gid);
+ ZVAL_LONG(&stat_dev, stat_sb->st_dev);
+ ZVAL_LONG(&stat_ino, stat_sb->st_ino);
+ ZVAL_LONG(&stat_mode, stat_sb->st_mode);
+ ZVAL_LONG(&stat_nlink, stat_sb->st_nlink);
+ ZVAL_LONG(&stat_uid, stat_sb->st_uid);
+ ZVAL_LONG(&stat_gid, stat_sb->st_gid);
#ifdef HAVE_ST_RDEV
- ZVAL_INT(&stat_rdev, stat_sb->st_rdev);
+ ZVAL_LONG(&stat_rdev, stat_sb->st_rdev);
#else
- ZVAL_INT(&stat_rdev, -1);
+ ZVAL_LONG(&stat_rdev, -1);
#endif
- ZVAL_INT(&stat_size, stat_sb->st_size);
+ ZVAL_LONG(&stat_size, stat_sb->st_size);
#ifdef NETWARE
- ZVAL_INT(&stat_atime, (stat_sb->st_atime).tv_sec);
- ZVAL_INT(&stat_mtime, (stat_sb->st_mtime).tv_sec);
- ZVAL_INT(&stat_ctime, (stat_sb->st_ctime).tv_sec);
+ ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec);
+ ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec);
+ ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec);
#else
- ZVAL_INT(&stat_atime, stat_sb->st_atime);
- ZVAL_INT(&stat_mtime, stat_sb->st_mtime);
- ZVAL_INT(&stat_ctime, stat_sb->st_ctime);
+ ZVAL_LONG(&stat_atime, stat_sb->st_atime);
+ ZVAL_LONG(&stat_mtime, stat_sb->st_mtime);
+ ZVAL_LONG(&stat_ctime, stat_sb->st_ctime);
#endif
#ifdef HAVE_ST_BLKSIZE
- ZVAL_INT(&stat_blksize, stat_sb->st_blksize);
+ ZVAL_LONG(&stat_blksize, stat_sb->st_blksize);
#else
- ZVAL_INT(&stat_blksize,-1);
+ ZVAL_LONG(&stat_blksize,-1);
#endif
#ifdef HAVE_ST_BLOCKS
- ZVAL_INT(&stat_blocks, stat_sb->st_blocks);
+ ZVAL_LONG(&stat_blocks, stat_sb->st_blocks);
#else
- ZVAL_INT(&stat_blocks,-1);
+ ZVAL_LONG(&stat_blocks,-1);
#endif
/* Store numeric indexes in propper order */
zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev);
@@ -611,7 +611,7 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i
if (!IS_ABSOLUTE_PATH(filename, filename_length) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- php_stat_t sb = {0};
+ zend_stat_t sb = {0};
phar_entry_info *data = NULL;
phar_archive_data *phar;
@@ -805,7 +805,7 @@ void fname(INTERNAL_FUNCTION_PARAMETERS) { \
PHAR_G(orig)(INTERNAL_FUNCTION_PARAM_PASSTHRU); \
} else { \
char *filename; \
- int filename_len; \
+ size_t filename_len; \
\
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \
return; \
@@ -889,7 +889,7 @@ PharFileFunction(phar_is_dir, FS_IS_DIR, orig_is_dir)
PHAR_FUNC(phar_is_file) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
if (!PHAR_G(intercepted)) {
goto skip_phar;
@@ -956,7 +956,7 @@ skip_phar:
PHAR_FUNC(phar_is_link) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
if (!PHAR_G(intercepted)) {
goto skip_phar;
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index c0df89fc5c..cdc61fee88 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -50,28 +50,28 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
{
zend_bool old, ini;
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
old = PHAR_G(readonly_orig);
} else {
old = PHAR_G(require_hash_orig);
}
- if (new_value_length == 2 && !strcasecmp("on", new_value)) {
+ if (new_value->len == 2 && !strcasecmp("on", new_value->val)) {
ini = (zend_bool) 1;
}
- else if (new_value_length == 3 && !strcasecmp("yes", new_value)) {
+ else if (new_value->len == 3 && !strcasecmp("yes", new_value->val)) {
ini = (zend_bool) 1;
}
- else if (new_value_length == 4 && !strcasecmp("true", new_value)) {
+ else if (new_value->len == 4 && !strcasecmp("true", new_value->val)) {
ini = (zend_bool) 1;
}
else {
- ini = (zend_bool) atoi(new_value);
+ ini = (zend_bool) atoi(new_value->val);
}
/* do not allow unsetting in runtime */
if (stage == ZEND_INI_STAGE_STARTUP) {
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
PHAR_G(readonly_orig) = ini;
} else {
PHAR_G(require_hash_orig) = ini;
@@ -80,7 +80,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
return FAILURE;
}
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
PHAR_G(readonly) = ini;
if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash) {
zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini TSRMLS_CC);
@@ -183,7 +183,7 @@ finish_error:
ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
{
- PHAR_G(cache_list) = new_value;
+ PHAR_G(cache_list) = new_value->val;
if (stage == ZEND_INI_STAGE_STARTUP) {
phar_split_cache_list(TSRMLS_C);
@@ -662,14 +662,14 @@ int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRM
* This is used by phar_open_from_filename to process the manifest, but can be called
* directly.
*/
-static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, php_int_t halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
+static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
{
char b32[4], *buffer, *endbuffer, *savebuf;
phar_archive_data *mydata = NULL;
phar_entry_info entry;
php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags;
php_uint16 manifest_ver;
- php_int_t offset;
+ zend_long offset;
int sig_len, register_alias = 0, temp_alias = 0;
char *signature = NULL;
@@ -771,7 +771,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
/* be ignored on reading because it is being generated anyways. */
if (manifest_flags & PHAR_HDR_SIGNATURE) {
char sig_buf[8], *sig_ptr = sig_buf;
- php_off_t read_len;
+ zend_off_t read_len;
size_t end_of_phar;
if (-1 == php_stream_seek(fp, -8, SEEK_END)
@@ -792,7 +792,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
case PHAR_SIG_OPENSSL: {
php_uint32 signature_len;
char *sig;
- php_off_t whence;
+ zend_off_t whence;
/* we store the signature followed by the signature length */
if (-1 == php_stream_seek(fp, -12, SEEK_CUR)
@@ -1575,9 +1575,9 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
char *pos, test = '\0';
const int window_size = 1024;
char buffer[1024 + sizeof(token)]; /* a 1024 byte window + the size of the halt_compiler token (moving window) */
- const php_int_t readsize = sizeof(buffer) - sizeof(token);
- const php_int_t tokenlen = sizeof(token) - 1;
- php_int_t halt_offset;
+ const zend_long readsize = sizeof(buffer) - sizeof(token);
+ const zend_long tokenlen = sizeof(token) - 1;
+ zend_long halt_offset;
size_t got;
php_uint32 compression = PHAR_FILE_COMPRESSED_NONE;
@@ -1618,7 +1618,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
#ifndef MAX_WBITS
#define MAX_WBITS 15
#endif
- add_assoc_int(&filterparams, "window", MAX_WBITS + 32);
+ add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS + 32);
/* entire file is gzip-compressed, uncompress to temporary file */
if (!(temp = php_stream_fopen_tmpfile())) {
@@ -1630,7 +1630,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
if (!filter) {
err = 1;
- add_assoc_int(&filterparams, "window", MAX_WBITS);
+ add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS);
filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC);
zval_dtor(&filterparams);
@@ -1960,7 +1960,7 @@ woohoo:
}
} else {
zend_string *str_key;
- php_uint_t unused;
+ zend_ulong unused;
for (zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map));
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &str_key, &unused, 0, &PHAR_GLOBALS->phar_fname_map.nInternalPointer);
@@ -2072,54 +2072,6 @@ static int php_check_dots(const char *element, int n) /* {{{ */
#define IS_BACKSLASH(c) ((c) == '/')
-#ifdef COMPILE_DL_PHAR
-/* stupid-ass non-extern declaration in tsrm_strtok.h breaks dumbass MS compiler */
-static inline int in_character_class(char ch, const char *delim) /* {{{ */
-{
- while (*delim) {
- if (*delim == ch) {
- return 1;
- }
- ++delim;
- }
- return 0;
-}
-/* }}} */
-
-char *tsrm_strtok_r(char *s, const char *delim, char **last) /* {{{ */
-{
- char *token;
-
- if (s == NULL) {
- s = *last;
- }
-
- while (*s && in_character_class(*s, delim)) {
- ++s;
- }
-
- if (!*s) {
- return NULL;
- }
-
- token = s;
-
- while (*s && !in_character_class(*s, delim)) {
- ++s;
- }
-
- if (!*s) {
- *last = s;
- } else {
- *s = '\0';
- *last = s + 1;
- }
-
- return token;
-}
-/* }}} */
-#endif
-
/**
* Remove .. and . references within a phar filename
*/
@@ -2534,7 +2486,7 @@ char *phar_create_default_stub(const char *index_php, const char *web_index, siz
* user_stub contains either a string, or a resource pointer, if len is a negative length.
* user_stub and len should be both 0 if the default or existing stub should be used
*/
-int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC) /* {{{ */
+int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC) /* {{{ */
{
char halt_stub[] = "__HALT_COMPILER();";
char *newstub, *tmp;
@@ -2542,8 +2494,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv
int halt_offset, restore_alias_len, global_flags = 0, closeoldfile;
char *pos, has_dirs = 0;
char manifest[18], entry_buffer[24];
- php_off_t manifest_ftell;
- php_int_t offset;
+ zend_off_t manifest_ftell;
+ zend_long offset;
size_t wrote;
php_uint32 manifest_len, mytime, loc, new_manifest_count;
php_uint32 newcrc32;
@@ -2650,7 +2602,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv
spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname);
}
if (free_user_stub) {
- STR_FREE(suser_stub);
+ zend_string_free(suser_stub);
}
return EOF;
}
@@ -2667,13 +2619,13 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv
spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname);
}
if (free_user_stub) {
- STR_FREE(suser_stub);
+ zend_string_free(suser_stub);
}
return EOF;
}
phar->halt_offset = len + 5;
if (free_user_stub) {
- STR_FREE(suser_stub);
+ zend_string_free(suser_stub);
}
} else {
size_t written;
@@ -3230,7 +3182,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv
zval filterparams;
array_init(&filterparams);
- add_assoc_int(&filterparams, "window", MAX_WBITS+16);
+ add_assoc_long(&filterparams, "window", MAX_WBITS+16);
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
zval_dtor(&filterparams);
diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index ff750d07cd..f49143bc8c 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -35,6 +35,7 @@
#include "zend_operators.h"
#include "zend_qsort.h"
#include "zend_vm.h"
+#include "zend_smart_str.h"
#include "main/php_streams.h"
#include "main/streams/php_stream_plain_wrapper.h"
#include "main/SAPI.h"
@@ -49,7 +50,6 @@
#include "ext/standard/md5.h"
#include "ext/standard/sha1.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
#include "ext/standard/php_versioning.h"
#ifndef PHP_WIN32
#include "TSRM/tsrm_strtok_r.h"
@@ -249,11 +249,11 @@ typedef struct _phar_entry_info {
char *filename;
enum phar_fp_type fp_type;
/* offset within original phar file of the file contents */
- php_int_t offset_abs;
+ zend_long offset_abs;
/* offset within fp of the file contents */
- php_int_t offset;
+ zend_long offset;
/* offset within original phar file of the file header (for zip-based/tar-based) */
- php_int_t header_offset;
+ zend_long header_offset;
php_stream *fp;
php_stream *cfp;
int fp_refcount;
@@ -334,7 +334,7 @@ struct _phar_archive_data {
typedef struct _phar_entry_fp_info {
enum phar_fp_type fp_type;
/* offset within fp of the file contents */
- php_int_t offset;
+ zend_long offset;
} phar_entry_fp_info;
struct _phar_entry_fp {
@@ -415,7 +415,7 @@ static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp TSRM
PHAR_GLOBALS->cached_fp[phar->phar_pos].ufp = fp;
}
-static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, php_off_t offset TSRMLS_DC)
+static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, zend_off_t offset TSRMLS_DC)
{
phar_entry_fp_info *data;
@@ -437,7 +437,7 @@ static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry TSRMLS_D
return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].manifest[entry->manifest_pos].fp_type;
}
-static inline php_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC)
+static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC)
{
if (!entry->is_persistent) {
return entry->offset;
@@ -466,9 +466,9 @@ typedef struct _phar_entry_data {
phar_archive_data *phar;
php_stream *fp;
/* stream position proxy, allows multiple open streams referring to the same fp */
- php_off_t position;
+ zend_off_t position;
/* for copies of the phar fp, defines where 0 is */
- php_off_t zero;
+ zend_off_t zero;
unsigned int for_write:1;
unsigned int is_zip:1;
unsigned int is_tar:1;
@@ -564,7 +564,7 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC);
phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRMLS_DC);
void destroy_phar_manifest_entry(zval *zv);
-int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC);
+int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC);
php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC);
int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error TSRMLS_DC);
int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TSRMLS_DC);
@@ -578,12 +578,12 @@ int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC);
int phar_is_tar(char *buf, char *fname);
int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC);
int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC);
+int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC);
/* zip functions in zip.c */
int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC);
int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_zip_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC);
+int phar_zip_flush(phar_archive_data *archive, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC);
#ifdef PHAR_MAIN
static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error TSRMLS_DC);
@@ -600,7 +600,7 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int pa
phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC);
phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
-int phar_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC);
+int phar_flush(phar_archive_data *archive, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC);
int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC);
int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC);
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 9319645fac..f82b825631 100755
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -75,7 +75,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
/* PATH_INFO and PATH_TRANSLATED should always be munged */
if (NULL != (stuff = zend_hash_str_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO")-1))) {
path_info = Z_STRVAL_P(stuff);
- code = Z_STRSIZE_P(stuff);
+ code = Z_STRLEN_P(stuff);
if (code > entry_len && !memcmp(path_info, entry, entry_len)) {
ZVAL_STR(&temp, Z_STR_P(stuff));
ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len);
@@ -87,7 +87,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
zend_string *str = strpprintf(4096, "phar://%s%s", fname, entry);
ZVAL_STR(&temp, Z_STR_P(stuff));
- ZVAL_STR(stuff, str);
+ ZVAL_NEW_STR(stuff, str);
zend_hash_str_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED")-1, &temp);
}
@@ -99,7 +99,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) {
if (NULL != (stuff = zend_hash_str_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI")-1))) {
path_info = Z_STRVAL_P(stuff);
- code = Z_STRSIZE_P(stuff);
+ code = Z_STRLEN_P(stuff);
if (code > basename_len && !memcmp(path_info, basename, basename_len)) {
ZVAL_STR(&temp, Z_STR_P(stuff));
ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len);
@@ -111,7 +111,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) {
if (NULL != (stuff = zend_hash_str_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF")-1))) {
path_info = Z_STRVAL_P(stuff);
- code = Z_STRSIZE_P(stuff);
+ code = Z_STRLEN_P(stuff);
if (code > basename_len && !memcmp(path_info, basename, basename_len)) {
ZVAL_STR(&temp, Z_STR_P(stuff));
@@ -134,7 +134,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
zend_string *str = strpprintf(4096, "phar://%s%s", fname, entry);
ZVAL_STR(&temp, Z_STR_P(stuff));
- ZVAL_STR(stuff, str);
+ ZVAL_NEW_STR(stuff, str);
zend_hash_str_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME")-1, &temp);
}
@@ -155,7 +155,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
zend_op_array *new_op_array;
zval result;
php_stream *fp;
- php_off_t position;
+ zend_off_t position;
switch (code) {
case PHAR_MIME_PHPS:
@@ -211,7 +211,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
if (got > 0) {
PHPWRITE(buf, got);
position += got;
- if (position == (php_off_t) info->uncompressed_filesize) {
+ if (position == (zend_off_t) info->uncompressed_filesize) {
break;
}
}
@@ -322,7 +322,7 @@ static void phar_do_403(char *entry, int entry_len TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, int f404_len, char *entry, int entry_len TSRMLS_DC) /* {{{ */
+static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len TSRMLS_DC) /* {{{ */
{
sapi_header_line ctr = {0};
phar_entry_info *info;
@@ -455,7 +455,8 @@ PHP_METHOD(Phar, running)
PHP_METHOD(Phar, mount)
{
char *fname, *arch = NULL, *entry = NULL, *path, *actual;
- int fname_len, arch_len, entry_len, path_len, actual_len;
+ int fname_len, arch_len, entry_len;
+ size_t path_len, actual_len;
phar_archive_data *pphar;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
@@ -545,12 +546,14 @@ PHP_METHOD(Phar, webPhar)
{
zval *mimeoverride = NULL, *rewrite = NULL;
char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL;
- int alias_len = 0, f404_len = 0, free_pathinfo = 0, ru_len = 0;
+ size_t alias_len = 0, f404_len = 0, free_pathinfo = 0, ru_len = 0;
char *fname, *path_info, *mime_type = NULL, *entry, *pt;
const char *basename;
- int fname_len, entry_len, code, index_php_len = 0, not_cgi;
+ size_t fname_len, index_php_len = 0;
+ int entry_len, code, not_cgi;
phar_archive_data *phar = NULL;
phar_entry_info *info = NULL;
+ size_t sapi_mod_name_len = strlen(sapi_module.name);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
return;
@@ -585,9 +588,9 @@ PHP_METHOD(Phar, webPhar)
++basename;
}
- if ((strlen(sapi_module.name) == sizeof("cgi-fcgi")-1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi")-1))
- || (strlen(sapi_module.name) == sizeof("fpm-fcgi")-1 && !strncmp(sapi_module.name, "fpm-fcgi", sizeof("fpm-fcgi")-1))
- || (strlen(sapi_module.name) == sizeof("cgi")-1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi")-1))) {
+ if ((sapi_mod_name_len == sizeof("cgi-fcgi") - 1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi") - 1))
+ || (sapi_mod_name_len == sizeof("fpm-fcgi") - 1 && !strncmp(sapi_module.name, "fpm-fcgi", sizeof("fpm-fcgi") - 1))
+ || (sapi_mod_name_len == sizeof("cgi") - 1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi") - 1))) {
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF) {
HashTable *_server = Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]);
@@ -601,11 +604,11 @@ PHP_METHOD(Phar, webPhar)
if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) &&
IS_STRING == Z_TYPE_P(z_path_info)) {
- entry_len = Z_STRSIZE_P(z_path_info);
+ entry_len = Z_STRLEN_P(z_path_info);
entry = estrndup(Z_STRVAL_P(z_path_info), entry_len);
- path_info = emalloc(Z_STRSIZE_P(z_script_name) + entry_len + 1);
- memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name));
- memcpy(path_info + Z_STRSIZE_P(z_script_name), entry, entry_len + 1);
+ path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1);
+ memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name));
+ memcpy(path_info + Z_STRLEN_P(z_script_name), entry, entry_len + 1);
free_pathinfo = 1;
} else {
entry_len = 0;
@@ -613,7 +616,7 @@ PHP_METHOD(Phar, webPhar)
path_info = Z_STRVAL_P(z_script_name);
}
- pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name));
+ pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name));
} else {
char *testit;
@@ -702,8 +705,8 @@ PHP_METHOD(Phar, webPhar)
switch (Z_TYPE(retval)) {
case IS_STRING:
efree(entry);
- entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRSIZE_P(fci.retval));
- entry_len = Z_STRSIZE_P(fci.retval);
+ entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval));
+ entry_len = Z_STRLEN_P(fci.retval);
break;
case IS_TRUE:
case IS_FALSE:
@@ -726,7 +729,7 @@ PHP_METHOD(Phar, webPhar)
}
if (entry_len) {
- phar_postprocess_ru_web(fname, fname_len, &entry, &entry_len, &ru, &ru_len TSRMLS_CC);
+ phar_postprocess_ru_web(fname, fname_len, &entry, (int *)&entry_len, &ru, (int *)&ru_len TSRMLS_CC);
}
if (!entry_len || (entry_len == 1 && entry[0] == '/')) {
@@ -809,10 +812,10 @@ PHP_METHOD(Phar, webPhar)
if (NULL != (val = zend_hash_str_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)))) {
switch (Z_TYPE_P(val)) {
- case IS_INT:
- if (Z_IVAL_P(val) == PHAR_MIME_PHP || Z_IVAL_P(val) == PHAR_MIME_PHPS) {
+ case IS_LONG:
+ if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) {
mime_type = "";
- code = Z_IVAL_P(val);
+ code = Z_LVAL_P(val);
} else {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed");
#ifdef PHP_WIN32
@@ -876,11 +879,11 @@ PHP_METHOD(Phar, mungServer)
return;
}
- if (Z_STRSIZE_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) {
+ if (Z_STRLEN_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) {
PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_PHP_SELF;
}
- if (Z_STRSIZE_P(data) == sizeof("REQUEST_URI")-1) {
+ if (Z_STRLEN_P(data) == sizeof("REQUEST_URI")-1) {
if (!strncmp(Z_STRVAL_P(data), "REQUEST_URI", sizeof("REQUEST_URI")-1)) {
PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_REQUEST_URI;
}
@@ -889,7 +892,7 @@ PHP_METHOD(Phar, mungServer)
}
}
- if (Z_STRSIZE_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) {
+ if (Z_STRLEN_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) {
PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME;
}
} ZEND_HASH_FOREACH_END();
@@ -921,7 +924,7 @@ PHP_METHOD(Phar, interceptFileFuncs)
PHP_METHOD(Phar, createDefaultStub)
{
char *index = NULL, *webindex = NULL, *stub, *error;
- int index_len = 0, webindex_len = 0;
+ size_t index_len = 0, webindex_len = 0;
size_t stub_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
@@ -946,10 +949,10 @@ PHP_METHOD(Phar, createDefaultStub)
PHP_METHOD(Phar, mapPhar)
{
char *alias = NULL, *error;
- int alias_len = 0;
- php_int_t dataoffset = 0;
+ size_t alias_len = 0;
+ zend_long dataoffset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!i", &alias, &alias_len, &dataoffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
return;
}
@@ -968,7 +971,7 @@ PHP_METHOD(Phar, mapPhar)
PHP_METHOD(Phar, loadPhar)
{
char *fname, *alias = NULL, *error;
- int fname_len, alias_len = 0;
+ size_t fname_len, alias_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
return;
@@ -999,9 +1002,9 @@ PHP_METHOD(Phar, apiVersion)
* Returns whether phar extension supports compression using zlib/bzip2 */
PHP_METHOD(Phar, canCompress)
{
- php_int_t method = 0;
+ zend_long method = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) {
return;
}
@@ -1046,7 +1049,8 @@ PHP_METHOD(Phar, isValidPharFilename)
{
char *fname;
const char *ext_str;
- int fname_len, ext_len, is_executable;
+ size_t fname_len;
+ int ext_len, is_executable;
zend_bool executable = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &fname, &fname_len, &executable) == FAILURE) {
@@ -1108,9 +1112,10 @@ PHP_METHOD(Phar, __construct)
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Cannot instantiate Phar object without SPL extension");
#else
char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname;
- int fname_len, alias_len = 0, arch_len, entry_len, is_data;
- php_int_t flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS;
- php_int_t format = 0;
+ size_t fname_len, alias_len = 0;
+ int arch_len, entry_len, is_data;
+ zend_long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS;
+ zend_long format = 0;
phar_archive_object *phar_obj;
phar_archive_data *phar_data;
zval *zobj = getThis(), arg1, arg2;
@@ -1120,11 +1125,11 @@ PHP_METHOD(Phar, __construct)
is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC);
if (is_data) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!i", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
return;
}
}
@@ -1135,7 +1140,7 @@ PHP_METHOD(Phar, __construct)
}
save_fname = fname;
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, !is_data, 2 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, !is_data, 2 TSRMLS_CC)) {
/* use arch (the basename for the archive) for fname instead of fname */
/* this allows support for RecursiveDirectoryIterator of subdirectories */
#ifdef PHP_WIN32
@@ -1214,7 +1219,7 @@ PHP_METHOD(Phar, __construct)
}
ZVAL_STRINGL(&arg1, fname, fname_len);
- ZVAL_INT(&arg2, flags);
+ ZVAL_LONG(&arg2, flags);
zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj),
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
@@ -1289,7 +1294,8 @@ PHP_METHOD(Phar, getSupportedCompression)
PHP_METHOD(Phar, unlinkArchive)
{
char *fname, *error, *zname, *arch, *entry;
- int fname_len, zname_len, arch_len, entry_len;
+ size_t fname_len;
+ int zname_len, arch_len, entry_len;
phar_archive_data *phar;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
@@ -1377,10 +1383,10 @@ struct _phar_t {
phar_archive_object *p;
zend_class_entry *c;
char *b;
- uint l;
zval *ret;
- int count;
php_stream *fp;
+ uint l;
+ int count;
};
static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
@@ -1435,7 +1441,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
return ZEND_HASH_APPLY_STOP;
}
- str_key_len = Z_STRSIZE(key);
+ str_key_len = Z_STRLEN(key);
str_key = estrndup(Z_STRVAL(key), str_key_len);
save = str_key;
@@ -1504,7 +1510,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
}
fname = Z_STRVAL_P(value);
- fname_len = Z_STRSIZE_P(value);
+ fname_len = Z_STRLEN_P(value);
phar_spl_fileinfo:
if (base_len) {
@@ -1563,7 +1569,7 @@ phar_spl_fileinfo:
return ZEND_HASH_APPLY_STOP;
}
- str_key_len = Z_STRSIZE(key);
+ str_key_len = Z_STRLEN(key);
str_key = estrndup(Z_STRVAL(key), str_key_len);
save = str_key;
@@ -1713,7 +1719,7 @@ after_open_fp:
PHP_METHOD(Phar, buildFromDirectory)
{
char *dir, *error, *regex = NULL;
- int dir_len, regex_len = 0;
+ size_t dir_len, regex_len = 0;
zend_bool apply_reg = 0;
zval arg, arg2, iter, iteriter, regexiter;
struct _phar_t pass;
@@ -1737,7 +1743,7 @@ PHP_METHOD(Phar, buildFromDirectory)
}
ZVAL_STRINGL(&arg, dir, dir_len);
- ZVAL_INT(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
+ ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
@@ -1846,7 +1852,7 @@ PHP_METHOD(Phar, buildFromIterator)
{
zval *obj;
char *error;
- uint base_len = 0;
+ size_t base_len = 0;
char *base = NULL;
struct _phar_t pass;
@@ -1900,14 +1906,14 @@ PHP_METHOD(Phar, buildFromIterator)
PHP_METHOD(Phar, count)
{
/* mode can be ignored, maximum depth is 1 */
- php_int_t mode;
+ zend_long mode;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
RETURN_FALSE;
}
- RETURN_INT(zend_hash_num_elements(&phar_obj->archive->manifest));
+ RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest));
}
/* }}} */
@@ -1917,10 +1923,10 @@ PHP_METHOD(Phar, count)
*/
PHP_METHOD(Phar, isFileFormat)
{
- php_int_t type;
+ zend_long type;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) {
RETURN_FALSE;
}
@@ -1940,7 +1946,7 @@ PHP_METHOD(Phar, isFileFormat)
static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */
{
char *error;
- php_off_t offset;
+ zend_off_t offset;
phar_entry_info *link;
if (FAILURE == phar_open_entry_fp(entry, &error, 1 TSRMLS_CC)) {
@@ -1993,7 +1999,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
zend_class_entry *ce;
char *error;
const char *pcr_error;
- int ext_len = ext ? strlen(ext) : 0;
+ size_t ext_len = ext ? strlen(ext) : 0;
int oldname_len;
phar_archive_data *pphar = NULL;
php_stream_statbuf ssb;
@@ -2044,7 +2050,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
ext = "phar";
}
}
- } else if (phar_path_check(&ext, &ext_len, &pcr_error) > pcr_is_ok) {
+ } else if (phar_path_check(&ext, (int *)&ext_len, &pcr_error) > pcr_is_ok) {
if (phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "data phar converted from \"%s\" has invalid extension %s", phar->fname, ext);
@@ -2296,14 +2302,15 @@ no_copy:
PHP_METHOD(Phar, convertToExecutable)
{
char *ext = NULL;
- int is_data, ext_len = 0;
+ int is_data;
+ size_t ext_len = 0;
php_uint32 flags;
zend_object *ret;
/* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */
- php_int_t format = 9021976, method = 9021976;
+ zend_long format = 9021976, method = 9021976;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
return;
}
@@ -2399,14 +2406,15 @@ PHP_METHOD(Phar, convertToExecutable)
PHP_METHOD(Phar, convertToData)
{
char *ext = NULL;
- int is_data, ext_len = 0;
+ int is_data;
+ size_t ext_len = 0;
php_uint32 flags;
zend_object *ret;
/* a number that is not 0, 1 or 2 (Which is also Greg's birthday so there) */
- php_int_t format = 9021976, method = 9021976;
+ zend_long format = 9021976, method = 9021976;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
return;
}
@@ -2506,11 +2514,11 @@ PHP_METHOD(Phar, isCompressed)
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) {
- RETURN_INT(PHAR_ENT_COMPRESSED_GZ);
+ RETURN_LONG(PHAR_ENT_COMPRESSED_GZ);
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) {
- RETURN_INT(PHAR_ENT_COMPRESSED_BZ2);
+ RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2);
}
RETURN_FALSE;
@@ -2551,7 +2559,7 @@ PHP_METHOD(Phar, isWritable)
PHP_METHOD(Phar, delete)
{
char *fname;
- int fname_len;
+ size_t fname_len;
char *error;
phar_entry_info *entry;
PHAR_ARCHIVE_OBJECT();
@@ -2636,7 +2644,8 @@ PHP_METHOD(Phar, setAlias)
{
char *alias, *error, *oldalias;
phar_archive_data *fd_ptr;
- int alias_len, oldalias_len, old_temp, readd = 0;
+ size_t alias_len, oldalias_len;
+ int old_temp, readd = 0;
PHAR_ARCHIVE_OBJECT();
@@ -2811,8 +2820,8 @@ PHP_METHOD(Phar, setStub)
{
zval *zstub;
char *stub, *error;
- int stub_len;
- php_int_t len = -1;
+ size_t stub_len;
+ zend_long len = -1;
php_stream *stream;
PHAR_ARCHIVE_OBJECT();
@@ -2833,7 +2842,7 @@ PHP_METHOD(Phar, setStub)
return;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zstub, &len) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zstub, &len) == SUCCESS) {
if ((php_stream_from_zval_no_verify(stream, zstub)) != NULL) {
if (len > 0) {
len = -len;
@@ -2889,7 +2898,8 @@ PHP_METHOD(Phar, setStub)
PHP_METHOD(Phar, setDefaultStub)
{
char *index = NULL, *webindex = NULL, *error = NULL, *stub = NULL;
- int index_len = 0, webindex_len = 0, created_stub = 0;
+ size_t index_len = 0, webindex_len = 0;
+ int created_stub = 0;
size_t stub_len = 0;
PHAR_ARCHIVE_OBJECT();
@@ -2962,9 +2972,9 @@ PHP_METHOD(Phar, setDefaultStub)
*/
PHP_METHOD(Phar, setSignatureAlgorithm)
{
- php_int_t algo;
+ zend_long algo;
char *error, *key = NULL;
- int key_len = 0;
+ size_t key_len = 0;
PHAR_ARCHIVE_OBJECT();
@@ -2974,7 +2984,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
return;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &algo, &key, &key_len) != SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &algo, &key, &key_len) != SUCCESS) {
return;
}
@@ -3133,14 +3143,14 @@ static int pharobj_cancompress(HashTable *manifest TSRMLS_DC) /* {{{ */
*/
PHP_METHOD(Phar, compress)
{
- php_int_t method;
+ zend_long method;
char *ext = NULL;
- int ext_len = 0;
+ size_t ext_len = 0;
php_uint32 flags;
zend_object *ret;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &method, &ext, &ext_len) == FAILURE) {
return;
}
@@ -3203,7 +3213,7 @@ PHP_METHOD(Phar, compress)
PHP_METHOD(Phar, decompress)
{
char *ext = NULL;
- int ext_len = 0;
+ size_t ext_len = 0;
zend_object *ret;
PHAR_ARCHIVE_OBJECT();
@@ -3246,10 +3256,10 @@ PHP_METHOD(Phar, compressFiles)
{
char *error;
php_uint32 flags;
- php_int_t method;
+ zend_long method;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) {
return;
}
@@ -3368,8 +3378,9 @@ PHP_METHOD(Phar, copy)
{
char *oldfile, *newfile, *error;
const char *pcr_error;
- int oldfile_len, newfile_len;
+ size_t oldfile_len, newfile_len;
phar_entry_info *oldentry, newentry = {0}, *temp;
+ int tmp_len = 0;
PHAR_ARCHIVE_OBJECT();
@@ -3411,11 +3422,13 @@ PHP_METHOD(Phar, copy)
}
}
- if (phar_path_check(&newfile, &newfile_len, &pcr_error) > pcr_is_ok) {
+ tmp_len = (int)newfile_len;
+ if (phar_path_check(&newfile, &tmp_len, &pcr_error) > pcr_is_ok) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"file \"%s\" contains invalid characters %s, cannot be copied from \"%s\" in phar %s", newfile, pcr_error, oldfile, phar_obj->archive->fname);
RETURN_FALSE;
}
+ newfile_len = tmp_len;
if (phar_obj->archive->is_persistent) {
if (FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
@@ -3466,7 +3479,7 @@ PHP_METHOD(Phar, copy)
PHP_METHOD(Phar, offsetExists)
{
char *fname;
- int fname_len;
+ size_t fname_len;
phar_entry_info *entry;
PHAR_ARCHIVE_OBJECT();
@@ -3503,7 +3516,7 @@ PHP_METHOD(Phar, offsetExists)
PHP_METHOD(Phar, offsetGet)
{
char *fname, *error;
- int fname_len;
+ size_t fname_len;
zval zfname;
phar_entry_info *entry;
zend_string *sfname;
@@ -3538,7 +3551,7 @@ PHP_METHOD(Phar, offsetGet)
}
sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
- ZVAL_STR(&zfname, sfname);
+ ZVAL_NEW_STR(&zfname, sfname);
spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname TSRMLS_CC);
zval_ptr_dtor(&zfname);
}
@@ -3547,7 +3560,7 @@ PHP_METHOD(Phar, offsetGet)
/* {{{ add a file within the phar archive from a string or resource
*/
-static void phar_add_file(phar_archive_data **pphar, char *filename, int filename_len, char *cont_str, int cont_len, zval *zresource TSRMLS_DC)
+static void phar_add_file(phar_archive_data **pphar, char *filename, int filename_len, char *cont_str, size_t cont_len, zval *zresource TSRMLS_DC)
{
char *error;
size_t contents_len;
@@ -3647,7 +3660,7 @@ static void phar_mkdir(phar_archive_data **pphar, char *dirname, int dirname_len
PHP_METHOD(Phar, offsetSet)
{
char *fname, *cont_str = NULL;
- int fname_len, cont_len;
+ size_t fname_len, cont_len;
zval *zresource;
PHAR_ARCHIVE_OBJECT();
@@ -3686,7 +3699,7 @@ PHP_METHOD(Phar, offsetSet)
PHP_METHOD(Phar, offsetUnset)
{
char *fname, *error;
- int fname_len;
+ size_t fname_len;
phar_entry_info *entry;
PHAR_ARCHIVE_OBJECT();
@@ -3738,7 +3751,7 @@ PHP_METHOD(Phar, offsetUnset)
PHP_METHOD(Phar, addEmptyDir)
{
char *dirname;
- int dirname_len;
+ size_t dirname_len;
PHAR_ARCHIVE_OBJECT();
@@ -3761,7 +3774,7 @@ PHP_METHOD(Phar, addEmptyDir)
PHP_METHOD(Phar, addFile)
{
char *fname, *localname = NULL;
- int fname_len, localname_len = 0;
+ size_t fname_len, localname_len = 0;
php_stream *resource;
zval zresource;
@@ -3805,7 +3818,7 @@ PHP_METHOD(Phar, addFile)
PHP_METHOD(Phar, addFromString)
{
char *localname, *cont_str;
- int localname_len, cont_len;
+ size_t localname_len, cont_len;
PHAR_ARCHIVE_OBJECT();
@@ -3889,7 +3902,7 @@ PHP_METHOD(Phar, getStub)
php_stream_rewind(fp);
carry_on:
- buf = STR_ALLOC(len, 0);
+ buf = zend_string_alloc(len, 0);
if (len != php_stream_read(fp, buf->val, len)) {
if (fp != phar_obj->archive->fp) {
@@ -3897,7 +3910,7 @@ carry_on:
}
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to read stub");
- STR_RELEASE(buf);
+ zend_string_release(buf);
return;
}
@@ -4186,7 +4199,7 @@ PHP_METHOD(Phar, extractTo)
php_stream_statbuf ssb;
phar_entry_info *entry;
char *pathto, *filename, *actual;
- int pathto_len, filename_len;
+ size_t pathto_len, filename_len;
int ret, i;
int nelems;
zval *zval_files = NULL;
@@ -4242,7 +4255,7 @@ PHP_METHOD(Phar, extractTo)
goto all_files;
case IS_STRING:
filename = Z_STRVAL_P(zval_files);
- filename_len = Z_STRSIZE_P(zval_files);
+ filename_len = Z_STRLEN_P(zval_files);
break;
case IS_ARRAY:
nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files));
@@ -4320,7 +4333,8 @@ all_files:
PHP_METHOD(PharFileInfo, __construct)
{
char *fname, *arch, *entry, *error;
- int fname_len, arch_len, entry_len;
+ size_t fname_len;
+ int arch_len, entry_len;
phar_entry_object *entry_obj;
phar_entry_info *entry_info;
phar_archive_data *phar_data;
@@ -4337,7 +4351,7 @@ PHP_METHOD(PharFileInfo, __construct)
return;
}
- if (fname_len < 7 || memcmp(fname, "phar://", 7) || phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC) == FAILURE) {
+ if (fname_len < 7 || memcmp(fname, "phar://", 7) || phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"'%s' is not a valid phar archive URL (must have at least phar://filename.phar)", fname);
return;
@@ -4419,7 +4433,7 @@ PHP_METHOD(PharFileInfo, getCompressedSize)
return;
}
- RETURN_INT(entry_obj->entry->compressed_filesize);
+ RETURN_LONG(entry_obj->entry->compressed_filesize);
}
/* }}} */
@@ -4429,10 +4443,10 @@ PHP_METHOD(PharFileInfo, getCompressedSize)
PHP_METHOD(PharFileInfo, isCompressed)
{
/* a number that is not Phar::GZ or Phar::BZ2 */
- php_int_t method = 9021976;
+ zend_long method = 9021976;
PHAR_ENTRY_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) {
return;
}
@@ -4468,7 +4482,7 @@ PHP_METHOD(PharFileInfo, getCRC32)
}
if (entry_obj->entry->is_crc_checked) {
- RETURN_INT(entry_obj->entry->crc32);
+ RETURN_LONG(entry_obj->entry->crc32);
} else {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
"Phar entry was not CRC checked"); \
@@ -4502,7 +4516,7 @@ PHP_METHOD(PharFileInfo, getPharFlags)
return;
}
- RETURN_INT(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK));
+ RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK));
}
/* }}} */
@@ -4512,7 +4526,7 @@ PHP_METHOD(PharFileInfo, getPharFlags)
PHP_METHOD(PharFileInfo, chmod)
{
char *error;
- php_int_t perms;
+ zend_long perms;
PHAR_ENTRY_OBJECT();
if (entry_obj->entry->is_temp_dir) {
@@ -4526,7 +4540,7 @@ PHP_METHOD(PharFileInfo, chmod)
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perms) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perms) == FAILURE) {
return;
}
@@ -4774,11 +4788,11 @@ PHP_METHOD(PharFileInfo, getContent)
*/
PHP_METHOD(PharFileInfo, compress)
{
- php_int_t method;
+ zend_long method;
char *error;
PHAR_ENTRY_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) {
return;
}
@@ -5266,8 +5280,8 @@ zend_function_entry phar_exception_methods[] = {
};
/* }}} */
-#define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \
- zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
+#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \
+ zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
#define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)
@@ -5301,20 +5315,20 @@ void phar_object_init(TSRMLS_D) /* {{{ */
phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS;
#endif
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "TAR", PHAR_FORMAT_TAR)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHP", PHAR_MIME_PHP)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHPS", PHAR_MIME_PHPS)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "MD5", PHAR_SIG_MD5)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA1", PHAR_SIG_SHA1)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA256", PHAR_SIG_SHA256)
- REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA512", PHAR_SIG_SHA512)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "TAR", PHAR_FORMAT_TAR)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHP", PHAR_MIME_PHP)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHPS", PHAR_MIME_PHPS)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "MD5", PHAR_SIG_MD5)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA1", PHAR_SIG_SHA1)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA256", PHAR_SIG_SHA256)
+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA512", PHAR_SIG_SHA512)
}
/* }}} */
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index a500758420..eb2fa607ee 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -213,11 +213,11 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
if (idata->internal_file->uncompressed_filesize == 0
&& idata->internal_file->compressed_filesize == 0
&& (pzoption = zend_hash_str_find(pharcontext, "compress", sizeof("compress")-1)) != NULL
- && Z_TYPE_P(pzoption) == IS_INT
- && (Z_IVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0
+ && Z_TYPE_P(pzoption) == IS_LONG
+ && (Z_LVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0
) {
idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK;
- idata->internal_file->flags |= Z_IVAL_P(pzoption);
+ idata->internal_file->flags |= Z_LVAL_P(pzoption);
}
if ((pzoption = zend_hash_str_find(pharcontext, "metadata", sizeof("metadata")-1)) != NULL) {
if (Z_TYPE(idata->internal_file->metadata) != IS_UNDEF) {
@@ -377,7 +377,7 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML
got = php_stream_read(data->fp, buf, MIN(count, entry->uncompressed_filesize - data->position));
data->position = php_stream_tell(data->fp) - data->zero;
- stream->eof = (data->position == (php_off_t) entry->uncompressed_filesize);
+ stream->eof = (data->position == (zend_off_t) entry->uncompressed_filesize);
return got;
}
@@ -386,12 +386,12 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML
/**
* Used for fseek($fp) on a phar file handle
*/
-static int phar_stream_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */
+static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */
{
phar_entry_data *data = (phar_entry_data *)stream->abstract;
phar_entry_info *entry;
int res;
- php_off_t temp;
+ zend_off_t temp;
if (data->internal_file->link) {
entry = phar_get_link_source(data->internal_file TSRMLS_CC);
@@ -412,7 +412,7 @@ static int phar_stream_seek(php_stream *stream, php_off_t offset, int whence, ph
default:
temp = 0;
}
- if (temp > data->zero + (php_off_t) entry->uncompressed_filesize) {
+ if (temp > data->zero + (zend_off_t) entry->uncompressed_filesize) {
*newoffset = -1;
return -1;
}
@@ -440,7 +440,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun
return -1;
}
data->position = php_stream_tell(data->fp);
- if (data->position > (php_off_t)data->internal_file->uncompressed_filesize) {
+ if (data->position > (zend_off_t)data->internal_file->uncompressed_filesize) {
data->internal_file->uncompressed_filesize = data->position;
}
data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize;
@@ -906,7 +906,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
IS_SLASH(str_key->val[from_len])) {
- new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0);
+ new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
memcpy(new_str_key->val, resource_to->path + 1, to_len);
memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
new_str_key->val[new_str_key->len] = 0;
@@ -918,8 +918,8 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
entry->filename = estrndup(new_str_key->val, new_str_key->len);
entry->filename_len = new_str_key->len;
- STR_RELEASE(str_key);
- b->h = STR_HASH_VAL(new_str_key);
+ zend_string_release(str_key);
+ b->h = zend_string_hash_val(new_str_key);
b->key = new_str_key;
}
} ZEND_HASH_FOREACH_END();
@@ -931,13 +931,13 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
(str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) {
- new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0);
+ new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
memcpy(new_str_key->val, resource_to->path + 1, to_len);
memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
new_str_key->val[new_str_key->len] = 0;
- STR_RELEASE(str_key);
- b->h = STR_HASH_VAL(new_str_key);
+ zend_string_release(str_key);
+ b->h = zend_string_hash_val(new_str_key);
b->key = new_str_key;
}
} ZEND_HASH_FOREACH_END();
@@ -949,13 +949,13 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
(str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) {
- new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0);
+ new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
memcpy(new_str_key->val, resource_to->path + 1, to_len);
memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
new_str_key->val[new_str_key->len] = 0;
- STR_RELEASE(str_key);
- b->h = STR_HASH_VAL(new_str_key);
+ zend_string_release(str_key);
+ b->h = zend_string_hash_val(new_str_key);
b->key = new_str_key;
}
} ZEND_HASH_FOREACH_END();
diff --git a/ext/phar/stream.h b/ext/phar/stream.h
index 20cf68d9d7..0171010179 100644
--- a/ext/phar/stream.h
+++ b/ext/phar/stream.h
@@ -34,7 +34,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun
static size_t phar_stream_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC);
static int phar_stream_flush(php_stream *stream TSRMLS_DC);
-static int phar_stream_seek( php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC);
+static int phar_stream_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC);
static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
END_EXTERN_C()
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index fd571eae48..76862f7cdb 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -256,7 +256,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
phar_tar_number(hdr->size, sizeof(hdr->size));
if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
- php_off_t curloc;
+ zend_off_t curloc;
if (size > 511) {
if (error) {
@@ -570,7 +570,7 @@ bail:
phar_destroy_phar_data(myphar TSRMLS_CC);
return FAILURE;
}
- } while (read != 0);
+ } while (!php_stream_eof(fp));
if (zend_hash_str_exists(&(myphar->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
myphar->is_data = 0;
@@ -921,7 +921,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */
}
/* }}} */
-int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
+int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
{
phar_entry_info entry = {0};
static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();";
@@ -1004,7 +1004,7 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int
if (str) {
len = str->len;
user_stub = estrndup(str->val, str->len);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
user_stub = NULL;
len = 0;
@@ -1300,7 +1300,7 @@ nostub:
#ifndef MAX_WBITS
#define MAX_WBITS 15
#endif
- add_assoc_int(&filterparams, "window", MAX_WBITS + 16);
+ add_assoc_long(&filterparams, "window", MAX_WBITS + 16);
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
zval_dtor(&filterparams);
diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt
index 886ba81925..fe2cd3e22b 100644
--- a/ext/phar/tests/create_path_error.phpt
+++ b/ext/phar/tests/create_path_error.phpt
@@ -75,11 +75,11 @@ string(5) "query"
6:
7:
8:
-9:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-10:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-11:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-12:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-13:Error: file_put_contents(phar:///%s): failed to open stream: phar error: invalid path "%s" contains illegal character
+9:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
+10:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
+11:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
+12:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
+13:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
Exception: Entry a does not exist and cannot be created: phar error: invalid path "a" contains illegal character
===DONE===
diff --git a/ext/phar/util.c b/ext/phar/util.c
index c2a398d787..f131aa99a2 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -38,7 +38,7 @@
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
#else
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC);
+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC);
#endif
/* for links to relative location, prepend cwd of the entry */
@@ -117,10 +117,10 @@ php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /*
}
/* }}} */
-int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC) /* {{{ */
+int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC) /* {{{ */
{
php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC);
- php_off_t temp, eoffset;
+ zend_off_t temp, eoffset;
if (!fp) {
return -1;
@@ -154,7 +154,7 @@ int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_
temp = 0;
}
- if (temp > eoffset + (php_off_t) entry->uncompressed_filesize) {
+ if (temp > eoffset + (zend_off_t) entry->uncompressed_filesize) {
return -1;
}
@@ -693,7 +693,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
php_stream_filter *filter;
phar_archive_data *phar = entry->phar;
char *filtername;
- php_off_t loc;
+ zend_off_t loc;
php_stream *ufp;
phar_entry_data dummy;
@@ -786,7 +786,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
php_stream_flush(ufp);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
- if (php_stream_tell(ufp) - loc != (php_off_t) entry->uncompressed_filesize) {
+ if (php_stream_tell(ufp) - loc != (zend_off_t) entry->uncompressed_filesize) {
spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
return FAILURE;
}
@@ -1388,7 +1388,7 @@ static int phar_hex_str(const char *digest, size_t digest_len, char **signature
/* }}} */
#ifndef PHAR_HAVE_OPENSSL
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */
+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */
{
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -1406,7 +1406,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e
ZVAL_EMPTY_STRING(&zp[0]);
}
- if (end != Z_STRSIZE(zp[0])) {
+ if (end != Z_STRLEN(zp[0])) {
zval_dtor(&zp[0]);
zval_dtor(&zp[1]);
zval_dtor(&zp[2]);
@@ -1457,15 +1457,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e
switch (Z_TYPE(retval)) {
default:
- case IS_INT:
+ case IS_LONG:
zval_dtor(&zp[1]);
- if (1 == Z_IVAL(retval)) {
+ if (1 == Z_LVAL(retval)) {
return SUCCESS;
}
return FAILURE;
case IS_TRUE:
- *signature = estrndup(Z_STRVAL(zp[1]), Z_STRSIZE(zp[1]));
- *signature_len = Z_STRSIZE(zp[1]);
+ *signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1]));
+ *signature_len = Z_STRLEN(zp[1]);
zval_dtor(&zp[1]);
return SUCCESS;
case IS_FALSE:
@@ -1479,7 +1479,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e
int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC) /* {{{ */
{
int read_size, len;
- php_off_t read_len;
+ zend_off_t read_len;
unsigned char buf[1024];
php_stream_rewind(fp);
@@ -1526,7 +1526,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0, &sig, &tempsig TSRMLS_CC)) {
if (pubkey) {
- STR_RELEASE(pubkey);
+ zend_string_release(pubkey);
}
if (error) {
@@ -1537,7 +1537,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
}
if (pubkey) {
- STR_RELEASE(pubkey);
+ zend_string_release(pubkey);
}
sig_len = tempsig;
@@ -1545,7 +1545,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
in = BIO_new_mem_buf(pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0);
if (NULL == in) {
- STR_RELEASE(pubkey);
+ zend_string_release(pubkey);
if (error) {
spprintf(error, 0, "openssl signature could not be processed");
}
@@ -1554,7 +1554,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL);
BIO_free(in);
- STR_RELEASE(pubkey);
+ zend_string_release(pubkey);
if (NULL == key) {
if (error) {
@@ -1576,7 +1576,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
while (read_size && (len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
EVP_VerifyUpdate (&md_ctx, buf, len);
- read_len -= (php_off_t)len;
+ read_len -= (zend_off_t)len;
if (read_len < read_size) {
read_size = (int)read_len;
@@ -1616,7 +1616,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
PHP_SHA512Update(&context, buf, len);
- read_len -= (php_off_t)len;
+ read_len -= (zend_off_t)len;
if (read_len < read_size) {
read_size = (int)read_len;
}
@@ -1649,7 +1649,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
PHP_SHA256Update(&context, buf, len);
- read_len -= (php_off_t)len;
+ read_len -= (zend_off_t)len;
if (read_len < read_size) {
read_size = (int)read_len;
}
@@ -1690,7 +1690,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
PHP_SHA1Update(&context, buf, len);
- read_len -= (php_off_t)len;
+ read_len -= (zend_off_t)len;
if (read_len < read_size) {
read_size = (int)read_len;
}
@@ -1723,7 +1723,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
PHP_MD5Update(&context, buf, len);
- read_len -= (php_off_t)len;
+ read_len -= (zend_off_t)len;
if (read_len < read_size) {
read_size = (int)read_len;
}
@@ -2037,7 +2037,7 @@ int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
return FAILURE;
}
- phar_copy_cached_phar(&Z_PTR_P(pzv) TSRMLS_CC);
+ phar_copy_cached_phar((phar_archive_data **)&Z_PTR_P(pzv) TSRMLS_CC);
newpphar = Z_PTR_P(pzv);
/* invalidate phar cache */
PHAR_G(last_phar) = NULL;
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 2eb48f45a4..4fe0bf05c8 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -167,7 +167,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
{
phar_zip_dir_end locator;
char buf[sizeof(locator) + 65536];
- php_int_t size;
+ zend_long size;
php_uint16 i;
phar_archive_data *mydata = NULL;
phar_entry_info entry = {0};
@@ -241,7 +241,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
mydata->metadata_len = 0;
/* if not valid serialized data, it is a regular string */
- ZVAL_STR(&mydata->metadata, STR_INIT(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
+ ZVAL_NEW_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent));
}
} else {
ZVAL_UNDEF(&mydata->metadata);
@@ -338,7 +338,7 @@ foundit:
/* add each central directory item to the manifest */
for (i = 0; i < PHAR_GET_16(locator.count); ++i) {
phar_zip_central_dir_file zipentry;
- php_off_t beforeus = php_stream_tell(fp);
+ zend_off_t beforeus = php_stream_tell(fp);
if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) {
PHAR_ZIP_FAIL("unable to read central directory entry, truncated");
@@ -393,7 +393,7 @@ foundit:
if (entry.filename_len == sizeof(".phar/signature.bin")-1 && !strncmp(entry.filename, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
size_t read;
php_stream *sigfile;
- php_off_t now;
+ zend_off_t now;
char *sig;
now = php_stream_tell(fp);
@@ -448,7 +448,7 @@ foundit:
phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len TSRMLS_CC);
if (PHAR_GET_16(zipentry.extra_len)) {
- php_off_t loc = php_stream_tell(fp);
+ zend_off_t loc = php_stream_tell(fp);
if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len) TSRMLS_CC)) {
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("Unable to process extra field header for file in central directory");
@@ -529,7 +529,7 @@ foundit:
entry.metadata_len = 0;
/* if not valid serialized data, it is a regular string */
- ZVAL_STR(&entry.metadata, STR_INIT(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent));
+ ZVAL_NEW_STR(&entry.metadata, zend_string_init(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent));
}
} else {
ZVAL_UNDEF(&entry.metadata);
@@ -537,7 +537,7 @@ foundit:
if (!actual_alias && entry.filename_len == sizeof(".phar/alias.txt")-1 && !strncmp(entry.filename, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) {
php_stream_filter *filter;
- php_off_t saveloc;
+ zend_off_t saveloc;
/* verify local file header */
phar_zip_file_header local;
@@ -586,7 +586,7 @@ foundit:
if (str) {
entry.uncompressed_filesize = str->len;
actual_alias = estrndup(str->val, str->len);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
actual_alias = NULL;
entry.uncompressed_filesize = 0;
@@ -618,7 +618,7 @@ foundit:
if (str) {
entry.uncompressed_filesize = str->len;
actual_alias = estrndup(str->val, str->len);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
actual_alias = NULL;
entry.uncompressed_filesize = 0;
@@ -640,7 +640,7 @@ foundit:
if (str) {
entry.uncompressed_filesize = str->len;
actual_alias = estrndup(str->val, str->len);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
actual_alias = NULL;
entry.uncompressed_filesize = 0;
@@ -790,7 +790,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
phar_zip_central_dir_file central;
struct _phar_zip_pass *p;
php_uint32 newcrc32;
- php_off_t offset;
+ zend_off_t offset;
int not_really_modified = 0;
p = (struct _phar_zip_pass*) arg;
@@ -1108,7 +1108,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
char *signature, sigbuf[8];
phar_entry_info entry = {0};
php_stream *newfile;
- php_off_t tell, st;
+ zend_off_t tell, st;
newfile = php_stream_fopen_tmpfile();
if (newfile == NULL) {
@@ -1177,7 +1177,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
}
/* }}} */
-int phar_zip_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
+int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
{
char *pos;
smart_str main_metadata_str = {0};
@@ -1274,7 +1274,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int
if (str) {
len = str->len;
user_stub = estrndup(str->val, str->len);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
user_stub = NULL;
len = 0;
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
index 8ace07c1c0..ebd449231d 100644
--- a/ext/posix/php_posix.h
+++ b/ext/posix/php_posix.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index d4047cb692..ca7d34c645 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -325,24 +325,24 @@ static PHP_GINIT_FUNCTION(posix) /* {{{ */
*/
static PHP_MINIT_FUNCTION(posix)
{
- REGISTER_INT_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT);
#ifdef S_IFREG
- REGISTER_INT_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef S_IFCHR
- REGISTER_INT_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef S_IFBLK
- REGISTER_INT_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef S_IFIFO
- REGISTER_INT_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef S_IFSOCK
- REGISTER_INT_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT);
#endif
return SUCCESS;
@@ -375,13 +375,13 @@ ZEND_GET_MODULE(posix)
#define PHP_POSIX_NO_ARGS if (zend_parse_parameters_none() == FAILURE) return;
-#define PHP_POSIX_RETURN_INT_FUNC(func_name) \
+#define PHP_POSIX_RETURN_LONG_FUNC(func_name) \
PHP_POSIX_NO_ARGS \
- RETURN_INT(func_name());
+ RETURN_LONG(func_name());
#define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \
- php_int_t val; \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) RETURN_FALSE; \
+ zend_long val; \
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) RETURN_FALSE; \
if (func_name(val) < 0) { \
POSIX_G(last_error) = errno; \
RETURN_FALSE; \
@@ -393,9 +393,9 @@ ZEND_GET_MODULE(posix)
PHP_FUNCTION(posix_kill)
{
- php_int_t pid, sig;
+ zend_long pid, sig;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &sig) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) == FAILURE) {
RETURN_FALSE;
}
@@ -412,7 +412,7 @@ PHP_FUNCTION(posix_kill)
Get the current process id (POSIX.1, 4.1.1) */
PHP_FUNCTION(posix_getpid)
{
- PHP_POSIX_RETURN_INT_FUNC(getpid);
+ PHP_POSIX_RETURN_LONG_FUNC(getpid);
}
/* }}} */
@@ -420,7 +420,7 @@ PHP_FUNCTION(posix_getpid)
Get the parent process id (POSIX.1, 4.1.1) */
PHP_FUNCTION(posix_getppid)
{
- PHP_POSIX_RETURN_INT_FUNC(getppid);
+ PHP_POSIX_RETURN_LONG_FUNC(getppid);
}
/* }}} */
@@ -428,7 +428,7 @@ PHP_FUNCTION(posix_getppid)
Get the current user id (POSIX.1, 4.2.1) */
PHP_FUNCTION(posix_getuid)
{
- PHP_POSIX_RETURN_INT_FUNC(getuid);
+ PHP_POSIX_RETURN_LONG_FUNC(getuid);
}
/* }}} */
@@ -436,7 +436,7 @@ PHP_FUNCTION(posix_getuid)
Get the current group id (POSIX.1, 4.2.1) */
PHP_FUNCTION(posix_getgid)
{
- PHP_POSIX_RETURN_INT_FUNC(getgid);
+ PHP_POSIX_RETURN_LONG_FUNC(getgid);
}
/* }}} */
@@ -444,7 +444,7 @@ PHP_FUNCTION(posix_getgid)
Get the current effective user id (POSIX.1, 4.2.1) */
PHP_FUNCTION(posix_geteuid)
{
- PHP_POSIX_RETURN_INT_FUNC(geteuid);
+ PHP_POSIX_RETURN_LONG_FUNC(geteuid);
}
/* }}} */
@@ -452,7 +452,7 @@ PHP_FUNCTION(posix_geteuid)
Get the current effective group id (POSIX.1, 4.2.1) */
PHP_FUNCTION(posix_getegid)
{
- PHP_POSIX_RETURN_INT_FUNC(getegid);
+ PHP_POSIX_RETURN_LONG_FUNC(getegid);
}
/* }}} */
@@ -511,7 +511,7 @@ PHP_FUNCTION(posix_getgroups)
array_init(return_value);
for (i=0; i<result; i++) {
- add_next_index_int(return_value, gidlist[i]);
+ add_next_index_long(return_value, gidlist[i]);
}
}
#endif
@@ -540,7 +540,7 @@ PHP_FUNCTION(posix_getlogin)
Get current process group id (POSIX.1, 4.3.1) */
PHP_FUNCTION(posix_getpgrp)
{
- PHP_POSIX_RETURN_INT_FUNC(getpgrp);
+ PHP_POSIX_RETURN_LONG_FUNC(getpgrp);
}
/* }}} */
@@ -549,7 +549,7 @@ PHP_FUNCTION(posix_getpgrp)
#ifdef HAVE_SETSID
PHP_FUNCTION(posix_setsid)
{
- PHP_POSIX_RETURN_INT_FUNC(setsid);
+ PHP_POSIX_RETURN_LONG_FUNC(setsid);
}
#endif
/* }}} */
@@ -558,9 +558,9 @@ PHP_FUNCTION(posix_setsid)
Set process group id for job control (POSIX.1, 4.3.3) */
PHP_FUNCTION(posix_setpgid)
{
- php_int_t pid, pgid;
+ zend_long pid, pgid;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &pgid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) == FAILURE) {
RETURN_FALSE;
}
@@ -578,8 +578,8 @@ PHP_FUNCTION(posix_setpgid)
#ifdef HAVE_GETPGID
PHP_FUNCTION(posix_getpgid)
{
- php_int_t val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) {
+ zend_long val;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
RETURN_FALSE;
}
@@ -587,7 +587,7 @@ PHP_FUNCTION(posix_getpgid)
POSIX_G(last_error) = errno;
RETURN_FALSE;
}
- RETURN_INT(val);
+ RETURN_LONG(val);
}
#endif
/* }}} */
@@ -597,8 +597,8 @@ PHP_FUNCTION(posix_getpgid)
#ifdef HAVE_GETSID
PHP_FUNCTION(posix_getsid)
{
- php_int_t val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) {
+ zend_long val;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
RETURN_FALSE;
}
@@ -606,7 +606,7 @@ PHP_FUNCTION(posix_getsid)
POSIX_G(last_error) = errno;
RETURN_FALSE;
}
- RETURN_INT(val);
+ RETURN_LONG(val);
}
#endif
/* }}} */
@@ -658,11 +658,11 @@ PHP_FUNCTION(posix_times)
array_init(return_value);
- add_assoc_int(return_value, "ticks", ticks); /* clock ticks */
- add_assoc_int(return_value, "utime", t.tms_utime); /* user time */
- add_assoc_int(return_value, "stime", t.tms_stime); /* system time */
- add_assoc_int(return_value, "cutime", t.tms_cutime); /* user time of children */
- add_assoc_int(return_value, "cstime", t.tms_cstime); /* system time of children */
+ add_assoc_long(return_value, "ticks", ticks); /* clock ticks */
+ add_assoc_long(return_value, "utime", t.tms_utime); /* user time */
+ add_assoc_long(return_value, "stime", t.tms_stime); /* system time */
+ add_assoc_long(return_value, "cutime", t.tms_cutime); /* user time of children */
+ add_assoc_long(return_value, "cstime", t.tms_cstime); /* system time of children */
}
/* }}} */
@@ -724,7 +724,7 @@ PHP_FUNCTION(posix_ttyname)
char *p;
int fd;
#if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX)
- php_int_t buflen;
+ zend_long buflen;
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) {
@@ -738,8 +738,8 @@ PHP_FUNCTION(posix_ttyname)
}
break;
default:
- convert_to_int_ex(z_fd);
- fd = Z_IVAL_P(z_fd);
+ convert_to_long_ex(z_fd);
+ fd = Z_LVAL_P(z_fd);
}
#if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX)
buflen = sysconf(_SC_TTY_NAME_MAX);
@@ -783,8 +783,8 @@ PHP_FUNCTION(posix_isatty)
}
break;
default:
- convert_to_int_ex(z_fd);
- fd = Z_IVAL_P(z_fd);
+ convert_to_long_ex(z_fd);
+ fd = Z_LVAL_P(z_fd);
}
if (isatty(fd)) {
@@ -835,11 +835,11 @@ PHP_FUNCTION(posix_getcwd)
PHP_FUNCTION(posix_mkfifo)
{
char *path;
- int path_len;
- php_int_t mode;
+ size_t path_len;
+ zend_long mode;
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &path, &path_len, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &path, &path_len, &mode) == FAILURE) {
RETURN_FALSE;
}
@@ -864,15 +864,15 @@ PHP_FUNCTION(posix_mkfifo)
PHP_FUNCTION(posix_mknod)
{
char *path;
- int path_len;
- php_int_t mode;
- php_int_t major = 0, minor = 0;
+ size_t path_len;
+ zend_long mode;
+ zend_long major = 0, minor = 0;
int result;
dev_t php_dev;
php_dev = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|ii", &path, &path_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|ll", &path, &path_len,
&mode, &major, &minor) == FAILURE) {
RETURN_FALSE;
}
@@ -931,7 +931,7 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
add_next_index_string(&array_members, g->gr_mem[count]);
}
zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members);
- add_assoc_int(array_group, "gid", g->gr_gid);
+ add_assoc_long(array_group, "gid", g->gr_gid);
return 1;
}
/* }}} */
@@ -947,11 +947,11 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
Determine accessibility of a file (POSIX.1 5.6.3) */
PHP_FUNCTION(posix_access)
{
- php_int_t mode = 0;
- int filename_len, ret;
+ zend_long mode = 0;
+ size_t filename_len, ret;
char *filename, *path;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &mode) == FAILURE) {
RETURN_FALSE;
}
@@ -992,7 +992,7 @@ PHP_FUNCTION(posix_getgrnam)
{
char *name;
struct group *g;
- int name_len;
+ size_t name_len;
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
struct group gbuf;
long buflen;
@@ -1039,7 +1039,7 @@ PHP_FUNCTION(posix_getgrnam)
Group database access (POSIX.1, 9.2.1) */
PHP_FUNCTION(posix_getgrgid)
{
- php_int_t gid;
+ zend_long gid;
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
int ret;
struct group _g;
@@ -1049,7 +1049,7 @@ PHP_FUNCTION(posix_getgrgid)
#endif
struct group *g;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &gid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE) {
RETURN_FALSE;
}
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -1096,8 +1096,8 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */
add_assoc_string(return_value, "name", pw->pw_name);
add_assoc_string(return_value, "passwd", pw->pw_passwd);
- add_assoc_int (return_value, "uid", pw->pw_uid);
- add_assoc_int (return_value, "gid", pw->pw_gid);
+ add_assoc_long (return_value, "uid", pw->pw_uid);
+ add_assoc_long (return_value, "gid", pw->pw_gid);
add_assoc_string(return_value, "gecos", pw->pw_gecos);
add_assoc_string(return_value, "dir", pw->pw_dir);
add_assoc_string(return_value, "shell", pw->pw_shell);
@@ -1111,7 +1111,7 @@ PHP_FUNCTION(posix_getpwnam)
{
struct passwd *pw;
char *name;
- int name_len;
+ size_t name_len;
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
struct passwd pwbuf;
long buflen;
@@ -1158,7 +1158,7 @@ PHP_FUNCTION(posix_getpwnam)
User database access (POSIX.1, 9.2.2) */
PHP_FUNCTION(posix_getpwuid)
{
- php_int_t uid;
+ zend_long uid;
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
struct passwd _pw;
struct passwd *retpwptr = NULL;
@@ -1168,7 +1168,7 @@ PHP_FUNCTION(posix_getpwuid)
#endif
struct passwd *pw;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &uid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) {
RETURN_FALSE;
}
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
@@ -1229,13 +1229,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) {
if (rl.rlim_cur == RLIM_INFINITY) {
add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1);
} else {
- add_assoc_int(return_value, soft, rl.rlim_cur);
+ add_assoc_long(return_value, soft, rl.rlim_cur);
}
if (rl.rlim_max == RLIM_INFINITY) {
add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1);
} else {
- add_assoc_int(return_value, hard, rl.rlim_max);
+ add_assoc_long(return_value, hard, rl.rlim_max);
}
return SUCCESS;
@@ -1328,7 +1328,7 @@ PHP_FUNCTION(posix_get_last_error)
{
PHP_POSIX_NO_ARGS;
- RETURN_INT(POSIX_G(last_error));
+ RETURN_LONG(POSIX_G(last_error));
}
/* }}} */
@@ -1336,9 +1336,9 @@ PHP_FUNCTION(posix_get_last_error)
Retrieve the system error message associated with the given errno. */
PHP_FUNCTION(posix_strerror)
{
- php_int_t error;
+ zend_long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) {
RETURN_FALSE;
}
@@ -1353,11 +1353,11 @@ PHP_FUNCTION(posix_strerror)
Calculate the group access list for the user specified in name. */
PHP_FUNCTION(posix_initgroups)
{
- php_int_t basegid;
+ zend_long basegid;
char *name;
- int name_len;
+ size_t name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &name, &name_len, &basegid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &name, &name_len, &basegid) == FAILURE) {
RETURN_FALSE;
}
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
index 83103fae74..bd0956c2ba 100644
--- a/ext/pspell/php_pspell.h
+++ b/ext/pspell/php_pspell.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 359f02fb15..72165ae78e 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -249,10 +249,10 @@ static void php_pspell_close_config(zend_resource *rsrc TSRMLS_DC)
*/
static PHP_MINIT_FUNCTION(pspell)
{
- REGISTER_INT_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
- REGISTER_INT_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
+ REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number);
le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number);
return SUCCESS;
@@ -264,8 +264,8 @@ static PHP_MINIT_FUNCTION(pspell)
static PHP_FUNCTION(pspell_new)
{
char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
- int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
- php_int_t mode = Z_I(0), speed = Z_I(0);
+ size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
+ zend_long mode = Z_L(0), speed = Z_L(0);
int argc = ZEND_NUM_ARGS();
zval *ind;
@@ -281,7 +281,7 @@ static PHP_FUNCTION(pspell_new)
PspellManager *manager;
PspellConfig *config;
- if (zend_parse_parameters(argc TSRMLS_CC, "s|sssi", &language, &language_len, &spelling, &spelling_len,
+ if (zend_parse_parameters(argc TSRMLS_CC, "s|sssl", &language, &language_len, &spelling, &spelling_len,
&jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
return;
}
@@ -352,7 +352,7 @@ static PHP_FUNCTION(pspell_new)
manager = to_pspell_manager(ret);
ind = zend_list_insert(manager, le_pspell TSRMLS_CC);
- RETURN_INT(Z_RES_HANDLE_P(ind));
+ RETURN_LONG(Z_RES_HANDLE_P(ind));
}
/* }}} */
@@ -361,8 +361,8 @@ static PHP_FUNCTION(pspell_new)
static PHP_FUNCTION(pspell_new_personal)
{
char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
- int personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
- php_int_t mode = Z_I(0), speed = Z_I(0);
+ size_t personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
+ zend_long mode = Z_L(0), speed = Z_L(0);
int argc = ZEND_NUM_ARGS();
zval *ind;
@@ -378,7 +378,7 @@ static PHP_FUNCTION(pspell_new_personal)
PspellManager *manager;
PspellConfig *config;
- if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssi", &personal, &personal_len, &language, &language_len,
+ if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssl", &personal, &personal_len, &language, &language_len,
&spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
return;
}
@@ -457,7 +457,7 @@ static PHP_FUNCTION(pspell_new_personal)
manager = to_pspell_manager(ret);
ind = zend_list_insert(manager, le_pspell TSRMLS_CC);
- RETURN_INT(Z_RES_HANDLE_P(ind));
+ RETURN_LONG(Z_RES_HANDLE_P(ind));
}
/* }}} */
@@ -465,13 +465,13 @@ static PHP_FUNCTION(pspell_new_personal)
Load a dictionary based on the given config */
static PHP_FUNCTION(pspell_new_config)
{
- php_int_t conf;
+ zend_long conf;
zval *ind;
PspellCanHaveError *ret;
PspellManager *manager;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &conf) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &conf) == FAILURE) {
return;
}
@@ -487,7 +487,7 @@ static PHP_FUNCTION(pspell_new_config)
manager = to_pspell_manager(ret);
ind = zend_list_insert(manager, le_pspell TSRMLS_CC);
- RETURN_INT(Z_RES_HANDLE_P(ind));
+ RETURN_LONG(Z_RES_HANDLE_P(ind));
}
/* }}} */
@@ -495,12 +495,12 @@ static PHP_FUNCTION(pspell_new_config)
Returns true if word is valid */
static PHP_FUNCTION(pspell_check)
{
- int word_len;
- php_int_t scin;
+ size_t word_len;
+ zend_long scin;
char *word;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
return;
}
@@ -518,14 +518,14 @@ static PHP_FUNCTION(pspell_check)
Returns array of suggestions */
static PHP_FUNCTION(pspell_suggest)
{
- php_int_t scin;
+ zend_long scin;
char *word;
- int word_len;
+ size_t word_len;
PspellManager *manager;
const PspellWordList *wl;
const char *sug;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
return;
}
@@ -551,12 +551,12 @@ static PHP_FUNCTION(pspell_suggest)
Notify the dictionary of a user-selected replacement */
static PHP_FUNCTION(pspell_store_replacement)
{
- int miss_len, corr_len;
- php_int_t scin;
+ size_t miss_len, corr_len;
+ zend_long scin;
char *miss, *corr;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) {
return;
}
@@ -576,12 +576,12 @@ static PHP_FUNCTION(pspell_store_replacement)
Adds a word to a personal list */
static PHP_FUNCTION(pspell_add_to_personal)
{
- int word_len;
- php_int_t scin;
+ size_t word_len;
+ zend_long scin;
char *word;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
return;
}
@@ -606,12 +606,12 @@ static PHP_FUNCTION(pspell_add_to_personal)
Adds a word to the current session */
static PHP_FUNCTION(pspell_add_to_session)
{
- int word_len;
- php_int_t scin;
+ size_t word_len;
+ zend_long scin;
char *word;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
return;
}
@@ -636,10 +636,10 @@ static PHP_FUNCTION(pspell_add_to_session)
Clears the current session */
static PHP_FUNCTION(pspell_clear_session)
{
- php_int_t scin;
+ zend_long scin;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) {
return;
}
@@ -659,10 +659,10 @@ static PHP_FUNCTION(pspell_clear_session)
Saves the current (personal) wordlist */
static PHP_FUNCTION(pspell_save_wordlist)
{
- php_int_t scin;
+ zend_long scin;
PspellManager *manager;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) {
return;
}
@@ -685,7 +685,7 @@ static PHP_FUNCTION(pspell_save_wordlist)
static PHP_FUNCTION(pspell_config_create)
{
char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
- int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
+ size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
zval *ind;
PspellConfig *config;
@@ -744,7 +744,7 @@ static PHP_FUNCTION(pspell_config_create)
pspell_config_replace(config, "save-repl", "false");
ind = zend_list_insert(config, le_pspell_config TSRMLS_CC);
- RETURN_INT(Z_RES_HANDLE_P(ind));
+ RETURN_LONG(Z_RES_HANDLE_P(ind));
}
/* }}} */
@@ -752,11 +752,11 @@ static PHP_FUNCTION(pspell_config_create)
Consider run-together words as valid components */
static PHP_FUNCTION(pspell_config_runtogether)
{
- php_int_t conf;
+ zend_long conf;
zend_bool runtogether;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &runtogether) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &runtogether) == FAILURE) {
return;
}
@@ -772,10 +772,10 @@ static PHP_FUNCTION(pspell_config_runtogether)
Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */
static PHP_FUNCTION(pspell_config_mode)
{
- php_int_t conf, mode;
+ zend_long conf, mode;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &mode) == FAILURE) {
return;
}
@@ -798,11 +798,11 @@ static PHP_FUNCTION(pspell_config_mode)
Ignore words <= n chars */
static PHP_FUNCTION(pspell_config_ignore)
{
- char ignore_str[MAX_LENGTH_OF_ZEND_INT + 1];
- php_int_t conf, ignore = 0L;
+ char ignore_str[MAX_LENGTH_OF_LONG + 1];
+ zend_long conf, ignore = 0L;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &ignore) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &ignore) == FAILURE) {
return;
}
@@ -817,12 +817,12 @@ static PHP_FUNCTION(pspell_config_ignore)
static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
{
- php_int_t conf;
+ zend_long conf;
char *value;
- int value_len;
+ size_t value_len;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &value, &value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &value, &value_len) == FAILURE) {
return;
}
@@ -865,12 +865,12 @@ static PHP_FUNCTION(pspell_config_data_dir)
Use a personal dictionary with replacement pairs for this config */
static PHP_FUNCTION(pspell_config_repl)
{
- php_int_t conf;
+ zend_long conf;
char *repl;
- int repl_len;
+ size_t repl_len;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &repl, &repl_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &repl, &repl_len) == FAILURE) {
return;
}
@@ -892,11 +892,11 @@ static PHP_FUNCTION(pspell_config_repl)
Save replacement pairs when personal list is saved for this config */
static PHP_FUNCTION(pspell_config_save_repl)
{
- php_int_t conf;
+ zend_long conf;
zend_bool save;
PspellConfig *config;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &save) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &save) == FAILURE) {
return;
}
diff --git a/ext/pspell/pspell.dsp b/ext/pspell/pspell.dsp
deleted file mode 100644
index f310099d89..0000000000
--- a/ext/pspell/pspell.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pspell" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pspell - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pspell.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pspell.mak" CFG="pspell - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pspell - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pspell - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pspell - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "pspell___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "pspell___Win32_Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "..\..\..\aspell\include\pspell" /I "..\..\..\php_build\include\pspell." /D ZEND_DEBUG=1 /D "_DEBUG" /D ZTS=1 /D HAVE_PSPELL=1 /D "COMPILE_DL_PSPELL" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_pspell.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-# ADD LINK32 php5ts_debug.lib aspell-15.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_pspell.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\aspell\lib"
-
-!ELSEIF "$(CFG)" == "pspell - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "pspell___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "pspell___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "..\..\..\aspell\include\pspell" /I "..\..\..\php_build\include\pspell" /D ZEND_DEBUG=0 /D "NDEBUG" /D ZTS=1 /D HAVE_PSPELL=1 /D "COMPILE_DL_PSPELL" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib aspell-15.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_pspell.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\aspell\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "pspell - Win32 Debug_TS"
-# Name "pspell - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pspell.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pspell.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
index 5660bdb7f6..7a014164fc 100644
--- a/ext/readline/php_readline.h
+++ b/ext/readline/php_readline.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index ef82d5f8a3..0e7b146174 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -213,7 +213,7 @@ PHP_MINFO_FUNCTION(readline)
PHP_FUNCTION(readline)
{
char *prompt = NULL;
- int prompt_len;
+ size_t prompt_len;
char *result;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &prompt, &prompt_len)) {
@@ -240,7 +240,7 @@ PHP_FUNCTION(readline_info)
{
char *what = NULL;
zval *value = NULL;
- int what_len, oldval;
+ size_t what_len, oldval;
char *oldstr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sz", &what, &what_len, &value) == FAILURE) {
@@ -250,21 +250,21 @@ PHP_FUNCTION(readline_info)
if (!what) {
array_init(return_value);
add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer));
- add_assoc_int(return_value,"point",rl_point);
- add_assoc_int(return_value,"end",rl_end);
+ add_assoc_long(return_value,"point",rl_point);
+ add_assoc_long(return_value,"end",rl_end);
#ifdef HAVE_LIBREADLINE
- add_assoc_int(return_value,"mark",rl_mark);
- add_assoc_int(return_value,"done",rl_done);
- add_assoc_int(return_value,"pending_input",rl_pending_input);
+ add_assoc_long(return_value,"mark",rl_mark);
+ add_assoc_long(return_value,"done",rl_done);
+ add_assoc_long(return_value,"pending_input",rl_pending_input);
add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt));
add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name));
#endif
#if HAVE_ERASE_EMPTY_LINE
- add_assoc_int(return_value,"erase_empty_line",rl_erase_empty_line);
+ add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
#endif
add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version));
add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name));
- add_assoc_int(return_value,"attempted_completion_over",rl_attempted_completion_over);
+ add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over);
} else {
if (!strcasecmp(what,"line_buffer")) {
oldstr = rl_line_buffer;
@@ -275,26 +275,26 @@ PHP_FUNCTION(readline_info)
}
RETVAL_STRING(SAFE_STRING(oldstr));
} else if (!strcasecmp(what, "point")) {
- RETVAL_INT(rl_point);
+ RETVAL_LONG(rl_point);
} else if (!strcasecmp(what, "end")) {
- RETVAL_INT(rl_end);
+ RETVAL_LONG(rl_end);
#ifdef HAVE_LIBREADLINE
} else if (!strcasecmp(what, "mark")) {
- RETVAL_INT(rl_mark);
+ RETVAL_LONG(rl_mark);
} else if (!strcasecmp(what, "done")) {
oldval = rl_done;
if (value) {
- convert_to_int_ex(value);
- rl_done = Z_IVAL_P(value);
+ convert_to_long_ex(value);
+ rl_done = Z_LVAL_P(value);
}
- RETVAL_INT(oldval);
+ RETVAL_LONG(oldval);
} else if (!strcasecmp(what, "pending_input")) {
oldval = rl_pending_input;
if (value) {
convert_to_string_ex(value);
rl_pending_input = Z_STRVAL_P(value)[0];
}
- RETVAL_INT(oldval);
+ RETVAL_LONG(oldval);
} else if (!strcasecmp(what, "prompt")) {
RETVAL_STRING(SAFE_STRING(rl_prompt));
} else if (!strcasecmp(what, "terminal_name")) {
@@ -304,10 +304,10 @@ PHP_FUNCTION(readline_info)
} else if (!strcasecmp(what, "erase_empty_line")) {
oldval = rl_erase_empty_line;
if (value) {
- convert_to_int_ex(value);
- rl_erase_empty_line = Z_IVAL_PP(value);
+ convert_to_long_ex(value);
+ rl_erase_empty_line = Z_LVAL_PP(value);
}
- RETVAL_INT(oldval);
+ RETVAL_LONG(oldval);
#endif
} else if (!strcasecmp(what,"library_version")) {
RETVAL_STRING((char *)SAFE_STRING(rl_library_version));
@@ -322,10 +322,10 @@ PHP_FUNCTION(readline_info)
} else if (!strcasecmp(what, "attempted_completion_over")) {
oldval = rl_attempted_completion_over;
if (value) {
- convert_to_int_ex(value);
- rl_attempted_completion_over = Z_IVAL_P(value);
+ convert_to_long_ex(value);
+ rl_attempted_completion_over = Z_LVAL_P(value);
}
- RETVAL_INT(oldval);
+ RETVAL_LONG(oldval);
}
}
}
@@ -336,7 +336,7 @@ PHP_FUNCTION(readline_info)
PHP_FUNCTION(readline_add_history)
{
char *arg;
- int arg_len;
+ size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
return;
@@ -396,7 +396,7 @@ PHP_FUNCTION(readline_list_history)
PHP_FUNCTION(readline_read_history)
{
char *arg = NULL;
- int arg_len;
+ size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) {
return;
@@ -420,7 +420,7 @@ PHP_FUNCTION(readline_read_history)
PHP_FUNCTION(readline_write_history)
{
char *arg = NULL;
- int arg_len;
+ size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) {
return;
@@ -473,7 +473,7 @@ static void _readline_string_zval(zval *ret, const char *str)
static void _readline_long_zval(zval *ret, long l)
{
- ZVAL_INT(ret, l);
+ ZVAL_LONG(ret, l);
}
static char **_readline_completion_cb(const char *text, int start, int end)
@@ -521,10 +521,10 @@ PHP_FUNCTION(readline_completion_function)
if (!zend_is_callable(arg, 0, &name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name->val);
- STR_RELEASE(name);
+ zend_string_release(name);
RETURN_FALSE;
}
- STR_RELEASE(name);
+ zend_string_release(name);
zval_dtor(&_readline_completion);
ZVAL_DUP(&_readline_completion, arg);
@@ -563,7 +563,7 @@ PHP_FUNCTION(readline_callback_handler_install)
zval *callback;
zend_string *name = NULL;
char *prompt;
- int prompt_len;
+ size_t prompt_len;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &prompt, &prompt_len, &callback)) {
return;
@@ -571,10 +571,10 @@ PHP_FUNCTION(readline_callback_handler_install)
if (!zend_is_callable(callback, 0, &name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name->val);
- STR_RELEASE(name);
+ zend_string_release(name);
RETURN_FALSE;
}
- STR_RELEASE(name);
+ zend_string_release(name);
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
rl_callback_handler_remove();
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 0ca9daf8ff..48ab488763 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -42,7 +42,7 @@
#include "php_main.h"
#include "fopen_wrappers.h"
#include "ext/standard/php_standard.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#ifdef __riscos__
#include <unixlib/local.h>
@@ -79,7 +79,7 @@ ZEND_DECLARE_MODULE_GLOBALS(cli_readline);
static char php_last_char = '\0';
static FILE *pager_pipe = NULL;
-static size_t readline_shell_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */
+static size_t readline_shell_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */
{
if (CLIR_G(prompt_str)) {
smart_str_appendl(CLIR_G(prompt_str), str, str_length);
@@ -97,7 +97,7 @@ static size_t readline_shell_write(const char *str, uint str_length TSRMLS_DC) /
}
/* }}} */
-static int readline_shell_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */
+static size_t readline_shell_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */
{
/* We just store the last char here and then pass back to the
caller (sapi_cli_single_write in sapi/cli) which will actually
@@ -270,12 +270,6 @@ static int cli_is_valid_code(char *code, int len, zend_string **prompt TSRMLS_DC
}
valid_end = 0;
break;
- case '%':
- if (!CG(asp_tags)) {
- valid_end = 0;
- break;
- }
- /* no break */
case '?':
if (code[i+1] == '>') {
i++;
@@ -360,7 +354,6 @@ static int cli_is_valid_code(char *code, int len, zend_string **prompt TSRMLS_DC
break;
case outside:
if ((CG(short_tags) && !strncmp(code+i-1, "<?", 2))
- || (CG(asp_tags) && !strncmp(code+i-1, "<%", 2))
|| (i > 3 && !strncmp(code+i-4, "<?php", 5))
) {
code_type = body;
@@ -409,7 +402,7 @@ static int cli_is_valid_code(char *code, int len, zend_string **prompt TSRMLS_DC
static char *cli_completion_generator_ht(const char *text, int textlen, int *state, HashTable *ht, void **pData TSRMLS_DC) /* {{{ */
{
zend_string *name;
- ulong number;
+ zend_ulong number;
if (!(*state % 2)) {
zend_hash_internal_pointer_reset(ht);
@@ -435,7 +428,7 @@ static char *cli_completion_generator_ht(const char *text, int textlen, int *sta
static char *cli_completion_generator_var(const char *text, int textlen, int *state TSRMLS_DC) /* {{{ */
{
char *retval, *tmp;
- zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
+ zend_array *symbol_table = &EG(symbol_table);
tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, symbol_table ? &symbol_table->ht : NULL, NULL TSRMLS_CC);
if (retval) {
@@ -530,10 +523,10 @@ TODO:
class_name_end = strstr(text, "::");
if (class_name_end) {
class_name_len = class_name_end - text;
- class_name = STR_ALLOC(class_name_len, 0);
+ class_name = zend_string_alloc(class_name_len, 0);
zend_str_tolower_copy(class_name->val, text, class_name_len);
if ((ce = zend_lookup_class(class_name TSRMLS_CC)) == NULL) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return NULL;
}
lc_text = zend_str_tolower_dup(class_name_end + 2, textlen - 2 - class_name_len);
@@ -564,7 +557,7 @@ TODO:
}
efree(lc_text);
if (class_name_end) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
}
if (ce && retval) {
int len = class_name_len + 2 + strlen(retval) + 1;
@@ -631,13 +624,13 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
if (param) {
zend_string *cmd;
param++;
- cmd = STR_INIT(&line[1], param - &line[1] - 1, 0);
+ cmd = zend_string_init(&line[1], param - &line[1] - 1, 0);
- zend_alter_ini_entry_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(cmd);
+ zend_alter_ini_entry_chars_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(cmd);
add_history(line);
- STR_RELEASE(prompt);
+ zend_string_release(prompt);
/* TODO: This might be wrong! */
prompt = cli_get_prompt("php", '>' TSRMLS_CC);
continue;
@@ -659,7 +652,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
}
free(line);
- STR_RELEASE(prompt);
+ zend_string_release(prompt);
if (!cli_is_valid_code(code, pos, &prompt TSRMLS_CC)) {
continue;
@@ -697,7 +690,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
}
free(history_file);
efree(code);
- STR_RELEASE(prompt);
+ zend_string_release(prompt);
return EG(exit_status);
}
/* }}} */
diff --git a/ext/readline/readline_cli.h b/ext/readline/readline_cli.h
index becd9d3342..6e57c83408 100644
--- a/ext/readline/readline_cli.h
+++ b/ext/readline/readline_cli.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -20,7 +20,7 @@
/* $Id$ */
#include "php.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str_public.h"
ZEND_BEGIN_MODULE_GLOBALS(cli_readline)
char *pager;
diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h
index 76ae292c56..265af7f148 100644
--- a/ext/recode/php_recode.h
+++ b/ext/recode/php_recode.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index e90ad060e0..a70a4fcb2c 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -146,7 +146,7 @@ PHP_FUNCTION(recode_string)
RECODE_REQUEST request = NULL;
char *r = NULL;
size_t r_len = 0, r_alen = 0;
- int req_len, str_len;
+ size_t req_len, str_len;
char *req, *str;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &req, &req_len, &str, &str_len) == FAILURE) {
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 8d3e0494f6..57e11945c1 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -83,7 +83,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
/* Method macros */
#define METHOD_NOTSTATIC(ce) \
- if (!Z_OBJ(EG(This)) || !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) { \
+ if (!Z_OBJ(EX(This)) || !instanceof_function(Z_OBJCE(EX(This)), ce TSRMLS_CC)) { \
php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C)); \
return; \
} \
@@ -110,8 +110,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
target = intern->ptr; \
/* Class constants */
-#define REGISTER_REFLECTION_CLASS_CONST_INT(class_name, const_name, value) \
- zend_declare_class_constant_int(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value) \
+ zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
/* {{{ Smart string functions */
typedef struct _string {
@@ -121,7 +121,7 @@ typedef struct _string {
static void string_init(string *str)
{
- str->buf= STR_ALLOC(1024, 0);
+ str->buf= zend_string_alloc(1024, 0);
str->alloced = 1024;
str->buf->val[0] = '\0';
str->buf->len = 0;
@@ -140,7 +140,7 @@ static string *string_printf(string *str, const char *format, ...)
if (str->alloced < nlen) {
int old_len = str->buf->len;
str->alloced = nlen;
- str->buf = STR_REALLOC(str->buf, str->alloced, 0);
+ str->buf = zend_string_realloc(str->buf, str->alloced, 0);
str->buf->len = old_len;
}
memcpy(str->buf->val + str->buf->len, s_tmp, len + 1);
@@ -157,7 +157,7 @@ static string *string_write(string *str, char *buf, int len)
if (str->alloced < nlen) {
int old_len = str->buf->len;
str->alloced = nlen;
- str->buf = STR_REALLOC(str->buf, str->alloced, 0);
+ str->buf = zend_string_realloc(str->buf, str->alloced, 0);
str->buf->len = old_len;
}
memcpy(str->buf->val + str->buf->len, buf, len);
@@ -176,7 +176,7 @@ static string *string_append(string *str, string *append)
static void string_free(string *str)
{
- STR_RELEASE(str->buf);
+ zend_string_release(str->buf);
str->alloced = 0;
str->buf = NULL;
}
@@ -192,8 +192,8 @@ typedef struct _property_reference {
/* Struct for parameters */
typedef struct _parameter_reference {
- zend_uint offset;
- zend_uint required;
+ uint32_t offset;
+ uint32_t required;
struct _zend_arg_info *arg_info;
zend_function *fptr;
} parameter_reference;
@@ -209,10 +209,10 @@ typedef enum {
/* Struct for reflection objects */
typedef struct {
zval dummy; /* holder for the second property */
- void *ptr;
- reflection_type_t ref_type;
zval obj;
+ void *ptr;
zend_class_entry *ce;
+ reflection_type_t ref_type;
unsigned int ignore_visibility:1;
zend_object zo;
} reflection_object;
@@ -226,7 +226,7 @@ static inline reflection_object *reflection_object_from_obj(zend_object *obj) /*
static zend_object_handlers reflection_object_handlers;
-static zval *_default_load_entry(zval *object, char *name, int name_len TSRMLS_DC) /* {{{ */
+static zval *_default_load_entry(zval *object, char *name, size_t name_len TSRMLS_DC) /* {{{ */
{
zval *value;
@@ -270,7 +270,7 @@ static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */
zend_function *copy_fptr;
copy_fptr = emalloc(sizeof(zend_function));
memcpy(copy_fptr, fptr, sizeof(zend_function));
- copy_fptr->internal_function.function_name = STR_COPY(fptr->internal_function.function_name);
+ copy_fptr->internal_function.function_name = zend_string_copy(fptr->internal_function.function_name);
return copy_fptr;
} else {
/* no copy needed */
@@ -285,7 +285,7 @@ static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */
&& fptr->type == ZEND_INTERNAL_FUNCTION
&& (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0)
{
- STR_RELEASE(fptr->internal_function.function_name);
+ zend_string_release(fptr->internal_function.function_name);
efree(fptr);
}
}
@@ -312,7 +312,7 @@ static void reflection_free_objects_storage(zend_object *object TSRMLS_DC) /* {{
break;
case REF_TYPE_DYNAMIC_PROPERTY:
prop_reference = (property_reference*)intern->ptr;
- STR_RELEASE(prop_reference->prop.name);
+ zend_string_release(prop_reference->prop.name);
efree(intern->ptr);
break;
case REF_TYPE_OTHER:
@@ -406,7 +406,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
}
if (ce->num_interfaces) {
- zend_uint i;
+ uint32_t i;
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
string_printf(str, " extends %s", ce->interfaces[0]->name->val);
@@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
HashPosition pos;
zval *value;
zend_string *key;
- php_uint_t num_index;
+ zend_ulong num_index;
zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);
@@ -565,7 +565,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) {
zend_string *prop_name;
- php_uint_t index;
+ zend_ulong index;
if (zend_hash_get_current_key_ex(properties, &prop_name, &index, 0, &pos) == HASH_KEY_IS_STRING) {
if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */
@@ -602,7 +602,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
zend_string *key;
- php_uint_t num_index;
+ zend_ulong num_index;
uint len = mptr->common.function_name->len;
/* Do not display old-style inherited constructors */
@@ -655,12 +655,12 @@ static void _const_string(string *str, char *name, zval *value, char *indent TSR
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
indent, type, name, value_str->val);
- STR_RELEASE(value_str);
+ zend_string_release(value_str);
}
/* }}} */
/* {{{ _get_recv_opcode */
-static zend_op* _get_recv_op(zend_op_array *op_array, zend_uint offset)
+static zend_op* _get_recv_op(zend_op_array *op_array, uint32_t offset)
{
zend_op *op = op_array->opcodes;
zend_op *end = op + op_array->last;
@@ -668,7 +668,7 @@ static zend_op* _get_recv_op(zend_op_array *op_array, zend_uint offset)
++offset;
while (op < end) {
if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT
- || op->opcode == ZEND_RECV_VARIADIC) && op->op1.num == (long)offset)
+ || op->opcode == ZEND_RECV_VARIADIC) && op->op1.num == (zend_long)offset)
{
return op;
}
@@ -679,7 +679,7 @@ static zend_op* _get_recv_op(zend_op_array *op_array, zend_uint offset)
/* }}} */
/* {{{ _parameter_string */
-static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, char* indent TSRMLS_DC)
+static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg_info *arg_info, uint32_t offset, uint32_t required, char* indent TSRMLS_DC)
{
string_printf(str, "Parameter #%d [ ", offset);
if (offset >= required) {
@@ -729,8 +729,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
string_write(str, "NULL", sizeof("NULL")-1);
} else if (Z_TYPE(zv) == IS_STRING) {
string_write(str, "'", sizeof("'")-1);
- string_write(str, Z_STRVAL(zv), MIN(Z_STRSIZE(zv), 15));
- if (Z_STRSIZE(zv) > 15) {
+ string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
+ if (Z_STRLEN(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
@@ -739,7 +739,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
} else {
zend_string *zv_str = zval_get_string(&zv);
string_write(str, zv_str->val, zv_str->len);
- STR_RELEASE(zv_str);
+ zend_string_release(zv_str);
}
zval_ptr_dtor(&zv);
}
@@ -752,7 +752,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
static void _function_parameter_string(string *str, zend_function *fptr, char* indent TSRMLS_DC)
{
struct _zend_arg_info *arg_info = fptr->common.arg_info;
- zend_uint i, required = fptr->common.required_num_args;
+ uint32_t i, required = fptr->common.required_num_args;
if (!arg_info) {
return;
@@ -773,8 +773,8 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i
/* {{{ _function_closure_string */
static void _function_closure_string(string *str, zend_function *fptr, char* indent TSRMLS_DC)
{
- zend_uint i, count;
- php_uint_t num_index;
+ uint32_t i, count;
+ zend_ulong num_index;
zend_string *key;
HashTable *static_variables;
HashPosition pos;
@@ -834,7 +834,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
string_printf(str, ", inherits %s", fptr->common.scope->name->val);
} else if (fptr->common.scope->parent) {
lc_name_len = fptr->common.function_name->len;
- lc_name = STR_ALLOC(lc_name_len, 0);
+ lc_name = zend_string_alloc(lc_name_len, 0);
zend_str_tolower_copy(lc_name->val, fptr->common.function_name->val, lc_name_len);
if ((overwrites = zend_hash_find_ptr(&fptr->common.scope->parent->function_table, lc_name)) != NULL) {
if (fptr->common.scope != overwrites->common.scope) {
@@ -941,7 +941,7 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
string_printf(str, "static ");
}
- zend_unmangle_property_name(prop->name->val, prop->name->len, &class_name, (const char**)&prop_name);
+ zend_unmangle_property_name(prop->name, &class_name, (const char**)&prop_name);
string_printf(str, "$%s", prop_name);
}
@@ -958,7 +958,7 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
char *comma = "";
if (number == ini_entry->module_number) {
- string_printf(str, " %sEntry [ %s <", indent, ini_entry->name);
+ string_printf(str, " %sEntry [ %s <", indent, ini_entry->name->val);
if (ini_entry->modifiable == ZEND_INI_ALL) {
string_printf(str, "ALL");
} else {
@@ -976,9 +976,9 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
}
string_printf(str, "> ]\n");
- string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
+ string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value->val : "");
if (ini_entry->modified) {
- string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
+ string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value->val : "");
}
string_printf(str, " %s}\n", indent);
}
@@ -995,9 +995,12 @@ static int _extension_class_string(zval *el TSRMLS_DC, int num_args, va_list arg
int *num_classes = va_arg(args, int*);
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
- string_printf(str, "\n");
- _class_string(str, ce, NULL, indent TSRMLS_CC);
- (*num_classes)++;
+ /* dump class if it is not an alias */
+ if (!zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ string_printf(str, "\n");
+ _class_string(str, ce, NULL, indent TSRMLS_CC);
+ (*num_classes)++;
+ }
}
return ZEND_HASH_APPLY_KEEP;
}
@@ -1178,7 +1181,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR
reflection_object *intern;
zval name;
- ZVAL_STR(&name, STR_COPY(ce->name));
+ ZVAL_STR_COPY(&name, ce->name);
reflection_instantiate(reflection_class_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
intern->ptr = ce;
@@ -1197,10 +1200,10 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM
zend_string *lcname;
struct _zend_module_entry *module;
- lcname = STR_ALLOC(name_len, 0);
+ lcname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lcname->val, name_str, name_len);
module = zend_hash_find_ptr(&module_registry, lcname);
- STR_FREE(lcname);
+ zend_string_free(lcname);
if (!module) {
return;
}
@@ -1216,7 +1219,7 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM
/* }}} */
/* {{{ reflection_parameter_factory */
-static void reflection_parameter_factory(zend_function *fptr, zval *closure_object, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, zval *object TSRMLS_DC)
+static void reflection_parameter_factory(zend_function *fptr, zval *closure_object, struct _zend_arg_info *arg_info, uint32_t offset, uint32_t required, zval *object TSRMLS_DC)
{
reflection_object *intern;
parameter_reference *reference;
@@ -1251,7 +1254,7 @@ static void reflection_function_factory(zend_function *function, zval *closure_o
reflection_object *intern;
zval name;
- ZVAL_STR(&name, STR_COPY(function->common.function_name));
+ ZVAL_STR_COPY(&name, function->common.function_name);
reflection_instantiate(reflection_function_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
@@ -1273,9 +1276,9 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
zval name;
zval classname;
- ZVAL_STR(&name, STR_COPY((method->common.scope && method->common.scope->trait_aliases)?
- zend_resolve_method_name(ce, method) : method->common.function_name));
- ZVAL_STR(&classname, STR_COPY(method->common.scope->name));
+ ZVAL_STR_COPY(&name, (method->common.scope && method->common.scope->trait_aliases)?
+ zend_resolve_method_name(ce, method) : method->common.function_name);
+ ZVAL_STR_COPY(&classname, method->common.scope->name);
reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
intern->ptr = method;
@@ -1298,15 +1301,16 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
zval classname;
property_reference *reference;
const char *class_name, *prop_name;
+ size_t prop_name_len;
- zend_unmangle_property_name(prop->name->val, prop->name->len, &class_name, &prop_name);
+ zend_unmangle_property_name_ex(prop->name, &class_name, &prop_name, &prop_name_len);
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
/* we have to search the class hierarchy for this (implicit) public or protected property */
zend_class_entry *tmp_ce = ce, *store_ce = ce;
zend_property_info *tmp_info = NULL;
- while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, prop_name, strlen(prop_name))) == NULL) {
+ while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, prop_name, prop_name_len)) == NULL) {
ce = tmp_ce;
tmp_ce = tmp_ce->parent;
}
@@ -1318,8 +1322,8 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
}
}
- ZVAL_STRING(&name, prop_name);
- ZVAL_STR(&classname, STR_COPY(prop->ce->name));
+ ZVAL_STRINGL(&name, prop_name, prop_name_len);
+ ZVAL_STR_COPY(&classname, prop->ce->name);
reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
@@ -1532,9 +1536,9 @@ ZEND_METHOD(reflection, export)
Returns an array of modifier names */
ZEND_METHOD(reflection, getModifierNames)
{
- php_int_t modifiers;
+ zend_long modifiers;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &modifiers) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &modifiers) == FAILURE) {
return;
}
@@ -1588,7 +1592,7 @@ ZEND_METHOD(reflection_function, __construct)
reflection_object *intern;
zend_function *fptr;
char *name_str;
- int name_len;
+ size_t name_len;
object = getThis();
intern = Z_REFLECTION_P(object);
@@ -1622,7 +1626,7 @@ ZEND_METHOD(reflection_function, __construct)
return;
}
- ZVAL_STR(&name, STR_COPY(fptr->common.function_name));
+ ZVAL_STR_COPY(&name, fptr->common.function_name);
reflection_update_property(object, "name", &name);
intern->ptr = fptr;
intern->ref_type = REF_TYPE_FUNCTION;
@@ -1790,7 +1794,7 @@ ZEND_METHOD(reflection_function, getFileName)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_STR(STR_COPY(fptr->op_array.filename));
+ RETURN_STR(zend_string_copy(fptr->op_array.filename));
}
RETURN_FALSE;
}
@@ -1808,7 +1812,7 @@ ZEND_METHOD(reflection_function, getStartLine)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_INT(fptr->op_array.line_start);
+ RETURN_LONG(fptr->op_array.line_start);
}
RETURN_FALSE;
}
@@ -1826,7 +1830,7 @@ ZEND_METHOD(reflection_function, getEndLine)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_INT(fptr->op_array.line_end);
+ RETURN_LONG(fptr->op_array.line_end);
}
RETURN_FALSE;
}
@@ -1844,7 +1848,7 @@ ZEND_METHOD(reflection_function, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- RETURN_STR(STR_COPY(fptr->op_array.doc_comment));
+ RETURN_STR(zend_string_copy(fptr->op_array.doc_comment));
}
RETURN_FALSE;
}
@@ -2009,7 +2013,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
METHOD_NOTSTATIC(reflection_function_abstract_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
- RETURN_INT(fptr->common.num_args);
+ RETURN_LONG(fptr->common.num_args);
}
/* }}} */
@@ -2023,7 +2027,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
METHOD_NOTSTATIC(reflection_function_abstract_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
- RETURN_INT(fptr->common.required_num_args);
+ RETURN_LONG(fptr->common.required_num_args);
}
/* }}} */
@@ -2033,7 +2037,7 @@ ZEND_METHOD(reflection_function, getParameters)
{
reflection_object *intern;
zend_function *fptr;
- zend_uint i;
+ uint32_t i;
struct _zend_arg_info *arg_info;
METHOD_NOTSTATIC(reflection_function_abstract_ptr);
@@ -2140,7 +2144,7 @@ ZEND_METHOD(reflection_parameter, __construct)
unsigned int lcname_len;
char *lcname;
- lcname_len = Z_STRSIZE_P(reference);
+ lcname_len = Z_STRLEN_P(reference);
lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len);
if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) {
efree(lcname);
@@ -2178,7 +2182,7 @@ ZEND_METHOD(reflection_parameter, __construct)
}
convert_to_string_ex(method);
- lcname_len = Z_STRSIZE_P(method);
+ lcname_len = Z_STRLEN_P(method);
lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len);
if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT
&& (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
@@ -2219,12 +2223,12 @@ ZEND_METHOD(reflection_parameter, __construct)
/* Now, search for the parameter */
arg_info = fptr->common.arg_info;
- if (Z_TYPE_P(parameter) == IS_INT) {
- position= Z_IVAL_P(parameter);
- if (position < 0 || (zend_uint)position >= fptr->common.num_args) {
+ if (Z_TYPE_P(parameter) == IS_LONG) {
+ position= Z_LVAL_P(parameter);
+ if (position < 0 || (uint32_t)position >= fptr->common.num_args) {
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fptr->common.function_name);
+ zend_string_release(fptr->common.function_name);
}
efree(fptr);
}
@@ -2235,7 +2239,7 @@ ZEND_METHOD(reflection_parameter, __construct)
/* returns out of this function */
}
} else {
- zend_uint i;
+ uint32_t i;
position= -1;
convert_to_string_ex(parameter);
@@ -2248,7 +2252,7 @@ ZEND_METHOD(reflection_parameter, __construct)
if (position == -1) {
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- STR_RELEASE(fptr->common.function_name);
+ zend_string_release(fptr->common.function_name);
}
efree(fptr);
}
@@ -2269,7 +2273,7 @@ ZEND_METHOD(reflection_parameter, __construct)
ref = (parameter_reference*) emalloc(sizeof(parameter_reference));
ref->arg_info = &arg_info[position];
- ref->offset = (zend_uint)position;
+ ref->offset = (uint32_t)position;
ref->required = fptr->common.required_num_args;
ref->fptr = fptr;
/* TODO: copy fptr */
@@ -2396,9 +2400,9 @@ ZEND_METHOD(reflection_parameter, getClass)
}
ce = ce->parent;
} else {
- zend_string *name = STR_INIT(param->arg_info->class_name, param->arg_info->class_name_len, 0);
+ zend_string *name = zend_string_init(param->arg_info->class_name, param->arg_info->class_name_len, 0);
ce = zend_lookup_class(name TSRMLS_CC);
- STR_FREE(name);
+ zend_string_release(name);
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", param->arg_info->class_name);
@@ -2503,7 +2507,7 @@ ZEND_METHOD(reflection_parameter, getPosition)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_INT(param->offset);
+ RETVAL_LONG(param->offset);
}
/* }}} */
@@ -2626,7 +2630,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) {
- RETURN_STR(STR_COPY(Z_STR_P(precv->op2.zv)));
+ RETURN_STR(zend_string_copy(Z_STR_P(precv->op2.zv)));
}
}
/* }}} */
@@ -2666,7 +2670,7 @@ ZEND_METHOD(reflection_method, __construct)
zend_class_entry *ce;
zend_function *mptr;
char *name_str, *tmp;
- int name_len, tmp_len;
+ size_t name_len, tmp_len;
zval ztmp;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) {
@@ -2739,9 +2743,9 @@ ZEND_METHOD(reflection_method, __construct)
}
efree(lcname);
- ZVAL_STR(&name, STR_COPY(mptr->common.scope->name));
+ ZVAL_STR_COPY(&name, mptr->common.scope->name);
reflection_update_property(object, "class", &name);
- ZVAL_STR(&name, STR_COPY(mptr->common.function_name));
+ ZVAL_STR_COPY(&name, mptr->common.function_name);
reflection_update_property(object, "name", &name);
intern->ptr = mptr;
intern->ref_type = REF_TYPE_FUNCTION;
@@ -3103,7 +3107,7 @@ ZEND_METHOD(reflection_function, inNamespace)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
@@ -3126,7 +3130,7 @@ ZEND_METHOD(reflection_function, getNamespaceName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
@@ -3149,10 +3153,10 @@ ZEND_METHOD(reflection_function, getShortName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1));
+ RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
RETURN_ZVAL(name, 1, 0);
}
@@ -3203,7 +3207,7 @@ ZEND_METHOD(reflection_method, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(mptr);
- RETURN_INT(mptr->common.fn_flags);
+ RETURN_LONG(mptr->common.fn_flags);
}
/* }}} */
@@ -3304,7 +3308,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
if (Z_TYPE_P(argument) == IS_OBJECT) {
- ZVAL_STR(&classname, STR_COPY(Z_OBJCE_P(argument)->name));
+ ZVAL_STR_COPY(&classname, Z_OBJCE_P(argument)->name);
reflection_update_property(object, "name", &classname);
intern->ptr = Z_OBJCE_P(argument);
if (is_object) {
@@ -3320,7 +3324,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
return;
}
- ZVAL_STR(&classname, STR_COPY(ce->name));
+ ZVAL_STR_COPY(&classname, ce->name);
reflection_update_property(object, "name", &classname);
intern->ptr = ce;
@@ -3343,7 +3347,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
- php_uint_t num_index;
+ zend_ulong num_index;
ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
@@ -3548,7 +3552,7 @@ ZEND_METHOD(reflection_class, getFileName)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_STR(STR_COPY(ce->info.user.filename));
+ RETURN_STR(zend_string_copy(ce->info.user.filename));
}
RETURN_FALSE;
}
@@ -3566,7 +3570,7 @@ ZEND_METHOD(reflection_class, getStartLine)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_FUNCTION) {
- RETURN_INT(ce->info.user.line_start);
+ RETURN_LONG(ce->info.user.line_start);
}
RETURN_FALSE;
}
@@ -3584,7 +3588,7 @@ ZEND_METHOD(reflection_class, getEndLine)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_INT(ce->info.user.line_end);
+ RETURN_LONG(ce->info.user.line_end);
}
RETURN_FALSE;
}
@@ -3602,7 +3606,7 @@ ZEND_METHOD(reflection_class, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) {
- RETURN_STR(STR_COPY(ce->info.user.doc_comment));
+ RETURN_STR(zend_string_copy(ce->info.user.doc_comment));
}
RETURN_FALSE;
}
@@ -3635,7 +3639,7 @@ ZEND_METHOD(reflection_class, hasMethod)
reflection_object *intern;
zend_class_entry *ce;
char *name, *lc_name;
- int name_len;
+ size_t name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
@@ -3665,7 +3669,7 @@ ZEND_METHOD(reflection_class, getMethod)
zend_function *mptr;
zval obj_tmp;
char *name, *lc_name;
- int name_len;
+ size_t name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
@@ -3744,12 +3748,12 @@ ZEND_METHOD(reflection_class, getMethods)
{
reflection_object *intern;
zend_class_entry *ce;
- php_int_t filter = 0;
+ zend_long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC(reflection_class_ptr);
if (argc) {
- if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
}
} else {
@@ -3794,7 +3798,7 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) {
- ZVAL_STR(&property, STR_COPY(name));
+ ZVAL_STR_COPY(&property, name);
if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL TSRMLS_CC)) {
zval_ptr_dtor(&property);
RETURN_TRUE;
@@ -3833,7 +3837,7 @@ ZEND_METHOD(reflection_class, getProperty)
if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj TSRMLS_CC), name)) {
zend_property_info property_info_tmp;
property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC;
- property_info_tmp.name = STR_COPY(name);
+ property_info_tmp.name = zend_string_copy(name);
property_info_tmp.doc_comment = NULL;
property_info_tmp.ce = ce;
@@ -3847,7 +3851,7 @@ ZEND_METHOD(reflection_class, getProperty)
str_name_len = name->len;
if ((tmp = strstr(name->val, "::")) != NULL) {
classname_len = tmp - name->val;
- classname = STR_ALLOC(classname_len, 0);
+ classname = zend_string_alloc(classname_len, 0);
zend_str_tolower_copy(classname->val, name->val, classname_len);
classname->val[classname_len] = '\0';
str_name_len = name->len - (classname_len + 2);
@@ -3858,10 +3862,10 @@ ZEND_METHOD(reflection_class, getProperty)
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname->val);
}
- STR_FREE(classname);
+ zend_string_release(classname);
return;
}
- STR_FREE(classname);
+ zend_string_release(classname);
if (!instanceof_function(ce, ce2 TSRMLS_CC)) {
zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name->val, str_name, ce->name->val);
@@ -3905,7 +3909,7 @@ static int _adddynproperty(zval *ptr TSRMLS_DC, int num_args, va_list args, zend
{
zval property;
zend_class_entry *ce = *va_arg(args, zend_class_entry**);
- zval *retval = va_arg(args, zval*), member;
+ zval *retval = va_arg(args, zval*);
/* under some circumstances, the properties hash table may contain numeric
* properties (e.g. when casting from array). This is a WONT FIX bug, at
@@ -3918,8 +3922,7 @@ static int _adddynproperty(zval *ptr TSRMLS_DC, int num_args, va_list args, zend
return 0; /* non public cannot be dynamic */
}
- ZVAL_STR(&member, hash_key->key);
- if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) {
+ if (zend_get_property_info(ce, hash_key->key, 1 TSRMLS_CC) == &EG(std_property_info)) {
EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC;
reflection_property_factory(ce, &EG(std_property_info), &property TSRMLS_CC);
add_next_index_zval(retval, &property);
@@ -3934,12 +3937,12 @@ ZEND_METHOD(reflection_class, getProperties)
{
reflection_object *intern;
zend_class_entry *ce;
- php_int_t filter = 0;
+ zend_long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC(reflection_class_ptr);
if (argc) {
- if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
}
} else {
@@ -4137,7 +4140,7 @@ ZEND_METHOD(reflection_class, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(ce);
- RETURN_INT(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED);
+ RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED);
}
/* }}} */
@@ -4154,7 +4157,7 @@ ZEND_METHOD(reflection_class, isInstance)
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
- RETURN_BOOL(HAS_CLASS_ENTRY(*object) && instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC));
+ RETURN_BOOL(instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC));
}
/* }}} */
@@ -4352,7 +4355,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
array_init(return_value);
if (ce->num_interfaces) {
- zend_uint i;
+ uint32_t i;
for (i=0; i < ce->num_interfaces; i++) {
zval interface;
@@ -4369,7 +4372,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames)
{
reflection_object *intern;
zend_class_entry *ce;
- zend_uint i;
+ uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -4380,7 +4383,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames)
array_init(return_value);
for (i=0; i < ce->num_interfaces; i++) {
- add_next_index_str(return_value, STR_COPY(ce->interfaces[i]->name));
+ add_next_index_str(return_value, zend_string_copy(ce->interfaces[i]->name));
}
}
/* }}} */
@@ -4391,7 +4394,7 @@ ZEND_METHOD(reflection_class, getTraits)
{
reflection_object *intern;
zend_class_entry *ce;
- zend_uint i;
+ uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -4414,7 +4417,7 @@ ZEND_METHOD(reflection_class, getTraitNames)
{
reflection_object *intern;
zend_class_entry *ce;
- zend_uint i;
+ uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -4424,7 +4427,7 @@ ZEND_METHOD(reflection_class, getTraitNames)
array_init(return_value);
for (i=0; i < ce->num_traits; i++) {
- add_next_index_str(return_value, STR_COPY(ce->traits[i]->name));
+ add_next_index_str(return_value, zend_string_copy(ce->traits[i]->name));
}
}
/* }}} */
@@ -4444,14 +4447,14 @@ ZEND_METHOD(reflection_class, getTraitAliases)
array_init(return_value);
if (ce->trait_aliases) {
- zend_uint i = 0;
+ uint32_t i = 0;
while (ce->trait_aliases[i]) {
zend_string *mname;
zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method;
if (ce->trait_aliases[i]->alias) {
- mname = STR_ALLOC(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0);
+ mname = zend_string_alloc(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0);
snprintf(mname->val, mname->len + 1, "%s::%s", cur_ref->ce->name->val, cur_ref->method_name->val);
add_assoc_str_ex(return_value, ce->trait_aliases[i]->alias->val, ce->trait_aliases[i]->alias->len, mname);
}
@@ -4648,7 +4651,7 @@ ZEND_METHOD(reflection_class, inNamespace)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
@@ -4671,7 +4674,7 @@ ZEND_METHOD(reflection_class, getNamespaceName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
@@ -4694,10 +4697,10 @@ ZEND_METHOD(reflection_class, getShortName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
&& backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1));
+ RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
RETURN_ZVAL(name, 1, 0);
}
@@ -4733,8 +4736,8 @@ ZEND_METHOD(reflection_property, __construct)
{
zval propname, cname, *classname;
char *name_str;
- const char *class_name, *prop_name;
- int name_len, dynam_prop = 0;
+ size_t name_len;
+ int dynam_prop = 0;
zval *object;
reflection_object *intern;
zend_class_entry *ce;
@@ -4796,11 +4799,13 @@ ZEND_METHOD(reflection_property, __construct)
}
if (dynam_prop == 0) {
- zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name);
- ZVAL_STR(&cname, STR_COPY(property_info->ce->name));
- ZVAL_STRING(&propname, prop_name);
+ const char *class_name, *prop_name;
+ size_t prop_name_len;
+ zend_unmangle_property_name_ex(property_info->name, &class_name, &prop_name, &prop_name_len);
+ ZVAL_STR_COPY(&cname, property_info->ce->name);
+ ZVAL_STRINGL(&propname, prop_name, prop_name_len);
} else {
- ZVAL_STR(&cname, STR_COPY(ce->name));
+ ZVAL_STR_COPY(&cname, ce->name);
ZVAL_STRINGL(&propname, name_str, name_len);
}
reflection_update_property(object, "class", &cname);
@@ -4917,7 +4922,7 @@ ZEND_METHOD(reflection_property, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_INT(ref->prop.flags);
+ RETURN_LONG(ref->prop.flags);
}
/* }}} */
@@ -4949,12 +4954,14 @@ ZEND_METHOD(reflection_property, getValue)
ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]);
} else {
const char *class_name, *prop_name;
+ size_t prop_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
return;
}
- zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name);
- member_p = zend_read_property(ref->ce, object, prop_name, strlen(prop_name), 1 TSRMLS_CC);
+
+ zend_unmangle_property_name_ex(ref->prop.name, &class_name, &prop_name, &prop_name_len);
+ member_p = zend_read_property(ref->ce, object, prop_name, prop_name_len, 1 TSRMLS_CC);
ZVAL_DUP(return_value, member_p);
}
}
@@ -5023,12 +5030,14 @@ ZEND_METHOD(reflection_property, setValue)
}
} else {
const char *class_name, *prop_name;
+ size_t prop_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
return;
}
- zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name);
- zend_update_property(ref->ce, object, prop_name, strlen(prop_name), value TSRMLS_CC);
+
+ zend_unmangle_property_name_ex(ref->prop.name, &class_name, &prop_name, &prop_name_len);
+ zend_update_property(ref->ce, object, prop_name, prop_name_len, value TSRMLS_CC);
}
}
/* }}} */
@@ -5042,18 +5051,17 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
zend_class_entry *tmp_ce, *ce;
zend_property_info *tmp_info;
const char *prop_name, *class_name;
- int prop_name_len;
+ size_t prop_name_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name) != SUCCESS) {
+ if (zend_unmangle_property_name_ex(ref->prop.name, &class_name, &prop_name, &prop_name_len) != SUCCESS) {
RETURN_FALSE;
}
- prop_name_len = strlen(prop_name);
ce = tmp_ce = ref->ce;
while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, prop_name, prop_name_len)) != NULL) {
if (tmp_info->flags & ZEND_ACC_PRIVATE || tmp_info->flags & ZEND_ACC_SHADOW) {
@@ -5084,7 +5092,7 @@ ZEND_METHOD(reflection_property, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop.doc_comment) {
- RETURN_STR(STR_COPY(ref->prop.doc_comment));
+ RETURN_STR(zend_string_copy(ref->prop.doc_comment));
}
RETURN_FALSE;
}
@@ -5129,7 +5137,7 @@ ZEND_METHOD(reflection_extension, __construct)
reflection_object *intern;
zend_module_entry *module;
char *name_str;
- int name_len;
+ size_t name_len;
ALLOCA_FLAG(use_heap)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) {
@@ -5277,9 +5285,12 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
if (number == ini_entry->module_number) {
if (ini_entry->value) {
- add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length);
+ zval zv;
+
+ ZVAL_STR_COPY(&zv, ini_entry->value);
+ zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv);
} else {
- add_assoc_null(retval, ini_entry->name);
+ zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval));
}
}
return ZEND_HASH_APPLY_KEEP;
@@ -5312,11 +5323,20 @@ static int add_extension_class(zval *zv TSRMLS_DC, int num_args, va_list args, z
int add_reflection_class = va_arg(args, int);
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
+ zend_string *name;
+
+ if (zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ /* This is an class alias, use alias name */
+ name = hash_key->key;
+ } else {
+ /* Use class name */
+ name = ce->name;
+ }
if (add_reflection_class) {
zend_reflection_class_factory(ce, &zclass TSRMLS_CC);
- zend_hash_update(Z_ARRVAL_P(class_array), ce->name, &zclass);
+ zend_hash_update(Z_ARRVAL_P(class_array), name, &zclass);
} else {
- add_next_index_str(class_array, STR_COPY(ce->name));
+ add_next_index_str(class_array, zend_string_copy(name));
}
}
return ZEND_HASH_APPLY_KEEP;
@@ -5411,7 +5431,7 @@ ZEND_METHOD(reflection_extension, getDependencies)
len += strlen(dep->version) + 1;
}
- relation = STR_ALLOC(len, 0);
+ relation = zend_string_alloc(len, 0);
snprintf(relation->val, relation->len + 1, "%s%s%s%s%s",
rel_type,
dep->rel ? " " : "",
@@ -5489,7 +5509,7 @@ ZEND_METHOD(reflection_zend_extension, __construct)
reflection_object *intern;
zend_extension *extension;
char *name_str;
- int name_len;
+ size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) {
return;
@@ -6026,7 +6046,7 @@ ZEND_END_ARG_INFO()
static const zend_function_entry reflection_zend_extension_functions[] = {
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_extension___construct, 0)
+ ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)
ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0)
ZEND_ME(reflection_zend_extension, getVersion, arginfo_reflection__void, 0)
@@ -6048,8 +6068,8 @@ static void _reflection_write_property(zval *object, zval *member, zval *value,
{
if ((Z_TYPE_P(member) == IS_STRING)
&& zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
+ || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member));
@@ -6092,7 +6112,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC);
zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_INT(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6106,12 +6126,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_STATIC", ZEND_ACC_STATIC);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PUBLIC", ZEND_ACC_PUBLIC);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PROTECTED", ZEND_ACC_PROTECTED);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PRIVATE", ZEND_ACC_PRIVATE);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
- REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_FINAL", ZEND_ACC_FINAL);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6119,9 +6139,9 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_class_implements(reflection_class_ptr TSRMLS_CC, 1, reflector_ptr);
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
- REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
- REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6134,10 +6154,10 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_STATIC", ZEND_ACC_STATIC);
- REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
- REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
- REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
+ REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions);
_reflection_entry.create_object = reflection_objects_new;
diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h
index 2c03bd6e7e..1c436d7dcc 100644
--- a/ext/reflection/php_reflection.h
+++ b/ext/reflection/php_reflection.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 6ea33a71aa..cb61c8a221 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -57,13 +57,13 @@
#endif
typedef struct {
- int fd;
char *lastkey;
char *basedir;
size_t basedir_len;
size_t dirdepth;
size_t st_size;
int filemode;
+ int fd;
} ps_files;
ps_module ps_mod_files = {
@@ -187,7 +187,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
DIR *dir;
char dentry[sizeof(struct dirent) + MAXPATHLEN];
struct dirent *entry = (struct dirent *) &dentry;
- php_stat_t sbuf;
+ zend_stat_t sbuf;
char buf[MAXPATHLEN];
time_t now;
int nrdels = 0;
@@ -238,7 +238,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
static int ps_files_key_exists(ps_files *data, const char *key TSRMLS_DC)
{
char buf[MAXPATHLEN];
- php_stat_t sbuf;
+ zend_stat_t sbuf;
if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) {
return FAILURE;
@@ -283,7 +283,7 @@ PS_OPEN_FUNC(files)
if (argc > 1) {
errno = 0;
- dirdepth = (size_t) ZEND_STRTOI(argv[0], NULL, 10);
+ dirdepth = (size_t) ZEND_STRTOL(argv[0], NULL, 10);
if (errno == ERANGE) {
php_error(E_WARNING, "The first parameter in session.save_path is invalid");
return FAILURE;
@@ -292,7 +292,7 @@ PS_OPEN_FUNC(files)
if (argc > 2) {
errno = 0;
- filemode = ZEND_STRTOI(argv[1], NULL, 8);
+ filemode = ZEND_STRTOL(argv[1], NULL, 8);
if (errno == ERANGE || filemode < 0 || filemode > 07777) {
php_error(E_WARNING, "The second parameter in session.save_path is invalid");
return FAILURE;
@@ -335,8 +335,8 @@ PS_CLOSE_FUNC(files)
PS_READ_FUNC(files)
{
- php_int_t n;
- struct stat sbuf;
+ zend_long n;
+ zend_stat_t sbuf;
PS_FILES_DATA;
/* If strict mode, check session id existence */
@@ -344,7 +344,7 @@ PS_READ_FUNC(files)
ps_files_key_exists(data, key? key->val : NULL TSRMLS_CC) == FAILURE) {
/* key points to PS(id), but cannot change here. */
if (key) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
PS(id) = NULL;
}
PS(id) = PS(mod)->s_create_sid((void **)&data TSRMLS_CC);
@@ -363,7 +363,7 @@ PS_READ_FUNC(files)
return FAILURE;
}
- if (fstat(data->fd, &sbuf)) {
+ if (zend_fstat(data->fd, &sbuf)) {
return FAILURE;
}
@@ -374,7 +374,7 @@ PS_READ_FUNC(files)
return SUCCESS;
}
- *val = STR_ALLOC(sbuf.st_size, 0);
+ *val = zend_string_alloc(sbuf.st_size, 0);
#if defined(HAVE_PREAD)
n = pread(data->fd, (*val)->val, (*val)->len, 0);
@@ -389,7 +389,7 @@ PS_READ_FUNC(files)
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "read returned less bytes than requested");
}
- STR_RELEASE(*val);
+ zend_string_release(*val);
return FAILURE;
}
@@ -398,7 +398,7 @@ PS_READ_FUNC(files)
PS_WRITE_FUNC(files)
{
- php_int_t n;
+ zend_long n;
PS_FILES_DATA;
ps_files_open(data, key->val TSRMLS_CC);
@@ -481,7 +481,7 @@ PS_CREATE_SID_FUNC(files)
/* Check collision */
if (data && ps_files_key_exists(data, sid? sid->val : NULL TSRMLS_CC) == SUCCESS) {
if (sid) {
- STR_RELEASE(sid);
+ zend_string_release(sid);
sid = NULL;
}
if (!(maxfail--)) {
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index d1d26cd39b..a56dce1d36 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 319f1d3c79..bf48436a7e 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index cafbfa0932..e0f2c1239f 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 40bb88813b..5d474deab5 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,9 +26,9 @@ ps_module ps_mod_user = {
PS_MOD_SID(user)
};
-#define SESS_ZVAL_INT(val, a) \
+#define SESS_ZVAL_LONG(val, a) \
{ \
- ZVAL_INT(a, val); \
+ ZVAL_LONG(a, val); \
}
#define SESS_ZVAL_STRING(vl, a) \
@@ -44,7 +44,7 @@ ps_module ps_mod_user = {
#define SESS_ZVAL_STR(vl, a) \
{ \
- ZVAL_STR(a, STR_COPY(vl)); \
+ ZVAL_STR_COPY(a, vl); \
}
static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRMLS_DC)
@@ -73,10 +73,10 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRML
ret = SUCCESS; \
} else if (Z_TYPE(retval) == IS_FALSE) { \
ret = FAILURE; \
- } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == -1)) { \
+ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \
/* BC for clever users - Deprecate me */ \
ret = FAILURE; \
- } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == 0)) { \
+ } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \
/* BC for clever users - Deprecate me */ \
ret = SUCCESS; \
} else { \
@@ -150,7 +150,7 @@ PS_READ_FUNC(user)
if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) == IS_STRING) {
- *val = STR_COPY(Z_STR(retval));
+ *val = zend_string_copy(Z_STR(retval));
ret = SUCCESS;
}
zval_ptr_dtor(&retval);
@@ -189,7 +189,7 @@ PS_GC_FUNC(user)
zval args[1];
STDVARS;
- SESS_ZVAL_INT(maxlifetime, &args[0]);
+ SESS_ZVAL_LONG(maxlifetime, &args[0]);
ps_call_handler(&PSF(gc), 1, args, &retval TSRMLS_CC);
@@ -207,7 +207,7 @@ PS_CREATE_SID_FUNC(user)
if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) == IS_STRING) {
- id = STR_COPY(Z_STR(retval));
+ id = zend_string_copy(Z_STR(retval));
}
zval_ptr_dtor(&retval);
} else {
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index b1f3688a25..72a119cbab 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index 326f6f21f1..7e2960cc32 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -39,7 +39,7 @@
PHP_METHOD(SessionHandler, open)
{
char *save_path = NULL, *session_name = NULL;
- int save_path_len, session_name_len;
+ size_t save_path_len, session_name_len;
PS_SANITY_CHECK;
@@ -125,12 +125,12 @@ PHP_METHOD(SessionHandler, destroy)
Wraps the old gc handler */
PHP_METHOD(SessionHandler, gc)
{
- php_int_t maxlifetime;
+ zend_long maxlifetime;
int nrdels;
PS_SANITY_CHECK_IS_OPEN;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &maxlifetime) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &maxlifetime) == FAILURE) {
return;
}
@@ -144,6 +144,8 @@ PHP_METHOD(SessionHandler, create_sid)
{
zend_string *id;
+ PS_SANITY_CHECK;
+
if (zend_parse_parameters_none() == FAILURE) {
return;
}
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 0e2eca9188..9fb6477056 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -104,8 +104,8 @@ typedef struct _php_session_rfc1867_progress {
zval sid;
smart_str key;
- php_int_t update_step;
- php_int_t next_update;
+ zend_long update_step;
+ zend_long next_update;
double next_update_time;
zend_bool cancel_upload;
zend_bool apply_trans_sid;
@@ -125,8 +125,8 @@ typedef struct _php_ps_globals {
char *extern_referer_chk;
char *entropy_file;
char *cache_limiter;
- php_int_t entropy_length;
- php_int_t cookie_lifetime;
+ zend_long entropy_length;
+ zend_long cookie_lifetime;
char *cookie_path;
char *cookie_domain;
zend_bool cookie_secure;
@@ -135,11 +135,11 @@ typedef struct _php_ps_globals {
ps_module *default_mod;
void *mod_data;
php_session_status session_status;
- php_int_t gc_probability;
- php_int_t gc_divisor;
- php_int_t gc_maxlifetime;
+ zend_long gc_probability;
+ zend_long gc_divisor;
+ zend_long gc_maxlifetime;
int module_number;
- php_int_t cache_expire;
+ zend_long cache_expire;
union {
zval names[7];
struct {
@@ -162,11 +162,11 @@ typedef struct _php_ps_globals {
zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */
- php_int_t hash_func;
+ zend_long hash_func;
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
php_hash_ops *hash_ops;
#endif
- php_int_t hash_bits_per_character;
+ zend_long hash_bits_per_character;
int send_cookie;
int define_sid;
zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */
@@ -176,7 +176,7 @@ typedef struct _php_ps_globals {
zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */
char *rfc1867_prefix; /* session.upload_progress.prefix */
char *rfc1867_name; /* session.upload_progress.name */
- php_int_t rfc1867_freq; /* session.upload_progress.freq */
+ zend_long rfc1867_freq; /* session.upload_progress.freq */
double rfc1867_min_freq; /* session.upload_progress.min_freq */
zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */
@@ -254,7 +254,7 @@ PHPAPI void php_session_reset_id(TSRMLS_D);
#define PS_ENCODE_VARS \
zend_string *key; \
- php_uint_t num_key; \
+ zend_ulong num_key; \
zval *struc;
#define PS_ENCODE_LOOP(code) do { \
@@ -262,7 +262,7 @@ PHPAPI void php_session_reset_id(TSRMLS_D);
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
if (key == NULL) { \
php_error_docref(NULL TSRMLS_CC, E_NOTICE, \
- "Skipping numeric key %ld", num_key); \
+ "Skipping numeric key %pd", num_key); \
continue; \
} \
if ((struc = php_get_session_var(key TSRMLS_CC))) { \
diff --git a/ext/session/session.c b/ext/session/session.c
index 8632ba493c..dae965b048 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -48,7 +48,7 @@
#include "ext/standard/url_scanner_ex.h"
#include "ext/standard/php_rand.h" /* for RAND_MAX */
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/url.h"
#include "ext/standard/basic_functions.h"
#include "ext/standard/head.h"
@@ -115,7 +115,7 @@ static inline void php_rshutdown_session_globals(TSRMLS_D) /* {{{ */
} zend_end_try();
}
if (PS(id)) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
}
}
/* }}} */
@@ -181,7 +181,7 @@ PHPAPI zval* php_get_session_var(zend_string *name TSRMLS_DC) /* {{{ */
static void php_session_track_init(TSRMLS_D) /* {{{ */
{
zval session_vars;
- zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0);
+ zend_string *var_name = zend_string_init("_SESSION", sizeof("_SESSION") - 1, 0);
/* Unconditionally destroy existing array -- possible dirty data */
zend_delete_global_variable(var_name TSRMLS_CC);
@@ -193,7 +193,7 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */
ZVAL_NEW_REF(&PS(http_session_vars), &session_vars);
Z_ADDREF_P(&PS(http_session_vars));
zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars));
- STR_RELEASE(var_name);
+ zend_string_release(var_name);
}
/* }}} */
@@ -305,7 +305,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
}
/* maximum 15+19+19+10 bytes */
- spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (php_int_t)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
+ spprintf(&buf, 0, "%.15s%ld" ZEND_LONG_FMT "%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (zend_long)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
switch (PS(hash_func)) {
case PS_HASH_FUNC_MD5:
@@ -416,7 +416,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now");
}
- outid = STR_ALLOC((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0);
+ outid = zend_string_alloc((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0);
outid->len = (int)(bin_to_readable((char *)digest, digest_len, outid->val, (char)PS(hash_bits_per_character)) - (char *)&outid->val);
efree(digest);
@@ -514,7 +514,7 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */
PHP_MD5Final(PS(session_data_hash), &context);
php_session_decode(val->val, val->len TSRMLS_CC);
- STR_RELEASE(val);
+ zend_string_release(val);
} else {
memset(PS(session_data_hash),'\0', 16);
}
@@ -551,7 +551,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */
} else {
ret = SUCCESS;
}
- STR_RELEASE(val);
+ zend_string_release(val);
} else {
ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC() TSRMLS_CC);
}
@@ -581,7 +581,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
ps_module *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_module(new_value TSRMLS_CC);
+ tmp = _php_find_ps_module(new_value->val TSRMLS_CC);
if (PG(modules_activated) && !tmp) {
int err_type;
@@ -594,7 +594,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value->val);
}
return FAILURE;
}
@@ -611,7 +611,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
const ps_serializer *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_serializer(new_value TSRMLS_CC);
+ tmp = _php_find_ps_serializer(new_value->val TSRMLS_CC);
if (PG(modules_activated) && !tmp) {
int err_type;
@@ -624,7 +624,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value->val);
}
return FAILURE;
}
@@ -638,10 +638,10 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
{
SESSION_CHECK_ACTIVE_STATE;
- if (!strncasecmp(new_value, "on", sizeof("on"))) {
+ if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
PS(use_trans_sid) = (zend_bool) 1;
} else {
- PS(use_trans_sid) = (zend_bool) atoi(new_value);
+ PS(use_trans_sid) = (zend_bool) atoi(new_value->val);
}
return SUCCESS;
@@ -654,19 +654,19 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value, '\0', new_value_length) != NULL) {
+ if (memchr(new_value->val, '\0', new_value->len) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value, ';'))) {
+ if ((p = strchr(new_value->val, ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value;
+ p = new_value->val;
}
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
@@ -674,7 +674,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
@@ -682,7 +682,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
static PHP_INI_MH(OnUpdateName) /* {{{ */
{
/* Numeric session.name won't work at all */
- if ((!new_value_length || is_numeric_string(new_value, new_value_length, NULL, NULL, 0))) {
+ if ((!new_value->len || is_numeric_string(new_value->val, new_value->len, NULL, NULL, 0))) {
int err_type;
if (stage == ZEND_INI_STAGE_RUNTIME || stage == ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) {
@@ -693,26 +693,26 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value->val);
}
return FAILURE;
}
- OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateStringUnempty(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
{
- php_int_t val;
+ zend_long val;
char *endptr = NULL;
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
PS(hash_ops) = NULL;
#endif
- val = ZEND_STRTOI(new_value, &endptr, 10);
+ val = ZEND_STRTOL(new_value->val, &endptr, 10);
if (endptr && (*endptr == '\0')) {
/* Numeric value */
PS(hash_func) = val ? 1 : 0;
@@ -720,15 +720,15 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
return SUCCESS;
}
- if (new_value_length == (sizeof("md5") - 1) &&
- strncasecmp(new_value, "md5", sizeof("md5") - 1) == 0) {
+ if (new_value->len == (sizeof("md5") - 1) &&
+ strncasecmp(new_value->val, "md5", sizeof("md5") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_MD5;
return SUCCESS;
}
- if (new_value_length == (sizeof("sha1") - 1) &&
- strncasecmp(new_value, "sha1", sizeof("sha1") - 1) == 0) {
+ if (new_value->len == (sizeof("sha1") - 1) &&
+ strncasecmp(new_value->val, "sha1", sizeof("sha1") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_SHA1;
return SUCCESS;
@@ -736,7 +736,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) /* {{{ */
{
- php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value, new_value_length);
+ php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value->val, new_value->len);
if (ops) {
PS(hash_func) = PS_HASH_FUNC_OTHER;
@@ -747,7 +747,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
}
#endif /* HAVE_HASH_EXT }}} */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value->val);
return FAILURE;
}
/* }}} */
@@ -755,12 +755,12 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
{
int tmp;
- tmp = zend_atoi(new_value, new_value_length);
+ tmp = zend_atoi(new_value->val, new_value->len);
if(tmp < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero");
return FAILURE;
}
- if(new_value_length > 0 && new_value[new_value_length-1] == '%') {
+ if(new_value->len > 0 && new_value->val[new_value->len-1] == '%') {
if(tmp > 100) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq cannot be over 100%%");
return FAILURE;
@@ -846,11 +846,11 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
const char *endptr = val + vallen;
zval session_vars;
php_unserialize_data_t var_hash;
- zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0);
+ zend_string *var_name = zend_string_init("_SESSION", sizeof("_SESSION") - 1, 0);
ZVAL_NULL(&session_vars);
PHP_VAR_UNSERIALIZE_INIT(var_hash);
- php_var_unserialize(&session_vars, &val, endptr, &var_hash TSRMLS_CC);
+ php_var_unserialize(&session_vars, (const unsigned char **)&val, endptr, &var_hash TSRMLS_CC);
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
if (!Z_ISUNDEF(PS(http_session_vars))) {
zval_ptr_dtor(&PS(http_session_vars));
@@ -861,7 +861,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
ZVAL_NEW_REF(&PS(http_session_vars), &session_vars);
Z_ADDREF_P(&PS(http_session_vars));
zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars));
- STR_RELEASE(var_name);
+ zend_string_release(var_name);
return SUCCESS;
}
/* }}} */
@@ -918,7 +918,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
has_value = *p & PS_BIN_UNDEF ? 0 : 1;
- name = STR_INIT(p + 1, namelen, 0);
+ name = zend_string_init(p + 1, namelen, 0);
p += namelen + 1;
@@ -939,7 +939,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
}
}
PS_ADD_VARL(name);
- STR_RELEASE(name);
+ zend_string_release(name);
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
@@ -1010,7 +1010,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
}
namelen = q - p;
- name = STR_INIT(p, namelen, 0);
+ name = zend_string_init(p, namelen, 0);
q++;
if ((tmp = zend_hash_find(&EG(symbol_table).ht, name))) {
@@ -1030,7 +1030,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
}
PS_ADD_VARL(name);
skip:
- STR_RELEASE(name);
+ zend_string_release(name);
p = q;
}
@@ -1148,7 +1148,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */
static inline void last_modified(TSRMLS_D) /* {{{ */
{
const char *path;
- php_stat_t sb;
+ zend_stat_t sb;
char buf[MAX_STR + 1];
path = SG(request_info).path_translated;
@@ -1178,7 +1178,7 @@ CACHE_LIMITER_FUNC(public) /* {{{ */
strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
ADD_HEADER(buf);
- snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
+ snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=" ZEND_LONG_FMT, PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
last_modified(TSRMLS_C);
@@ -1189,7 +1189,7 @@ CACHE_LIMITER_FUNC(private_no_expire) /* {{{ */
{
char buf[MAX_STR + 1];
- snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
+ snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=" ZEND_LONG_FMT ", pre-check=" ZEND_LONG_FMT, PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
last_modified(TSRMLS_C);
@@ -1268,11 +1268,12 @@ static void php_session_remove_cookie(TSRMLS_D) {
zend_llist_element *current;
char *session_cookie;
zend_string *e_session_name;
- int session_cookie_len, len = sizeof("Set-Cookie")-1;
+ int session_cookie_len;
+ uint len = sizeof("Set-Cookie")-1;
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)));
spprintf(&session_cookie, 0, "Set-Cookie: %s=", e_session_name->val);
- STR_FREE(e_session_name);
+ zend_string_free(e_session_name);
session_cookie_len = strlen(session_cookie);
current = l->head;
@@ -1327,8 +1328,8 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */
smart_str_appendc(&ncookie, '=');
smart_str_appendl(&ncookie, e_id->val, e_id->len);
- STR_RELEASE(e_session_name);
- STR_RELEASE(e_id);
+ zend_string_release(e_session_name);
+ zend_string_release(e_id);
if (PS(cookie_lifetime) > 0) {
struct timeval tv;
@@ -1341,10 +1342,10 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */
date_fmt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, t, 0 TSRMLS_CC);
smart_str_appends(&ncookie, COOKIE_EXPIRES);
smart_str_appendl(&ncookie, date_fmt->val, date_fmt->len);
- STR_RELEASE(date_fmt);
+ zend_string_release(date_fmt);
smart_str_appends(&ncookie, COOKIE_MAX_AGE);
- smart_str_append_int(&ncookie, PS(cookie_lifetime));
+ smart_str_append_long(&ncookie, PS(cookie_lifetime));
}
}
@@ -1413,7 +1414,7 @@ static void ppid2sid(zval *ppid TSRMLS_DC) {
PS(send_cookie) = 1;
} else {
convert_to_string(ppid);
- PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRSIZE_P(ppid), 0);
+ PS(id) = zend_string_init(Z_STRVAL_P(ppid), Z_STRLEN_P(ppid), 0);
PS(send_cookie) = 0;
}
}
@@ -1547,7 +1548,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
p += lensess + 1;
if ((q = strpbrk(p, "/?\\"))) {
- PS(id) = STR_INIT(p, q - p, 0);
+ PS(id) = zend_string_init(p, q - p, 0);
PS(send_cookie) = 0;
}
}
@@ -1560,10 +1561,10 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
!Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) &&
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) &&
Z_TYPE_P(data) == IS_STRING &&
- Z_STRSIZE_P(data) != 0 &&
+ Z_STRLEN_P(data) != 0 &&
strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL
) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
PS(id) = NULL;
PS(send_cookie) = 1;
if (PS(use_trans_sid) && !PS(use_only_cookies)) {
@@ -1574,7 +1575,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */
/* Finally check session id for dangerous characters
* Security note: session id may be embedded in HTML pages.*/
if (PS(id) && strpbrk(PS(id)->val, "\r\n\t <>'\"\\")) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
PS(id) = NULL;
}
@@ -1643,42 +1644,42 @@ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t
static PHP_FUNCTION(session_set_cookie_params)
{
zval *lifetime;
- char *path = NULL, *domain = NULL;
- int path_len, domain_len, argc = ZEND_NUM_ARGS();
+ zend_string *path = NULL, *domain = NULL;
+ int argc = ZEND_NUM_ARGS();
zend_bool secure = 0, httponly = 0;
zend_string *ini_name;
if (!PS(use_cookies) ||
- zend_parse_parameters(argc TSRMLS_CC, "z|ssbb", &lifetime, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
+ zend_parse_parameters(argc TSRMLS_CC, "z|SSbb", &lifetime, &path, &domain, &secure, &httponly) == FAILURE) {
return;
}
convert_to_string_ex(lifetime);
- ini_name = STR_INIT("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRSIZE_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0);
+ zend_alter_ini_entry(ini_name, Z_STR_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
if (path) {
- ini_name = STR_INIT("session.cookie_path", sizeof("session.cookie_path") - 1, 0);
- zend_alter_ini_entry(ini_name, path, path_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cookie_path", sizeof("session.cookie_path") - 1, 0);
+ zend_alter_ini_entry(ini_name, path, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
if (domain) {
- ini_name = STR_INIT("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0);
- zend_alter_ini_entry(ini_name, domain, domain_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0);
+ zend_alter_ini_entry(ini_name, domain, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
if (argc > 3) {
- ini_name = STR_INIT("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0);
- zend_alter_ini_entry(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0);
+ zend_alter_ini_entry_chars(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
if (argc > 4) {
- ini_name = STR_INIT("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0);
- zend_alter_ini_entry(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0);
+ zend_alter_ini_entry_chars(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -1693,7 +1694,7 @@ static PHP_FUNCTION(session_get_cookie_params)
array_init(return_value);
- add_assoc_int(return_value, "lifetime", PS(cookie_lifetime));
+ add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
add_assoc_string(return_value, "path", PS(cookie_path));
add_assoc_string(return_value, "domain", PS(cookie_domain));
add_assoc_bool(return_value, "secure", PS(cookie_secure));
@@ -1705,20 +1706,19 @@ static PHP_FUNCTION(session_get_cookie_params)
Return the current session name. If newname is given, the session name is replaced with newname */
static PHP_FUNCTION(session_name)
{
- char *name = NULL;
- int name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
RETVAL_STRING(PS(session_name));
if (name) {
- ini_name = STR_INIT("session.name", sizeof("session.name") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.name", sizeof("session.name") - 1, 0);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -1727,11 +1727,10 @@ static PHP_FUNCTION(session_name)
Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
static PHP_FUNCTION(session_module_name)
{
- char *name = NULL;
- int name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
@@ -1743,8 +1742,8 @@ static PHP_FUNCTION(session_module_name)
}
if (name) {
- if (!_php_find_ps_module(name TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name);
+ if (!_php_find_ps_module(name->val TSRMLS_CC)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name->val);
zval_dtor(return_value);
RETURN_FALSE;
@@ -1754,9 +1753,9 @@ static PHP_FUNCTION(session_module_name)
}
PS(mod_data) = NULL;
- ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -1768,7 +1767,7 @@ static PHP_FUNCTION(session_set_save_handler)
zval *args = NULL;
int i, num_args, argc = ZEND_NUM_ARGS();
zend_string *name;
- zend_string *ini_name;
+ zend_string *ini_name, *ini_val;
if (PS(session_status) != php_session_none) {
RETURN_FALSE;
@@ -1777,10 +1776,7 @@ static PHP_FUNCTION(session_set_save_handler)
if (argc > 0 && argc <= 2) {
zval *obj = NULL;
zend_string *func_name;
- HashPosition pos;
- zend_function *default_mptr, *current_mptr;
- php_uint_t func_index;
- php_shutdown_function_entry shutdown_function_entry;
+ zend_function *current_mptr;
zend_bool register_shutdown = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &obj, php_session_iface_entry, &register_shutdown) == FAILURE) {
@@ -1788,11 +1784,8 @@ static PHP_FUNCTION(session_set_save_handler)
}
/* Find implemented methods - SessionHandlerInterface */
- zend_hash_internal_pointer_reset_ex(&php_session_iface_entry->function_table, &pos);
i = 0;
- while ((default_mptr = zend_hash_get_current_data_ptr_ex(&php_session_iface_entry->function_table, &pos))) {
- zend_hash_get_current_key_ex(&php_session_iface_entry->function_table, &func_name, &func_index, 0, &pos);
-
+ ZEND_HASH_FOREACH_STR_KEY(&php_session_iface_entry->function_table, func_name) {
if ((current_mptr = zend_hash_find_ptr(&Z_OBJCE_P(obj)->function_table, func_name))) {
if (!Z_ISUNDEF(PS(mod_user_names).names[i])) {
zval_ptr_dtor(&PS(mod_user_names).names[i]);
@@ -1801,21 +1794,17 @@ static PHP_FUNCTION(session_set_save_handler)
array_init_size(&PS(mod_user_names).names[i], 2);
Z_ADDREF_P(obj);
add_next_index_zval(&PS(mod_user_names).names[i], obj);
- add_next_index_str(&PS(mod_user_names).names[i], func_name);
+ add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name));
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Session handler's function table is corrupt");
RETURN_FALSE;
}
- zend_hash_move_forward_ex(&php_session_iface_entry->function_table, &pos);
++i;
- }
+ } ZEND_HASH_FOREACH_END();
/* Find implemented methods - SessionIdInterface (optional) */
- zend_hash_internal_pointer_reset_ex(&php_session_id_iface_entry->function_table, &pos);
- while ((default_mptr = zend_hash_get_current_data_ptr_ex(&php_session_id_iface_entry->function_table, &pos))) {
- zend_hash_get_current_key_ex(&php_session_id_iface_entry->function_table, &func_name, &func_index, 0, &pos);
-
+ ZEND_HASH_FOREACH_STR_KEY(&php_session_id_iface_entry->function_table, func_name) {
if ((current_mptr = zend_hash_find_ptr(&Z_OBJCE_P(obj)->function_table, func_name))) {
if (!Z_ISUNDEF(PS(mod_user_names).names[i])) {
zval_ptr_dtor(&PS(mod_user_names).names[i]);
@@ -1824,15 +1813,15 @@ static PHP_FUNCTION(session_set_save_handler)
array_init_size(&PS(mod_user_names).names[i], 2);
Z_ADDREF_P(obj);
add_next_index_zval(&PS(mod_user_names).names[i], obj);
- add_next_index_str(&PS(mod_user_names).names[i], func_name);
+ add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name));
}
- zend_hash_move_forward_ex(&php_session_id_iface_entry->function_table, &pos);
++i;
- }
+ } ZEND_HASH_FOREACH_END();
if (register_shutdown) {
/* create shutdown function */
+ php_shutdown_function_entry shutdown_function_entry;
shutdown_function_entry.arg_count = 1;
shutdown_function_entry.arguments = (zval *) safe_emalloc(sizeof(zval), 1, 0);
@@ -1851,9 +1840,11 @@ static PHP_FUNCTION(session_set_save_handler)
}
if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) {
- ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, "user", sizeof("user") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
+ ini_val = zend_string_init("user", sizeof("user") - 1, 0);
+ zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_val);
+ zend_string_release(ini_name);
}
RETURN_TRUE;
@@ -1874,16 +1865,18 @@ static PHP_FUNCTION(session_set_save_handler)
for (i = 0; i < argc; i++) {
if (!zend_is_callable(&args[i], 0, &name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1);
- STR_RELEASE(name);
+ zend_string_release(name);
RETURN_FALSE;
}
- STR_RELEASE(name);
+ zend_string_release(name);
}
if (PS(mod) && PS(mod) != &ps_mod_user) {
- ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
+ ini_val = zend_string_init("user", sizeof("user") - 1, 0);
+ zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_val);
+ zend_string_release(ini_name);
}
for (i = 0; i < argc; i++) {
@@ -1901,25 +1894,24 @@ static PHP_FUNCTION(session_set_save_handler)
Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
static PHP_FUNCTION(session_save_path)
{
- char *name = NULL;
- int name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
RETVAL_STRING(PS(save_path));
if (name) {
- if (memchr(name, '\0', name_len) != NULL) {
+ if (memchr(name->val, '\0', name->len) != NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The save_path cannot contain NULL characters");
zval_dtor(return_value);
RETURN_FALSE;
}
- ini_name = STR_INIT("session.save_path", sizeof("session.save_path") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -1940,9 +1932,9 @@ static PHP_FUNCTION(session_id)
* see: ext/session/tests/session_id_error3.phpt */
int len = strlen(PS(id)->val);
if (UNEXPECTED(len != PS(id)->len)) {
- RETVAL_STR(STR_INIT(PS(id)->val, len, 0));
+ RETVAL_STR(zend_string_init(PS(id)->val, len, 0));
} else {
- RETVAL_STR(STR_COPY(PS(id)));
+ RETVAL_STR(zend_string_copy(PS(id)));
}
} else {
RETVAL_EMPTY_STRING();
@@ -1950,9 +1942,9 @@ static PHP_FUNCTION(session_id)
if (name) {
if (PS(id)) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
}
- PS(id) = STR_COPY(name);
+ PS(id) = zend_string_copy(name);
}
}
/* }}} */
@@ -1978,7 +1970,7 @@ static PHP_FUNCTION(session_regenerate_id)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed");
RETURN_FALSE;
}
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
memset(PS(session_data_hash),'\0', 16);
}
@@ -1999,20 +1991,19 @@ static PHP_FUNCTION(session_regenerate_id)
Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
static PHP_FUNCTION(session_cache_limiter)
{
- char *limiter = NULL;
- int limiter_len;
+ zend_string *limiter = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &limiter, &limiter_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &limiter) == FAILURE) {
return;
}
RETVAL_STRING(PS(cache_limiter));
if (limiter) {
- ini_name = STR_INIT("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0);
- zend_alter_ini_entry(ini_name, limiter, limiter_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0);
+ zend_alter_ini_entry(ini_name, limiter, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -2028,13 +2019,13 @@ static PHP_FUNCTION(session_cache_expire)
return;
}
- RETVAL_INT(PS(cache_expire));
+ RETVAL_LONG(PS(cache_expire));
if (expires) {
convert_to_string_ex(expires);
- ini_name = STR_INIT("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRSIZE_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- STR_RELEASE(ini_name);
+ ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
+ zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string_release(ini_name);
}
}
/* }}} */
@@ -2063,7 +2054,7 @@ static PHP_FUNCTION(session_encode)
static PHP_FUNCTION(session_decode)
{
char *str;
- int str_len;
+ size_t str_len;
if (PS(session_status) == php_session_none) {
RETURN_FALSE;
@@ -2114,10 +2105,7 @@ static PHP_FUNCTION(session_unset)
}
IF_SESSION_VARS() {
- HashTable *ht_sess_var;
-
- SEPARATE_ZVAL_IF_NOT_REF(&PS(http_session_vars));
- ht_sess_var = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars)));
+ HashTable *ht_sess_var = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars)));
/* Clean $_SESSION. */
zend_hash_clean(ht_sess_var);
@@ -2157,7 +2145,7 @@ static PHP_FUNCTION(session_status)
return;
}
- RETURN_INT(PS(session_status));
+ RETURN_LONG(PS(session_status));
}
/* }}} */
@@ -2432,7 +2420,7 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */
{
zend_class_entry ce;
- zend_register_auto_global(STR_INIT("_SESSION", sizeof("_SESSION") - 1, 1), 0, NULL TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_SESSION", sizeof("_SESSION") - 1, 1), 0, NULL TSRMLS_CC);
PS(module_number) = module_number; /* if we really need this var we need to init it in zts mode as well! */
@@ -2460,9 +2448,9 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */
zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_iface_entry);
zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_id_iface_entry);
- REGISTER_INT_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -2603,7 +2591,7 @@ static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress
static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, int force_update TSRMLS_DC) /* {{{ */
{
if (!force_update) {
- if (Z_IVAL_P(progress->post_bytes_processed) < progress->next_update) {
+ if (Z_LVAL_P(progress->post_bytes_processed) < progress->next_update) {
return;
}
#ifdef HAVE_GETTIMEOFDAY
@@ -2618,7 +2606,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i
progress->next_update_time = dtv + PS(rfc1867_min_freq);
}
#endif
- progress->next_update = Z_IVAL_P(progress->post_bytes_processed) + progress->update_step;
+ progress->next_update = Z_LVAL_P(progress->post_bytes_processed) + progress->update_step;
}
php_session_initialize(TSRMLS_C);
@@ -2720,16 +2708,16 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
array_init(&progress->data);
array_init(&progress->files);
- add_assoc_int_ex(&progress->data, "start_time", sizeof("start_time") - 1, (php_int_t)sapi_get_request_time(TSRMLS_C));
- add_assoc_int_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length);
- add_assoc_int_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed);
+ add_assoc_long_ex(&progress->data, "start_time", sizeof("start_time") - 1, (zend_long)sapi_get_request_time(TSRMLS_C));
+ add_assoc_long_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length);
+ add_assoc_long_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed);
add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 0);
add_assoc_zval_ex(&progress->data, "files", sizeof("files") - 1, &progress->files);
progress->post_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->data), "bytes_processed", sizeof("bytes_processed") - 1);
php_rinit_session(0 TSRMLS_CC);
- PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRSIZE(progress->sid), 0);
+ PS(id) = zend_string_init(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0);
PS(apply_trans_sid) = progress->apply_trans_sid;
PS(send_cookie) = 0;
}
@@ -2740,17 +2728,17 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name);
add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename);
add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1);
- add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, 0);
+ add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0);
add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 0);
- add_assoc_int_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (php_int_t)time(NULL));
- add_assoc_int_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0);
+ add_assoc_long_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (zend_long)time(NULL));
+ add_assoc_long_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0);
add_next_index_zval(&progress->files, &progress->current_file);
progress->current_file_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->current_file), "bytes_processed", sizeof("bytes_processed") - 1);
- Z_IVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed;
+ Z_LVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed;
php_session_rfc1867_update(progress, 0 TSRMLS_CC);
}
break;
@@ -2761,8 +2749,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
break;
}
- Z_IVAL_P(progress->current_file_bytes_processed) = data->offset + data->length;
- Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
+ Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length;
+ Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
php_session_rfc1867_update(progress, 0 TSRMLS_CC);
}
@@ -2778,10 +2766,10 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename);
}
- add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload);
+ add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload);
add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 1);
- Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
+ Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
php_session_rfc1867_update(progress, 0 TSRMLS_CC);
}
@@ -2794,7 +2782,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
php_session_rfc1867_cleanup(progress TSRMLS_CC);
} else {
add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 1);
- Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
+ Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
php_session_rfc1867_update(progress, 1 TSRMLS_CC);
}
php_rshutdown_session_globals(TSRMLS_C);
diff --git a/ext/session/tests/bug67972.phpt b/ext/session/tests/bug67972.phpt
new file mode 100644
index 0000000000..63ed3a95b8
--- /dev/null
+++ b/ext/session/tests/bug67972.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #67972: SessionHandler Invalid memory read create_sid()
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+(new SessionHandler)->create_sid();
+--EXPECTF--
+Fatal error: SessionHandler::create_sid(): Cannot call default session handler in %s on line %d
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index e0e0448709..4ee6d4f61c 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -45,7 +45,7 @@ struct php_shmop
int shmflg;
int shmatflg;
char *addr;
- php_int_t size;
+ zend_long size;
};
typedef struct {
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 3a66d7343c..4bf9d7dedf 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -146,13 +146,13 @@ PHP_MINFO_FUNCTION(shmop)
gets and attaches a shared memory segment */
PHP_FUNCTION(shmop_open)
{
- php_int_t key, mode, size;
+ zend_long key, mode, size;
struct php_shmop *shmop;
struct shmid_ds shm;
char *flags;
- int flags_len;
+ size_t flags_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "isii", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
return;
}
@@ -216,7 +216,7 @@ PHP_FUNCTION(shmop_open)
shmop->size = shm.shm_segsz;
ZEND_REGISTER_RESOURCE(return_value, shmop, shm_type);
- RETURN_INT(Z_RES_HANDLE_P(return_value));
+ RETURN_LONG(Z_RES_HANDLE_P(return_value));
err:
efree(shmop);
RETURN_FALSE;
@@ -227,13 +227,13 @@ err:
reads from a shm segment */
PHP_FUNCTION(shmop_read)
{
- php_int_t shmid, start, count;
+ zend_long shmid, start, count;
struct php_shmop *shmop;
char *startaddr;
int bytes;
zend_string *return_string;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &shmid, &start, &count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) {
return;
}
@@ -252,7 +252,7 @@ PHP_FUNCTION(shmop_read)
startaddr = shmop->addr + start;
bytes = count ? count : shmop->size - start;
- return_string = STR_INIT(startaddr, bytes, 0);
+ return_string = zend_string_init(startaddr, bytes, 0);
RETURN_STR(return_string);
}
@@ -262,10 +262,10 @@ PHP_FUNCTION(shmop_read)
closes a shared memory segment */
PHP_FUNCTION(shmop_close)
{
- php_int_t shmid;
+ zend_long shmid;
zval *res;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
return;
}
@@ -280,16 +280,16 @@ PHP_FUNCTION(shmop_close)
returns the shm size */
PHP_FUNCTION(shmop_size)
{
- php_int_t shmid;
+ zend_long shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(shmop, struct php_shmop *, NULL, shmid, "shmop", shm_type);
- RETURN_INT(shmop->size);
+ RETURN_LONG(shmop->size);
}
/* }}} */
@@ -299,10 +299,10 @@ PHP_FUNCTION(shmop_write)
{
struct php_shmop *shmop;
int writesize;
- php_int_t shmid, offset;
+ zend_long shmid, offset;
zend_string *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSi", &shmid, &data, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lSl", &shmid, &data, &offset) == FAILURE) {
return;
}
@@ -321,7 +321,7 @@ PHP_FUNCTION(shmop_write)
writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset;
memcpy(shmop->addr + offset, data->val, writesize);
- RETURN_INT(writesize);
+ RETURN_LONG(writesize);
}
/* }}} */
@@ -329,10 +329,10 @@ PHP_FUNCTION(shmop_write)
mark segment for deletion */
PHP_FUNCTION(shmop_delete)
{
- php_int_t shmid;
+ zend_long shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
return;
}
diff --git a/ext/shmop/shmop.dsp b/ext/shmop/shmop.dsp
deleted file mode 100644
index 848f0bdc91..0000000000
--- a/ext/shmop/shmop.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="shmop" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=shmop - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "shmop.mak" CFG="shmop - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "shmop - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "shmop - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "shmop - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D "WIN32" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SHMOP" /D COMPILE_DL_SHMOP=1 /D ZEND_DEBUG=0 /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_shmop.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "shmop - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SHMOP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D "WIN32" /D ZEND_DEBUG=1 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_EXPORTS" /D "COMPILE_DL_SHMOP" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SHMOP=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_shmop.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "shmop - Win32 Release_TS"
-# Name "shmop - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\shmop.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_shmop.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/simplexml/php_simplexml.h b/ext/simplexml/php_simplexml.h
index b908e4c722..780974c0c9 100644
--- a/ext/simplexml/php_simplexml.h
+++ b/ext/simplexml/php_simplexml.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h
index 6cdda1be4a..82e5aff9e4 100644
--- a/ext/simplexml/php_simplexml_exports.h
+++ b/ext/simplexml/php_simplexml_exports.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 78d8da5694..ba70ecca9d 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -138,9 +138,9 @@ static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name,
}
/* }}} */
-static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, php_int_t offset, xmlNodePtr node, php_int_t *cnt) /* {{{ */
+static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, zend_long offset, xmlNodePtr node, zend_long *cnt) /* {{{ */
{
- php_int_t nodendx = 0;
+ zend_long nodendx = 0;
if (sxe->iter.type == SXE_ITER_NONE) {
if (offset == 0) {
@@ -255,7 +255,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
sxe = Z_SXEOBJ_P(object);
- if (!member || Z_TYPE_P(member) == IS_INT) {
+ if (!member || Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
@@ -299,11 +299,11 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
if (node) {
if (attribs) {
- if (Z_TYPE_P(member) != IS_INT || sxe->iter.type == SXE_ITER_ATTRLIST) {
- if (Z_TYPE_P(member) == IS_INT) {
- while (attr && nodendx <= Z_IVAL_P(member)) {
+ if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) {
+ if (Z_TYPE_P(member) == IS_LONG) {
+ while (attr && nodendx <= Z_LVAL_P(member)) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_IVAL_P(member)) {
+ if (nodendx == Z_LVAL_P(member)) {
_node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
break;
}
@@ -327,27 +327,27 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
if (!sxe->node) {
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL TSRMLS_CC);
}
- if (!member || Z_TYPE_P(member) == IS_INT) {
- php_int_t cnt = 0;
+ if (!member || Z_TYPE_P(member) == IS_LONG) {
+ zend_long cnt = 0;
xmlNodePtr mynode = node;
if (sxe->iter.type == SXE_ITER_CHILD) {
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
}
if (sxe->iter.type == SXE_ITER_NONE) {
- if (member && Z_IVAL_P(member) > 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member));
+ if (member && Z_LVAL_P(member) > 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
}
} else if (member) {
- node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt);
+ node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt);
} else {
node = NULL;
}
if (node) {
_node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
} else if (type == BP_VAR_W || type == BP_VAR_RW) {
- if (member && cnt < Z_IVAL_P(member)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt);
+ if (member && cnt < Z_LVAL_P(member)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt);
}
node = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, NULL);
_node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
@@ -410,7 +410,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
return;
}
switch (Z_TYPE_P(value)) {
- case IS_INT:
+ case IS_LONG:
case IS_FALSE:
case IS_TRUE:
case IS_DOUBLE:
@@ -456,13 +456,13 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
int nodendx = 0;
int test = 0;
int new_value = 0;
- php_int_t cnt = 0;
+ zend_long cnt = 0;
int retval = SUCCESS;
zval tmp_zv, trim_zv, zval_copy;
sxe = Z_SXEOBJ_P(object);
- if (!member || Z_TYPE_P(member) == IS_INT) {
+ if (!member || Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
@@ -479,12 +479,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
trim_zv = *member;
zval_copy_ctor(&trim_zv);
convert_to_string(&trim_zv);
- php_trim(Z_STRVAL(trim_zv), Z_STRSIZE(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC);
+ php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC);
zval_dtor(&trim_zv);
member = &tmp_zv;
}
- if (!Z_STRSIZE_P(member)) {
+ if (!Z_STRLEN_P(member)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
if (member == &tmp_zv) {
zval_dtor(&tmp_zv);
@@ -525,7 +525,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
if (value) {
switch (Z_TYPE_P(value)) {
- case IS_INT:
+ case IS_LONG:
case IS_FALSE:
case IS_TRUE:
case IS_DOUBLE:
@@ -559,10 +559,10 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
if (node) {
if (attribs) {
- if (Z_TYPE_P(member) == IS_INT) {
- while (attr && nodendx <= Z_IVAL_P(member)) {
+ if (Z_TYPE_P(member) == IS_LONG) {
+ while (attr && nodendx <= Z_LVAL_P(member)) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_IVAL_P(member)) {
+ if (nodendx == Z_LVAL_P(member)) {
is_attr = 1;
++counter;
break;
@@ -585,7 +585,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
}
if (elements) {
- if (!member || Z_TYPE_P(member) == IS_INT) {
+ if (!member || Z_TYPE_P(member) == IS_LONG) {
if (node->type == XML_ATTRIBUTE_NODE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot create duplicate attribute");
return FAILURE;
@@ -594,12 +594,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
if (sxe->iter.type == SXE_ITER_NONE) {
newnode = node;
++counter;
- if (member && Z_IVAL_P(member) > 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member));
+ if (member && Z_LVAL_P(member) > 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
retval = FAILURE;
}
} else if (member) {
- newnode = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt);
+ newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt);
if (newnode) {
++counter;
}
@@ -636,21 +636,21 @@ next_iter:
retval = FAILURE;
} else if (elements) {
if (!node) {
- if (!member || Z_TYPE_P(member) == IS_INT) {
+ if (!member || Z_TYPE_P(member) == IS_LONG) {
newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
} else {
newnode = xmlNewTextChild(mynode, mynode->ns, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
}
- } else if (!member || Z_TYPE_P(member) == IS_INT) {
- if (member && cnt < Z_IVAL_P(member)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt);
+ } else if (!member || Z_TYPE_P(member) == IS_LONG) {
+ if (member && cnt < Z_LVAL_P(member)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt);
retval = FAILURE;
}
newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
}
} else if (attribs) {
- if (Z_TYPE_P(member) == IS_INT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_IVAL_P(member), nodendx);
+ if (Z_TYPE_P(member) == IS_LONG) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_LVAL_P(member), nodendx);
retval = FAILURE;
} else {
newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
@@ -735,7 +735,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
int test = 0;
zval tmp_zv;
- if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) {
+ if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
tmp_zv = *member;
zval_copy_ctor(&tmp_zv);
member = &tmp_zv;
@@ -746,7 +746,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
GET_NODE(sxe, node);
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
@@ -770,12 +770,12 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
if (node) {
if (attribs) {
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
int nodendx = 0;
- while (attr && nodendx <= Z_IVAL_P(member)) {
+ while (attr && nodendx <= Z_LVAL_P(member)) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_IVAL_P(member)) {
+ if (nodendx == Z_LVAL_P(member)) {
exists = 1;
break;
}
@@ -801,11 +801,11 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
}
if (elements) {
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type == SXE_ITER_CHILD) {
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
}
- node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL);
+ node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL);
}
else {
node = node->children;
@@ -865,7 +865,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
zval tmp_zv;
int test = 0;
- if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) {
+ if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
tmp_zv = *member;
zval_copy_ctor(&tmp_zv);
member = &tmp_zv;
@@ -876,7 +876,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
GET_NODE(sxe, node);
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
@@ -900,12 +900,12 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
if (node) {
if (attribs) {
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
int nodendx = 0;
- while (attr && nodendx <= Z_IVAL_P(member)) {
+ while (attr && nodendx <= Z_LVAL_P(member)) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) {
- if (nodendx == Z_IVAL_P(member)) {
+ if (nodendx == Z_LVAL_P(member)) {
xmlUnlinkNode((xmlNodePtr) attr);
php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC);
break;
@@ -928,11 +928,11 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
}
if (elements) {
- if (Z_TYPE_P(member) == IS_INT) {
+ if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type == SXE_ITER_CHILD) {
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
}
- node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL);
+ node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL);
if (node) {
xmlUnlinkNode(node);
php_libxml_node_free_resource(node TSRMLS_CC);
@@ -984,7 +984,7 @@ static inline zend_string *sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr li
zend_string *res;
if (tmp) {
- res = STR_INIT((char*)tmp, strlen((char *)tmp), 0);
+ res = zend_string_init((char*)tmp, strlen((char *)tmp), 0);
xmlFree(tmp);
} else {
res = STR_EMPTY_ALLOC();
@@ -1231,7 +1231,7 @@ SXE_METHOD(xpath)
php_sxe_object *sxe;
zval value;
char *query;
- int query_len;
+ size_t query_len;
int i;
int nsnbr = 0;
xmlNsPtr *ns = NULL;
@@ -1319,7 +1319,7 @@ SXE_METHOD(xpath)
SXE_METHOD(registerXPathNamespace)
{
php_sxe_object *sxe;
- int prefix_len, ns_uri_len;
+ size_t prefix_len, ns_uri_len;
char *prefix, *ns_uri;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
@@ -1349,7 +1349,7 @@ SXE_METHOD(asXML)
xmlChar *strval;
int strval_len;
char *filename;
- int filename_len;
+ size_t filename_len;
if (ZEND_NUM_ARGS() > 1) {
RETURN_FALSE;
@@ -1542,7 +1542,7 @@ SXE_METHOD(children)
{
php_sxe_object *sxe;
char *nsprefix = NULL;
- int nsprefix_len = 0;
+ size_t nsprefix_len = 0;
xmlNodePtr node;
zend_bool isprefix = 0;
@@ -1591,7 +1591,7 @@ SXE_METHOD(attributes)
{
php_sxe_object *sxe;
char *nsprefix = NULL;
- int nsprefix_len = 0;
+ size_t nsprefix_len = 0;
xmlNodePtr node;
zend_bool isprefix = 0;
@@ -1618,7 +1618,7 @@ SXE_METHOD(addChild)
{
php_sxe_object *sxe;
char *qname, *value = NULL, *nsuri = NULL;
- int qname_len, value_len = 0, nsuri_len = 0;
+ size_t qname_len, value_len = 0, nsuri_len = 0;
xmlNodePtr node, newnode;
xmlNsPtr nsptr = NULL;
xmlChar *localname, *prefix = NULL;
@@ -1683,7 +1683,7 @@ SXE_METHOD(addAttribute)
{
php_sxe_object *sxe;
char *qname, *value = NULL, *nsuri = NULL;
- int qname_len, value_len = 0, nsuri_len = 0;
+ size_t qname_len, value_len = 0, nsuri_len = 0;
xmlNodePtr node;
xmlAttrPtr attrp = NULL;
xmlNsPtr nsptr = NULL;
@@ -1770,8 +1770,8 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
case _IS_BOOL:
convert_to_boolean(object);
break;
- case IS_INT:
- convert_to_int(object);
+ case IS_LONG:
+ convert_to_long(object);
break;
case IS_DOUBLE:
convert_to_double(object);
@@ -1864,7 +1864,7 @@ SXE_METHOD(__toString)
}
/* }}} */
-static int php_sxe_count_elements_helper(php_sxe_object *sxe, php_int_t *count TSRMLS_DC) /* {{{ */
+static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count TSRMLS_DC) /* {{{ */
{
xmlNodePtr node;
zval data;
@@ -1891,7 +1891,7 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, php_int_t *count T
}
/* }}} */
-static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
+static int sxe_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */
{
php_sxe_object *intern;
intern = Z_SXEOBJ_P(object);
@@ -1903,8 +1903,8 @@ static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ *
zval_ptr_dtor(&intern->tmp);
}
ZVAL_ZVAL(&intern->tmp, &rv, 0, 0);
- convert_to_int(&intern->tmp);
- *count = (php_int_t)Z_IVAL(intern->tmp);
+ convert_to_long(&intern->tmp);
+ *count = (zend_long)Z_LVAL(intern->tmp);
return SUCCESS;
}
return FAILURE;
@@ -1917,7 +1917,7 @@ static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ *
Get number of child elements */
SXE_METHOD(count)
{
- php_int_t count = 0;
+ zend_long count = 0;
php_sxe_object *sxe = Z_SXEOBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -1926,7 +1926,7 @@ SXE_METHOD(count)
php_sxe_count_elements_helper(sxe, &count TSRMLS_CC);
- RETURN_INT(count);
+ RETURN_LONG(count);
}
/* }}} */
@@ -1958,7 +1958,6 @@ static zend_object_handlers sxe_object_handlers = { /* {{{ */
NULL, /* zend_get_std_object_handlers()->get_method,*/
NULL, /* zend_get_std_object_handlers()->call_method,*/
NULL, /* zend_get_std_object_handlers()->get_constructor, */
- NULL, /* zend_get_std_object_handlers()->get_class_entry,*/
NULL, /* zend_get_std_object_handlers()->get_class_name,*/
sxe_objects_compare,
sxe_object_cast,
@@ -2114,15 +2113,15 @@ PHP_FUNCTION(simplexml_load_file)
{
php_sxe_object *sxe;
char *filename;
- int filename_len;
+ size_t filename_len;
xmlDocPtr docp;
char *ns = NULL;
- int ns_len = 0;
- php_int_t options = 0;
+ size_t ns_len = 0;
+ zend_long options = 0;
zend_class_entry *ce= sxe_class_entry;
zend_bool isprefix = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!isb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
return;
}
@@ -2151,15 +2150,15 @@ PHP_FUNCTION(simplexml_load_string)
{
php_sxe_object *sxe;
char *data;
- int data_len;
+ size_t data_len;
xmlDocPtr docp;
char *ns = NULL;
- int ns_len = 0;
- php_int_t options = 0;
+ size_t ns_len = 0;
+ zend_long options = 0;
zend_class_entry *ce= sxe_class_entry;
zend_bool isprefix = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!isb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
return;
}
@@ -2188,14 +2187,14 @@ SXE_METHOD(__construct)
{
php_sxe_object *sxe = Z_SXEOBJ_P(getThis());
char *data, *ns = NULL;
- int data_len, ns_len = 0;
+ size_t data_len, ns_len = 0;
xmlDocPtr docp;
- php_int_t options = 0;
+ zend_long options = 0;
zend_bool is_url = 0, isprefix = 0;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ibsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -2580,7 +2579,6 @@ PHP_MINIT_FUNCTION(simplexml)
sxe_object_handlers.clone_obj = sxe_object_clone;
sxe_object_handlers.get_method = zend_get_std_object_handlers()->get_method;
sxe_object_handlers.get_constructor = zend_get_std_object_handlers()->get_constructor;
- sxe_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry;
sxe_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name;
sxe_class_entry->serialize = zend_class_serialize_deny;
sxe_class_entry->unserialize = zend_class_unserialize_deny;
diff --git a/ext/simplexml/simplexml.dsp b/ext/simplexml/simplexml.dsp
deleted file mode 100644
index 79df918703..0000000000
--- a/ext/simplexml/simplexml.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="simplexml" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=simplexml - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "simplexml.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "simplexml.mak" CFG="simplexml - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "simplexml - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "simplexml - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "simplexml - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php\5d\extensions"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\php5" /I "..\..\..\php5\main" /I "..\..\..\php5\Zend" /I "..\..\..\php5\TSRM" /D ZEND_DEBUG=1 /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D COMPILE_DL_SIMPLEXML=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /D "LIBXML_THREAD_ENABLED" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php5\Debug_TS"
-
-!ELSEIF "$(CFG)" == "simplexml - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\php5\main" /I "..\..\..\php5\Zend" /I "..\..\..\php5\TSRM" /I "..\..\..\php5\win32" /I "..\..\..\php5" /D ZTS=1 /D ZEND_DEBUG=0 /D "ZEND_WIN32" /D "PHP_WIN32" /D COMPILE_DL_SIMPLEXML=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SIMPLEXML_EXPORTS" /D "LIBXML_THREAD_ENABLED" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\php5\Release_TS" /libpath:"..\..\..\php5\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "simplexml - Win32 Debug_TS"
-# Name "simplexml - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\simplexml.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_simplexml.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index e237d2fb95..27d1e9b0f2 100644
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/simplexml/sxe.h b/ext/simplexml/sxe.h
index 629e7b31d4..a08c8f7300 100644
--- a/ext/simplexml/sxe.h
+++ b/ext/simplexml/sxe.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/xml/tests/bug62328.phpt b/ext/simplexml/tests/bug62328.phpt
index c59a4aac0c..a6e60e488c 100644
--- a/ext/xml/tests/bug62328.phpt
+++ b/ext/simplexml/tests/bug62328.phpt
@@ -1,11 +1,7 @@
--TEST--
Bug #62328 (implementing __toString and a cast to string fails)
--SKIPIF--
-<?php
-require_once("skipif.inc");
-if (!extension_loaded("SimpleXML"))
- die("skip: SimpleXML extension not available");
-?>
+<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
class UberSimpleXML extends SimpleXMLElement {
diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h
index bd0b272777..bf73bfcc9b 100644
--- a/ext/skeleton/php_skeleton.h
+++ b/ext/skeleton/php_skeleton.h
@@ -25,7 +25,7 @@ extern zend_module_entry extname_module_entry;
and END macros here:
ZEND_BEGIN_MODULE_GLOBALS(extname)
- php_int_t global_value;
+ zend_long global_value;
char *global_string;
ZEND_END_MODULE_GLOBALS(extname)
*/
diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c
index ef5aed4bff..5103ba82fc 100644
--- a/ext/skeleton/skeleton.c
+++ b/ext/skeleton/skeleton.c
@@ -36,7 +36,7 @@ PHP_INI_END()
PHP_FUNCTION(confirm_extname_compiled)
{
char *arg = NULL;
- int arg_len, len;
+ size_t arg_len, len;
char *strg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
diff --git a/ext/skeleton/skeleton.dsp b/ext/skeleton/skeleton.dsp
deleted file mode 100644
index c3c67c7e34..0000000000
--- a/ext/skeleton/skeleton.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=extname - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "extname - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "extname - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "extname - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_extname.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "extname - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXTNAME_EXPORTS" /D "COMPILE_DL_EXTNAME" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXTNAME=1 /D "LIBZEND_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_extname.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "extname - Win32 Release_TS"
-# Name "extname - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\extname.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_extname.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/skeleton/tests/001.phpt b/ext/skeleton/tests/001.phpt
index a375577e1b..88f5795650 100644
--- a/ext/skeleton/tests/001.phpt
+++ b/ext/skeleton/tests/001.phpt
@@ -13,7 +13,7 @@ echo "extname extension is available";
to pass, differences between the output and the
expected text are interpreted as failure
- see php5/README.TESTING for further information on
+ see php7/README.TESTING for further information on
writing regression tests
*/
?>
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
index a3293e370f..610fff11c7 100644
--- a/ext/snmp/php_snmp.h
+++ b/ext/snmp/php_snmp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -132,8 +132,8 @@ ZEND_END_MODULE_GLOBALS(snmp)
#define SNMP_G(v) (snmp_globals.v)
#endif
-#define REGISTER_SNMP_CLASS_CONST_INT(const_name, value) \
- zend_declare_class_constant_int(php_snmp_ce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
+#define REGISTER_SNMP_CLASS_CONST_LONG(const_name, value) \
+ zend_declare_class_constant_long(php_snmp_ce, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
#else
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 2d6afc43d4..250b1f0ebe 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -376,8 +376,8 @@ struct objid_query {
int count;
int offset;
int step;
- php_int_t non_repeaters;
- php_int_t max_repetitions;
+ zend_long non_repeaters;
+ zend_long max_repetitions;
int valueretrieval;
int array_output;
int oid_increasing_check;
@@ -680,7 +680,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D
if (valueretrieval & SNMP_VALUE_OBJECT) {
object_init(snmpval);
- add_property_int(snmpval, "type", vars->type);
+ add_property_long(snmpval, "type", vars->type);
add_property_zval(snmpval, "value", &val);
} else {
ZVAL_COPY(snmpval, &val);
@@ -1014,8 +1014,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
objid_query->vars[objid_query->count].oid = Z_STRVAL_P(oid);
if (st & SNMP_CMD_SET) {
if (Z_TYPE_P(type) == IS_STRING && Z_TYPE_P(value) == IS_STRING) {
- if (Z_STRSIZE_P(type) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRSIZE_P(type));
+ if (Z_STRLEN_P(type) != 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRLEN_P(type));
efree(objid_query->vars);
return FALSE;
}
@@ -1054,8 +1054,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
} else if (Z_TYPE_P(type) == IS_ARRAY) {
if ((tmp_type = zend_hash_get_current_data_ex(Z_ARRVAL_P(type), &pos_type)) != NULL) {
convert_to_string_ex(tmp_type);
- if (Z_STRSIZE_P(tmp_type) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRSIZE_P(tmp_type));
+ if (Z_STRLEN_P(tmp_type) != 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRLEN_P(tmp_type));
efree(objid_query->vars);
return FALSE;
}
@@ -1427,10 +1427,10 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
{
zval *oid, *value, *type;
char *a1, *a2, *a3, *a4, *a5, *a6, *a7;
- int a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len;
+ size_t a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len;
zend_bool use_orignames = 0, suffix_keys = 0;
- php_int_t timeout = SNMP_DEFAULT_TIMEOUT;
- php_int_t retries = SNMP_DEFAULT_RETRIES;
+ zend_long timeout = SNMP_DEFAULT_TIMEOUT;
+ zend_long retries = SNMP_DEFAULT_RETRIES;
int argc = ZEND_NUM_ARGS();
struct objid_query objid_query;
php_snmp_session *session;
@@ -1446,7 +1446,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
if (session_less_mode) {
if (version == SNMP_VERSION_3) {
if (st & SNMP_CMD_SET) {
- if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
+ if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
RETURN_FALSE;
}
@@ -1455,14 +1455,14 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
* SNMP_CMD_GETNEXT
* SNMP_CMD_WALK
*/
- if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
+ if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &timeout, &retries) == FAILURE) {
RETURN_FALSE;
}
}
} else {
if (st & SNMP_CMD_SET) {
- if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
RETURN_FALSE;
}
} else {
@@ -1470,7 +1470,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
* SNMP_CMD_GETNEXT
* SNMP_CMD_WALK
*/
- if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) {
RETURN_FALSE;
}
}
@@ -1481,7 +1481,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
RETURN_FALSE;
}
} else if (st & SNMP_CMD_WALK) {
- if (zend_parse_parameters(argc TSRMLS_CC, "z|bii", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) {
RETURN_FALSE;
}
if (suffix_keys) {
@@ -1619,9 +1619,9 @@ PHP_FUNCTION(snmp_get_quick_print)
Return all objects including their respective object id withing the specified one */
PHP_FUNCTION(snmp_set_quick_print)
{
- php_int_t a1;
+ zend_long a1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) {
RETURN_FALSE;
}
@@ -1634,9 +1634,9 @@ PHP_FUNCTION(snmp_set_quick_print)
Return all values that are enums with their enum value instead of the raw integer */
PHP_FUNCTION(snmp_set_enum_print)
{
- php_int_t a1;
+ zend_long a1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) {
RETURN_FALSE;
}
@@ -1649,9 +1649,9 @@ PHP_FUNCTION(snmp_set_enum_print)
Set the OID output format. */
PHP_FUNCTION(snmp_set_oid_output_format)
{
- php_int_t a1;
+ zend_long a1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) {
RETURN_FALSE;
}
@@ -1757,9 +1757,9 @@ PHP_FUNCTION(snmp3_set)
Specify the method how the SNMP values will be returned */
PHP_FUNCTION(snmp_set_valueretrieval)
{
- php_int_t method;
+ zend_long method;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) {
RETURN_FALSE;
}
@@ -1781,7 +1781,7 @@ PHP_FUNCTION(snmp_get_valueretrieval)
RETURN_FALSE;
}
- RETURN_INT(SNMP_G(valueretrieval));
+ RETURN_LONG(SNMP_G(valueretrieval));
}
/* }}} */
@@ -1790,7 +1790,7 @@ PHP_FUNCTION(snmp_get_valueretrieval)
PHP_FUNCTION(snmp_read_mib)
{
char *filename;
- int filename_len;
+ size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
RETURN_FALSE;
@@ -1812,17 +1812,17 @@ PHP_METHOD(snmp, __construct)
php_snmp_object *snmp_object;
zval *object = getThis();
char *a1, *a2;
- int a1_len, a2_len;
- php_int_t timeout = SNMP_DEFAULT_TIMEOUT;
- php_int_t retries = SNMP_DEFAULT_RETRIES;
- php_int_t version = SNMP_DEFAULT_VERSION;
+ size_t a1_len, a2_len;
+ zend_long timeout = SNMP_DEFAULT_TIMEOUT;
+ zend_long retries = SNMP_DEFAULT_RETRIES;
+ zend_long version = SNMP_DEFAULT_VERSION;
int argc = ZEND_NUM_ARGS();
zend_error_handling error_handling;
snmp_object = Z_SNMP_P(object);
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(argc TSRMLS_CC, "iss|ii", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -1915,7 +1915,7 @@ PHP_METHOD(snmp, setSecurity)
php_snmp_object *snmp_object;
zval *object = getThis();
char *a1 = "", *a2 = "", *a3 = "", *a4 = "", *a5 = "", *a6 = "", *a7 = "";
- int a1_len = 0, a2_len = 0, a3_len = 0, a4_len = 0, a5_len = 0, a6_len = 0, a7_len = 0;
+ size_t a1_len = 0, a2_len = 0, a3_len = 0, a4_len = 0, a5_len = 0, a6_len = 0, a7_len = 0;
int argc = ZEND_NUM_ARGS();
snmp_object = Z_SNMP_P(object);
@@ -1942,7 +1942,7 @@ PHP_METHOD(snmp, getErrno)
snmp_object = Z_SNMP_P(object);
- RETVAL_INT(snmp_object->snmp_errno);
+ RETVAL_LONG(snmp_object->snmp_errno);
return;
}
/* }}} */
@@ -2097,7 +2097,7 @@ static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC)
HashTable *props;
zval rv;
zend_string *key;
- php_uint_t num_key;
+ zend_ulong num_key;
obj = Z_SNMP_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -2127,13 +2127,13 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_
ZVAL_STRINGL(&val, snmp_object->session->peername, strlen(snmp_object->session->peername));
add_assoc_zval(retval, "hostname", &val);
- ZVAL_INT(&val, snmp_object->session->remote_port);
+ ZVAL_LONG(&val, snmp_object->session->remote_port);
add_assoc_zval(retval, "port", &val);
- ZVAL_INT(&val, snmp_object->session->timeout);
+ ZVAL_LONG(&val, snmp_object->session->timeout);
add_assoc_zval(retval, "timeout", &val);
- ZVAL_INT(&val, snmp_object->session->retries);
+ ZVAL_LONG(&val, snmp_object->session->retries);
add_assoc_zval(retval, "retries", &val);
return SUCCESS;
@@ -2144,7 +2144,7 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_
static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval TSRMLS_DC)
{
if (snmp_object->max_oids > 0) {
- ZVAL_INT(retval, snmp_object->max_oids);
+ ZVAL_LONG(retval, snmp_object->max_oids);
} else {
ZVAL_NULL(retval);
}
@@ -2163,16 +2163,16 @@ PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(oid_increasing_check)
PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(quick_print)
PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(enum_print)
-#define PHP_SNMP_INT_PROPERTY_READER_FUNCTION(name) \
+#define PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(name) \
static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) \
{ \
- ZVAL_INT(retval, snmp_object->name); \
+ ZVAL_LONG(retval, snmp_object->name); \
return SUCCESS; \
}
-PHP_SNMP_INT_PROPERTY_READER_FUNCTION(valueretrieval)
-PHP_SNMP_INT_PROPERTY_READER_FUNCTION(oid_output_format)
-PHP_SNMP_INT_PROPERTY_READER_FUNCTION(exceptions_enabled)
+PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(valueretrieval)
+PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(oid_output_format)
+PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(exceptions_enabled)
/* {{{ */
static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval TSRMLS_DC)
@@ -2193,17 +2193,17 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval TS
return ret;
}
- if (Z_TYPE_P(newval) != IS_INT) {
+ if (Z_TYPE_P(newval) != IS_LONG) {
ztmp = *newval;
zval_copy_ctor(&ztmp);
- convert_to_int(&ztmp);
+ convert_to_long(&ztmp);
newval = &ztmp;
}
- if (Z_IVAL_P(newval) > 0) {
- snmp_object->max_oids = Z_IVAL_P(newval);
+ if (Z_LVAL_P(newval) > 0) {
+ snmp_object->max_oids = Z_LVAL_P(newval);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_IVAL_P(newval));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_LVAL_P(newval));
}
if (newval == &ztmp) {
@@ -2220,17 +2220,17 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new
zval ztmp;
int ret = SUCCESS;
- if (Z_TYPE_P(newval) != IS_INT) {
+ if (Z_TYPE_P(newval) != IS_LONG) {
ztmp = *newval;
zval_copy_ctor(&ztmp);
- convert_to_int(&ztmp);
+ convert_to_long(&ztmp);
newval = &ztmp;
}
- if (Z_IVAL_P(newval) >= 0 && Z_IVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
- snmp_object->valueretrieval = Z_IVAL_P(newval);
+ if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
+ snmp_object->valueretrieval = Z_LVAL_P(newval);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_IVAL_P(newval));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_LVAL_P(newval));
ret = FAILURE;
}
@@ -2264,23 +2264,23 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *
{
zval ztmp;
int ret = SUCCESS;
- if (Z_TYPE_P(newval) != IS_INT) {
+ if (Z_TYPE_P(newval) != IS_LONG) {
ZVAL_COPY(&ztmp, newval);
- convert_to_int(&ztmp);
+ convert_to_long(&ztmp);
newval = &ztmp;
}
- switch(Z_IVAL_P(newval)) {
+ switch(Z_LVAL_P(newval)) {
case NETSNMP_OID_OUTPUT_SUFFIX:
case NETSNMP_OID_OUTPUT_MODULE:
case NETSNMP_OID_OUTPUT_FULL:
case NETSNMP_OID_OUTPUT_NUMERIC:
case NETSNMP_OID_OUTPUT_UCD:
case NETSNMP_OID_OUTPUT_NONE:
- snmp_object->oid_output_format = Z_IVAL_P(newval);
+ snmp_object->oid_output_format = Z_LVAL_P(newval);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%pd'", Z_IVAL_P(newval));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%pd'", Z_LVAL_P(newval));
ret = FAILURE;
break;
}
@@ -2297,13 +2297,13 @@ static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval
{
zval ztmp;
int ret = SUCCESS;
- if (Z_TYPE_P(newval) != IS_INT) {
+ if (Z_TYPE_P(newval) != IS_LONG) {
ZVAL_COPY(&ztmp, newval);
- convert_to_int(&ztmp);
+ convert_to_long(&ztmp);
newval = &ztmp;
}
- snmp_object->exceptions_enabled = Z_IVAL_P(newval);
+ snmp_object->exceptions_enabled = Z_LVAL_P(newval);
if (newval == &ztmp) {
zval_ptr_dtor(newval);
@@ -2391,43 +2391,43 @@ PHP_MINIT_FUNCTION(snmp)
zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1);
PHP_SNMP_ADD_PROPERTIES(&php_snmp_properties, php_snmp_property_entries);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_SNMP_CLASS_CONST_INT("VERSION_1", SNMP_VERSION_1);
- REGISTER_SNMP_CLASS_CONST_INT("VERSION_2c", SNMP_VERSION_2c);
- REGISTER_SNMP_CLASS_CONST_INT("VERSION_2C", SNMP_VERSION_2c);
- REGISTER_SNMP_CLASS_CONST_INT("VERSION_3", SNMP_VERSION_3);
-
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ANY", PHP_SNMP_ERRNO_ANY);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR);
- REGISTER_SNMP_CLASS_CONST_INT("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_SNMP_CLASS_CONST_LONG("VERSION_1", SNMP_VERSION_1);
+ REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2c", SNMP_VERSION_2c);
+ REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2C", SNMP_VERSION_2c);
+ REGISTER_SNMP_CLASS_CONST_LONG("VERSION_3", SNMP_VERSION_3);
+
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ANY", PHP_SNMP_ERRNO_ANY);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR);
+ REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES);
/* Register SNMPException class */
INIT_CLASS_ENTRY(cex, "SNMPException", NULL);
diff --git a/ext/snmp/snmp.dsp b/ext/snmp/snmp.dsp
deleted file mode 100644
index 3cc62338bd..0000000000
--- a/ext/snmp/snmp.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="snmp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=snmp - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak" CFG="snmp - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "snmp - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "snmp - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "snmp - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_snmp.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "snmp - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_snmp.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "snmp - Win32 Release_TS"
-# Name "snmp - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\snmp.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_snmp.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 97b619d359..d34587b85e 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -145,7 +145,7 @@ encode defaultEncoding[] = {
{{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null},
{{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{IS_FALSE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
{{IS_TRUE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
@@ -290,7 +290,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) {
if (Z_TYPE_P(data) == IS_OBJECT) {
data = (zval*)Z_OBJ_P(data);
}
- if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data)) != NULL) {
+ if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data)) != NULL) {
xmlAttrPtr attr = node_ptr->properties;
char *id;
smart_str prefix = {0};
@@ -317,7 +317,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) {
} else {
SOAP_GLOBAL(cur_uniq_ref)++;
smart_str_appendl(&prefix, "#ref", 4);
- smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref));
+ smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref));
smart_str_0(&prefix);
id = prefix.s->val;
xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1));
@@ -334,7 +334,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) {
} else {
SOAP_GLOBAL(cur_uniq_ref)++;
smart_str_appendl(&prefix, "#ref", 4);
- smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref));
+ smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref));
smart_str_0(&prefix);
id = prefix.s->val;
set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1);
@@ -344,7 +344,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) {
smart_str_free(&prefix);
return 1;
} else {
- zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data, node);
+ zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data, node);
}
}
return 0;
@@ -355,7 +355,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC)
zval *data_ptr;
if (SOAP_GLOBAL(ref_map)) {
- if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (php_uint_t)node)) != NULL) {
+ if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (zend_ulong)node)) != NULL) {
if (!Z_REFCOUNTED_P(data) ||
!Z_REFCOUNTED_P(data_ptr) ||
Z_COUNTED_P(data) != Z_COUNTED_P(data_ptr)) {
@@ -371,7 +371,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC)
static void soap_add_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC)
{
if (SOAP_GLOBAL(ref_map)) {
- zend_hash_index_update(SOAP_GLOBAL(ref_map), (php_uint_t)node, data);
+ zend_hash_index_update(SOAP_GLOBAL(ref_map), (zend_ulong)node, data);
}
}
@@ -397,23 +397,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype));
} else {
zns = NULL;
- enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype));
+ enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRLEN_P(zstype));
}
if (enc == NULL && SOAP_GLOBAL(typemap)) {
smart_str nscat = {0};
if (zns != NULL) {
- smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRSIZE_P(zns));
+ smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRLEN_P(zns));
smart_str_appendc(&nscat, ':');
}
- smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype));
+ smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRLEN_P(zstype));
smart_str_0(&nscat);
enc = zend_hash_find_ptr(SOAP_GLOBAL(typemap), nscat.s);
smart_str_free(&nscat);
}
}
if (enc == NULL) {
- enc = get_conversion(Z_IVAL_P(ztype));
+ enc = get_conversion(Z_LVAL_P(ztype));
}
if (enc == NULL) {
enc = encode;
@@ -449,7 +449,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) {
if (Z_TYPE_P(tmp) == IS_STRING &&
- ce->name->len == Z_STRSIZE_P(tmp) &&
+ ce->name->len == Z_STRLEN_P(tmp) &&
zend_binary_strncasecmp(ce->name->val, ce->name->len, Z_STRVAL_P(tmp), ce->name->len, ce->name->len) == 0 &&
type_name) {
@@ -600,7 +600,7 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par
soap_error0(E_ERROR, "Encoding: Error calling to_xml callback");
}
if (Z_TYPE(return_value) == IS_STRING) {
- xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRSIZE(return_value));
+ xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRLEN(return_value));
if (doc && doc->children) {
ret = xmlDocCopyNode(doc->children, parent->doc, 1);
}
@@ -789,7 +789,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
return ret;
}
- str = STR_ALLOC(strlen((char*)data->children->content) / 2, 0);
+ str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0);
for (i = j = 0; i < str->len; i++) {
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
@@ -813,7 +813,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML
}
}
str->val[str->len] = '\0';
- ZVAL_STR(ret, str);
+ ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
}
@@ -831,15 +831,15 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
- str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data));
- new_len = Z_STRSIZE_P(data);
+ str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
+ new_len = Z_STRLEN_P(data);
} else {
zval tmp = *data;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
- str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp));
- new_len = Z_STRSIZE(tmp);
+ str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
+ new_len = Z_STRLEN(tmp);
zval_dtor(&tmp);
}
@@ -918,19 +918,19 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
- str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRSIZE_P(data));
+ str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data));
text = xmlNewTextLen(BAD_CAST(str->val), str->len);
xmlAddChild(ret, text);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
zval tmp;
ZVAL_DUP(&tmp, data);
convert_to_string(&tmp);
- str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRSIZE(tmp));
+ str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp));
text = xmlNewTextLen(BAD_CAST(str->val), str->len);
xmlAddChild(ret, text);
- STR_RELEASE(str);
+ zend_string_release(str);
zval_dtor(&tmp);
}
@@ -958,15 +958,15 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo
convert_to_string(&tmp);
data = &tmp;
}
- str = (unsigned char *) safe_emalloc(Z_STRSIZE_P(data) * 2, sizeof(char), 1);
+ str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1);
- for (i = j = 0; i < Z_STRSIZE_P(data); i++) {
+ for (i = j = 0; i < Z_STRLEN_P(data); i++) {
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4];
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15];
}
str[j] = '\0';
- text = xmlNewTextLen(str, Z_STRSIZE_P(data) * 2 * sizeof(char));
+ text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char));
xmlAddChild(ret, text);
efree(str);
if (data == &tmp) {
@@ -986,12 +986,12 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML
if (data && data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- php_int_t lval;
+ zend_long lval;
double dval;
whiteSpace_collapse(data->children->content);
switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) {
- case IS_INT:
+ case IS_LONG:
ZVAL_DOUBLE(ret, lval);
break;
case IS_DOUBLE:
@@ -1024,15 +1024,15 @@ static zval *to_zval_long(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_
if (data && data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
- php_int_t lval;
+ zend_long lval;
double dval;
whiteSpace_collapse(data->children->content);
errno = 0;
switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) {
- case IS_INT:
- ZVAL_INT(ret, lval);
+ case IS_LONG:
+ ZVAL_LONG(ret, lval);
break;
case IS_DOUBLE:
ZVAL_DOUBLE(ret, dval);
@@ -1066,11 +1066,11 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode
zval tmp = *data;
zval_copy_ctor(&tmp);
- if (Z_TYPE(tmp) != IS_INT) {
- convert_to_int(&tmp);
+ if (Z_TYPE(tmp) != IS_LONG) {
+ convert_to_long(&tmp);
}
convert_to_string(&tmp);
- xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp));
+ xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp));
zval_dtor(&tmp);
}
@@ -1201,7 +1201,7 @@ static zval* get_zval_property(zval* object, char* name, zval *rv TSRMLS_DC)
/* Hack for bug #32455 */
zend_property_info *property_info;
- property_info = zend_get_property_info(Z_OBJCE_P(object), &member, 1 TSRMLS_CC);
+ property_info = zend_get_property_info(Z_OBJCE_P(object), Z_STR(member), 1 TSRMLS_CC);
EG(scope) = old_scope;
if (property_info && zend_hash_exists(Z_OBJPROP_P(object), property_info->name)) {
zval_ptr_dtor(&member);
@@ -1717,7 +1717,6 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
}
case XSD_CONTENT_ANY: {
zval *data;
- xmlNodePtr property;
encodePtr enc;
zval rv;
@@ -1731,10 +1730,10 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
zval *val;
ZEND_HASH_FOREACH_VAL(ht, val) {
- property = master_to_xml(enc, val, style, node TSRMLS_CC);
+ master_to_xml(enc, val, style, node TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
} else {
- property = master_to_xml(enc, data, style, node TSRMLS_CC);
+ master_to_xml(enc, data, style, node TSRMLS_CC);
}
return 1;
} else if (model->min_occurs == 0) {
@@ -1985,7 +1984,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
if (Z_TYPE_P(data) == IS_OBJECT) {
const char *class_name;
- zend_unmangle_property_name(str_key->val, str_key->len, &class_name, &prop_name);
+ zend_unmangle_property_name(str_key, &class_name, &prop_name);
} else {
prop_name = str_key->val;
}
@@ -2347,10 +2346,10 @@ iterator_done:
}
}
- smart_str_append_int(&array_size, dims[0]);
+ smart_str_append_long(&array_size, dims[0]);
for (i=1; i<dimension; i++) {
smart_str_appendc(&array_size, ',');
- smart_str_append_int(&array_size, dims[i]);
+ smart_str_append_long(&array_size, dims[i]);
}
efree(value);
@@ -2375,15 +2374,15 @@ iterator_done:
dims = get_position_12(dimension, ext->val);
if (dims[0] == 0) {dims[0] = i;}
- smart_str_append_int(&array_size, dims[0]);
+ smart_str_append_long(&array_size, dims[0]);
for (i=1; i<dimension; i++) {
smart_str_appendc(&array_size, ',');
- smart_str_append_int(&array_size, dims[i]);
+ smart_str_append_long(&array_size, dims[i]);
}
} else {
dims = emalloc(sizeof(int));
*dims = 0;
- smart_str_append_int(&array_size, i);
+ smart_str_append_long(&array_size, i);
}
} else if (sdl_type &&
sdl_type->attributes &&
@@ -2395,10 +2394,10 @@ iterator_done:
dims = get_position_12(dimension, ext->val);
if (dims[0] == 0) {dims[0] = i;}
- smart_str_append_int(&array_size, dims[0]);
+ smart_str_append_long(&array_size, dims[0]);
for (i=1; i<dimension; i++) {
smart_str_appendc(&array_size, ',');
- smart_str_append_int(&array_size, dims[i]);
+ smart_str_append_long(&array_size, dims[i]);
}
if (sdl_type && sdl_type->elements &&
@@ -2422,14 +2421,14 @@ iterator_done:
enc = elementType->encode;
get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type);
- smart_str_append_int(&array_size, i);
+ smart_str_append_long(&array_size, i);
dims = safe_emalloc(sizeof(int), dimension, 0);
dims[0] = i;
} else {
enc = get_array_type(xmlParam, data, &array_type TSRMLS_CC);
- smart_str_append_int(&array_size, i);
+ smart_str_append_long(&array_size, i);
dims = safe_emalloc(sizeof(int), dimension, 0);
dims[0] = i;
}
@@ -2442,7 +2441,7 @@ iterator_done:
smart_str_appendl(&array_type,"xsd:ur-type",sizeof("xsd:ur-type")-1);
}
smart_str_appendc(&array_type, '[');
- smart_str_append(&array_type, &array_size);
+ smart_str_append_smart_str(&array_type, &array_size);
smart_str_appendc(&array_type, ']');
smart_str_0(&array_type);
set_ns_prop(xmlParam, SOAP_1_1_ENC_NAMESPACE, "arrayType", array_type.s->val);
@@ -2485,14 +2484,12 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS
int* dims = NULL;
int* pos = NULL;
xmlAttrPtr attr;
- sdlPtr sdl;
sdlAttributePtr arrayType;
sdlExtraAttributePtr ext;
sdlTypePtr elementType;
ZVAL_NULL(ret);
FIND_XML_NULL(data, ret);
- sdl = SOAP_GLOBAL(sdl);
if (data &&
(attr = get_attribute(data->properties,"arrayType")) &&
@@ -2689,7 +2686,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP
{
zval *temp_data;
zend_string *key_val;
- php_uint_t int_val;
+ zend_ulong int_val;
xmlNodePtr xmlParam;
xmlNodePtr xparam, item;
xmlNodePtr key;
@@ -2712,7 +2709,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP
xmlNodeSetContent(key, BAD_CAST(key_val->val));
} else {
smart_str tmp = {0};
- smart_str_append_int(&tmp, int_val);
+ smart_str_append_long(&tmp, int_val);
smart_str_0(&tmp);
if (style == SOAP_ENCODED) {
@@ -2765,8 +2762,8 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_D
if (Z_TYPE(key) == IS_STRING) {
zend_symtable_update(Z_ARRVAL_P(ret), Z_STR(key), &value);
- } else if (Z_TYPE(key) == IS_INT) {
- zend_hash_index_update(Z_ARRVAL_P(ret), Z_IVAL(key), &value);
+ } else if (Z_TYPE(key) == IS_LONG) {
+ zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL(key), &value);
} else {
soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys");
}
@@ -2863,7 +2860,7 @@ static zval *guess_zval_convert(zval *ret, encodeTypePtr type, xmlNodePtr data T
xmlNsPtr nsptr;
object_init_ex(&soapvar, soap_var_class_entry);
- add_property_int(&soapvar, "enc_type", enc->details.type);
+ add_property_long(&soapvar, "enc_type", enc->details.type);
Z_DELREF_P(ret);
add_property_zval(&soapvar, "enc_value", ret);
parse_namespace(type_name, &cptype, &ns);
@@ -2896,12 +2893,12 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
xmlAddChild(parent, xmlParam);
FIND_ZVAL_NULL(data, xmlParam, style);
- if (Z_TYPE_P(data) == IS_INT) {
- timestamp = Z_IVAL_P(data);
+ if (Z_TYPE_P(data) == IS_LONG) {
+ timestamp = Z_LVAL_P(data);
ta = php_localtime_r(&timestamp, &tmbuf);
/*ta = php_gmtime_r(&timestamp, &tmbuf);*/
if (!ta) {
- soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_IVAL_P(data));
+ soap_error1(E_ERROR, "Encoding: Invalid timestamp %pd", Z_LVAL_P(data));
}
buf = (char *) emalloc(buf_len);
@@ -2935,7 +2932,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
xmlNodeSetContent(xmlParam, BAD_CAST(buf));
efree(buf);
} else if (Z_TYPE_P(data) == IS_STRING) {
- xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data));
+ xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data));
}
if (style == SOAP_ENCODED) {
@@ -3043,7 +3040,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
convert_to_string(&tmp);
data = &tmp;
}
- str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data));
+ str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
whiteSpace_collapse(BAD_CAST(str));
start = str;
while (start != NULL && *start != '\0') {
@@ -3144,13 +3141,13 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP
return ret;
}
if (Z_TYPE_P(data) == IS_STRING) {
- ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data));
+ ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data));
} else {
zval tmp = *data;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
- ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp));
+ ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp));
zval_dtor(&tmp);
}
@@ -3251,20 +3248,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo
if (type) {
if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
if (type->restrictions->enumeration) {
- if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRSIZE_P(data)+1)) {
+ if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data));
}
}
if (type->restrictions->minLength &&
- Z_STRSIZE_P(data) < type->restrictions->minLength->value) {
+ Z_STRLEN_P(data) < type->restrictions->minLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'");
}
if (type->restrictions->maxLength &&
- Z_STRSIZE_P(data) > type->restrictions->maxLength->value) {
+ Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'");
}
if (type->restrictions->length &&
- Z_STRSIZE_P(data) != type->restrictions->length->value) {
+ Z_STRLEN_P(data) != type->restrictions->length->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'");
}
}
@@ -3426,7 +3423,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns)
while (1) {
smart_str_appendl(&prefix, "ns", 2);
- smart_str_append_int(&prefix, num);
+ smart_str_append_long(&prefix, num);
smart_str_0(&prefix);
if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.s->val)) == NULL) {
break;
@@ -3498,7 +3495,7 @@ encodePtr get_conversion(int encode)
static int is_map(zval *array)
{
- php_uint_t index;
+ zend_ulong index;
zend_string *key;
int i = 0;
@@ -3536,7 +3533,7 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS
if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) {
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
}
- cur_type = Z_IVAL_P(ztype);
+ cur_type = Z_LVAL_P(ztype);
if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) {
cur_stype = Z_STRVAL_P(ztype);
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
index adcccd3612..4424116524 100644
--- a/ext/soap/php_encoding.h
+++ b/ext/soap/php_encoding.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 0935ce36ad..a1cee555a8 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,7 +26,7 @@
static char *get_http_header_value(char *headers, char *type);
static int get_http_body(php_stream *socketd, int close, char *headers, char **response, int *out_size TSRMLS_DC);
-static int get_http_headers(php_stream *socketd,char **response, int *out_size TSRMLS_DC);
+static zend_string *get_http_headers(php_stream *socketd TSRMLS_DC);
#define smart_str_append_const(str, const) \
smart_str_appendl(str,const,sizeof(const)-1)
@@ -40,17 +40,17 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
zend_string *buf;
smart_str auth = {0};
- smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login));
+ smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) {
- smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password));
+ smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
smart_str_append_const(soap_headers, "Proxy-Authorization: Basic ");
smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
smart_str_append_const(soap_headers, "\r\n");
- STR_RELEASE(buf);
+ zend_string_release(buf);
smart_str_free(&auth);
return 1;
}
@@ -67,17 +67,17 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
zend_string* buf;
smart_str auth = {0};
- smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login));
+ smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) {
- smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password));
+ smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
smart_str_append_const(soap_headers, "Authorization: Basic ");
smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
smart_str_append_const(soap_headers, "\r\n");
- STR_RELEASE(buf);
+ zend_string_release(buf);
smart_str_free(&auth);
return 1;
}
@@ -95,7 +95,7 @@ void http_context_headers(php_stream_context* context,
if (context &&
(tmp = php_stream_context_get_option(context, "http", "header")) != NULL &&
- Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp)) {
+ Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) {
char *s = Z_STRVAL_P(tmp);
char *p;
int name_len;
@@ -161,7 +161,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
char *host;
char *name;
char *protocol;
- php_int_t namelen;
+ zend_long namelen;
int port;
int old_error_reporting;
struct timeval tv;
@@ -170,17 +170,17 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
Z_TYPE_P(proxy_host) == IS_STRING &&
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
- Z_TYPE_P(proxy_port) == IS_INT) {
+ Z_TYPE_P(proxy_port) == IS_LONG) {
host = Z_STRVAL_P(proxy_host);
- port = Z_IVAL_P(proxy_port);
+ port = Z_LVAL_P(proxy_port);
*use_proxy = 1;
} else {
host = phpurl->host;
port = phpurl->port;
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) > 0) {
- tv.tv_sec = Z_IVAL_P(tmp);
+ Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) {
+ tv.tv_sec = Z_LVAL_P(tmp);
tv.tv_usec = 0;
timeout = &tv;
}
@@ -191,9 +191,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
/* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */
if (use_ssl && !*use_proxy) {
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
+ Z_TYPE_P(tmp) == IS_LONG) {
/* uses constants declared in soap.c to determine ssl uri protocol */
- switch (Z_IVAL_P(tmp)) {
+ switch (Z_LVAL_P(tmp)) {
case SOAP_SSL_METHOD_TLS:
protocol = "tls";
break;
@@ -236,8 +236,6 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
/* SSL & proxy */
if (stream && *use_proxy && use_ssl) {
smart_str soap_headers = {0};
- char *http_headers;
- int http_header_size;
smart_str_append_const(&soap_headers, "CONNECT ");
smart_str_appends(&soap_headers, phpurl->host);
@@ -260,13 +258,13 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
smart_str_free(&soap_headers);
if (stream) {
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC) || http_headers == NULL) {
+ zend_string *http_headers = get_http_headers(stream TSRMLS_CC);
+ if (http_headers) {
+ zend_string_free(http_headers);
+ } else {
php_stream_close(stream);
stream = NULL;
}
- if (http_headers) {
- efree(http_headers);
- }
}
/* enable SSL transport layer */
if (stream) {
@@ -274,8 +272,8 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
proper encrypyion method based on constants defined in soap.c */
int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- switch (Z_IVAL_P(tmp)) {
+ Z_TYPE_P(tmp) == IS_LONG) {
+ switch (Z_LVAL_P(tmp)) {
case SOAP_SSL_METHOD_TLS:
crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
break;
@@ -341,13 +339,14 @@ int make_http_soap_request(zval *this_ptr,
zval *trace, *tmp;
int use_proxy = 0;
int use_ssl;
- char *http_headers, *http_body, *content_type, *http_version, *cookie_itt;
- int http_header_size, http_body_size, http_close;
+ char *http_body, *content_type, *http_version, *cookie_itt;
+ int http_body_size, http_close;
+ zend_string *http_headers;
char *connection;
int http_1_1;
int http_status;
int content_type_xml = 0;
- php_int_t redirect_max = 20;
+ zend_long redirect_max = 20;
char *content_encoding;
char *http_msg = NULL;
zend_bool old_allow_url_fopen;
@@ -363,13 +362,13 @@ int make_http_soap_request(zval *this_ptr,
request = buf;
request_size = buf_size;
/* Compress request */
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) {
- int level = Z_IVAL_P(tmp) & 0x0f;
- int kind = Z_IVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE;
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
+ int level = Z_LVAL_P(tmp) & 0x0f;
+ int kind = Z_LVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE;
if (level > 9) {level = 9;}
- if ((Z_IVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
+ if ((Z_LVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n");
}
if (level > 0) {
@@ -379,7 +378,7 @@ int make_http_soap_request(zval *this_ptr,
int n;
ZVAL_STRINGL(&params[0], buf, buf_size);
- ZVAL_INT(&params[1], level);
+ ZVAL_LONG(&params[1], level);
if (kind == SOAP_COMPRESSION_DEFLATE) {
n = 2;
ZVAL_STRING(&func, "gzcompress");
@@ -388,7 +387,7 @@ int make_http_soap_request(zval *this_ptr,
n = 3;
ZVAL_STRING(&func, "gzencode");
smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n");
- ZVAL_INT(&params[2], 0x1f);
+ ZVAL_LONG(&params[2], 0x1f);
}
if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS &&
Z_TYPE(retval) == IS_STRING) {
@@ -396,7 +395,7 @@ int make_http_soap_request(zval *this_ptr,
zval_ptr_dtor(&func);
// TODO: free retval ???
request = Z_STRVAL(retval);
- request_size = Z_STRSIZE(retval);
+ request_size = Z_STRLEN(retval);
} else {
zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&func);
@@ -409,8 +408,8 @@ int make_http_soap_request(zval *this_ptr,
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1)) != NULL) {
php_stream_from_zval_no_verify(stream,tmp);
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) {
- use_proxy = Z_IVAL_P(tmp);
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
+ use_proxy = Z_LVAL_P(tmp);
}
} else {
stream = NULL;
@@ -427,9 +426,9 @@ int make_http_soap_request(zval *this_ptr,
if (context &&
(tmp = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) {
- if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), &redirect_max, NULL, 1)) {
- if (Z_TYPE_P(tmp) == IS_INT)
- redirect_max = Z_IVAL_P(tmp);
+ if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &redirect_max, NULL, 1)) {
+ if (Z_TYPE_P(tmp) == IS_LONG)
+ redirect_max = Z_LVAL_P(tmp);
}
}
@@ -504,7 +503,7 @@ try_again:
if (stream) {
php_stream_auto_cleanup(stream);
add_property_resource(this_ptr, "httpsocket", stream->res);
- add_property_int(this_ptr, "_use_proxy", use_proxy);
+ add_property_long(this_ptr, "_use_proxy", use_proxy);
} else {
php_url_free(phpurl);
if (request != buf) {efree(request);}
@@ -566,7 +565,7 @@ try_again:
}
if (!http_1_1 ||
((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL &&
- Z_IVAL_P(tmp) == 0)) {
+ Z_LVAL_P(tmp) == 0)) {
smart_str_append_const(&soap_headers, "\r\n"
"Connection: close\r\n");
} else {
@@ -575,17 +574,17 @@ try_again:
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- if (Z_STRSIZE_P(tmp) > 0) {
+ if (Z_STRLEN_P(tmp) > 0) {
smart_str_append_const(&soap_headers, "User-Agent: ");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
smart_str_append_const(&soap_headers, "\r\n");
}
} else if (context &&
(tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- if (Z_STRSIZE_P(tmp) > 0) {
+ if (Z_STRLEN_P(tmp) > 0) {
smart_str_append_const(&soap_headers, "User-Agent: ");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
smart_str_append_const(&soap_headers, "\r\n");
}
} else if (FG(user_agent)) {
@@ -596,7 +595,7 @@ try_again:
smart_str_append_const(&soap_headers, "User-Agent: PHP-SOAP/"PHP_VERSION"\r\n");
}
- smart_str_append(&soap_headers, &soap_headers_z);
+ smart_str_append_smart_str(&soap_headers, &soap_headers_z);
if (soap_version == SOAP_1_2) {
smart_str_append_const(&soap_headers,"Content-Type: application/soap+xml; charset=utf-8");
@@ -615,7 +614,7 @@ try_again:
}
}
smart_str_append_const(&soap_headers,"Content-Length: ");
- smart_str_append_int(&soap_headers, request_size);
+ smart_str_append_long(&soap_headers, request_size);
smart_str_append_const(&soap_headers, "\r\n");
/* HTTP Authentication */
@@ -631,44 +630,44 @@ try_again:
unsigned char hash[16];
PHP_MD5Init(&md5ctx);
- snprintf(cnonce, sizeof(cnonce), "%ld", php_rand(TSRMLS_C));
+ snprintf(cnonce, sizeof(cnonce), ZEND_LONG_FMT, php_rand(TSRMLS_C));
PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, strlen(cnonce));
PHP_MD5Final(hash, &md5ctx);
make_digest(cnonce, hash);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- Z_IVAL_P(tmp)++;
- snprintf(nc, sizeof(nc), "%08ld", Z_IVAL_P(tmp));
+ Z_TYPE_P(tmp) == IS_LONG) {
+ Z_LVAL_P(tmp)++;
+ snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp));
} else {
- add_assoc_int(digest, "nc", 1);
+ add_assoc_long(digest, "nc", 1);
strcpy(nc, "00000001");
}
PHP_MD5Init(&md5ctx);
- PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRSIZE_P(login));
+ PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRLEN_P(login));
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
- PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRSIZE_P(password));
+ PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password));
}
PHP_MD5Final(hash, &md5ctx);
make_digest(HA1, hash);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING &&
- Z_STRSIZE_P(tmp) == sizeof("md5-sess")-1 &&
+ Z_STRLEN_P(tmp) == sizeof("md5-sess")-1 &&
stricmp(Z_STRVAL_P(tmp), "md5-sess") == 0) {
PHP_MD5Init(&md5ctx);
PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32);
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8);
@@ -692,7 +691,7 @@ try_again:
/*
if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING &&
- Z_STRSIZE_PP(tmp) == sizeof("auth-int")-1 &&
+ Z_STRLEN_PP(tmp) == sizeof("auth-int")-1 &&
stricmp(Z_STRVAL_PP(tmp), "auth-int") == 0) {
PHP_MD5Update(&md5ctx, ":", 1);
PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN);
@@ -706,7 +705,7 @@ try_again:
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL &&
@@ -724,16 +723,16 @@ try_again:
make_digest(response, hash);
smart_str_append_const(&soap_headers, "Authorization: Digest username=\"");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRSIZE_P(login));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login));
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
smart_str_append_const(&soap_headers, "\", realm=\"");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
smart_str_append_const(&soap_headers, "\", nonce=\"");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
smart_str_append_const(&soap_headers, "\", uri=\"");
if (phpurl->path) {
@@ -763,12 +762,12 @@ try_again:
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
smart_str_append_const(&soap_headers, "\", opaque=\"");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
smart_str_append_const(&soap_headers, "\", algorithm=\"");
- smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
smart_str_append_const(&soap_headers, "\"\r\n");
}
@@ -776,18 +775,18 @@ try_again:
zend_string *buf;
smart_str auth = {0};
- smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login));
+ smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
- smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password));
+ smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
smart_str_append_const(&soap_headers, "Authorization: Basic ");
smart_str_appendl(&soap_headers, (char*)buf->val, buf->len);
smart_str_append_const(&soap_headers, "\r\n");
- STR_RELEASE(buf);
+ zend_string_release(buf);
smart_str_free(&auth);
}
}
@@ -819,13 +818,13 @@ try_again:
Z_TYPE_P(value) == IS_STRING) {
zval *tmp;
if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL ||
- strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRSIZE_P(tmp)) == 0) &&
+ strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) &&
((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL ||
in_domain(phpurl->host,Z_STRVAL_P(tmp))) &&
(use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) {
smart_str_appendl(&soap_headers, key->val, key->len);
smart_str_appendc(&soap_headers, '=');
- smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRSIZE_P(value));
+ smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRLEN_P(value));
smart_str_appendc(&soap_headers, ';');
}
}
@@ -841,7 +840,7 @@ try_again:
smart_str_append_const(&soap_headers, "\r\n");
smart_str_0(&soap_headers);
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_IVAL_P(trace) > 0) {
+ Z_LVAL_P(trace) > 0) {
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len);
}
smart_str_appendl(&soap_headers, request, request_size);
@@ -874,8 +873,8 @@ try_again:
}
do {
- if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
- if (http_headers) {efree(http_headers);}
+ http_headers = get_http_headers(stream TSRMLS_CC);
+ if (!http_headers) {
if (request != buf) {efree(request);}
php_stream_close(stream);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
@@ -886,14 +885,14 @@ try_again:
}
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_IVAL_P(trace) > 0) {
- add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size);
+ Z_LVAL_P(trace) > 0) {
+ add_property_str(this_ptr, "__last_response_headers", zend_string_copy(http_headers));
}
/* Check to see what HTTP status was sent */
http_1_1 = 0;
http_status = 0;
- http_version = get_http_header_value(http_headers,"HTTP/");
+ http_version = get_http_header_value(http_headers->val, "HTTP/");
if (http_version) {
char *tmp;
@@ -918,7 +917,7 @@ try_again:
/* Try and get headers again */
if (http_status == 100) {
- efree(http_headers);
+ zend_string_release(http_headers);
}
}
} while (http_status == 100);
@@ -929,9 +928,9 @@ try_again:
we shouldn't be changing urls so path dont
matter too much
*/
- cookie_itt = strstr(http_headers,"Set-Cookie: ");
+ cookie_itt = strstr(http_headers->val, "Set-Cookie: ");
while (cookie_itt) {
- char *end_pos, *cookie;
+ char *cookie;
char *eqpos, *sempos;
zval *cookies;
@@ -941,7 +940,6 @@ try_again:
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
}
- end_pos = strstr(cookie_itt,"\r\n");
cookie = get_http_header_value(cookie_itt,"Set-Cookie: ");
eqpos = strstr(cookie, "=");
@@ -1007,7 +1005,7 @@ try_again:
if (http_1_1) {
http_close = FALSE;
if (use_proxy && !use_ssl) {
- connection = get_http_header_value(http_headers,"Proxy-Connection: ");
+ connection = get_http_header_value(http_headers->val, "Proxy-Connection: ");
if (connection) {
if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
http_close = TRUE;
@@ -1016,7 +1014,7 @@ try_again:
}
}
if (http_close == FALSE) {
- connection = get_http_header_value(http_headers,"Connection: ");
+ connection = get_http_header_value(http_headers->val, "Connection: ");
if (connection) {
if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
http_close = TRUE;
@@ -1027,7 +1025,7 @@ try_again:
} else {
http_close = TRUE;
if (use_proxy && !use_ssl) {
- connection = get_http_header_value(http_headers,"Proxy-Connection: ");
+ connection = get_http_header_value(http_headers->val, "Proxy-Connection: ");
if (connection) {
if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
http_close = FALSE;
@@ -1036,7 +1034,7 @@ try_again:
}
}
if (http_close == TRUE) {
- connection = get_http_header_value(http_headers,"Connection: ");
+ connection = get_http_header_value(http_headers->val, "Connection: ");
if (connection) {
if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
http_close = FALSE;
@@ -1046,10 +1044,10 @@ try_again:
}
}
- if (!get_http_body(stream, http_close, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
+ if (!get_http_body(stream, http_close, http_headers->val, &http_body, &http_body_size TSRMLS_CC)) {
if (request != buf) {efree(request);}
php_stream_close(stream);
- efree(http_headers);
+ zend_string_release(http_headers);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL TSRMLS_CC);
@@ -1073,11 +1071,11 @@ try_again:
if (http_status >= 300 && http_status < 400) {
char *loc;
- if ((loc = get_http_header_value(http_headers,"Location: ")) != NULL) {
+ if ((loc = get_http_header_value(http_headers->val, "Location: ")) != NULL) {
php_url *new_url = php_url_parse(loc);
if (new_url != NULL) {
- efree(http_headers);
+ zend_string_release(http_headers);
efree(http_body);
efree(loc);
if (new_url->scheme == NULL && new_url->path != NULL) {
@@ -1119,7 +1117,7 @@ try_again:
} else if (http_status == 401) {
/* Digest authentication */
zval *digest, *login, *password;
- char *auth = get_http_header_value(http_headers, "WWW-Authenticate: ");
+ char *auth = get_http_header_value(http_headers->val, "WWW-Authenticate: ");
if (auth &&
strstr(auth, "Digest") == auth &&
@@ -1185,7 +1183,7 @@ try_again:
phpurl = new_url;
efree(auth);
- efree(http_headers);
+ zend_string_release(http_headers);
efree(http_body);
goto try_again;
@@ -1196,7 +1194,7 @@ try_again:
smart_str_free(&soap_headers_z);
/* Check and see if the server even sent a xml document */
- content_type = get_http_header_value(http_headers,"Content-Type: ");
+ content_type = get_http_header_value(http_headers->val, "Content-Type: ");
if (content_type) {
char *pos = NULL;
int cmplen;
@@ -1216,7 +1214,7 @@ try_again:
ZVAL_STRINGL(err, http_body, http_body_size, 1);
add_soap_fault(this_ptr, "HTTP", "Didn't receive an xml document", NULL, err TSRMLS_CC);
efree(content_type);
- efree(http_headers);
+ zend_string_release(http_headers);
efree(http_body);
return FALSE;
}
@@ -1226,7 +1224,7 @@ try_again:
}
/* Decompress response */
- content_encoding = get_http_header_value(http_headers,"Content-Encoding: ");
+ content_encoding = get_http_header_value(http_headers->val, "Content-Encoding: ");
if (content_encoding) {
zval func;
zval retval;
@@ -1243,7 +1241,7 @@ try_again:
ZVAL_STRINGL(&params[0], http_body, http_body_size);
} else {
efree(content_encoding);
- efree(http_headers);
+ zend_string_release(http_headers);
efree(http_body);
if (http_msg) {
efree(http_msg);
@@ -1261,7 +1259,7 @@ try_again:
zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&func);
efree(content_encoding);
- efree(http_headers);
+ zend_string_release(http_headers);
efree(http_body);
add_soap_fault(this_ptr, "HTTP", "Can't uncompress compressed response", NULL, NULL TSRMLS_CC);
if (http_msg) {
@@ -1278,14 +1276,14 @@ try_again:
efree(http_body);
}
- efree(http_headers);
+ zend_string_release(http_headers);
if (http_status >= 400) {
int error = 0;
- if (Z_STRSIZE_P(return_value) == 0) {
+ if (Z_STRLEN_P(return_value) == 0) {
error = 1;
- } else if (Z_STRSIZE_P(return_value) > 0) {
+ } else if (Z_STRLEN_P(return_value) > 0) {
if (!content_type_xml) {
char *s = Z_STRVAL_P(return_value);
@@ -1486,31 +1484,25 @@ static int get_http_body(php_stream *stream, int close, char *headers, char **r
return TRUE;
}
-static int get_http_headers(php_stream *stream, char **response, int *out_size TSRMLS_DC)
+static zend_string *get_http_headers(php_stream *stream TSRMLS_DC)
{
- int done = FALSE;
smart_str tmp_response = {0};
char headerbuf[8192];
- while (!done) {
- if (!php_stream_gets(stream, headerbuf, sizeof(headerbuf))) {
- break;
- }
-
+ while (php_stream_gets(stream, headerbuf, sizeof(headerbuf))) {
if ((headerbuf[0] == '\r' && headerbuf[1] == '\n') ||
(headerbuf[0] == '\n')) {
/* empty line marks end of headers */
- done = TRUE;
- break;
+ smart_str_0(&tmp_response);
+ return tmp_response.s;
}
/* add header to collection */
smart_str_appends(&tmp_response, headerbuf);
}
- smart_str_0(&tmp_response);
- (*response) = tmp_response.s->val;
- (*out_size) = tmp_response.s->len;
- return done;
+
+ smart_str_free(&tmp_response);
+ return NULL;
}
/*
* Local variables:
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
index 3fcc053741..b752641b1b 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 348fbc007d..52fa71d4e0 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -236,10 +236,10 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
}
add_soap_fault(this_ptr, faultcode, faultstring ? faultstring->val : NULL, faultactor ? faultactor->val : NULL, &details TSRMLS_CC);
if (faultstring) {
- STR_RELEASE(faultstring);
+ zend_string_release(faultstring);
}
if (faultactor) {
- STR_RELEASE(faultactor);
+ zend_string_release(faultactor);
}
if (Z_REFCOUNTED(details)) {
Z_DELREF(details);
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index dacf5055a2..632470f255 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 9145390ca3..b5aa5f21c2 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -460,7 +460,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
smart_str anonymous = {0};
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
- smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
newType->name = estrndup(anonymous.s->val, anonymous.s->len);
@@ -558,7 +558,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
smart_str anonymous = {0};
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
- smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
newType->name = estrndup(anonymous.s->val, anonymous.s->len);
@@ -1931,7 +1931,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
smart_str anonymous = {0};
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
- smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len);
@@ -2169,7 +2169,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
zend_hash_move_forward(tmp->attributes);
} else {
- php_uint_t index;
+ zend_ulong index;
schema_attributegroup_fixup(ctx, tmp_attr, ht);
zend_hash_get_current_key(tmp->attributes, NULL, &index, 0);
@@ -2268,7 +2268,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
}
if (type->attributes) {
zend_string *str_key;
- php_uint_t index;
+ zend_ulong index;
ZEND_HASH_FOREACH_KEY_PTR(type->attributes, index, str_key, attr) {
if (str_key) {
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
index d68db88edc..55595f2ad8 100644
--- a/ext/soap/php_schema.h
+++ b/ext/soap/php_schema.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 6daa8dbafe..798c06fdd2 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -292,9 +292,9 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
zval new_header;
rest += 2;
- ZVAL_STR(&new_header, STR_ALLOC(Z_STRSIZE_P(header) - (rest - s), 0));
+ ZVAL_NEW_STR(&new_header, zend_string_alloc(Z_STRLEN_P(header) - (rest - s), 0));
memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header));
- memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRSIZE_P(header) - (rest - Z_STRVAL_P(header)) + 1);
+ memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1);
ZVAL_COPY(&ctx->old_header, header);
php_stream_context_set_option(ctx->context, "http", "header", &new_header);
zval_dtor(&new_header);
@@ -975,7 +975,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
input = get_node_ex(portTypeOperation->children, "input", WSDL_NAMESPACE);
if (input != NULL) {
- xmlAttrPtr message, name;
+ xmlAttrPtr message;
message = get_attribute(input->properties, "message");
if (message == NULL) {
@@ -983,8 +983,8 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
}
function->requestParameters = wsdl_message(&ctx, message->children->content);
- name = get_attribute(input->properties, "name");
/* FIXME
+ xmlAttrPtr name = get_attribute(input->properties, "name");
if (name != NULL) {
function->requestName = estrdup(name->children->content);
} else {
@@ -1004,7 +1004,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
output = get_node_ex(portTypeOperation->children, "output", WSDL_NAMESPACE);
if (output != NULL) {
- xmlAttrPtr message, name;
+ xmlAttrPtr message;
message = get_attribute(output->properties, "message");
if (message == NULL) {
@@ -1012,8 +1012,8 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
}
function->responseParameters = wsdl_message(&ctx, message->children->content);
- name = get_attribute(output->properties, "name");
/* FIXME
+ xmlAttrPtr name = get_attribute(output->properties, "name");
if (name != NULL) {
function->responseName = estrdup(name->children->content);
} else if (input == NULL) {
@@ -1805,7 +1805,7 @@ static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, sm
if (enc) {
zval *encoder_num;
if ((encoder_num = zend_hash_str_find(tmp_encoders, (char*)&enc, sizeof(enc))) != 0) {
- WSDL_CACHE_PUT_INT(Z_IVAL_P(encoder_num), out);
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(encoder_num), out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
@@ -1818,7 +1818,7 @@ static void sdl_serialize_type_ref(sdlTypePtr type, HashTable *tmp_types, smart_
if (type) {
zval *type_num;
if ((type_num = zend_hash_str_find(tmp_types, (char*)&type, sizeof(type))) != NULL) {
- WSDL_CACHE_PUT_INT(Z_IVAL_P(type_num), out);
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(type_num), out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
@@ -1974,7 +1974,7 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab
ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) {
sdl_serialize_key(key, out);
sdl_serialize_type(tmp, tmp_encoders, tmp_types, out);
- ZVAL_INT(&zv, i);
+ ZVAL_LONG(&zv, i);
zend_hash_str_add(tmp_elements, (char*)&tmp, sizeof(tmp), &zv);
i--;
} ZEND_HASH_FOREACH_END();
@@ -2140,7 +2140,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
zval zv;
ZEND_HASH_FOREACH_PTR(sdl->groups, tmp) {
- ZVAL_INT(&zv, type_num);
+ ZVAL_LONG(&zv, type_num);
zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
} ZEND_HASH_FOREACH_END();
@@ -2157,7 +2157,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
zval zv;
ZEND_HASH_FOREACH_PTR(sdl->types, tmp) {
- ZVAL_INT(&zv, type_num);
+ ZVAL_LONG(&zv, type_num);
zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
} ZEND_HASH_FOREACH_END();
@@ -2174,7 +2174,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
zval zv;
ZEND_HASH_FOREACH_PTR(sdl->elements, tmp) {
- ZVAL_INT(&zv, type_num);
+ ZVAL_LONG(&zv, type_num);
zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
} ZEND_HASH_FOREACH_END();
@@ -2191,7 +2191,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
zval zv;
ZEND_HASH_FOREACH_PTR(sdl->encoders, tmp) {
- ZVAL_INT(&zv, encoder_num);
+ ZVAL_LONG(&zv, encoder_num);
zend_hash_str_add(&tmp_encoders, (char*)&tmp, sizeof(tmp), &zv);
++encoder_num;
} ZEND_HASH_FOREACH_END();
@@ -2200,7 +2200,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
while (enc->details.type != END_KNOWN_TYPES) {
zval zv;
- ZVAL_INT(&zv, encoder_num);
+ ZVAL_LONG(&zv, encoder_num);
zend_hash_str_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), &zv);
enc++;
++encoder_num;
@@ -2272,7 +2272,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
WSDL_CACHE_PUT_1(0,out);
}
- ZVAL_INT(&zv, binding_num);
+ ZVAL_LONG(&zv, binding_num);
zend_hash_str_add(&tmp_bindings, (char*)&tmp, sizeof(tmp), &zv);
binding_num++;
} ZEND_HASH_FOREACH_END();
@@ -2296,8 +2296,8 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
if (tmp->binding) {
binding_num = zend_hash_str_find(&tmp_bindings,(char*)&tmp->binding, sizeof(tmp->binding));
if (binding_num) {
- WSDL_CACHE_PUT_INT(Z_IVAL_P(binding_num), out);
- if (Z_IVAL_P(binding_num) >= 0) {
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(binding_num), out);
+ if (Z_LVAL_P(binding_num) >= 0) {
if (tmp->binding->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) {
sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)tmp->bindingAttributes;
WSDL_CACHE_PUT_1(binding->style, out);
@@ -2338,7 +2338,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
WSDL_CACHE_PUT_INT(0, out);
}
- ZVAL_INT(&zv, function_num);
+ ZVAL_LONG(&zv, function_num);
zend_hash_str_add(&tmp_functions, (char*)&tmp, sizeof(tmp), &zv);
function_num++;
} ZEND_HASH_FOREACH_END();
@@ -2358,7 +2358,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->requests, key, tmp) {
function_num = zend_hash_str_find(&tmp_functions, (char*)&tmp, sizeof(tmp));
- WSDL_CACHE_PUT_INT(Z_IVAL_P(function_num), out);
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(function_num), out);
sdl_serialize_key(key, out);
} ZEND_HASH_FOREACH_END();
}
@@ -3151,7 +3151,7 @@ static void delete_psdl(zval *zv)
free(Z_PTR_P(zv));
}
-sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC)
+sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC)
{
char fn[MAXPATHLEN];
sdlPtr sdl = NULL;
@@ -3230,7 +3230,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp) > 0) {
+ Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) {
smart_str_appends(&headers, "User-Agent: ");
smart_str_appends(&headers, Z_STRVAL_P(tmp));
smart_str_appends(&headers, "\r\n");
@@ -3239,7 +3239,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC)
if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
Z_TYPE_P(proxy_host) == IS_STRING &&
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
- Z_TYPE_P(proxy_port) == IS_INT) {
+ Z_TYPE_P(proxy_port) == IS_LONG) {
zval str_port, str_proxy;
smart_str proxy = {0};
ZVAL_DUP(&str_port, proxy_port);
@@ -3250,8 +3250,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC)
smart_str_appends(&proxy,Z_STRVAL(str_port));
smart_str_0(&proxy);
zval_dtor(&str_port);
- ZVAL_STR(&str_proxy, STR_COPY(proxy.s));
- smart_str_free(&proxy);
+ ZVAL_NEW_STR(&str_proxy, proxy.s);
if (!context) {
context = php_stream_context_alloc(TSRMLS_C);
@@ -3289,9 +3288,8 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC)
}
smart_str_0(&headers);
- ZVAL_STR(&str_headers, STR_COPY(headers.s));
+ ZVAL_NEW_STR(&str_headers, headers.s);
php_stream_context_set_option(context, "http", "header", &str_headers);
- smart_str_free(&headers);
zval_ptr_dtor(&str_headers);
}
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index 56877b5b85..cf6e26b179 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -254,7 +254,7 @@ struct _sdlAttribute {
};
-sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC);
+sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC);
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const xmlChar *type);
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
diff --git a/ext/soap/php_soap.dsp b/ext/soap/php_soap.dsp
deleted file mode 100644
index 4157c63320..0000000000
--- a/ext/soap/php_soap.dsp
+++ /dev/null
@@ -1,156 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php_soap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php_soap - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php_soap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php_soap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php_soap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTSWS" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=0 /D "COMPILE_DL_SOAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php_soap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Debug_TS/" /Fp"Debug_TS/soap.pch" /YX /Fo"Debug_TS/" /Fd"Debug_TS/" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "php_soap - Win32 Release_TS"
-# Name "php_soap - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_encoding.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_packet_soap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\soap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_encoding.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_http.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_packet_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_schema.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xml.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index d311214a20..6d36792981 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
#include "ext/session/php_session.h"
#endif
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_ini.h"
#include "SAPI.h"
#include <libxml/parser.h>
@@ -171,8 +171,8 @@ ZEND_BEGIN_MODULE_GLOBALS(soap)
char cache_mode;
char cache_enabled;
char* cache_dir;
- php_int_t cache_ttl;
- php_int_t cache_limit;
+ zend_long cache_ttl;
+ zend_long cache_limit;
HashTable *mem_cache;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index f7c8fd51e5..5ad5548c40 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
index 1eddcf9503..42d9dc9c6b 100644
--- a/ext/soap/php_xml.h
+++ b/ext/soap/php_xml.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 5af02c3ad4..2b37622a7a 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -78,7 +78,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
int _old_soap_version = SOAP_GLOBAL(soap_version);\
SOAP_GLOBAL(use_soap_error_handler) = 1;\
SOAP_GLOBAL(error_code) = "Server";\
- Z_OBJ(SOAP_GLOBAL(error_object)) = Z_OBJ(EG(This));
+ Z_OBJ(SOAP_GLOBAL(error_object)) = Z_OBJ(EX(This));
#define SOAP_SERVER_END_CODE() \
SOAP_GLOBAL(use_soap_error_handler) = _old_handler;\
@@ -93,11 +93,11 @@ static void soap_error_handler(int error_num, const char *error_filename, const
int _old_soap_version = SOAP_GLOBAL(soap_version);\
zend_bool _old_in_compilation = CG(in_compilation); \
zend_execute_data *_old_current_execute_data = EG(current_execute_data); \
- zval *_old_stack_top = EG(argument_stack)->top; \
+ zval *_old_stack_top = EG(vm_stack_top); \
int _bailout = 0;\
SOAP_GLOBAL(use_soap_error_handler) = 1;\
SOAP_GLOBAL(error_code) = "Client";\
- Z_OBJ(SOAP_GLOBAL(error_object)) = Z_OBJ(EG(This));\
+ Z_OBJ(SOAP_GLOBAL(error_object)) = Z_OBJ(EX(This));\
zend_try {
#define SOAP_CLIENT_END_CODE() \
@@ -105,18 +105,19 @@ static void soap_error_handler(int error_num, const char *error_filename, const
CG(in_compilation) = _old_in_compilation; \
EG(current_execute_data) = _old_current_execute_data; \
if (EG(exception) == NULL || \
- !instanceof_function(zend_get_class_entry(EG(exception) TSRMLS_CC), soap_fault_class_entry TSRMLS_CC)) {\
+ !instanceof_function(EG(exception)->ce, soap_fault_class_entry TSRMLS_CC)) {\
_bailout = 1;\
}\
- if (_old_stack_top != EG(argument_stack)->top) { \
- while (EG(argument_stack)->prev != NULL && \
- ((char*)_old_stack_top < (char*)EG(argument_stack) || \
- (char*) _old_stack_top > (char*)EG(argument_stack)->end)) { \
- zend_vm_stack tmp = EG(argument_stack)->prev; \
- efree(EG(argument_stack)); \
- EG(argument_stack) = tmp; \
+ if (_old_stack_top != EG(vm_stack_top)) { \
+ while (EG(vm_stack)->prev != NULL && \
+ ((char*)_old_stack_top < (char*)EG(vm_stack) || \
+ (char*) _old_stack_top > (char*)EG(vm_stack)->end)) { \
+ zend_vm_stack tmp = EG(vm_stack)->prev; \
+ efree(EG(vm_stack)); \
+ EG(vm_stack) = tmp; \
+ EG(vm_stack_end) = tmp->end; \
} \
- EG(argument_stack)->top = _old_stack_top; \
+ EG(vm_stack)->top = _old_stack_top; \
} \
} zend_end_try();\
SOAP_GLOBAL(use_soap_error_handler) = _old_handler;\
@@ -479,7 +480,7 @@ ZEND_INI_MH(OnUpdateCacheMode)
p = (char*) (base+(size_t) mh_arg1);
- *p = (char)atoi(new_value);
+ *p = (char)atoi(new_value->val);
return SUCCESS;
}
@@ -490,19 +491,19 @@ static PHP_INI_MH(OnUpdateCacheDir)
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value, '\0', new_value_length) != NULL) {
+ if (memchr(new_value->val, '\0', new_value->len) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value, ';'))) {
+ if ((p = strchr(new_value->val, ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value;
+ p = new_value->val;
}
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
@@ -510,7 +511,7 @@ static PHP_INI_MH(OnUpdateCacheDir)
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
@@ -687,103 +688,103 @@ PHP_MINIT_FUNCTION(soap)
le_service = zend_register_list_destructors_ex(delete_service_res, NULL, "SOAP service", module_number);
le_typemap = zend_register_list_destructors_ex(delete_hashtable_res, NULL, "SOAP table", module_number);
- REGISTER_INT_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT);
/* New SOAP SSL Method Constants */
- REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT);
old_error_handler = zend_error_cb;
zend_error_cb = soap_error_handler;
@@ -807,7 +808,7 @@ PHP_METHOD(SoapParam, SoapParam)
{
zval *data;
char *name;
- int name_length;
+ size_t name_length;
zval *this_ptr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE) {
@@ -831,7 +832,7 @@ PHP_METHOD(SoapHeader, SoapHeader)
{
zval *data = NULL, *actor = NULL;
char *name, *ns;
- int name_len, ns_len;
+ size_t name_len, ns_len;
zend_bool must_understand = 0;
zval *this_ptr;
@@ -855,13 +856,13 @@ PHP_METHOD(SoapHeader, SoapHeader)
}
add_property_bool(this_ptr, "mustUnderstand", must_understand);
if (actor == NULL) {
- } else if (Z_TYPE_P(actor) == IS_INT &&
- (Z_IVAL_P(actor) == SOAP_ACTOR_NEXT ||
- Z_IVAL_P(actor) == SOAP_ACTOR_NONE ||
- Z_IVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) {
- add_property_int(this_ptr, "actor", Z_IVAL_P(actor));
- } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRSIZE_P(actor) > 0) {
- add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRSIZE_P(actor));
+ } else if (Z_TYPE_P(actor) == IS_LONG &&
+ (Z_LVAL_P(actor) == SOAP_ACTOR_NEXT ||
+ Z_LVAL_P(actor) == SOAP_ACTOR_NONE ||
+ Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) {
+ add_property_long(this_ptr, "actor", Z_LVAL_P(actor));
+ } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) {
+ add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor");
}
@@ -872,7 +873,7 @@ PHP_METHOD(SoapHeader, SoapHeader)
PHP_METHOD(SoapFault, SoapFault)
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
- int fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
+ size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
zval *code = NULL, *details = NULL, *headerfault = NULL, *this_ptr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|s!z!s!z",
@@ -886,7 +887,7 @@ PHP_METHOD(SoapFault, SoapFault)
if (Z_TYPE_P(code) == IS_NULL) {
} else if (Z_TYPE_P(code) == IS_STRING) {
fault_code = Z_STRVAL_P(code);
- fault_code_len = Z_STRSIZE_P(code);
+ fault_code_len = Z_STRLEN_P(code);
} else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) {
zval *t_ns, *t_code;
@@ -897,7 +898,7 @@ PHP_METHOD(SoapFault, SoapFault)
if (Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) {
fault_code_ns = Z_STRVAL_P(t_ns);
fault_code = Z_STRVAL_P(t_code);
- fault_code_len = Z_STRSIZE_P(t_code);
+ fault_code_len = Z_STRLEN_P(t_code);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code");
return;
@@ -946,7 +947,7 @@ PHP_METHOD(SoapFault, __toString)
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
ZVAL_STRINGL(&fci.function_name, "gettraceasstring", sizeof("gettraceasstring")-1);
fci.symbol_table = NULL;
- fci.object = Z_OBJ(EG(This));
+ fci.object = Z_OBJ(EX(This));
fci.retval = &trace;
fci.param_count = 0;
fci.params = NULL;
@@ -956,9 +957,9 @@ PHP_METHOD(SoapFault, __toString)
zval_ptr_dtor(&fci.function_name);
- str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s",
- Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_IVAL_P(line),
- Z_STRSIZE(trace) ? Z_STRVAL(trace) : "#0 {main}\n");
+ str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%pd\nStack trace:\n%s",
+ Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line),
+ Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n");
zval_ptr_dtor(&trace);
@@ -972,7 +973,7 @@ PHP_METHOD(SoapVar, SoapVar)
{
zval *data, *type, *this_ptr;
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
- int stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
+ size_t stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
return;
@@ -980,10 +981,10 @@ PHP_METHOD(SoapVar, SoapVar)
this_ptr = getThis();
if (Z_TYPE_P(type) == IS_NULL) {
- add_property_int(this_ptr, "enc_type", UNKNOWN_TYPE);
+ add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE);
} else {
- if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_IVAL_P(type))) {
- add_property_int(this_ptr, "enc_type", Z_IVAL_P(type));
+ if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
+ add_property_long(this_ptr, "enc_type", Z_LVAL_P(type));
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type ID");
return;
@@ -1121,7 +1122,7 @@ PHP_METHOD(SoapServer, SoapServer)
zval *wsdl = NULL, *options = NULL;
zend_resource *res;
int version = SOAP_1_1;
- php_int_t cache_wsdl;
+ zend_long cache_wsdl;
HashTable *typemap_ht = NULL;
SOAP_SERVER_BEGIN_CODE();
@@ -1145,9 +1146,9 @@ PHP_METHOD(SoapServer, SoapServer)
zval *tmp;
if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) {
- if (Z_TYPE_P(tmp) == IS_INT &&
- (Z_IVAL_P(tmp) == SOAP_1_1 || Z_IVAL_P(tmp) == SOAP_1_2)) {
- version = Z_IVAL_P(tmp);
+ if (Z_TYPE_P(tmp) == IS_LONG &&
+ (Z_LVAL_P(tmp) == SOAP_1_1 || Z_LVAL_P(tmp) == SOAP_1_2)) {
+ version = Z_LVAL_P(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'soap_version' option must be SOAP_1_1 or SOAP_1_2");
}
@@ -1155,14 +1156,14 @@ PHP_METHOD(SoapServer, SoapServer)
if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
} else if (Z_TYPE_P(wsdl) == IS_NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
}
if ((tmp = zend_hash_str_find(ht, "actor", sizeof("actor")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL &&
@@ -1190,13 +1191,13 @@ PHP_METHOD(SoapServer, SoapServer)
}
if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- service->features = Z_IVAL_P(tmp);
+ Z_TYPE_P(tmp) == IS_LONG) {
+ service->features = Z_LVAL_P(tmp);
}
if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- cache_wsdl = Z_IVAL_P(tmp);
+ Z_TYPE_P(tmp) == IS_LONG) {
+ cache_wsdl = Z_LVAL_P(tmp);
}
if ((tmp = zend_hash_str_find(ht, "send_errors", sizeof("send_errors")-1)) != NULL) {
@@ -1204,8 +1205,8 @@ PHP_METHOD(SoapServer, SoapServer)
service->send_errors = 0;
} else if (Z_TYPE_P(tmp) == IS_TRUE) {
service->send_errors = 1;
- } else if (Z_TYPE_P(tmp) == IS_INT) {
- service->send_errors = Z_IVAL_P(tmp);
+ } else if (Z_TYPE_P(tmp) == IS_LONG) {
+ service->send_errors = Z_LVAL_P(tmp);
}
}
@@ -1248,13 +1249,13 @@ PHP_METHOD(SoapServer, SoapServer)
PHP_METHOD(SoapServer, setPersistence)
{
soapServicePtr service;
- php_int_t value;
+ zend_long value;
SOAP_SERVER_BEGIN_CODE();
FETCH_THIS_SERVICE(service);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) != FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE) {
if (service->type == SOAP_CLASS) {
if (value == SOAP_PERSISTENCE_SESSION ||
value == SOAP_PERSISTENCE_REQUEST) {
@@ -1367,7 +1368,7 @@ PHP_METHOD(SoapServer, getFunctions)
zval *name;
ZEND_HASH_FOREACH_VAL(service->soap_functions.ft, name) {
- add_next_index_str(return_value, STR_COPY(Z_STR_P(name)));
+ add_next_index_str(return_value, zend_string_copy(Z_STR_P(name)));
} ZEND_HASH_FOREACH_END();
}
if (ft != NULL) {
@@ -1375,7 +1376,7 @@ PHP_METHOD(SoapServer, getFunctions)
ZEND_HASH_FOREACH_PTR(ft, f) {
if ((service->type != SOAP_OBJECT && service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) {
- add_next_index_str(return_value, STR_COPY(f->common.function_name));
+ add_next_index_str(return_value, zend_string_copy(f->common.function_name));
}
} ZEND_HASH_FOREACH_END();
}
@@ -1421,26 +1422,26 @@ PHP_METHOD(SoapServer, addFunction)
return;
}
- key = STR_ALLOC(Z_STRSIZE_P(tmp_function), 0);
- zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRSIZE_P(tmp_function));
+ key = zend_string_alloc(Z_STRLEN_P(tmp_function), 0);
+ zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function));
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function));
return;
}
- ZVAL_STR(&function_copy, STR_COPY(f->common.function_name));
+ ZVAL_STR_COPY(&function_copy, f->common.function_name);
zend_hash_update(service->soap_functions.ft, key, &function_copy);
- STR_RELEASE(key);
+ zend_string_release(key);
} ZEND_HASH_FOREACH_END();
}
} else if (Z_TYPE_P(function_name) == IS_STRING) {
zend_string *key;
zend_function *f;
- key = STR_ALLOC(Z_STRSIZE_P(function_name), 0);
- zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name));
+ key = zend_string_alloc(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name));
@@ -1452,11 +1453,11 @@ PHP_METHOD(SoapServer, addFunction)
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
}
- ZVAL_STR(&function_copy, STR_COPY(f->common.function_name));
+ ZVAL_STR_COPY(&function_copy, f->common.function_name);
zend_hash_update(service->soap_functions.ft, key, &function_copy);
- STR_RELEASE(key);
- } else if (Z_TYPE_P(function_name) == IS_INT) {
- if (Z_IVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {
+ zend_string_release(key);
+ } else if (Z_TYPE_P(function_name) == IS_LONG) {
+ if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {
if (service->soap_functions.ft != NULL) {
zend_hash_destroy(service->soap_functions.ft);
efree(service->soap_functions.ft);
@@ -1490,7 +1491,7 @@ PHP_METHOD(SoapServer, handle)
soapHeader *soap_headers = NULL;
sdlFunctionPtr function;
char *arg = NULL;
- int arg_len = 0;
+ size_t arg_len = 0;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map, *old_typemap;
int old_features;
@@ -1558,7 +1559,7 @@ PHP_METHOD(SoapServer, handle)
if (SG(request_info).request_body && 0 == php_stream_rewind(SG(request_info).request_body)) {
zval *server_vars, *encoding;
php_stream_filter *zf = NULL;
- zend_string *server = STR_INIT("_SERVER", sizeof("_SERVER")-1, 0);
+ zend_string *server = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0);
zend_is_auto_global(server TSRMLS_CC);
if ((server_vars = zend_hash_find(&EG(symbol_table).ht, server)) != NULL &&
@@ -1573,7 +1574,7 @@ PHP_METHOD(SoapServer, handle)
zval filter_params;
array_init_size(&filter_params, 1);
- add_assoc_int_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */
+ add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */
zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC);
zval_dtor(&filter_params);
@@ -1582,16 +1583,16 @@ PHP_METHOD(SoapServer, handle)
php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request");
- STR_RELEASE(server);
+ zend_string_release(server);
return;
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_P(encoding));
- STR_RELEASE(server);
+ zend_string_release(server);
return;
}
}
- STR_RELEASE(server);
+ zend_string_release(server);
doc_request = soap_xmlParseFile("php://input" TSRMLS_CC);
@@ -1713,7 +1714,7 @@ PHP_METHOD(SoapServer, handle)
if (zend_hash_str_exists(&Z_OBJCE(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len)) {
zval c_ret, constructor;
- ZVAL_STR(&constructor, STR_COPY(service->soap_class.ce->name));
+ ZVAL_STR_COPY(&constructor, service->soap_class.ce->name);
if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor");
}
@@ -1786,8 +1787,8 @@ PHP_METHOD(SoapServer, handle)
}
}
#endif
- fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRSIZE(h->function_name));
- if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(h->function_name)), Z_STRSIZE(h->function_name)) ||
+ fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
+ if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name)) ||
((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) {
@@ -1839,8 +1840,8 @@ PHP_METHOD(SoapServer, handle)
}
}
- fn_name = estrndup(Z_STRVAL(function_name),Z_STRSIZE(function_name));
- if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(function_name)), Z_STRSIZE(function_name)) ||
+ fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
+ if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name)) ||
((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) {
@@ -1897,9 +1898,9 @@ PHP_METHOD(SoapServer, handle)
if (function && function->responseName) {
response_name = estrdup(function->responseName);
} else {
- response_name = emalloc(Z_STRSIZE(function_name) + sizeof("Response"));
- memcpy(response_name,Z_STRVAL(function_name),Z_STRSIZE(function_name));
- memcpy(response_name+Z_STRSIZE(function_name),"Response",sizeof("Response"));
+ response_name = emalloc(Z_STRLEN(function_name) + sizeof("Response"));
+ memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name));
+ memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response"));
}
doc_return = serialize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC);
efree(response_name);
@@ -1947,7 +1948,7 @@ PHP_METHOD(SoapServer, handle)
xmlFreeDoc(doc_return);
- if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
+ if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
} else {
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
@@ -2007,7 +2008,7 @@ fail:
PHP_METHOD(SoapServer, fault)
{
char *code, *string, *actor=NULL, *name=NULL;
- int code_len, string_len, actor_len = 0, name_len = 0;
+ size_t code_len, string_len, actor_len = 0, name_len = 0;
zval* details = NULL;
soapServicePtr service;
xmlCharEncodingHandlerPtr old_encoding;
@@ -2079,7 +2080,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
xmlDocDumpMemory(doc_return, &buf, &size);
- server = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0);
+ server = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(server TSRMLS_CC);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF &&
(agent_name = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) != NULL &&
@@ -2088,7 +2089,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
use_http_error_status = 0;
}
}
- STR_RELEASE(server);
+ zend_string_release(server);
/*
Want to return HTTP 500 but apache wants to over write
our fault code with their own handling... Figure this out later
@@ -2096,7 +2097,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
if (use_http_error_status) {
sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
}
- if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
+ if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
} else {
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
@@ -2265,7 +2266,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
}
/* Get output buffer and send as fault detials */
- if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_IVAL(outbuflen) != 0) {
+ if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) {
php_output_get_contents(&outbuf TSRMLS_CC);
}
php_output_discard(TSRMLS_C);
@@ -2330,7 +2331,7 @@ PHP_METHOD(SoapClient, SoapClient)
zval *wsdl, *options = NULL;
int soap_version = SOAP_1_1;
php_stream_context *context = NULL;
- php_int_t cache_wsdl;
+ zend_long cache_wsdl;
sdlPtr sdl = NULL;
HashTable *typemap_ht = NULL;
zval *this_ptr = getThis();
@@ -2355,21 +2356,21 @@ PHP_METHOD(SoapClient, SoapClient)
/* Fetching non-WSDL mode options */
if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "uri", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "uri", zend_string_copy(Z_STR_P(tmp)));
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
}
if ((tmp = zend_hash_str_find(ht, "style", sizeof("style")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT &&
- (Z_IVAL_P(tmp) == SOAP_RPC || Z_IVAL_P(tmp) == SOAP_DOCUMENT)) {
- add_property_int(this_ptr, "style", Z_IVAL_P(tmp));
+ Z_TYPE_P(tmp) == IS_LONG &&
+ (Z_LVAL_P(tmp) == SOAP_RPC || Z_LVAL_P(tmp) == SOAP_DOCUMENT)) {
+ add_property_long(this_ptr, "style", Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "use", sizeof("use")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT &&
- (Z_IVAL_P(tmp) == SOAP_LITERAL || Z_IVAL_P(tmp) == SOAP_ENCODED)) {
- add_property_int(this_ptr, "use", Z_IVAL_P(tmp));
+ Z_TYPE_P(tmp) == IS_LONG &&
+ (Z_LVAL_P(tmp) == SOAP_LITERAL || Z_LVAL_P(tmp) == SOAP_ENCODED)) {
+ add_property_long(this_ptr, "use", Z_LVAL_P(tmp));
}
}
@@ -2381,46 +2382,46 @@ PHP_METHOD(SoapClient, SoapClient)
if ((tmp = zend_hash_str_find(ht, "location", sizeof("location")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "location", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "location", zend_string_copy(Z_STR_P(tmp)));
} else if (Z_TYPE_P(wsdl) == IS_NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is required in nonWSDL mode");
}
if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) {
- if (Z_TYPE_P(tmp) == IS_INT ||
- (Z_IVAL_P(tmp) == SOAP_1_1 && Z_IVAL_P(tmp) == SOAP_1_2)) {
- soap_version = Z_IVAL_P(tmp);
+ if (Z_TYPE_P(tmp) == IS_LONG ||
+ (Z_LVAL_P(tmp) == SOAP_1_1 && Z_LVAL_P(tmp) == SOAP_1_2)) {
+ soap_version = Z_LVAL_P(tmp);
}
}
if ((tmp = zend_hash_str_find(ht, "login", sizeof("login")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_login", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_login", zend_string_copy(Z_STR_P(tmp)));
if ((tmp = zend_hash_str_find(ht, "password", sizeof("password")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_password", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_password", zend_string_copy(Z_STR_P(tmp)));
}
if ((tmp = zend_hash_str_find(ht, "authentication", sizeof("authentication")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT &&
- Z_IVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) {
+ Z_TYPE_P(tmp) == IS_LONG &&
+ Z_LVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) {
add_property_null(this_ptr, "_digest");
}
}
if ((tmp = zend_hash_str_find(ht, "proxy_host", sizeof("proxy_host")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_proxy_host", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_proxy_host", zend_string_copy(Z_STR_P(tmp)));
if ((tmp = zend_hash_str_find(ht, "proxy_port", sizeof("proxy_port")-1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- ZVAL_INT(&tmp2, zval_get_int(tmp));
+ if (Z_TYPE_P(tmp) != IS_LONG) {
+ ZVAL_LONG(&tmp2, zval_get_long(tmp));
tmp = &tmp2;
}
- add_property_int(this_ptr, "_proxy_port", Z_IVAL_P(tmp));
+ add_property_long(this_ptr, "_proxy_port", Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "proxy_login", sizeof("proxy_login")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_proxy_login", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_proxy_login", zend_string_copy(Z_STR_P(tmp)));
if ((tmp = zend_hash_str_find(ht, "proxy_password", sizeof("proxy_password")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_proxy_password", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_proxy_password", zend_string_copy(Z_STR_P(tmp)));
}
}
}
@@ -2437,24 +2438,24 @@ PHP_METHOD(SoapClient, SoapClient)
}
if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_TRUE ||
- (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 1))) {
- add_property_int(this_ptr, "trace", 1);
+ (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) {
+ add_property_long(this_ptr, "trace", 1);
}
if ((tmp = zend_hash_str_find(ht, "exceptions", sizeof("exceptions")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_FALSE ||
- (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) {
+ (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) {
add_property_bool(this_ptr, "_exceptions", 0);
}
if ((tmp = zend_hash_str_find(ht, "compression", sizeof("compression")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT &&
+ Z_TYPE_P(tmp) == IS_LONG &&
zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1) &&
zend_hash_str_exists(EG(function_table), "gzdeflate", sizeof("gzdeflate")-1) &&
zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1) &&
zend_hash_str_exists(EG(function_table), "gzcompress", sizeof("gzcompress")-1) &&
zend_hash_str_exists(EG(function_table), "gzencode", sizeof("gzencode")-1)) {
- add_property_int(this_ptr, "compression", Z_IVAL_P(tmp));
+ add_property_long(this_ptr, "compression", Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
@@ -2465,7 +2466,7 @@ PHP_METHOD(SoapClient, SoapClient)
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_P(tmp));
} else {
xmlCharEncCloseFunc(encoding);
- add_property_str(this_ptr, "_encoding", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_encoding", zend_string_copy(Z_STR_P(tmp)));
}
}
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
@@ -2486,17 +2487,17 @@ PHP_METHOD(SoapClient, SoapClient)
}
if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- add_property_int(this_ptr, "_features", Z_IVAL_P(tmp));
+ Z_TYPE_P(tmp) == IS_LONG) {
+ add_property_long(this_ptr, "_features", Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "connection_timeout", sizeof("connection_timeout")-1)) != NULL) {
- if (Z_TYPE_P(tmp) != IS_INT) {
- ZVAL_INT(&tmp2, zval_get_int(tmp));
+ if (Z_TYPE_P(tmp) != IS_LONG) {
+ ZVAL_LONG(&tmp2, zval_get_long(tmp));
tmp = &tmp2;
}
- if (Z_IVAL_P(tmp) > 0) {
- add_property_int(this_ptr, "_connection_timeout", Z_IVAL_P(tmp));
+ if (Z_LVAL_P(tmp) > 0) {
+ add_property_long(this_ptr, "_connection_timeout", Z_LVAL_P(tmp));
}
}
@@ -2505,30 +2506,30 @@ PHP_METHOD(SoapClient, SoapClient)
}
if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- cache_wsdl = Z_IVAL_P(tmp);
+ Z_TYPE_P(tmp) == IS_LONG) {
+ cache_wsdl = Z_LVAL_P(tmp);
}
if ((tmp = zend_hash_str_find(ht, "user_agent", sizeof("user_agent")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- add_property_str(this_ptr, "_user_agent", STR_COPY(Z_STR_P(tmp)));
+ add_property_str(this_ptr, "_user_agent", zend_string_copy(Z_STR_P(tmp)));
}
if ((tmp = zend_hash_str_find(ht, "keep_alive", sizeof("keep_alive")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_FALSE ||
- (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) {
- add_property_int(this_ptr, "_keep_alive", 0);
+ (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) {
+ add_property_long(this_ptr, "_keep_alive", 0);
}
if ((tmp = zend_hash_str_find(ht, "ssl_method", sizeof("ssl_method")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- add_property_int(this_ptr, "_ssl_method", Z_IVAL_P(tmp));
+ Z_TYPE_P(tmp) == IS_LONG) {
+ add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp));
}
} else if (Z_TYPE_P(wsdl) == IS_NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode");
}
- add_property_int(this_ptr, "_soap_version", soap_version);
+ add_property_long(this_ptr, "_soap_version", soap_version);
if (Z_TYPE_P(wsdl) != IS_NULL) {
int old_soap_version;
@@ -2577,7 +2578,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
}
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_IVAL_P(trace) > 0) {
+ Z_LVAL_P(trace) > 0) {
add_property_stringl(this_ptr, "__last_request", buf, buf_size);
}
@@ -2593,8 +2594,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
} else {
ZVAL_STRING(&params[2], action);
}
- ZVAL_INT(&params[3], version);
- ZVAL_INT(&params[4], one_way);
+ ZVAL_LONG(&params[3], version);
+ ZVAL_LONG(&params[4], one_way);
if (call_user_function(NULL, this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) {
add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC);
@@ -2605,8 +2606,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
}
ret = FALSE;
} else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_IVAL_P(trace) > 0) {
- add_property_str(this_ptr, "__last_response", STR_COPY(Z_STR_P(response)));
+ Z_LVAL_P(trace) > 0) {
+ add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response)));
}
zval_ptr_dtor(&func);
zval_ptr_dtor(&params[4]);
@@ -2621,9 +2622,10 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
return ret;
}
-static void do_soap_call(zval* this_ptr,
+static void do_soap_call(zend_execute_data *execute_data,
+ zval* this_ptr,
char* function,
- int function_len,
+ size_t function_len,
int arg_count,
zval* real_args,
zval* return_value,
@@ -2651,12 +2653,12 @@ static void do_soap_call(zval* this_ptr,
SOAP_CLIENT_BEGIN_CODE();
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL
- && Z_IVAL_P(trace) > 0) {
+ && Z_LVAL_P(trace) > 0) {
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1);
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL
- && Z_IVAL_P(tmp) == SOAP_1_2) {
+ && Z_LVAL_P(tmp) == SOAP_1_2) {
soap_version = SOAP_1_2;
} else {
soap_version = SOAP_1_1;
@@ -2699,8 +2701,8 @@ static void do_soap_call(zval* this_ptr,
SOAP_GLOBAL(typemap) = typemap;
old_features = SOAP_GLOBAL(features);
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features")-1)) != NULL &&
- Z_TYPE_P(tmp) == IS_INT) {
- SOAP_GLOBAL(features) = Z_IVAL_P(tmp);
+ Z_TYPE_P(tmp) == IS_LONG) {
+ SOAP_GLOBAL(features) = Z_LVAL_P(tmp);
} else {
SOAP_GLOBAL(features) = 0;
}
@@ -2734,7 +2736,7 @@ static void do_soap_call(zval* this_ptr,
if (ret && Z_TYPE(response) == IS_STRING) {
encode_reset_ns();
- ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers TSRMLS_CC);
+ ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC);
encode_finish();
}
@@ -2779,7 +2781,7 @@ static void do_soap_call(zval* this_ptr,
if (ret && Z_TYPE(response) == IS_STRING) {
encode_reset_ns();
- ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, output_headers TSRMLS_CC);
+ ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC);
encode_finish();
}
@@ -2848,7 +2850,8 @@ static void verify_soap_headers_array(HashTable *ht TSRMLS_DC)
PHP_METHOD(SoapClient, __call)
{
char *function, *location=NULL, *soap_action = NULL, *uri = NULL;
- int function_len, i = 0;
+ size_t function_len;
+ int i = 0;
HashTable* soap_headers = NULL;
zval *options = NULL;
zval *headers = NULL;
@@ -2935,7 +2938,7 @@ PHP_METHOD(SoapClient, __call)
if (output_headers) {
array_init(output_headers);
}
- do_soap_call(this_ptr, function, function_len, arg_count, real_args, return_value, location, soap_action, uri, soap_headers, output_headers TSRMLS_CC);
+ do_soap_call(execute_data, this_ptr, function, function_len, arg_count, real_args, return_value, location, soap_action, uri, soap_headers, output_headers TSRMLS_CC);
if (arg_count > 0) {
efree(real_args);
}
@@ -3015,7 +3018,7 @@ PHP_METHOD(SoapClient, __getLastRequest)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL) {
- RETURN_STR(STR_COPY(Z_STR_P(tmp)));
+ RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
}
@@ -3033,7 +3036,7 @@ PHP_METHOD(SoapClient, __getLastResponse)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL) {
- RETURN_STR(STR_COPY(Z_STR_P(tmp)));
+ RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
}
@@ -3051,7 +3054,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL) {
- RETURN_STR(STR_COPY(Z_STR_P(tmp)));
+ RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
}
@@ -3069,7 +3072,7 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL) {
- RETURN_STR(STR_COPY(Z_STR_P(tmp)));
+ RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
}
@@ -3081,12 +3084,12 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
PHP_METHOD(SoapClient, __doRequest)
{
char *buf, *location, *action;
- int buf_size, location_size, action_size;
- php_int_t version;
- php_int_t one_way = 0;
+ size_t buf_size, location_size, action_size;
+ zend_long version;
+ zend_long one_way = 0;
zval *this_ptr = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|l",
&buf, &buf_size,
&location, &location_size,
&action, &action_size,
@@ -3116,7 +3119,7 @@ PHP_METHOD(SoapClient, __setCookie)
{
char *name;
char *val = NULL;
- int name_len, val_len = 0;
+ size_t name_len, val_len = 0;
zval *cookies;
zval *this_ptr = getThis();
@@ -3214,7 +3217,7 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
PHP_METHOD(SoapClient, __setLocation)
{
char *location = NULL;
- int location_len = 0;
+ size_t location_len = 0;
zval *tmp;
zval *this_ptr = getThis();
@@ -3223,7 +3226,7 @@ PHP_METHOD(SoapClient, __setLocation)
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) {
- RETVAL_STR(STR_COPY(Z_STR_P(tmp)));
+ RETVAL_STR(zend_string_copy(Z_STR_P(tmp)));
} else {
RETVAL_NULL();
}
@@ -3643,7 +3646,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c
smart_str_appends(&key, (char*)hdr_func->ns->href);
smart_str_appendc(&key, ':');
}
- smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRSIZE(h->function_name));
+ smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRLEN(h->function_name));
smart_str_0(&key);
if ((hdr = zend_hash_find_ptr(fnb->input.headers, key.s)) != NULL) {
h->hdr = hdr;
@@ -3711,17 +3714,17 @@ static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version)
} else {
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_P(tmp)));
}
- } else if (Z_TYPE_P(tmp) == IS_INT) {
+ } else if (Z_TYPE_P(tmp) == IS_LONG) {
if (version == SOAP_1_1) {
- if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) {
+ if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) {
xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT));
}
} else {
- if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) {
+ if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) {
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT));
- } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_NONE) {
+ } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_NONE) {
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE));
- } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
+ } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) {
xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER));
}
}
@@ -3801,7 +3804,7 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch
int i = 0;
zend_string *param_name;
//???
- php_uint_t param_index = i;
+ zend_ulong param_index = i;
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(ret), param_index, param_name, data) {
parameter = get_param(function, param_name->val, param_index, TRUE);
@@ -3885,13 +3888,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
smart_str_appendc(&key, ':');
hdr_ns = Z_STRVAL_P(tmp);
}
if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
hdr_name = Z_STRVAL_P(tmp);
}
smart_str_0(&key);
@@ -3978,7 +3981,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
if (version == SOAP_1_1) {
if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) {
xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode"));
- zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC);
+ zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC);
xmlAddChild(param, node);
if (fault_ns) {
xmlNsPtr nsptr = encode_add_ns(node, fault_ns);
@@ -3988,7 +3991,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
} else {
xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len);
}
- STR_RELEASE(str);
+ zend_string_release(str);
}
if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) {
xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), tmp, SOAP_LITERAL, param TSRMLS_CC);
@@ -4002,7 +4005,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
} else {
if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) {
xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL);
- zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC);
+ zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC);
node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL);
if (fault_ns) {
xmlNsPtr nsptr = encode_add_ns(node, fault_ns);
@@ -4012,7 +4015,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
} else {
xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len);
}
- STR_RELEASE(str);
+ zend_string_release(str);
}
if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) {
xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Reason"), NULL);
@@ -4101,13 +4104,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
ht = Z_OBJPROP(h->retval);
if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
smart_str_appendc(&key, ':');
hdr_ns = Z_STRVAL_P(tmp);
}
if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
- smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
hdr_name = Z_STRVAL_P(tmp);
}
smart_str_0(&key);
@@ -4239,7 +4242,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
}
} else {
if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) {
- style = Z_IVAL_P(zstyle);
+ style = Z_LVAL_P(zstyle);
} else {
style = SOAP_RPC;
}
@@ -4261,7 +4264,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
}
if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL &&
- Z_IVAL_P(zuse) == SOAP_LITERAL) {
+ Z_LVAL_P(zuse) == SOAP_LITERAL) {
use = SOAP_LITERAL;
} else {
use = SOAP_ENCODED;
@@ -4330,9 +4333,9 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
smart_str key = {0};
sdlSoapBindingFunctionHeaderPtr hdr;
- smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRSIZE_P(ns));
+ smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRLEN_P(ns));
smart_str_appendc(&key, ':');
- smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRSIZE_P(name));
+ smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRLEN_P(name));
smart_str_0(&key);
if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) {
hdr_use = hdr->use;
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index 7f616232b8..d808271728 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -6,7 +6,7 @@
#endif
#include <Zend/zend_llist.h>
-#include <ext/standard/php_smart_str.h>
+#include <zend_smart_str.h>
#ifndef PHP_WIN32
# include <sys/types.h>
@@ -175,7 +175,7 @@ static void do_from_to_zval_err(struct err_s *err,
err->should_free = 1;
efree(user_msg);
- smart_str_free_ex(&path, 0);
+ smart_str_free(&path);
}
ZEND_ATTRIBUTE_FORMAT(printf, 2 ,3)
static void do_from_zval_err(ser_context *ctx, const char *fmt, ...)
@@ -303,45 +303,45 @@ static void to_zval_read_aggregation(const char *structure,
}
/* CONVERSIONS for integers */
-static php_int_t from_zval_integer_common(const zval *arr_value, ser_context *ctx)
+static zend_long from_zval_integer_common(const zval *arr_value, ser_context *ctx)
{
- php_int_t ret = 0;
+ zend_long ret = 0;
zval lzval;
ZVAL_NULL(&lzval);
- if (Z_TYPE_P(arr_value) != IS_INT) {
- ZVAL_COPY(&lzval, arr_value);
+ if (Z_TYPE_P(arr_value) != IS_LONG) {
+ ZVAL_COPY(&lzval, (zval *)arr_value);
arr_value = &lzval;
}
switch (Z_TYPE_P(arr_value)) {
- case IS_INT:
+ case IS_LONG:
long_case:
- ret = Z_IVAL_P(arr_value);
+ ret = Z_LVAL_P(arr_value);
break;
/* if not long we're operating on lzval */
case IS_DOUBLE:
double_case:
- convert_to_int(&lzval);
+ convert_to_long(&lzval);
goto long_case;
case IS_OBJECT:
case IS_STRING: {
- php_int_t lval;
+ zend_long lval;
double dval;
convert_to_string(&lzval);
- switch (is_numeric_string(Z_STRVAL(lzval), Z_STRSIZE(lzval), &lval, &dval, 0)) {
+ switch (is_numeric_string(Z_STRVAL(lzval), Z_STRLEN(lzval), &lval, &dval, 0)) {
case IS_DOUBLE:
zval_dtor(&lzval);
ZVAL_DOUBLE(&lzval, dval);
goto double_case;
- case IS_INT:
+ case IS_LONG:
zval_dtor(&lzval);
- ZVAL_INT(&lzval, lval);
+ ZVAL_LONG(&lzval, lval);
goto long_case;
}
@@ -363,7 +363,7 @@ double_case:
}
void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
int ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -382,7 +382,7 @@ void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx)
}
static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
uint32_t ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -390,7 +390,7 @@ static void from_zval_write_uint32(const zval *arr_value, char *field, ser_conte
return;
}
- if (sizeof(long) > sizeof(uint32_t) && (lval < 0 || lval > 0xFFFFFFFF)) {
+ if (sizeof(zend_long) > sizeof(uint32_t) && (lval < 0 || lval > 0xFFFFFFFF)) {
do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds "
"for an unsigned 32-bit integer");
return;
@@ -401,7 +401,7 @@ static void from_zval_write_uint32(const zval *arr_value, char *field, ser_conte
}
static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
uint16_t ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -420,7 +420,7 @@ static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_c
}
static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
sa_family_t ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -439,7 +439,7 @@ static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_co
}
static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
pid_t ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -458,7 +458,7 @@ static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_contex
}
static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
uid_t ival;
lval = from_zval_integer_common(arr_value, ctx);
@@ -468,13 +468,13 @@ static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_contex
/* uid_t can be signed or unsigned (generally unsigned) */
if ((uid_t)-1 > (uid_t)0) {
- if (sizeof(long) > sizeof(uid_t) && (lval < 0 || (uid_t)lval != lval)) {
+ if (sizeof(zend_long) > sizeof(uid_t) && (lval < 0 || (uid_t)lval != lval)) {
do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds "
"for a uid_t value");
return;
}
} else {
- if (sizeof(long) > sizeof(uid_t) && (uid_t)lval != lval) {
+ if (sizeof(zend_long) > sizeof(uid_t) && (uid_t)lval != lval) {
do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds "
"for a uid_t value");
return;
@@ -490,49 +490,49 @@ void to_zval_read_int(const char *data, zval *zv, res_context *ctx)
int ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx)
{
unsigned ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx)
{
uint16_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ntohs(ival));
+ ZVAL_LONG(zv, (zend_long)ntohs(ival));
}
static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx)
{
uint32_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx)
{
sa_family_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx)
{
pid_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx)
{
uid_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_INT(zv, (long)ival);
+ ZVAL_LONG(zv, (zend_long)ival);
}
/* CONVERSIONS for sockaddr */
@@ -540,35 +540,29 @@ static void from_zval_write_sin_addr(const zval *zaddr_str, char *inaddr, ser_co
{
int res;
struct sockaddr_in saddr = {0};
- zval lzval;
+ zend_string *addr_str;
TSRMLS_FETCH();
- ZVAL_NULL(&lzval);
- if (Z_TYPE_P(zaddr_str) != IS_STRING) {
- ZVAL_COPY(&lzval, zaddr_str);
- convert_to_string(&lzval);
- zaddr_str = &lzval;
- }
-
- res = php_set_inet_addr(&saddr, Z_STRVAL_P(zaddr_str), ctx->sock TSRMLS_CC);
+ addr_str = zval_get_string((zval *) zaddr_str);
+ res = php_set_inet_addr(&saddr, addr_str->val, ctx->sock TSRMLS_CC);
if (res) {
memcpy(inaddr, &saddr.sin_addr, sizeof saddr.sin_addr);
} else {
/* error already emitted, but let's emit another more relevant */
do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET "
- "address", Z_STRVAL_P(zaddr_str));
+ "address", addr_str->val);
}
- zval_dtor(&lzval);
+ zend_string_release(addr_str);
}
static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx)
{
const struct in_addr *addr = (const struct in_addr *)data;
socklen_t size = INET_ADDRSTRLEN;
- zend_string *str = STR_ALLOC(size - 1, 0);
+ zend_string *str = zend_string_alloc(size - 1, 0);
memset(str->val, '\0', size);
- ZVAL_STR(zv, str);
+ ZVAL_NEW_STR(zv, str);
if (inet_ntop(AF_INET, addr, Z_STRVAL_P(zv), size) == NULL) {
do_to_zval_err(ctx, "could not convert IPv4 address to string "
@@ -576,7 +570,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx)
return;
}
- Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv));
+ Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv));
}
static const field_descriptor descriptors_sockaddr_in[] = {
{"family", sizeof("family"), 0, offsetof(struct sockaddr_in, sin_family), from_zval_write_sa_family, to_zval_read_sa_family},
@@ -597,18 +591,11 @@ static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_co
{
int res;
struct sockaddr_in6 saddr6 = {0};
- zval lzval;
+ zend_string *addr_str;
TSRMLS_FETCH();
- ZVAL_NULL(&lzval);
- if (Z_TYPE_P(zaddr_str) != IS_STRING) {
- ZVAL_COPY(&lzval, zaddr_str);
- convert_to_string(&lzval);
- zaddr_str = &lzval;
- }
-
- res = php_set_inet6_addr(&saddr6,
- Z_STRVAL_P(zaddr_str), ctx->sock TSRMLS_CC);
+ addr_str = zval_get_string((zval *) zaddr_str);
+ res = php_set_inet6_addr(&saddr6, addr_str->val, ctx->sock TSRMLS_CC);
if (res) {
memcpy(addr6, &saddr6.sin6_addr, sizeof saddr6.sin6_addr);
} else {
@@ -617,17 +604,17 @@ static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_co
"address", Z_STRVAL_P(zaddr_str));
}
- zval_dtor(&lzval);
+ zend_string_release(addr_str);
}
static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx)
{
const struct in6_addr *addr = (const struct in6_addr *)data;
socklen_t size = INET6_ADDRSTRLEN;
- zend_string *str = STR_ALLOC(size - 1, 0);
+ zend_string *str = zend_string_alloc(size - 1, 0);
memset(str->val, '\0', size);
- ZVAL_STR(zv, str);
+ ZVAL_NEW_STR(zv, str);
if (inet_ntop(AF_INET6, addr, Z_STRVAL_P(zv), size) == NULL) {
do_to_zval_err(ctx, "could not convert IPv6 address to string "
@@ -635,7 +622,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx)
return;
}
- Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv));
+ Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv));
}
static const field_descriptor descriptors_sockaddr_in6[] = {
{"family", sizeof("family"), 0, offsetof(struct sockaddr_in6, sin6_family), from_zval_write_sa_family, to_zval_read_sa_family},
@@ -656,33 +643,29 @@ static void to_zval_read_sockaddr_in6(const char *data, zval *zv, res_context *c
#endif /* HAVE_IPV6 */
static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_context *ctx)
{
- zval lzval;
+ zend_string *path_str;
struct sockaddr_un *saddr = (struct sockaddr_un*)sockaddr_un_c;
+ TSRMLS_FETCH();
- ZVAL_NULL(&lzval);
- if (Z_TYPE_P(path) != IS_STRING) {
- ZVAL_COPY(&lzval, path);
- convert_to_string(&lzval);
- path = &lzval;
- }
+ path_str = zval_get_string((zval *) path);
/* code in this file relies on the path being nul terminated, even though
* this is not required, at least on linux for abstract paths. It also
* assumes that the path is not empty */
- if (Z_STRSIZE_P(path) == 0) {
+ if (path_str->len == 0) {
do_from_zval_err(ctx, "%s", "the path is cannot be empty");
return;
}
- if (Z_STRSIZE_P(path) >= sizeof(saddr->sun_path)) {
+ if (path_str->len >= sizeof(saddr->sun_path)) {
do_from_zval_err(ctx, "the path is too long, the maximum permitted "
"length is %ld", sizeof(saddr->sun_path) - 1);
return;
}
- memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRSIZE_P(path));
- saddr->sun_path[Z_STRSIZE_P(path)] = '\0';
+ memcpy(&saddr->sun_path, path_str->val, path_str->len);
+ saddr->sun_path[path_str->len] = '\0';
- zval_dtor(&lzval);
+ zend_string_release(path_str);
}
static void to_zval_read_sun_path(const char *data, zval *zv, res_context *ctx) {
struct sockaddr_un *saddr = (struct sockaddr_un*)data;
@@ -985,7 +968,7 @@ static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context
if (CMSG_LEN(entry->size) > cmsg->cmsg_len) {
do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; "
"expected a length of at least %pd, but got %pd",
- (php_int_t)CMSG_LEN(entry->size), (php_int_t)cmsg->cmsg_len);
+ (zend_long)CMSG_LEN(entry->size), (zend_long)cmsg->cmsg_len);
return;
}
@@ -1072,7 +1055,7 @@ static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx
}
static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, ser_context *ctx)
{
- php_int_t lval;
+ zend_long lval;
struct msghdr *msghdr = (struct msghdr *)msghdr_c;
lval = from_zval_integer_common(elem, ctx);
@@ -1082,7 +1065,7 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c,
if (lval < 0 || lval > MAX_USER_BUFF_SIZE) {
do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; "
- "given %pd", (php_int_t)MAX_USER_BUFF_SIZE, lval);
+ "given %pd", (zend_long)MAX_USER_BUFF_SIZE, lval);
return;
}
@@ -1101,7 +1084,7 @@ static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, s
}
convert_to_string_ex(elem);
- len = Z_STRSIZE_P(elem);
+ len = Z_STRLEN_P(elem);
msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx);
msg->msg_iov[i - 1].iov_len = len;
memcpy(msg->msg_iov[i - 1].iov_base, Z_STRVAL_P(elem), len);
@@ -1224,12 +1207,12 @@ static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx)
for (i = 0; bytes_left > 0 && i < (uint)iovlen; i++) {
zval elem;
size_t len = MIN(msghdr->msg_iov[i].iov_len, (size_t)bytes_left);
- zend_string *buf = STR_ALLOC(len, 0);
+ zend_string *buf = zend_string_alloc(len, 0);
memcpy(buf->val, msghdr->msg_iov[i].iov_base, buf->len);
buf->val[buf->len] = '\0';
- ZVAL_STR(&elem, buf);
+ ZVAL_NEW_STR(&elem, buf);
add_next_index_zval(zv, &elem);
bytes_left -= len;
}
@@ -1252,47 +1235,40 @@ void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx)
/* CONVERSIONS for if_index */
static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx)
{
- unsigned ret = 0;
- zval lzval;
+ unsigned ret = 0;
- ZVAL_NULL(&lzval);
-
- if (Z_TYPE_P(zv) == IS_INT) {
- if (Z_IVAL_P(zv) < 0 || Z_IVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */
+ if (Z_TYPE_P(zv) == IS_LONG) {
+ if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */
do_from_zval_err(ctx, "the interface index cannot be negative or "
- "larger than %u; given %ld", UINT_MAX, Z_IVAL_P(zv));
+ "larger than %u; given %pd", UINT_MAX, Z_LVAL_P(zv));
} else {
- ret = (unsigned)Z_IVAL_P(zv);
+ ret = (unsigned)Z_LVAL_P(zv);
}
} else {
- if (Z_TYPE_P(zv) != IS_STRING) {
- ZVAL_COPY_VALUE(&lzval, zv);
- zval_copy_ctor(&lzval);
- convert_to_string(&lzval);
- zv = &lzval;
- }
+ zend_string *str;
+ TSRMLS_FETCH();
+
+ str = zval_get_string((zval *) zv);
#if HAVE_IF_NAMETOINDEX
- ret = if_nametoindex(Z_STRVAL_P(zv));
+ ret = if_nametoindex(str->val);
if (ret == 0) {
- do_from_zval_err(ctx, "no interface with name \"%s\" could be "
- "found", Z_STRVAL_P(zv));
+ do_from_zval_err(ctx, "no interface with name \"%s\" could be found", str->val);
}
#elif defined(SIOCGIFINDEX)
{
struct ifreq ifr;
- if (strlcpy(ifr.ifr_name, Z_STRVAL_P(zv), sizeof(ifr.ifr_name))
+ if (strlcpy(ifr.ifr_name, str->val, sizeof(ifr.ifr_name))
>= sizeof(ifr.ifr_name)) {
- do_from_zval_err(ctx, "the interface name \"%s\" is too large ",
- Z_STRVAL_P(zv));
+ do_from_zval_err(ctx, "the interface name \"%s\" is too large ", str->val);
} else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) {
if (errno == ENODEV) {
do_from_zval_err(ctx, "no interface with name \"%s\" could be "
- "found", Z_STRVAL_P(zv));
+ "found", str->val);
} else {
do_from_zval_err(ctx, "error fetching interface index for "
"interface with name \"%s\" (errno %d)",
- Z_STRVAL_P(zv), errno);
+ str->val, errno);
}
} else {
ret = (unsigned)ifr.ifr_ifindex;
@@ -1303,13 +1279,13 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context
"this platform does not support looking up an interface by "
"name, an integer interface index must be supplied instead");
#endif
+
+ zend_string_release(str);
}
if (!ctx->err.has_error) {
memcpy(uinteger, &ret, sizeof(ret));
}
-
- zval_dtor(&lzval);
}
/* CONVERSIONS for struct in6_pktinfo */
@@ -1431,7 +1407,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx)
if (*cmsg_len < data_offset) {
do_to_zval_err(ctx, "length of cmsg is smaller than its data member "
- "offset (%pd vs %pd)", (php_int_t)*cmsg_len, (php_int_t)data_offset);
+ "offset (%pd vs %pd)", (zend_long)*cmsg_len, (zend_long)data_offset);
return;
}
num_elems = (*cmsg_len - data_offset) / sizeof(int);
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c
index 0fc3dbb2cf..3c076b4e7c 100644
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -89,14 +89,14 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC)
{
int ret;
- if (Z_TYPE_P(val) == IS_INT) {
- if (Z_IVAL_P(val) < 0 || Z_IVAL_P(val) > UINT_MAX) {
+ if (Z_TYPE_P(val) == IS_LONG) {
+ if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"the interface index cannot be negative or larger than %u;"
- " given %ld", UINT_MAX, Z_IVAL_P(val));
+ " given %pd", UINT_MAX, Z_LVAL_P(val));
ret = FAILURE;
} else {
- *out = Z_IVAL_P(val);
+ *out = Z_LVAL_P(val);
ret = SUCCESS;
}
} else {
@@ -288,13 +288,13 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock,
goto ipv4_loop_ttl;
case IP_MULTICAST_TTL:
- convert_to_int_ex(arg4);
- if (Z_IVAL_P(arg4) < 0L || Z_IVAL_P(arg4) > 255L) {
+ convert_to_long_ex(arg4);
+ if (Z_LVAL_P(arg4) < 0L || Z_LVAL_P(arg4) > 255L) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Expected a value between 0 and 255");
return FAILURE;
}
- ipv4_mcast_ttl_lback = (unsigned char) Z_IVAL_P(arg4);
+ ipv4_mcast_ttl_lback = (unsigned char) Z_LVAL_P(arg4);
ipv4_loop_ttl:
opt_ptr = &ipv4_mcast_ttl_lback;
optlen = sizeof(ipv4_mcast_ttl_lback);
@@ -353,13 +353,13 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
ov = (int) Z_TYPE_P(arg4) == IS_TRUE;
goto ipv6_loop_hops;
case IPV6_MULTICAST_HOPS:
- convert_to_int_ex(arg4);
- if (Z_IVAL_P(arg4) < -1L || Z_IVAL_P(arg4) > 255L) {
+ convert_to_long_ex(arg4);
+ if (Z_LVAL_P(arg4) < -1L || Z_LVAL_P(arg4) > 255L) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Expected a value between -1 and 255");
return FAILURE;
}
- ov = (int) Z_IVAL_P(arg4);
+ ov = (int) Z_LVAL_P(arg4);
ipv6_loop_hops:
opt_ptr = &ov;
optlen = sizeof(ov);
diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h
index 29eb54efd8..de76dfcec7 100644
--- a/ext/sockets/multicast.h
+++ b/ext/sockets/multicast.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 86729650e4..b1ee5798c9 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c
index 07740cdfe5..dcaa60ac7a 100644
--- a/ext/sockets/sendrecvmsg.c
+++ b/ext/sockets/sendrecvmsg.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -71,7 +71,7 @@ inline ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags)
#define LONG_CHECK_VALID_INT(l) \
do { \
if ((l) < INT_MIN && (l) > INT_MAX) { \
- php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value %ld does not fit inside " \
+ php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value %pd does not fit inside " \
"the boundaries of a native integer", (l)); \
return; \
} \
@@ -167,7 +167,7 @@ PHP_FUNCTION(socket_sendmsg)
{
zval *zsocket,
*zmsg;
- php_int_t flags = 0;
+ zend_long flags = 0;
php_socket *php_sock;
struct msghdr *msghdr;
zend_llist *allocations;
@@ -175,7 +175,7 @@ PHP_FUNCTION(socket_sendmsg)
ssize_t res;
/* zmsg should be passed by ref */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|i", &zsocket, &zmsg, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|l", &zsocket, &zmsg, &flags) == FAILURE) {
return;
}
@@ -198,7 +198,7 @@ PHP_FUNCTION(socket_sendmsg)
zend_llist_destroy(allocations);
efree(allocations);
- RETURN_INT((long)res);
+ RETURN_LONG((zend_long)res);
} else {
PHP_SOCKET_ERROR(php_sock, "error in sendmsg", errno);
RETURN_FALSE;
@@ -209,7 +209,7 @@ PHP_FUNCTION(socket_recvmsg)
{
zval *zsocket,
*zmsg;
- php_int_t flags = 0;
+ zend_long flags = 0;
php_socket *php_sock;
ssize_t res;
struct msghdr *msghdr;
@@ -217,7 +217,7 @@ PHP_FUNCTION(socket_recvmsg)
struct err_s err = {0};
//ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|l",
&zsocket, &zmsg, &flags) == FAILURE) {
return;
}
@@ -268,17 +268,17 @@ PHP_FUNCTION(socket_recvmsg)
RETURN_FALSE;
}
- RETURN_INT((php_int_t)res);
+ RETURN_LONG((zend_long)res);
}
PHP_FUNCTION(socket_cmsg_space)
{
- php_int_t level,
+ zend_long level,
type,
n = 0;
ancillary_reg_entry *entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|l",
&level, &type, &n) == FAILURE) {
return;
}
@@ -300,15 +300,15 @@ PHP_FUNCTION(socket_cmsg_space)
return;
}
- if (entry->var_el_size > 0 && n > (PHP_INT_MAX - (php_int_t)entry->size -
- (php_int_t)CMSG_SPACE(0) - 15L) / entry->var_el_size) {
+ if (entry->var_el_size > 0 && n > (ZEND_LONG_MAX - (zend_long)entry->size -
+ (zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) {
/* the -15 is to account for any padding CMSG_SPACE may add after the data */
php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value for the "
"third argument (%pd) is too large", n);
return;
}
- RETURN_INT((long)CMSG_SPACE(entry->size + n * entry->var_el_size));
+ RETURN_LONG((zend_long)CMSG_SPACE(entry->size + n * entry->var_el_size));
}
#if HAVE_IPV6
@@ -409,35 +409,35 @@ void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS)
{
/* IPv6 ancillary data */
#if defined(IPV6_RECVPKTINFO) && HAVE_IPV6
- REGISTER_INT_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT);
#endif
#if defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6
- REGISTER_INT_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT);
#endif
/* would require some effort:
- REGISTER_INT_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT);
*/
#if defined(IPV6_RECVTCLASS) && HAVE_IPV6
- REGISTER_INT_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT);
#endif
/*
- REGISTER_INT_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT);
*/
#ifdef SCM_RIGHTS
- REGISTER_INT_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SO_PASSCRED
- REGISTER_INT_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ZTS
diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c
index f563941396..f9de9f1361 100644
--- a/ext/sockets/sockaddr_conv.c
+++ b/ext/sockets/sockaddr_conv.c
@@ -61,11 +61,11 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
}
if (scope++) {
- php_int_t lval = 0;
+ zend_long lval = 0;
double dval = 0;
unsigned scope_id = 0;
- if (IS_INT == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) {
+ if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) {
if (lval > 0 && lval <= UINT_MAX) {
scope_id = lval;
}
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 5ea62bbd10..0dab51bed6 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -611,100 +611,100 @@ static PHP_MINIT_FUNCTION(sockets)
{
le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number);
- REGISTER_INT_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT);
#if HAVE_IPV6
- REGISTER_INT_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_INT_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT);
+#endif
+ REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT);
#ifdef MSG_EOR
- REGISTER_INT_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_EOF
- REGISTER_INT_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_CONFIRM
- REGISTER_INT_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_ERRQUEUE
- REGISTER_INT_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_NOSIGNAL
- REGISTER_INT_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_DONTWAIT
- REGISTER_INT_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_MORE
- REGISTER_INT_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_WAITFORONE
- REGISTER_INT_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef MSG_CMSG_CLOEXEC
- REGISTER_INT_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT);
#ifdef SO_REUSEPORT
- REGISTER_INT_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_INT_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT);
+#endif
+ REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT);
#ifdef SO_FAMILY
- REGISTER_INT_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT);
#ifdef SO_BINDTODEVICE
- REGISTER_INT_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT);
#ifdef TCP_NODELAY
- REGISTER_INT_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT);
#ifdef HAS_MCAST_EXT
- REGISTER_INT_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT);
#if HAVE_IPV6
- REGISTER_INT_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT);
#endif
#ifndef WIN32
@@ -713,16 +713,16 @@ static PHP_MINIT_FUNCTION(sockets)
# include "win32_socket_constants.h"
#endif
- REGISTER_INT_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT);
#if HAVE_IPV6
- REGISTER_INT_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT);
#if HAVE_IPV6
- REGISTER_INT_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT);
#endif
php_socket_sendrecvmsg_init(INIT_FUNC_ARGS_PASSTHRU);
@@ -793,7 +793,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) /
php_socket *php_sock;
zval new_hash;
int num = 0;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_string *key;
if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
@@ -836,9 +836,9 @@ PHP_FUNCTION(socket_select)
fd_set rfds, wfds, efds;
PHP_SOCKET max_fd = 0;
int retval, sets = 0;
- php_int_t usec = 0;
+ zend_long usec = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) {
return;
}
@@ -861,19 +861,19 @@ PHP_FUNCTION(socket_select)
if (sec != NULL) {
zval tmp;
- if (Z_TYPE_P(sec) != IS_INT) {
+ if (Z_TYPE_P(sec) != IS_LONG) {
tmp = *sec;
zval_copy_ctor(&tmp);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
sec = &tmp;
}
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000);
+ tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = Z_IVAL_P(sec);
+ tv.tv_sec = Z_LVAL_P(sec);
tv.tv_usec = usec;
}
@@ -896,7 +896,7 @@ PHP_FUNCTION(socket_select)
if (w_array != NULL) php_sock_array_from_fd_set(w_array, &wfds TSRMLS_CC);
if (e_array != NULL) php_sock_array_from_fd_set(e_array, &efds TSRMLS_CC);
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -905,9 +905,9 @@ PHP_FUNCTION(socket_select)
PHP_FUNCTION(socket_create_listen)
{
php_socket *php_sock;
- php_int_t port, backlog = 128;
+ zend_long port, backlog = 128;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &port, &backlog) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port, &backlog) == FAILURE) {
return;
}
@@ -1027,9 +1027,9 @@ PHP_FUNCTION(socket_listen)
{
zval *arg1;
php_socket *php_sock;
- php_int_t backlog = 0;
+ zend_long backlog = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &backlog) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &backlog) == FAILURE) {
return;
}
@@ -1075,11 +1075,12 @@ PHP_FUNCTION(socket_write)
{
zval *arg1;
php_socket *php_sock;
- int retval, str_len;
- php_int_t length = 0;
+ int retval;
+ size_t str_len;
+ zend_long length = 0;
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &str, &str_len, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE) {
return;
}
@@ -1100,7 +1101,7 @@ PHP_FUNCTION(socket_write)
RETURN_FALSE;
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -1112,9 +1113,9 @@ PHP_FUNCTION(socket_read)
php_socket *php_sock;
zend_string *tmpbuf;
int retval;
- php_int_t length, type = PHP_BINARY_READ;
+ zend_long length, type = PHP_BINARY_READ;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &length, &type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE) {
return;
}
@@ -1123,7 +1124,7 @@ PHP_FUNCTION(socket_read)
RETURN_FALSE;
}
- tmpbuf = STR_ALLOC(length, 0);
+ tmpbuf = zend_string_alloc(length, 0);
ZEND_FETCH_RESOURCE(php_sock, php_socket *, arg1, -1, le_socket_name, le_socket);
@@ -1147,14 +1148,14 @@ PHP_FUNCTION(socket_read)
PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
}
- STR_FREE(tmpbuf);
+ zend_string_free(tmpbuf);
RETURN_FALSE;
} else if (!retval) {
- STR_FREE(tmpbuf);
+ zend_string_free(tmpbuf);
RETURN_EMPTY_STRING();
}
- tmpbuf = STR_REALLOC(tmpbuf, retval, 0);
+ tmpbuf = zend_string_realloc(tmpbuf, retval, 0);
tmpbuf->len = retval;
tmpbuf->val[tmpbuf->len] = '\0' ;
@@ -1206,7 +1207,7 @@ PHP_FUNCTION(socket_getsockname)
if (port != NULL) {
zval_dtor(port);
- ZVAL_INT(port, htons(sin6->sin6_port));
+ ZVAL_LONG(port, htons(sin6->sin6_port));
}
RETURN_TRUE;
break;
@@ -1223,7 +1224,7 @@ PHP_FUNCTION(socket_getsockname)
if (port != NULL) {
zval_dtor(port);
- ZVAL_INT(port, htons(sin->sin_port));
+ ZVAL_LONG(port, htons(sin->sin_port));
}
RETURN_TRUE;
break;
@@ -1283,7 +1284,7 @@ PHP_FUNCTION(socket_getpeername)
if (arg3 != NULL) {
zval_dtor(arg3);
- ZVAL_INT(arg3, htons(sin6->sin6_port));
+ ZVAL_LONG(arg3, htons(sin6->sin6_port));
}
RETURN_TRUE;
@@ -1301,7 +1302,7 @@ PHP_FUNCTION(socket_getpeername)
if (arg3 != NULL) {
zval_dtor(arg3);
- ZVAL_INT(arg3, htons(sin->sin_port));
+ ZVAL_LONG(arg3, htons(sin->sin_port));
}
RETURN_TRUE;
@@ -1326,10 +1327,10 @@ PHP_FUNCTION(socket_getpeername)
Creates an endpoint for communication in the domain specified by domain, of type specified by type */
PHP_FUNCTION(socket_create)
{
- php_int_t arg1, arg2, arg3;
+ zend_long arg1, arg2, arg3;
php_socket *php_sock = php_create_socket();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &arg1, &arg2, &arg3) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) {
efree(php_sock);
return;
}
@@ -1372,11 +1373,12 @@ PHP_FUNCTION(socket_connect)
zval *arg1;
php_socket *php_sock;
char *addr;
- int retval, addr_len;
- php_int_t port = 0;
+ int retval;
+ size_t addr_len;
+ zend_long port = 0;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) {
return;
}
@@ -1457,9 +1459,9 @@ PHP_FUNCTION(socket_connect)
Returns a string describing an error */
PHP_FUNCTION(socket_strerror)
{
- php_int_t arg1;
+ zend_long arg1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg1) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) == FAILURE) {
return;
}
@@ -1476,11 +1478,11 @@ PHP_FUNCTION(socket_bind)
struct sockaddr *sock_type = (struct sockaddr*) &sa_storage;
php_socket *php_sock;
char *addr;
- int addr_len;
- php_int_t port = 0;
- php_int_t retval = 0;
+ size_t addr_len;
+ zend_long port = 0;
+ zend_long retval = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) {
return;
}
@@ -1558,9 +1560,9 @@ PHP_FUNCTION(socket_recv)
zend_string *recv_buf;
php_socket *php_sock;
int retval;
- php_int_t len, flags;
+ zend_long len, flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ii", &php_sock_res, &buf, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ll", &php_sock_res, &buf, &len, &flags) == FAILURE) {
return;
}
@@ -1571,7 +1573,7 @@ PHP_FUNCTION(socket_recv)
RETURN_FALSE;
}
- recv_buf = STR_ALLOC(len, 0);
+ recv_buf = zend_string_alloc(len, 0);
if ((retval = recv(php_sock->bsd_socket, recv_buf->val, len, flags)) < 1) {
efree(recv_buf);
@@ -1584,7 +1586,7 @@ PHP_FUNCTION(socket_recv)
/* Rebuild buffer zval */
zval_dtor(buf);
- ZVAL_STR(buf, recv_buf);
+ ZVAL_NEW_STR(buf, recv_buf);
}
if (retval == -1) {
@@ -1592,7 +1594,7 @@ PHP_FUNCTION(socket_recv)
RETURN_FALSE;
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -1602,11 +1604,11 @@ PHP_FUNCTION(socket_send)
{
zval *arg1;
php_socket *php_sock;
- int buf_len, retval;
- php_int_t len, flags;
+ size_t buf_len, retval;
+ zend_long len, flags;
char *buf;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsii", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) {
return;
}
@@ -1619,7 +1621,7 @@ PHP_FUNCTION(socket_send)
RETURN_FALSE;
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -1637,11 +1639,11 @@ PHP_FUNCTION(socket_recvfrom)
#endif
socklen_t slen;
int retval;
- php_int_t arg3, arg4;
+ zend_long arg3, arg4;
char *address;
zend_string *recv_buf;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/iiz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/llz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
return;
}
@@ -1652,7 +1654,7 @@ PHP_FUNCTION(socket_recvfrom)
RETURN_FALSE;
}
- recv_buf = STR_ALLOC(arg3 + 1, 0);
+ recv_buf = zend_string_alloc(arg3 + 1, 0);
switch (php_sock->type) {
case AF_UNIX:
@@ -1662,7 +1664,7 @@ PHP_FUNCTION(socket_recvfrom)
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- STR_FREE(recv_buf);
+ zend_string_free(recv_buf);
RETURN_FALSE;
}
recv_buf->len = retval;
@@ -1671,7 +1673,7 @@ PHP_FUNCTION(socket_recvfrom)
zval_dtor(arg2);
zval_dtor(arg5);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, s_un.sun_path);
break;
@@ -1681,7 +1683,7 @@ PHP_FUNCTION(socket_recvfrom)
sin.sin_family = AF_INET;
if (arg6 == NULL) {
- STR_FREE(recv_buf);
+ zend_string_free(recv_buf);
WRONG_PARAM_COUNT;
}
@@ -1689,7 +1691,7 @@ PHP_FUNCTION(socket_recvfrom)
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- STR_FREE(recv_buf);
+ zend_string_free(recv_buf);
RETURN_FALSE;
}
recv_buf->len = retval;
@@ -1701,9 +1703,9 @@ PHP_FUNCTION(socket_recvfrom)
address = inet_ntoa(sin.sin_addr);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, address ? address : "0.0.0.0");
- ZVAL_INT(arg6, ntohs(sin.sin_port));
+ ZVAL_LONG(arg6, ntohs(sin.sin_port));
break;
#if HAVE_IPV6
case AF_INET6:
@@ -1720,7 +1722,7 @@ PHP_FUNCTION(socket_recvfrom)
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
- STR_FREE(recv_buf);
+ zend_string_free(recv_buf);
RETURN_FALSE;
}
recv_buf->len = retval;
@@ -1733,9 +1735,9 @@ PHP_FUNCTION(socket_recvfrom)
memset(addr6, 0, INET6_ADDRSTRLEN);
inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN);
- ZVAL_STR(arg2, recv_buf);
+ ZVAL_NEW_STR(arg2, recv_buf);
ZVAL_STRING(arg5, addr6[0] ? addr6 : "::");
- ZVAL_INT(arg6, ntohs(sin6.sin6_port));
+ ZVAL_LONG(arg6, ntohs(sin6.sin6_port));
break;
#endif
default:
@@ -1743,7 +1745,7 @@ PHP_FUNCTION(socket_recvfrom)
RETURN_FALSE;
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -1758,12 +1760,13 @@ PHP_FUNCTION(socket_sendto)
#if HAVE_IPV6
struct sockaddr_in6 sin6;
#endif
- int retval, buf_len, addr_len;
- php_int_t len, flags, port = 0;
+ int retval;
+ size_t buf_len, addr_len;
+ zend_long len, flags, port = 0;
char *buf, *addr;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsiis|i", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) {
return;
}
@@ -1820,7 +1823,7 @@ PHP_FUNCTION(socket_sendto)
RETURN_FALSE;
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -1837,9 +1840,9 @@ PHP_FUNCTION(socket_get_option)
socklen_t optlen;
php_socket *php_sock;
int other_val;
- php_int_t level, optname;
+ zend_long level, optname;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &arg1, &level, &optname) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1, &level, &optname) == FAILURE) {
return;
}
@@ -1856,7 +1859,7 @@ PHP_FUNCTION(socket_get_option)
RETURN_FALSE;
}
if (php_add4_to_if_index(&if_addr, php_sock, &if_index TSRMLS_CC) == SUCCESS) {
- RETURN_INT((long) if_index);
+ RETURN_LONG((zend_long) if_index);
} else {
RETURN_FALSE;
}
@@ -1885,8 +1888,8 @@ PHP_FUNCTION(socket_get_option)
}
array_init(return_value);
- add_assoc_int(return_value, "l_onoff", linger_val.l_onoff);
- add_assoc_int(return_value, "l_linger", linger_val.l_linger);
+ add_assoc_long(return_value, "l_onoff", linger_val.l_onoff);
+ add_assoc_long(return_value, "l_linger", linger_val.l_linger);
break;
case SO_RCVTIMEO:
@@ -1912,8 +1915,8 @@ PHP_FUNCTION(socket_get_option)
array_init(return_value);
- add_assoc_int(return_value, "sec", tv.tv_sec);
- add_assoc_int(return_value, "usec", tv.tv_usec);
+ add_assoc_long(return_value, "sec", tv.tv_sec);
+ add_assoc_long(return_value, "usec", tv.tv_usec);
break;
default:
@@ -1926,7 +1929,7 @@ PHP_FUNCTION(socket_get_option)
if (optlen == 1)
other_val = *((unsigned char *)&other_val);
- RETURN_INT(other_val);
+ RETURN_LONG(other_val);
break;
}
}
@@ -1945,14 +1948,14 @@ PHP_FUNCTION(socket_set_option)
#else
struct timeval tv;
#endif
- php_int_t level, optname;
+ zend_long level, optname;
void *opt_ptr;
HashTable *opt_ht;
zval *l_onoff, *l_linger;
zval *sec, *usec;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiz", &arg1, &level, &optname, &arg4) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllz", &arg1, &level, &optname, &arg4) == FAILURE) {
return;
}
@@ -2000,11 +2003,11 @@ PHP_FUNCTION(socket_set_option)
RETURN_FALSE;
}
- convert_to_int_ex(l_onoff);
- convert_to_int_ex(l_linger);
+ convert_to_long_ex(l_onoff);
+ convert_to_long_ex(l_linger);
- lv.l_onoff = (unsigned short)Z_IVAL_P(l_onoff);
- lv.l_linger = (unsigned short)Z_IVAL_P(l_linger);
+ lv.l_onoff = (unsigned short)Z_LVAL_P(l_onoff);
+ lv.l_linger = (unsigned short)Z_LVAL_P(l_linger);
optlen = sizeof(lv);
opt_ptr = &lv;
@@ -2028,15 +2031,15 @@ PHP_FUNCTION(socket_set_option)
RETURN_FALSE;
}
- convert_to_int_ex(sec);
- convert_to_int_ex(usec);
+ convert_to_long_ex(sec);
+ convert_to_long_ex(usec);
#ifndef PHP_WIN32
- tv.tv_sec = Z_IVAL_P(sec);
- tv.tv_usec = Z_IVAL_P(usec);
+ tv.tv_sec = Z_LVAL_P(sec);
+ tv.tv_usec = Z_LVAL_P(usec);
optlen = sizeof(tv);
opt_ptr = &tv;
#else
- timeout = Z_IVAL_P(sec) * 1000 + Z_IVAL_P(usec) / 1000;
+ timeout = Z_LVAL_P(sec) * 1000 + Z_LVAL_P(usec) / 1000;
optlen = sizeof(int);
opt_ptr = &timeout;
#endif
@@ -2046,7 +2049,7 @@ PHP_FUNCTION(socket_set_option)
case SO_BINDTODEVICE: {
if (Z_TYPE_P(arg4) == IS_STRING) {
opt_ptr = Z_STRVAL_P(arg4);
- optlen = Z_STRSIZE_P(arg4);
+ optlen = Z_STRLEN_P(arg4);
} else {
opt_ptr = "";
optlen = 0;
@@ -2057,8 +2060,8 @@ PHP_FUNCTION(socket_set_option)
default:
default_case:
- convert_to_int_ex(arg4);
- ov = Z_IVAL_P(arg4);
+ convert_to_long_ex(arg4);
+ ov = Z_LVAL_P(arg4);
optlen = sizeof(ov);
opt_ptr = &ov;
@@ -2083,9 +2086,9 @@ PHP_FUNCTION(socket_create_pair)
zval retval[2], *fds_array_zval;
php_socket *php_sock[2];
PHP_SOCKET fds_array[2];
- php_int_t domain, type, protocol;
+ zend_long domain, type, protocol;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiiz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) {
return;
}
@@ -2143,10 +2146,10 @@ PHP_FUNCTION(socket_create_pair)
PHP_FUNCTION(socket_shutdown)
{
zval *arg1;
- php_int_t how_shutdown = 2;
+ zend_long how_shutdown = 2;
php_socket *php_sock;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &how_shutdown) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &how_shutdown) == FAILURE) {
return;
}
@@ -2175,9 +2178,9 @@ PHP_FUNCTION(socket_last_error)
if (arg1) {
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, le_socket_name, le_socket);
- RETVAL_INT(php_sock->error);
+ RETVAL_LONG(php_sock->error);
} else {
- RETVAL_INT(SOCKETS_G(last_error));
+ RETVAL_LONG(SOCKETS_G(last_error));
}
}
/* }}} */
diff --git a/ext/sockets/sockets.dsp b/ext/sockets/sockets.dsp
deleted file mode 100644
index 961bab784d..0000000000
--- a/ext/sockets/sockets.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sockets" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sockets - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sockets.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sockets.mak" CFG="sockets - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sockets - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sockets - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sockets - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D HAVE_SOCKETS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sockets.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /debug
-
-!ELSEIF "$(CFG)" == "sockets - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SOCKETS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_sockets.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sockets - Win32 Release_TS"
-# Name "sockets - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sockets_win.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sockets.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sockets.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sockets_win.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt
index b36764f617..0effd04d34 100644
--- a/ext/sockets/tests/socket_import_stream-4-win.phpt
+++ b/ext/sockets/tests/socket_import_stream-4-win.phpt
@@ -77,7 +77,7 @@ stream_set_blocking 1
close stream
stream_set_blocking
-Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d
+Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket.
@@ -91,13 +91,13 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: An operatio
close socket
stream_set_blocking
-Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d
+Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
socket_set_block
-Warning: socket_set_block(): %d is not a valid Socket resource in %s on line %d
+Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
socket_get_option
-Warning: socket_get_option(): %d is not a valid Socket resource in %s on line %d
+Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
Done.
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
index 645b018cbf..7d183b83ae 100644
--- a/ext/sockets/unix_socket_constants.h
+++ b/ext/sockets/unix_socket_constants.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -22,405 +22,405 @@
#ifdef EPERM
/* Operation not permitted */
- REGISTER_INT_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOENT
/* No such file or directory */
- REGISTER_INT_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EINTR
/* Interrupted system call */
- REGISTER_INT_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EIO
/* I/O error */
- REGISTER_INT_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENXIO
/* No such device or address */
- REGISTER_INT_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef E2BIG
/* Arg list too long */
- REGISTER_INT_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADF
/* Bad file number */
- REGISTER_INT_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EAGAIN
/* Try again */
- REGISTER_INT_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOMEM
/* Out of memory */
- REGISTER_INT_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EACCES
/* Permission denied */
- REGISTER_INT_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EFAULT
/* Bad address */
- REGISTER_INT_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTBLK
/* Block device required */
- REGISTER_INT_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBUSY
/* Device or resource busy */
- REGISTER_INT_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EEXIST
/* File exists */
- REGISTER_INT_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EXDEV
/* Cross-device link */
- REGISTER_INT_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENODEV
/* No such device */
- REGISTER_INT_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTDIR
/* Not a directory */
- REGISTER_INT_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EISDIR
/* Is a directory */
- REGISTER_INT_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EINVAL
/* Invalid argument */
- REGISTER_INT_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENFILE
/* File table overflow */
- REGISTER_INT_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EMFILE
/* Too many open files */
- REGISTER_INT_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTTY
/* Not a typewriter */
- REGISTER_INT_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOSPC
/* No space left on device */
- REGISTER_INT_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ESPIPE
/* Illegal seek */
- REGISTER_INT_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EROFS
/* Read-only file system */
- REGISTER_INT_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EMLINK
/* Too many links */
- REGISTER_INT_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EPIPE
/* Broken pipe */
- REGISTER_INT_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENAMETOOLONG
/* File name too long */
- REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOLCK
/* No record locks available */
- REGISTER_INT_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOSYS
/* Function not implemented */
- REGISTER_INT_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTEMPTY
/* Directory not empty */
- REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ELOOP
/* Too many symbolic links encountered */
- REGISTER_INT_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EWOULDBLOCK
/* Operation would block */
- REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOMSG
/* No message of desired type */
- REGISTER_INT_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EIDRM
/* Identifier removed */
- REGISTER_INT_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ECHRNG
/* Channel number out of range */
- REGISTER_INT_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EL2NSYNC
/* Level 2 not synchronized */
- REGISTER_INT_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EL3HLT
/* Level 3 halted */
- REGISTER_INT_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EL3RST
/* Level 3 reset */
- REGISTER_INT_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ELNRNG
/* Link number out of range */
- REGISTER_INT_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EUNATCH
/* Protocol driver not attached */
- REGISTER_INT_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOCSI
/* No CSI structure available */
- REGISTER_INT_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EL2HLT
/* Level 2 halted */
- REGISTER_INT_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADE
/* Invalid exchange */
- REGISTER_INT_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADR
/* Invalid request descriptor */
- REGISTER_INT_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EXFULL
/* Exchange full */
- REGISTER_INT_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOANO
/* No anode */
- REGISTER_INT_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADRQC
/* Invalid request code */
- REGISTER_INT_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADSLT
/* Invalid slot */
- REGISTER_INT_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOSTR
/* Device not a stream */
- REGISTER_INT_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENODATA
/* No data available */
- REGISTER_INT_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ETIME
/* Timer expired */
- REGISTER_INT_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOSR
/* Out of streams resources */
- REGISTER_INT_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENONET
/* Machine is not on the network */
- REGISTER_INT_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EREMOTE
/* Object is remote */
- REGISTER_INT_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOLINK
/* Link has been severed */
- REGISTER_INT_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EADV
/* Advertise error */
- REGISTER_INT_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ESRMNT
/* Srmount error */
- REGISTER_INT_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ECOMM
/* Communication error on send */
- REGISTER_INT_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EPROTO
/* Protocol error */
- REGISTER_INT_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EMULTIHOP
/* Multihop attempted */
- REGISTER_INT_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADMSG
/* Not a data message */
- REGISTER_INT_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTUNIQ
/* Name not unique on network */
- REGISTER_INT_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EBADFD
/* File descriptor in bad state */
- REGISTER_INT_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EREMCHG
/* Remote address changed */
- REGISTER_INT_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ERESTART
/* Interrupted system call should be restarted */
- REGISTER_INT_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ESTRPIPE
/* Streams pipe error */
- REGISTER_INT_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EUSERS
/* Too many users */
- REGISTER_INT_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTSOCK
/* Socket operation on non-socket */
- REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EDESTADDRREQ
/* Destination address required */
- REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EMSGSIZE
/* Message too long */
- REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EPROTOTYPE
/* Protocol wrong type for socket */
- REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOPROTOOPT
/* Protocol not available */
- REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EPROTONOSUPPORT
/* Protocol not supported */
- REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ESOCKTNOSUPPORT
/* Socket type not supported */
- REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EOPNOTSUPP
/* Operation not supported on transport endpoint */
- REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EPFNOSUPPORT
/* Protocol family not supported */
- REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EAFNOSUPPORT
/* Address family not supported by protocol */
- REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EADDRINUSE
/* Address already in use */
- REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EADDRNOTAVAIL
/* Cannot assign requested address */
- REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENETDOWN
/* Network is down */
- REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENETUNREACH
/* Network is unreachable */
- REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENETRESET
/* Network dropped connection because of reset */
- REGISTER_INT_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ECONNABORTED
/* Software caused connection abort */
- REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ECONNRESET
/* Connection reset by peer */
- REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOBUFS
/* No buffer space available */
- REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EISCONN
/* Transport endpoint is already connected */
- REGISTER_INT_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOTCONN
/* Transport endpoint is not connected */
- REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ESHUTDOWN
/* Cannot send after transport endpoint shutdown */
- REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ETOOMANYREFS
/* Too many references: cannot splice */
- REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ETIMEDOUT
/* Connection timed out */
- REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ECONNREFUSED
/* Connection refused */
- REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EHOSTDOWN
/* Host is down */
- REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EHOSTUNREACH
/* No route to host */
- REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EALREADY
/* Operation already in progress */
- REGISTER_INT_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EINPROGRESS
/* Operation now in progress */
- REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EISNAM
/* Is a named type file */
- REGISTER_INT_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EREMOTEIO
/* Remote I/O error */
- REGISTER_INT_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EDQUOT
/* Quota exceeded */
- REGISTER_INT_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ENOMEDIUM
/* No medium found */
- REGISTER_INT_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef EMEDIUMTYPE
/* Wrong medium type */
- REGISTER_INT_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT);
#endif
diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
index 2d633efdb7..2d707e9074 100644
--- a/ext/sockets/win32_socket_constants.h
+++ b/ext/sockets/win32_socket_constants.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -20,55 +20,55 @@
/* This file is to be included by sockets.c */
-REGISTER_INT_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT);
-REGISTER_INT_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT);
+REGISTER_LONG_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/sockets/windows_common.h b/ext/sockets/windows_common.h
index 9cc01ae129..5536d88a4a 100644
--- a/ext/sockets/windows_common.h
+++ b/ext/sockets/windows_common.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 5ca26d3f19..44078733d6 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -66,11 +66,11 @@ static zend_class_entry * spl_find_ce_by_name(zend_string *name, zend_bool autol
zend_class_entry *ce;
if (!autoload) {
- zend_string *lc_name = STR_ALLOC(name->len, 0);
+ zend_string *lc_name = zend_string_alloc(name->len, 0);
zend_str_tolower_copy(lc_name->val, name->val, name->len);
ce = zend_hash_find_ptr(EG(class_table), lc_name);
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
} else {
ce = zend_lookup_class(name TSRMLS_CC);
}
@@ -275,7 +275,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(class_file, class_file_len);
}
- opened_path = STR_INIT(file_handle.opened_path, strlen(file_handle.opened_path), 0);
+ opened_path = zend_string_init(file_handle.opened_path, strlen(file_handle.opened_path), 0);
ZVAL_NULL(&dummy);
if (zend_hash_add(&EG(included_files), opened_path, &dummy)) {
new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
@@ -284,7 +284,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
new_op_array = NULL;
zend_file_handle_dtor(&file_handle TSRMLS_CC);
}
- STR_RELEASE(opened_path);
+ zend_string_release(opened_path);
if (new_op_array) {
ZVAL_UNDEF(&result);
zend_execute(new_op_array, &result TSRMLS_CC);
@@ -323,7 +323,7 @@ PHP_FUNCTION(spl_autoload)
pos_len = file_exts->len;
}
- lc_name = STR_ALLOC(class_name->len, 0);
+ lc_name = zend_string_alloc(class_name->len, 0);
zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
while (pos && *pos && !EG(exception)) {
pos1 = strchr(pos, ',');
@@ -339,14 +339,14 @@ PHP_FUNCTION(spl_autoload)
pos = pos1 ? pos1 + 1 : NULL;
pos_len = pos1? pos_len - pos1_len - 1 : 0;
}
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
if (!found && !SPL_G(autoload_running)) {
/* For internal errors, we generate E_ERROR, for direct calls an exception is thrown.
* The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
* the Zend engine.
*/
- zend_execute_data *ex = EG(current_execute_data);
+ zend_execute_data *ex = EX(prev_execute_data);
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
ex = ex->prev_execute_data;
@@ -370,15 +370,15 @@ PHP_FUNCTION(spl_autoload_extensions)
}
if (file_exts) {
if (SPL_G(autoload_extensions)) {
- STR_RELEASE(SPL_G(autoload_extensions));
+ zend_string_release(SPL_G(autoload_extensions));
}
- SPL_G(autoload_extensions) = STR_COPY(file_exts);
+ SPL_G(autoload_extensions) = zend_string_copy(file_exts);
}
if (SPL_G(autoload_extensions) == NULL) {
RETURN_STRINGL(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1);
} else {
- STR_ADDREF(SPL_G(autoload_extensions));
+ zend_string_addref(SPL_G(autoload_extensions));
RETURN_STR(SPL_G(autoload_extensions));
}
} /* }}} */
@@ -417,8 +417,8 @@ PHP_FUNCTION(spl_autoload_call)
if (SPL_G(autoload_functions)) {
int l_autoload_running = SPL_G(autoload_running);
SPL_G(autoload_running) = 1;
- lc_name = STR_ALLOC(Z_STRSIZE_P(class_name), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name));
+ lc_name = zend_string_alloc(Z_STRLEN_P(class_name), 0);
+ zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), func_name, alfi) {
zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, func_name->val, func_name->len, retval, 1, class_name, NULL TSRMLS_CC);
zend_exception_save(TSRMLS_C);
@@ -431,7 +431,7 @@ PHP_FUNCTION(spl_autoload_call)
}
} ZEND_HASH_FOREACH_END();
zend_exception_restore(TSRMLS_C);
- STR_FREE(lc_name);
+ zend_string_free(lc_name);
SPL_G(autoload_running) = l_autoload_running;
} else {
/* do not use or overwrite &EG(autoload_func) here */
@@ -480,7 +480,7 @@ PHP_FUNCTION(spl_autoload_register)
if (error) {
efree(error);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
} else if (do_throw) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error);
@@ -488,7 +488,7 @@ PHP_FUNCTION(spl_autoload_register)
if (error) {
efree(error);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
} else if (Z_TYPE_P(zcallable) == IS_STRING) {
if (do_throw) {
@@ -497,7 +497,7 @@ PHP_FUNCTION(spl_autoload_register)
if (error) {
efree(error);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
} else {
if (do_throw) {
@@ -506,7 +506,7 @@ PHP_FUNCTION(spl_autoload_register)
if (error) {
efree(error);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
}
} else if (fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
@@ -517,7 +517,7 @@ PHP_FUNCTION(spl_autoload_register)
if (error) {
efree(error);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
RETURN_FALSE;
}
alfi.ce = fcc.calling_scope;
@@ -530,16 +530,16 @@ PHP_FUNCTION(spl_autoload_register)
if (Z_TYPE_P(zcallable) == IS_OBJECT) {
ZVAL_COPY(&alfi.closure, zcallable);
- lc_name = STR_ALLOC(func_name->len + sizeof(zend_uint), 0);
+ lc_name = zend_string_alloc(func_name->len + sizeof(uint32_t), 0);
zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
- memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(zend_uint));
+ memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
lc_name->val[lc_name->len] = '\0';
} else {
ZVAL_UNDEF(&alfi.closure);
- lc_name = STR_ALLOC(func_name->len, 0);
+ lc_name = zend_string_alloc(func_name->len, 0);
zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), lc_name)) {
if (!Z_ISUNDEF(alfi.closure)) {
@@ -550,8 +550,8 @@ PHP_FUNCTION(spl_autoload_register)
if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
/* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
- lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint));
+ lc_name = zend_string_realloc(lc_name, lc_name->len + sizeof(uint32_t), 0);
+ memcpy(lc_name->val + lc_name->len - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
lc_name->val[lc_name->len] = '\0';
ZVAL_OBJ(&alfi.obj, obj_ptr);
Z_ADDREF(alfi.obj);
@@ -594,7 +594,7 @@ PHP_FUNCTION(spl_autoload_register)
HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
}
skip:
- STR_RELEASE(lc_name);
+ zend_string_release(lc_name);
}
if (SPL_G(autoload_functions)) {
@@ -629,7 +629,7 @@ PHP_FUNCTION(spl_autoload_unregister)
efree(error);
}
if (func_name) {
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
}
RETURN_FALSE;
}
@@ -639,15 +639,15 @@ PHP_FUNCTION(spl_autoload_unregister)
}
if (Z_TYPE_P(zcallable) == IS_OBJECT) {
- lc_name = STR_ALLOC(func_name->len + sizeof(zend_uint), 0);
+ lc_name = zend_string_alloc(func_name->len + sizeof(uint32_t), 0);
zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
- memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(zend_uint));
+ memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
lc_name->val[lc_name->len] = '\0';
} else {
- lc_name = STR_ALLOC(func_name->len, 0);
+ lc_name = zend_string_alloc(func_name->len, 0);
zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
}
- STR_RELEASE(func_name);
+ zend_string_release(func_name);
if (SPL_G(autoload_functions)) {
if (lc_name->len == sizeof("spl_autoload_call") - 1 && !strcmp(lc_name->val, "spl_autoload_call")) {
@@ -661,8 +661,8 @@ PHP_FUNCTION(spl_autoload_unregister)
/* remove specific */
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
if (success != SUCCESS && obj_ptr) {
- lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint));
+ lc_name = zend_string_realloc(lc_name, lc_name->len + sizeof(uint32_t), 0);
+ memcpy(lc_name->val + lc_name->len - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
lc_name->val[lc_name->len] = '\0';
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
}
@@ -677,7 +677,7 @@ PHP_FUNCTION(spl_autoload_unregister)
}
}
- STR_RELEASE(lc_name);
+ zend_string_release(lc_name);
RETURN_BOOL(success == SUCCESS);
} /* }}} */
@@ -718,15 +718,15 @@ PHP_FUNCTION(spl_autoload_functions)
Z_ADDREF(alfi->obj);
add_next_index_zval(&tmp, &alfi->obj);
} else {
- add_next_index_str(&tmp, STR_COPY(alfi->ce->name));
+ add_next_index_str(&tmp, zend_string_copy(alfi->ce->name));
}
- add_next_index_str(&tmp, STR_COPY(alfi->func_ptr->common.function_name));
+ add_next_index_str(&tmp, zend_string_copy(alfi->func_ptr->common.function_name));
add_next_index_zval(return_value, &tmp);
} else {
if (strncmp(alfi->func_ptr->common.function_name->val, "__lambda_func", sizeof("__lambda_func") - 1)) {
- add_next_index_str(return_value, STR_COPY(alfi->func_ptr->common.function_name));
+ add_next_index_str(return_value, zend_string_copy(alfi->func_ptr->common.function_name));
} else {
- add_next_index_str(return_value, STR_COPY(key));
+ add_next_index_str(return_value, zend_string_copy(key));
}
}
} ZEND_HASH_FOREACH_END();
@@ -734,7 +734,7 @@ PHP_FUNCTION(spl_autoload_functions)
}
array_init(return_value);
- add_next_index_str(return_value, STR_COPY(EG(autoload_func)->common.function_name));
+ add_next_index_str(return_value, zend_string_copy(EG(autoload_func)->common.function_name));
} /* }}} */
/* {{{ proto string spl_object_hash(object obj)
@@ -927,7 +927,7 @@ PHP_RINIT_FUNCTION(spl) /* {{{ */
PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */
{
if (SPL_G(autoload_extensions)) {
- STR_RELEASE(SPL_G(autoload_extensions));
+ zend_string_release(SPL_G(autoload_extensions));
SPL_G(autoload_extensions) = NULL;
}
if (SPL_G(autoload_functions)) {
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index c2b1837e8d..534a03885e 100644
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -60,10 +60,10 @@ PHP_MINFO_FUNCTION(spl);
ZEND_BEGIN_MODULE_GLOBALS(spl)
zend_string *autoload_extensions;
HashTable *autoload_functions;
- int autoload_running;
intptr_t hash_mask_handle;
intptr_t hash_mask_handlers;
int hash_mask_init;
+ int autoload_running;
ZEND_END_MODULE_GLOBALS(spl)
#ifdef ZTS
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 23ee137064..8aab4c49bf 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,7 +26,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"
@@ -66,7 +66,7 @@ typedef struct _spl_array_object {
zval array;
zval retval;
HashPosition pos;
- php_uint_t pos_h;
+ zend_ulong pos_h;
int ar_flags;
int is_self;
zend_function *fptr_offset_get;
@@ -300,7 +300,7 @@ static zend_object *spl_array_object_clone(zval *zobject TSRMLS_DC)
static zval *spl_array_get_dimension_ptr(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
{
zval *retval;
- php_int_t index;
+ zend_long index;
zend_string *offset_key;
spl_array_object *intern = Z_SPLARRAY_P(object);
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -364,7 +364,7 @@ fetch_dim_string:
index = Z_RES_P(offset)->handle;
goto num_index;
case IS_DOUBLE:
- index = (php_int_t)Z_DVAL_P(offset);
+ index = (zend_long)Z_DVAL_P(offset);
goto num_index;
case IS_FALSE:
index = 0;
@@ -372,8 +372,8 @@ fetch_dim_string:
case IS_TRUE:
index = 1;
goto num_index;
- case IS_INT:
- index = Z_IVAL_P(offset);
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index:
if ((retval = zend_hash_index_find(ht, index)) == NULL) {
switch (type) {
@@ -450,7 +450,7 @@ static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval
static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
- php_int_t index;
+ zend_long index;
HashTable *ht;
if (check_inherited && intern->fptr_offset_set) {
@@ -493,7 +493,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
zend_symtable_update_ind(ht, Z_STR_P(offset), value);
return;
case IS_DOUBLE:
- index = (php_int_t)Z_DVAL_P(offset);
+ index = (zend_long)Z_DVAL_P(offset);
goto num_index;
case IS_RESOURCE:
index = Z_RES_HANDLE_P(offset);
@@ -504,8 +504,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
case IS_TRUE:
index = 1;
goto num_index;
- case IS_INT:
- index = Z_IVAL_P(offset);
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
if (ht->u.v.nApplyCount > 0) {
@@ -535,7 +535,7 @@ static void spl_array_write_dimension(zval *object, zval *offset, zval *value TS
static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */
{
- php_int_t index;
+ zend_long index;
HashTable *ht;
spl_array_object *intern = Z_SPLARRAY_P(object);
@@ -585,7 +585,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
}
break;
case IS_DOUBLE:
- index = (php_int_t)Z_DVAL_P(offset);
+ index = (zend_long)Z_DVAL_P(offset);
goto num_index;
case IS_RESOURCE:
index = Z_RES_HANDLE_P(offset);
@@ -596,8 +596,8 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
case IS_TRUE:
index = 1;
goto num_index;
- case IS_INT:
- index = Z_IVAL_P(offset);
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
if (ht->u.v.nApplyCount > 0) {
@@ -623,7 +623,7 @@ static void spl_array_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {
static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
- php_int_t index;
+ zend_long index;
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
@@ -664,7 +664,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
break;
case IS_DOUBLE:
- index = (php_int_t)Z_DVAL_P(offset);
+ index = (zend_long)Z_DVAL_P(offset);
goto num_index;
case IS_RESOURCE:
index = Z_RES_HANDLE_P(offset);
@@ -675,8 +675,8 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
case IS_TRUE:
index = 1;
goto num_index;
- case IS_INT:
- index = Z_IVAL_P(offset);
+ case IS_LONG:
+ index = Z_LVAL_P(offset);
num_index:
if ((tmp = zend_hash_index_find(ht, index)) != NULL) {
if (check_empty == 2) {
@@ -874,7 +874,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /*
base = (Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator) ? spl_ce_ArrayIterator : spl_ce_ArrayObject;
zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1 TSRMLS_CC);
zend_symtable_update(intern->debug_info, zname, storage);
- STR_RELEASE(zname);
+ zend_string_release(zname);
}
return intern->debug_info;
@@ -957,7 +957,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
ht2 = spl_array_get_hash_table(intern2, 0 TSRMLS_CC);
zend_compare_symbol_tables(&temp_zv, ht1, ht2 TSRMLS_CC);
- result = (int)Z_IVAL(temp_zv);
+ result = (int)Z_LVAL(temp_zv);
/* if we just compared std.properties, don't do it again */
if (result == 0 &&
!(ht1 == intern1->std.properties && ht2 == intern2->std.properties)) {
@@ -969,7 +969,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */
{
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zval *data;
if (Z_TYPE(intern->array) == IS_OBJECT) {
@@ -1141,10 +1141,10 @@ static void spl_array_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
/* }}} */
/* {{{ spl_array_set_array */
-static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, php_int_t ar_flags, int just_array TSRMLS_DC) {
+static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, zend_long ar_flags, int just_array TSRMLS_DC) {
if (Z_TYPE_P(array) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array);
+ SEPARATE_ARRAY(array);
}
if (Z_TYPE_P(array) == IS_OBJECT && (Z_OBJ_HT_P(array) == &spl_handler_ArrayObject || Z_OBJ_HT_P(array) == &spl_handler_ArrayIterator)) {
@@ -1223,7 +1223,7 @@ SPL_METHOD(Array, __construct)
zval *object = getThis();
spl_array_object *intern;
zval *array;
- php_int_t ar_flags = 0;
+ zend_long ar_flags = 0;
zend_class_entry *ce_get_iterator = spl_ce_Iterator;
zend_error_handling error_handling;
@@ -1235,7 +1235,7 @@ SPL_METHOD(Array, __construct)
intern = Z_SPLARRAY_P(object);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|iC", &array, &ar_flags, &ce_get_iterator) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -1286,7 +1286,7 @@ SPL_METHOD(Array, getIteratorClass)
return;
}
- STR_ADDREF(intern->ce_get_iterator->name);
+ zend_string_addref(intern->ce_get_iterator->name);
RETURN_STR(intern->ce_get_iterator->name);
}
/* }}} */
@@ -1302,7 +1302,7 @@ SPL_METHOD(Array, getFlags)
return;
}
- RETURN_INT(intern->ar_flags & ~SPL_ARRAY_INT_MASK);
+ RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK);
}
/* }}} */
@@ -1312,9 +1312,9 @@ SPL_METHOD(Array, setFlags)
{
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
- php_int_t ar_flags = 0;
+ zend_long ar_flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ar_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ar_flags) == FAILURE) {
return;
}
@@ -1381,13 +1381,13 @@ SPL_METHOD(Array, rewind)
Seek to position. */
SPL_METHOD(Array, seek)
{
- php_int_t opos, position;
+ zend_long opos, position;
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) {
return;
}
@@ -1411,7 +1411,7 @@ SPL_METHOD(Array, seek)
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %pd is out of range", opos);
} /* }}} */
-int static spl_array_object_count_elements_helper(spl_array_object *intern, php_int_t *count TSRMLS_DC) /* {{{ */
+int static spl_array_object_count_elements_helper(spl_array_object *intern, zend_long *count TSRMLS_DC) /* {{{ */
{
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
HashPosition pos;
@@ -1439,7 +1439,7 @@ int static spl_array_object_count_elements_helper(spl_array_object *intern, php_
}
} /* }}} */
-int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
+int spl_array_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
@@ -1449,8 +1449,8 @@ int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /*
if (Z_TYPE(rv) != IS_UNDEF) {
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
- convert_to_int(&intern->retval);
- *count = (php_int_t)Z_IVAL(intern->retval);
+ convert_to_long(&intern->retval);
+ *count = (zend_long)Z_LVAL(intern->retval);
return SUCCESS;
}
*count = 0;
@@ -1464,7 +1464,7 @@ int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /*
Return the number of elements in the Iterator. */
SPL_METHOD(Array, count)
{
- php_int_t count;
+ zend_long count;
spl_array_object *intern = Z_SPLARRAY_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -1473,7 +1473,7 @@ SPL_METHOD(Array, count)
spl_array_object_count_elements_helper(intern, &count TSRMLS_CC);
- RETURN_INT(count);
+ RETURN_LONG(count);
} /* }}} */
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */
@@ -1706,7 +1706,7 @@ SPL_METHOD(Array, getChildren)
}
}
- ZVAL_INT(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags);
+ ZVAL_LONG(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags);
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, entry, &flags TSRMLS_CC);
}
/* }}} */
@@ -1733,7 +1733,7 @@ SPL_METHOD(Array, serialize)
PHP_VAR_SERIALIZE_INIT(var_hash);
- ZVAL_INT(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK));
+ ZVAL_LONG(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK));
/* storage */
smart_str_appendl(&buf, "x:", 2);
@@ -1776,12 +1776,12 @@ SPL_METHOD(Array, unserialize)
spl_array_object *intern = Z_SPLARRAY_P(getThis());
char *buf;
- int buf_len;
+ size_t buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
zval members, zflags;
HashTable *aht;
- php_int_t flags;
+ zend_long flags;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
return;
@@ -1806,12 +1806,12 @@ SPL_METHOD(Array, unserialize)
}
++p;
- if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_INT) {
+ if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_LONG) {
goto outexcept;
}
--p; /* for ';' */
- flags = Z_IVAL(zflags);
+ flags = Z_LVAL(zflags);
/* flags needs to be verified and we also need to verify whether the next
* thing we get is ';'. After that we require an 'm' or somethign else
* where 'm' stands for members and anything else should be an array. If
@@ -1861,7 +1861,7 @@ SPL_METHOD(Array, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
return;
} /* }}} */
@@ -2018,13 +2018,13 @@ PHP_MINIT_FUNCTION(spl_array)
REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);
spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;
- REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST);
- REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS);
+ REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST);
+ REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS);
- REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST);
- REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS);
+ REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST);
+ REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY);
return SUCCESS;
}
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index 23ca80bc8f..c27e55bbec 100644
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index de8cff4ab0..73588ff1bd 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -173,7 +173,7 @@ static zend_object *spl_filesystem_object_new_check(zend_class_entry *class_type
}
/* }}} */
-PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC) /* {{{ */
+PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, size_t *len TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_GLOB
if (intern->type == SPL_FS_DIR) {
@@ -375,7 +375,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject TSRMLS_DC)
}
/* }}} */
-void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */
+void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, size_t len, size_t use_copy TSRMLS_DC) /* {{{ */
{
char *p1, *p2;
@@ -490,7 +490,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else {
intern->file_name = estrndup(source->file_name, source->file_name_len);
intern->file_name_len = source->file_name_len;
- intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC);
+ intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len);
}
break;
@@ -514,7 +514,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else {
intern->file_name = source->file_name;
intern->file_name_len = source->file_name_len;
- intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC);
+ intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len);
intern->u.file.open_mode = "r";
@@ -554,7 +554,7 @@ static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */
}
/* }}} */
-static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, int *len TSRMLS_DC) { /* {{{ */
+static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, size_t *len TSRMLS_DC) { /* {{{ */
switch (intern->type) {
case SPL_FS_INFO:
case SPL_FS_FILE:
@@ -579,7 +579,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
HashTable *rv;
zend_string *pnstr;
char *path;
- int path_len;
+ size_t path_len;
char stmp[2];
*is_temp = 1;
@@ -596,7 +596,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
ZVAL_STRINGL(&tmp, path, path_len);
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
if (intern->file_name) {
pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "fileName", sizeof("fileName")-1 TSRMLS_CC);
@@ -608,7 +608,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
ZVAL_STRINGL(&tmp, intern->file_name, intern->file_name_len);
}
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
}
if (intern->type == SPL_FS_DIR) {
#ifdef HAVE_GLOB
@@ -619,7 +619,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
ZVAL_BOOL(&tmp, 0);
}
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
#endif
pnstr = spl_gen_private_prop_name(spl_ce_RecursiveDirectoryIterator, "subPathName", sizeof("subPathName")-1 TSRMLS_CC);
if (intern->u.dir.sub_path) {
@@ -628,24 +628,24 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem
ZVAL_EMPTY_STRING(&tmp);
}
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
}
if (intern->type == SPL_FS_FILE) {
pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "openMode", sizeof("openMode")-1 TSRMLS_CC);
ZVAL_STRINGL(&tmp, intern->u.file.open_mode, intern->u.file.open_mode_len);
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
stmp[1] = '\0';
stmp[0] = intern->u.file.delimiter;
pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "delimiter", sizeof("delimiter")-1 TSRMLS_CC);
ZVAL_STRINGL(&tmp, stmp, 1);
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
stmp[0] = intern->u.file.enclosure;
pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "enclosure", sizeof("enclosure")-1 TSRMLS_CC);
ZVAL_STRINGL(&tmp, stmp, 1);
zend_symtable_update(rv, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
}
return rv;
@@ -658,9 +658,9 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend
if (fsobj->u.dir.entry.d_name[0] == '\0' && fsobj->orig_path == NULL) {
zend_function *func;
- zend_string *tmp = STR_INIT("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0);
+ zend_string *tmp = zend_string_init("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0);
func = zend_get_std_object_handlers()->get_method(object, tmp, NULL TSRMLS_CC);
- STR_RELEASE(tmp);
+ zend_string_release(tmp);
return func;
}
@@ -671,19 +671,19 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend
#define DIT_CTOR_FLAGS 0x00000001
#define DIT_CTOR_GLOB 0x00000002
-void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, php_int_t ctor_flags) /* {{{ */
+void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long ctor_flags) /* {{{ */
{
spl_filesystem_object *intern;
char *path;
- int parsed, len;
- php_int_t flags;
+ size_t parsed, len;
+ zend_long flags;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
- parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &len, &flags);
+ parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags);
} else {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len);
@@ -767,7 +767,7 @@ SPL_METHOD(DirectoryIterator, key)
}
if (intern->u.dir.dirp) {
- RETURN_INT(intern->u.dir.index);
+ RETURN_LONG(intern->u.dir.index);
} else {
RETURN_FALSE;
}
@@ -813,20 +813,20 @@ SPL_METHOD(DirectoryIterator, seek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
zval retval;
- php_int_t pos;
+ zend_long pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
return;
}
if (intern->u.dir.index > pos) {
/* we first rewind */
- zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(&EX(This), Z_OBJCE(EX(This)), &intern->u.dir.func_rewind, "rewind", NULL);
}
while (intern->u.dir.index < pos) {
int valid = 0;
- zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_valid, "valid", &retval);
+ zend_call_method_with_0_params(&EX(This), Z_OBJCE(EX(This)), &intern->u.dir.func_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = zend_is_true(&retval TSRMLS_CC);
zval_ptr_dtor(&retval);
@@ -834,7 +834,7 @@ SPL_METHOD(DirectoryIterator, seek)
if (!valid) {
break;
}
- zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_next, "next", NULL);
+ zend_call_method_with_0_params(&EX(This), Z_OBJCE(EX(This)), &intern->u.dir.func_next, "next", NULL);
}
} /* }}} */
@@ -858,7 +858,7 @@ SPL_METHOD(SplFileInfo, getPath)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *path;
- int path_len;
+ size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -874,7 +874,7 @@ SPL_METHOD(SplFileInfo, getPath)
SPL_METHOD(SplFileInfo, getFilename)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- int path_len;
+ size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -912,7 +912,8 @@ SPL_METHOD(SplFileInfo, getExtension)
char *fname = NULL;
const char *p;
size_t flen;
- int path_len, idx;
+ size_t path_len;
+ int idx;
zend_string *ret;
if (zend_parse_parameters_none() == FAILURE) {
@@ -935,10 +936,10 @@ SPL_METHOD(SplFileInfo, getExtension)
if (p) {
idx = p - ret->val;
RETVAL_STRINGL(ret->val + idx + 1, ret->len - idx - 1);
- STR_RELEASE(ret);
+ zend_string_release(ret);
return;
} else {
- STR_RELEASE(ret);
+ zend_string_release(ret);
RETURN_EMPTY_STRING();
}
}
@@ -963,9 +964,9 @@ SPL_METHOD(DirectoryIterator, getExtension)
if (p) {
idx = p - fname->val;
RETVAL_STRINGL(fname->val + idx + 1, fname->len - idx - 1);
- STR_RELEASE(fname);
+ zend_string_release(fname);
} else {
- STR_RELEASE(fname);
+ zend_string_release(fname);
RETURN_EMPTY_STRING();
}
}
@@ -978,7 +979,7 @@ SPL_METHOD(SplFileInfo, getBasename)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *fname, *suffix = 0;
size_t flen;
- int slen = 0, path_len;
+ size_t slen = 0, path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) {
return;
@@ -1004,7 +1005,7 @@ SPL_METHOD(DirectoryIterator, getBasename)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *suffix = 0;
- int slen = 0;
+ size_t slen = 0;
zend_string *fname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) {
@@ -1023,7 +1024,7 @@ SPL_METHOD(SplFileInfo, getPathname)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *path;
- int path_len;
+ size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1106,7 +1107,7 @@ SPL_METHOD(SplFileInfo, __construct)
{
spl_filesystem_object *intern;
char *path;
- int len;
+ size_t len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
@@ -1383,7 +1384,7 @@ SPL_METHOD(SplFileInfo, getPathInfo)
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) {
- int path_len;
+ size_t path_len;
char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
if (path) {
char *dpath = estrndup(path, path_len);
@@ -1445,7 +1446,7 @@ SPL_METHOD(FilesystemIterator, getFlags)
return;
}
- RETURN_INT(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK));
+ RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK));
} /* }}} */
/* {{{ proto void FilesystemIterator::setFlags(long $flags)
@@ -1453,9 +1454,9 @@ SPL_METHOD(FilesystemIterator, getFlags)
SPL_METHOD(FilesystemIterator, setFlags)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t flags;
+ zend_long flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
return;
}
@@ -1506,7 +1507,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
RETURN_STRINGL(intern->file_name, intern->file_name_len);
} else {
- ZVAL_INT(&zflags, intern->flags);
+ ZVAL_LONG(&zflags, intern->flags);
ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len);
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC);
zval_ptr_dtor(&zpath);
@@ -1597,7 +1598,7 @@ SPL_METHOD(GlobIterator, count)
}
if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) {
- RETURN_INT(php_glob_stream_get_count(intern->u.dir.dirp, NULL));
+ RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL));
} else {
/* should not happen */
php_error_docref(NULL TSRMLS_CC, E_ERROR, "GlobIterator lost glob state");
@@ -1686,7 +1687,7 @@ static void spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zval *
{
spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter TSRMLS_CC);
- ZVAL_INT(key, object->u.dir.index);
+ ZVAL_LONG(key, object->u.dir.index);
}
/* }}} */
@@ -2025,7 +2026,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
{
char *buf;
size_t line_len = 0;
- php_int_t line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0;
+ zend_long line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0;
spl_filesystem_file_free_line(intern TSRMLS_CC);
@@ -2169,7 +2170,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV)) {
return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL TSRMLS_CC);
} else {
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(getThis()), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_call_method_with_0_params(this_ptr, Z_OBJCE(EX(This)), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
}
if (!Z_ISUNDEF(retval)) {
if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) {
@@ -2177,8 +2179,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
if (Z_TYPE(retval) == IS_STRING) {
- intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval));
- intern->u.file.current_line_len = Z_STRSIZE(retval);
+ intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ intern->u.file.current_line_len = Z_STRLEN(retval);
} else {
ZVAL_ZVAL(&intern->u.file.current_zval, &retval, 1, 0);
}
@@ -2199,7 +2201,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML
} else if (!Z_ISUNDEF(intern->u.file.current_zval)) {
switch(Z_TYPE(intern->u.file.current_zval)) {
case IS_STRING:
- return Z_STRSIZE(intern->u.file.current_zval) == 0;
+ return Z_STRLEN(intern->u.file.current_zval) == 0;
case IS_ARRAY:
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV)
&& zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 1) {
@@ -2210,7 +2212,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML
idx++;
}
first = &Z_ARRVAL(intern->u.file.current_zval)->arData[idx].val;
- return Z_TYPE_P(first) == IS_STRING && Z_STRSIZE_P(first) == 0;
+ return Z_TYPE_P(first) == IS_STRING && Z_STRLEN_P(first) == 0;
}
return zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 0;
case IS_NULL:
@@ -2262,7 +2264,7 @@ SPL_METHOD(SplFileObject, __construct)
zend_bool use_include_path = 0;
char *p1, *p2;
char *tmp_path;
- int tmp_path_len;
+ size_t tmp_path_len;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
@@ -2319,14 +2321,14 @@ SPL_METHOD(SplFileObject, __construct)
Construct a new temp file object */
SPL_METHOD(SplTempFileObject, __construct)
{
- php_int_t max_memory = PHP_STREAM_MAX_MEM;
+ zend_long max_memory = PHP_STREAM_MAX_MEM;
char tmp_fname[48];
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_memory) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -2335,7 +2337,7 @@ SPL_METHOD(SplTempFileObject, __construct)
intern->file_name = "php://memory";
intern->file_name_len = 12;
} else if (ZEND_NUM_ARGS()) {
- intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%ld", max_memory);
+ intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%pd", max_memory);
intern->file_name = tmp_fname;
} else {
intern->file_name = "php://temp";
@@ -2463,7 +2465,7 @@ SPL_METHOD(SplFileObject, key)
if (!intern->current_line) {
spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
} */
- RETURN_INT(intern->u.file.current_line_num);
+ RETURN_LONG(intern->u.file.current_line_num);
} /* }}} */
/* {{{ proto void SplFileObject::next()
@@ -2489,7 +2491,7 @@ SPL_METHOD(SplFileObject, setFlags)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) {
return;
}
} /* }}} */
@@ -2504,18 +2506,18 @@ SPL_METHOD(SplFileObject, getFlags)
return;
}
- RETURN_INT(intern->flags & SPL_FILE_OBJECT_MASK);
+ RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK);
} /* }}} */
/* {{{ proto void SplFileObject::setMaxLineLen(int max_len)
Set maximum line length */
SPL_METHOD(SplFileObject, setMaxLineLen)
{
- php_int_t max_len;
+ zend_long max_len;
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &max_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &max_len) == FAILURE) {
return;
}
@@ -2537,7 +2539,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen)
return;
}
- RETURN_INT((php_int_t)intern->u.file.max_line_len);
+ RETURN_LONG((zend_long)intern->u.file.max_line_len);
} /* }}} */
/* {{{ proto bool SplFileObject::hasChildren()
@@ -2577,7 +2579,7 @@ SPL_METHOD(SplFileObject, fgetcsv)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;
char *delim = NULL, *enclo = NULL, *esc = NULL;
- int d_len = 0, e_len = 0, esc_len = 0;
+ size_t d_len = 0, e_len = 0, esc_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
@@ -2624,7 +2626,8 @@ SPL_METHOD(SplFileObject, fputcsv)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;
char *delim = NULL, *enclo = NULL;
- int d_len = 0, e_len = 0, ret;
+ size_t d_len = 0, e_len = 0;
+ int ret;
zval *fields = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) {
@@ -2649,7 +2652,7 @@ SPL_METHOD(SplFileObject, fputcsv)
break;
}
ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC);
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
}
/* }}} */
@@ -2661,7 +2664,7 @@ SPL_METHOD(SplFileObject, setCsvControl)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char delimiter = ',', enclosure = '"', escape='\\';
char *delim = NULL, *enclo = NULL, *esc = NULL;
- int d_len = 0, e_len = 0, esc_len = 0;
+ size_t d_len = 0, e_len = 0, esc_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {
switch(ZEND_NUM_ARGS())
@@ -2740,7 +2743,7 @@ SPL_METHOD(SplFileObject, fflush)
SPL_METHOD(SplFileObject, ftell)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t ret;
+ zend_long ret;
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
@@ -2752,7 +2755,7 @@ SPL_METHOD(SplFileObject, ftell)
if (ret == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
} /* }}} */
@@ -2761,9 +2764,9 @@ SPL_METHOD(SplFileObject, ftell)
SPL_METHOD(SplFileObject, fseek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t pos, whence = SEEK_SET;
+ zend_long pos, whence = SEEK_SET;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &pos, &whence) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &pos, &whence) == FAILURE) {
return;
}
@@ -2773,7 +2776,7 @@ SPL_METHOD(SplFileObject, fseek)
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
- RETURN_INT(php_stream_seek(intern->u.file.stream, pos, whence));
+ RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence));
} /* }}} */
/* {{{ proto int SplFileObject::fgetc()
@@ -2819,9 +2822,9 @@ SPL_METHOD(SplFileObject, fgetss)
}
if (intern->u.file.max_line_len > 0) {
- ZVAL_INT(&arg2, intern->u.file.max_line_len);
+ ZVAL_LONG(&arg2, intern->u.file.max_line_len);
} else {
- ZVAL_INT(&arg2, 1024);
+ ZVAL_LONG(&arg2, 1024);
}
spl_filesystem_file_free_line(intern TSRMLS_CC);
@@ -2841,7 +2844,7 @@ SPL_METHOD(SplFileObject, fpassthru)
return;
}
- RETURN_INT(php_stream_passthru(intern->u.file.stream));
+ RETURN_LONG(php_stream_passthru(intern->u.file.stream));
} /* }}} */
/* {{{ proto bool SplFileObject::fscanf(string format [, string ...])
@@ -2868,10 +2871,10 @@ SPL_METHOD(SplFileObject, fwrite)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *str;
- int str_len;
- php_int_t length = 0;
+ size_t str_len;
+ zend_long length = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
return;
}
@@ -2881,21 +2884,26 @@ SPL_METHOD(SplFileObject, fwrite)
}
if (ZEND_NUM_ARGS() > 1) {
- str_len = MAX(0, MIN(length, str_len));
+ if (length >= 0) {
+ str_len = MAX(0, MIN((size_t)length, str_len));
+ } else {
+ /* Negative length given, nothing to write */
+ str_len = 0;
+ }
}
if (!str_len) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
- RETURN_INT(php_stream_write(intern->u.file.stream, str, str_len));
+ RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len));
} /* }}} */
SPL_METHOD(SplFileObject, fread)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t length = 0;
+ zend_long length = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) {
return;
}
@@ -2909,11 +2917,11 @@ SPL_METHOD(SplFileObject, fread)
RETURN_FALSE;
}
- ZVAL_STR(return_value, STR_ALLOC(length, 0));
- Z_STRSIZE_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length);
+ ZVAL_NEW_STR(return_value, zend_string_alloc(length, 0));
+ Z_STRLEN_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length);
/* needed because recv/read/gzread doesnt put a null at the end*/
- Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0;
+ Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
}
/* {{{ proto bool SplFileObject::fstat()
@@ -2926,9 +2934,9 @@ FileFunction(fstat)
SPL_METHOD(SplFileObject, ftruncate)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t size;
+ zend_long size;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
return;
}
@@ -2950,9 +2958,9 @@ SPL_METHOD(SplFileObject, ftruncate)
SPL_METHOD(SplFileObject, seek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- php_int_t line_pos;
+ zend_long line_pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &line_pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) {
return;
}
if(!intern->u.file.stream) {
@@ -3110,18 +3118,18 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_SUB_CLASS_EX(FilesystemIterator, DirectoryIterator, spl_filesystem_object_new, spl_FilesystemIterator_functions);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS);
- REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS);
+ REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS);
spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator;
@@ -3140,10 +3148,10 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator);
REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator);
- REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE);
- REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD);
- REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY);
- REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV);
+ REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE);
+ REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD);
+ REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY);
+ REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV);
REGISTER_SPL_SUB_CLASS_EX(SplTempFileObject, SplFileObject, spl_filesystem_object_new_check, spl_SplTempFileObject_functions);
return SUCCESS;
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index a958e30874..f1db1f69b9 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -45,7 +45,7 @@ typedef struct _spl_filesystem_object spl_filesystem_object;
typedef void (*spl_foreign_dtor_t)(spl_filesystem_object *object TSRMLS_DC);
typedef void (*spl_foreign_clone_t)(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC);
-PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC);
+PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, size_t *len TSRMLS_DC);
typedef struct _spl_other_handler {
spl_foreign_dtor_t dtor;
@@ -68,7 +68,7 @@ struct _spl_filesystem_object {
char *file_name;
int file_name_len;
SPL_FS_OBJ_TYPE type;
- php_int_t flags;
+ zend_long flags;
zend_class_entry *file_class;
zend_class_entry *info_class;
union {
@@ -93,7 +93,7 @@ struct _spl_filesystem_object {
char *current_line;
size_t current_line_len;
size_t max_line_len;
- php_int_t current_line_num;
+ zend_long current_line_num;
zval zresource;
zend_function *func_getCurr;
char delimiter;
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index c2eb5c0486..945f7c7ab4 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@
#include "php_spl.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "spl_functions.h"
#include "spl_engine.h"
#include "spl_iterators.h"
@@ -86,7 +86,6 @@ struct _spl_dllist_object {
spl_ptr_llist *llist;
int traverse_position;
spl_ptr_llist_element *traverse_pointer;
- zval retval;
int flags;
zend_function *fptr_offset_get;
zend_function *fptr_offset_set;
@@ -101,8 +100,8 @@ struct _spl_dllist_object {
/* define an overloaded iterator structure */
struct _spl_dllist_it {
zend_user_iterator intern;
- int traverse_position;
spl_ptr_llist_element *traverse_pointer;
+ int traverse_position;
int flags;
};
@@ -143,9 +142,9 @@ static spl_ptr_llist *spl_ptr_llist_init(spl_ptr_llist_ctor_func ctor, spl_ptr_l
}
/* }}} */
-static php_int_t spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */
+static zend_long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */
{
- return (php_int_t)llist->count;
+ return (zend_long)llist->count;
}
/* }}} */
@@ -167,7 +166,7 @@ static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
}
/* }}} */
-static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, php_int_t offset, int backward) /* {{{ */
+static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, zend_long offset, int backward) /* {{{ */
{
spl_ptr_llist_element *current;
@@ -358,7 +357,6 @@ static void spl_dllist_object_free_storage(zend_object *object TSRMLS_DC) /* {{{
spl_ptr_llist_destroy(intern->llist TSRMLS_CC);
SPL_LLIST_CHECK_DELREF(intern->traverse_pointer);
- zval_ptr_dtor(&intern->retval);
if (intern->debug_info != NULL) {
zend_hash_destroy(intern->debug_info);
@@ -474,7 +472,7 @@ static zend_object *spl_dllist_object_clone(zval *zobject TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
+static int spl_dllist_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */
{
spl_dllist_object *intern = Z_SPLDLLIST_P(object);
@@ -482,10 +480,8 @@ static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRML
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
if (!Z_ISUNDEF(rv)) {
- zval_ptr_dtor(&intern->retval);
- ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
- convert_to_int(&intern->retval);
- *count = (php_int_t) Z_IVAL(intern->retval);
+ *count = zval_get_long(&rv);
+ zval_ptr_dtor(&rv);
return SUCCESS;
}
*count = 0;
@@ -520,9 +516,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML
zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);
pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1 TSRMLS_CC);
- ZVAL_INT(&tmp, intern->flags);
+ ZVAL_LONG(&tmp, intern->flags);
zend_hash_add(intern->debug_info, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
array_init(&dllist_array);
@@ -540,7 +536,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML
pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1 TSRMLS_CC);
zend_hash_add(intern->debug_info, pnstr, &dllist_array);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
}
return intern->debug_info;
@@ -673,7 +669,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
Return the number of elements in the datastructure. */
SPL_METHOD(SplDoublyLinkedList, count)
{
- php_int_t count;
+ zend_long count;
spl_dllist_object *intern = Z_SPLDLLIST_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -681,7 +677,7 @@ SPL_METHOD(SplDoublyLinkedList, count)
}
count = spl_ptr_llist_count(intern->llist);
- RETURN_INT(count);
+ RETURN_LONG(count);
}
/* }}} */
@@ -689,7 +685,7 @@ SPL_METHOD(SplDoublyLinkedList, count)
Return true if the SplDoublyLinkedList is empty. */
SPL_METHOD(SplDoublyLinkedList, isEmpty)
{
- php_int_t count;
+ zend_long count;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -704,10 +700,10 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
Set the mode of iteration */
SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
{
- php_int_t value;
+ zend_long value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) {
return;
}
@@ -721,7 +717,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
intern->flags = value & SPL_DLLIST_IT_MASK;
- RETURN_INT(intern->flags);
+ RETURN_LONG(intern->flags);
}
/* }}} */
@@ -737,7 +733,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode)
intern = Z_SPLDLLIST_P(getThis());
- RETURN_INT(intern->flags);
+ RETURN_LONG(intern->flags);
}
/* }}} */
@@ -747,14 +743,14 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists)
{
zval *zindex;
spl_dllist_object *intern;
- php_int_t index;
+ zend_long index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zindex) == FAILURE) {
return;
}
intern = Z_SPLDLLIST_P(getThis());
- index = spl_offset_convert_to_int(zindex TSRMLS_CC);
+ index = spl_offset_convert_to_long(zindex TSRMLS_CC);
RETURN_BOOL(index >= 0 && index < intern->llist->count);
} /* }}} */
@@ -764,7 +760,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists)
SPL_METHOD(SplDoublyLinkedList, offsetGet)
{
zval *zindex;
- php_int_t index;
+ zend_long index;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
@@ -773,7 +769,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet)
}
intern = Z_SPLDLLIST_P(getThis());
- index = spl_offset_convert_to_int(zindex TSRMLS_CC);
+ index = spl_offset_convert_to_long(zindex TSRMLS_CC);
if (index < 0 || index >= intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC);
@@ -808,10 +804,10 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
spl_ptr_llist_push(intern->llist, value TSRMLS_CC);
} else {
/* $obj[$foo] = ... */
- php_int_t index;
+ zend_long index;
spl_ptr_llist_element *element;
- index = spl_offset_convert_to_int(zindex TSRMLS_CC);
+ index = spl_offset_convert_to_long(zindex TSRMLS_CC);
if (index < 0 || index >= intern->llist->count) {
zval_ptr_dtor(value);
@@ -849,7 +845,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
SPL_METHOD(SplDoublyLinkedList, offsetUnset)
{
zval *zindex;
- php_int_t index;
+ zend_long index;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
spl_ptr_llist *llist;
@@ -859,7 +855,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
}
intern = Z_SPLDLLIST_P(getThis());
- index = spl_offset_convert_to_int(zindex TSRMLS_CC);
+ index = spl_offset_convert_to_long(zindex TSRMLS_CC);
llist = intern->llist;
if (index < 0 || index >= intern->llist->count) {
@@ -1006,7 +1002,7 @@ static void spl_dllist_it_get_current_key(zend_object_iterator *iter, zval *key
{
spl_dllist_it *iterator = (spl_dllist_it *)iter;
- ZVAL_INT(key, iterator->traverse_position);
+ ZVAL_LONG(key, iterator->traverse_position);
}
/* }}} */
@@ -1031,7 +1027,7 @@ SPL_METHOD(SplDoublyLinkedList, key)
return;
}
- RETURN_INT(intern->traverse_position);
+ RETURN_LONG(intern->traverse_position);
}
/* }}} */
@@ -1127,7 +1123,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize)
PHP_VAR_SERIALIZE_INIT(var_hash);
/* flags */
- ZVAL_INT(&flags, intern->flags);
+ ZVAL_LONG(&flags, intern->flags);
php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC);
zval_ptr_dtor(&flags);
@@ -1161,7 +1157,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
spl_dllist_object *intern = Z_SPLDLLIST_P(getThis());
zval flags, elem;
char *buf;
- int buf_len;
+ size_t buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
@@ -1181,12 +1177,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
goto error;
}
- if (Z_TYPE(flags) != IS_INT) {
+ if (Z_TYPE(flags) != IS_LONG) {
zval_ptr_dtor(&flags);
goto error;
}
- intern->flags = Z_IVAL(flags);
+ intern->flags = Z_LVAL(flags);
zval_ptr_dtor(&flags);
/* elements */
@@ -1209,7 +1205,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
error:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
return;
} /* }}} */
@@ -1221,14 +1217,14 @@ SPL_METHOD(SplDoublyLinkedList, add)
zval *zindex, *value;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
- php_int_t index;
+ zend_long index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zindex, &value) == FAILURE) {
return;
}
intern = Z_SPLDLLIST_P(getThis());
- index = spl_offset_convert_to_int(zindex TSRMLS_CC);
+ index = spl_offset_convert_to_long(zindex TSRMLS_CC);
if (index < 0 || index > intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC);
@@ -1385,10 +1381,10 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */
spl_handler_SplDoublyLinkedList.dtor_obj = zend_objects_destroy_object;
spl_handler_SplDoublyLinkedList.free_obj = spl_dllist_object_free_storage;
- REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO);
- REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_FIFO", 0);
- REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE);
- REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_KEEP", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO);
+ REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_FIFO", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE);
+ REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_KEEP", 0);
REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Iterator);
REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Countable);
diff --git a/ext/spl/spl_dllist.h b/ext/spl/spl_dllist.h
index c6f82ce57a..b8bd98ef6d 100644
--- a/ext/spl/spl_dllist.h
+++ b/ext/spl/spl_dllist.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 1cae08e652..1e51484394 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -40,9 +40,9 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
}
/* }}} */
-PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
+PHPAPI zend_long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */
{
- php_uint_t idx;
+ zend_ulong idx;
switch (Z_TYPE_P(offset)) {
case IS_STRING:
@@ -51,9 +51,9 @@ PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
}
break;
case IS_DOUBLE:
- return (php_int_t)Z_DVAL_P(offset);
- case IS_INT:
- return Z_IVAL_P(offset);
+ return (zend_long)Z_DVAL_P(offset);
+ case IS_LONG:
+ return Z_LVAL_P(offset);
case IS_FALSE:
return 0;
case IS_TRUE:
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index f5a58e835e..8fa5539ba5 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
-PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC);
+PHPAPI zend_long spl_offset_convert_to_long(zval *offset TSRMLS_DC);
/* {{{ spl_instantiate_arg_ex1 */
static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1 TSRMLS_DC)
@@ -51,6 +51,36 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z
}
/* }}} */
+/* {{{ spl_instantiate_arg_n */
+static inline void spl_instantiate_arg_n(zend_class_entry *pce, zval *retval, int argc, zval *argv TSRMLS_DC)
+{
+ zend_function *func = pce->constructor;
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
+ zval dummy;
+
+ spl_instantiate(pce, retval TSRMLS_CC);
+
+ fci.size = sizeof(zend_fcall_info);
+ fci.function_table = &pce->function_table;
+ ZVAL_STR(&fci.function_name, func->common.function_name);
+ fci.object = Z_OBJ_P(retval);
+ fci.symbol_table = NULL;
+ fci.retval = &dummy;
+ fci.param_count = argc;
+ fci.params = argv;
+ fci.no_separation = 1;
+
+ fcc.initialized = 1;
+ fcc.function_handler = func;
+ fcc.calling_scope = EG(scope);
+ fcc.called_scope = pce;
+ fcc.object = Z_OBJ_P(retval);
+
+ zend_call_function(&fci, &fcc TSRMLS_CC);
+}
+/* }}} */
+
#endif /* SPL_ENGINE_H */
/*
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index 221b25df47..3c6b724b5c 100644
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 5e4e0f702c..e061c86118 100644
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 990805bd4a..ee5ef6b990 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -43,7 +43,7 @@ ZEND_GET_MODULE(spl_fixedarray)
#endif
typedef struct _spl_fixedarray { /* {{{ */
- php_int_t size;
+ zend_long size;
zval *elements;
} spl_fixedarray;
/* }}} */
@@ -81,7 +81,7 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj)
#define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv)))
-static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */
+static void spl_fixedarray_init(spl_fixedarray *array, zend_long size TSRMLS_DC) /* {{{ */
{
if (size > 0) {
array->size = 0; /* reset size in case ecalloc() fails */
@@ -94,7 +94,7 @@ static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC)
}
/* }}} */
-static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */
+static void spl_fixedarray_resize(spl_fixedarray *array, zend_long size TSRMLS_DC) /* {{{ */
{
if (size == array->size) {
/* nothing to do */
@@ -109,7 +109,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_D
/* clearing the array */
if (size == 0) {
- php_int_t i;
+ zend_long i;
for (i = 0; i < array->size; i++) {
zval_ptr_dtor(&(array->elements[i]));
@@ -123,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_D
array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0);
memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size));
} else { /* size < array->size */
- php_int_t i;
+ zend_long i;
for (i = size; i < array->size; i++) {
zval_ptr_dtor(&(array->elements[i]));
@@ -194,7 +194,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* {
static void spl_fixedarray_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
spl_fixedarray_object *intern = spl_fixed_array_from_obj(object);
- php_int_t i;
+ zend_long i;
if (intern->array) {
for (i = 0; i < intern->array->size; i++) {
@@ -328,7 +328,7 @@ static zend_object *spl_fixedarray_object_clone(zval *zobject TSRMLS_DC) /* {{{
static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */
{
- php_int_t index;
+ zend_long index;
/* we have to return NULL on error here to avoid memleak because of
* ZE duplicating uninitialized_zval_ptr */
@@ -337,10 +337,10 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o
return NULL;
}
- if (Z_TYPE_P(offset) != IS_INT) {
- index = spl_offset_convert_to_int(offset TSRMLS_CC);
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ index = spl_offset_convert_to_long(offset TSRMLS_CC);
} else {
- index = Z_IVAL_P(offset);
+ index = Z_LVAL_P(offset);
}
if (index < 0 || intern->array == NULL || index >= intern->array->size) {
@@ -384,7 +384,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in
static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value TSRMLS_DC) /* {{{ */
{
- php_int_t index;
+ zend_long index;
if (!offset) {
/* '$array[] = value' syntax is not supported */
@@ -392,10 +392,10 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o
return;
}
- if (Z_TYPE_P(offset) != IS_INT) {
- index = spl_offset_convert_to_int(offset TSRMLS_CC);
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ index = spl_offset_convert_to_long(offset TSRMLS_CC);
} else {
- index = Z_IVAL_P(offset);
+ index = Z_LVAL_P(offset);
}
if (index < 0 || intern->array == NULL || index >= intern->array->size) {
@@ -438,12 +438,12 @@ static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zv
static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */
{
- php_int_t index;
+ zend_long index;
- if (Z_TYPE_P(offset) != IS_INT) {
- index = spl_offset_convert_to_int(offset TSRMLS_CC);
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ index = spl_offset_convert_to_long(offset TSRMLS_CC);
} else {
- index = Z_IVAL_P(offset);
+ index = Z_LVAL_P(offset);
}
if (index < 0 || intern->array == NULL || index >= intern->array->size) {
@@ -476,13 +476,13 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset TSR
static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_object *intern, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
{
- php_int_t index;
+ zend_long index;
int retval;
- if (Z_TYPE_P(offset) != IS_INT) {
- index = spl_offset_convert_to_int(offset TSRMLS_CC);
+ if (Z_TYPE_P(offset) != IS_LONG) {
+ index = spl_offset_convert_to_long(offset TSRMLS_CC);
} else {
- index = Z_IVAL_P(offset);
+ index = Z_LVAL_P(offset);
}
if (index < 0 || intern->array == NULL || index >= intern->array->size) {
@@ -528,7 +528,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c
}
/* }}} */
-static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
+static int spl_fixedarray_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */
{
spl_fixedarray_object *intern;
@@ -539,8 +539,8 @@ static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count T
if (!Z_ISUNDEF(rv)) {
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
- convert_to_int(&intern->retval);
- *count = (php_int_t) Z_IVAL(intern->retval);
+ convert_to_long(&intern->retval);
+ *count = (zend_long) Z_LVAL(intern->retval);
return SUCCESS;
}
} else if (intern->array) {
@@ -559,9 +559,9 @@ SPL_METHOD(SplFixedArray, __construct)
{
zval *object = getThis();
spl_fixedarray_object *intern;
- php_int_t size = 0;
+ zend_long size = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) {
return;
}
@@ -629,9 +629,9 @@ SPL_METHOD(SplFixedArray, count)
intern = Z_SPLFIXEDARRAY_P(object);
if (intern->array) {
- RETURN_INT(intern->array->size);
+ RETURN_LONG(intern->array->size);
}
- RETURN_INT(0);
+ RETURN_LONG(0);
}
/* }}} */
@@ -684,11 +684,11 @@ SPL_METHOD(SplFixedArray, fromArray)
if (num > 0 && save_indexes) {
zval *element;
zend_string *str_index;
- php_uint_t num_index, max_index = 0;
- php_int_t tmp;
+ zend_ulong num_index, max_index = 0;
+ zend_long tmp;
ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) {
- if (str_index != NULL || (php_int_t)num_index < 0) {
+ if (str_index != NULL || (zend_long)num_index < 0) {
efree(array);
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "array must contain only positive integer keys");
return;
@@ -714,7 +714,7 @@ SPL_METHOD(SplFixedArray, fromArray)
} else if (num > 0 && !save_indexes) {
zval *element;
- php_int_t i = 0;
+ zend_long i = 0;
spl_fixedarray_init(array, num TSRMLS_CC);
@@ -747,9 +747,9 @@ SPL_METHOD(SplFixedArray, getSize)
intern = Z_SPLFIXEDARRAY_P(object);
if (intern->array) {
- RETURN_INT(intern->array->size);
+ RETURN_LONG(intern->array->size);
}
- RETURN_INT(0);
+ RETURN_LONG(0);
}
/* }}} */
@@ -759,9 +759,9 @@ SPL_METHOD(SplFixedArray, setSize)
{
zval *object = getThis();
spl_fixedarray_object *intern;
- php_int_t size;
+ zend_long size;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
return;
}
@@ -895,7 +895,7 @@ static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRML
} else {
zval *data;
- ZVAL_INT(&zindex, object->current);
+ ZVAL_LONG(&zindex, object->current);
data = spl_fixedarray_object_read_dimension_helper(object, &zindex TSRMLS_CC);
zval_ptr_dtor(&zindex);
@@ -915,7 +915,7 @@ static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval *
if (object->flags & SPL_FIXEDARRAY_OVERLOADED_KEY) {
zend_user_it_get_current_key(iter, key TSRMLS_CC);
} else {
- ZVAL_INT(key, object->current);
+ ZVAL_LONG(key, object->current);
}
}
/* }}} */
@@ -943,7 +943,7 @@ SPL_METHOD(SplFixedArray, key)
return;
}
- RETURN_INT(intern->current);
+ RETURN_LONG(intern->current);
}
/* }}} */
@@ -1000,7 +1000,7 @@ SPL_METHOD(SplFixedArray, current)
return;
}
- ZVAL_INT(&zindex, intern->current);
+ ZVAL_LONG(&zindex, intern->current);
value = spl_fixedarray_object_read_dimension_helper(intern, &zindex TSRMLS_CC);
diff --git a/ext/spl/spl_fixedarray.h b/ext/spl/spl_fixedarray.h
index 9011e8c1d5..a61f7ef486 100644
--- a/ext/spl/spl_fixedarray.h
+++ b/ext/spl/spl_fixedarray.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 97a9509caa..f409927271 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -84,8 +84,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla
if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
zval t;
- STR_ADDREF(pce->name);
- ZVAL_STR(&t, pce->name);
+ ZVAL_STR_COPY(&t, pce->name);
zend_hash_add(Z_ARRVAL_P(list), pce->name, &t);
}
}
@@ -95,7 +94,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla
/* {{{ spl_add_interfaces */
void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
{
- zend_uint num_interfaces;
+ uint32_t num_interfaces;
for (num_interfaces = 0; num_interfaces < pce->num_interfaces; num_interfaces++) {
spl_add_class_name(list, pce->interfaces[num_interfaces], allow, ce_flags TSRMLS_CC);
@@ -106,7 +105,7 @@ void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_fl
/* {{{ spl_add_traits */
void spl_add_traits(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
{
- zend_uint num_traits;
+ uint32_t num_traits;
for (num_traits = 0; num_traits < pce->num_traits; num_traits++) {
spl_add_class_name(list, pce->traits[num_traits], allow, ce_flags TSRMLS_CC);
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index f3d8f26a07..3381975e6c 100644
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -46,8 +46,8 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type TSRMLS
#define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \
spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC);
-#define REGISTER_SPL_CLASS_CONST_INT(class_name, const_name, value) \
- zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
+#define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \
+ zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC);
void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC);
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 916ed919f8..d29150c1d6 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -105,7 +105,7 @@ static void spl_ptr_heap_zval_ctor(zval *elem TSRMLS_DC) { /* {{{ */
}
/* }}} */
-static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, php_int_t *result TSRMLS_DC) { /* {{{ */
+static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result TSRMLS_DC) { /* {{{ */
zval zresult;
zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
@@ -114,8 +114,8 @@ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object
return FAILURE;
}
- convert_to_int(&zresult);
- *result = Z_IVAL(zresult);
+ convert_to_long(&zresult);
+ *result = Z_LVAL(zresult);
zval_ptr_dtor(&zresult);
@@ -155,7 +155,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- php_int_t lval = 0;
+ zend_long lval = 0;
if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -165,7 +165,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
}
compare_function(&result, a, b TSRMLS_CC);
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
/* }}} */
@@ -179,7 +179,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- php_int_t lval = 0;
+ zend_long lval = 0;
if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -189,7 +189,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
}
compare_function(&result, b, a TSRMLS_CC);
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
/* }}} */
@@ -210,7 +210,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { /
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- php_int_t lval = 0;
+ zend_long lval = 0;
if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, a_priority_p, b_priority_p, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -220,7 +220,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { /
}
compare_function(&result, a_priority_p, b_priority_p TSRMLS_CC);
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
/* }}} */
@@ -483,7 +483,7 @@ static zend_object *spl_heap_object_clone(zval *zobject TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int spl_heap_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
+static int spl_heap_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */
{
spl_heap_object *intern = Z_SPLHEAP_P(object);
@@ -493,8 +493,8 @@ static int spl_heap_object_count_elements(zval *object, php_int_t *count TSRMLS_
if (!Z_ISUNDEF(rv)) {
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
- convert_to_int(&intern->retval);
- *count = (php_int_t) Z_IVAL(intern->retval);
+ convert_to_long(&intern->retval);
+ *count = (zend_long) Z_LVAL(intern->retval);
return SUCCESS;
}
*count = 0;
@@ -529,14 +529,14 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);
pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1 TSRMLS_CC);
- ZVAL_INT(&tmp, intern->flags);
+ ZVAL_LONG(&tmp, intern->flags);
zend_hash_update(intern->debug_info, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
pnstr = spl_gen_private_prop_name(ce, "isCorrupted", sizeof("isCorrupted")-1 TSRMLS_CC);
ZVAL_BOOL(&tmp, intern->heap->flags&SPL_HEAP_CORRUPTED);
zend_hash_update(intern->debug_info, pnstr, &tmp);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
array_init(&heap_array);
@@ -549,7 +549,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
pnstr = spl_gen_private_prop_name(ce, "heap", sizeof("heap")-1 TSRMLS_CC);
zend_hash_update(intern->debug_info, pnstr, &heap_array);
- STR_RELEASE(pnstr);
+ zend_string_release(pnstr);
}
return intern->debug_info;
@@ -572,7 +572,7 @@ static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp TSRML
Return the number of elements in the heap. */
SPL_METHOD(SplHeap, count)
{
- php_int_t count;
+ zend_long count;
spl_heap_object *intern = Z_SPLHEAP_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -580,7 +580,7 @@ SPL_METHOD(SplHeap, count)
}
count = spl_ptr_heap_count(intern->heap);
- RETURN_INT(count);
+ RETURN_LONG(count);
}
/* }}} */
@@ -761,14 +761,15 @@ SPL_METHOD(SplPriorityQueue, top)
}
/* }}} */
-/* {{{ proto int SplPriorityQueue::setIteratorMode($flags)
+
+/* {{{ proto int SplPriorityQueue::setExtractFlags($flags)
Set the flags of extraction*/
SPL_METHOD(SplPriorityQueue, setExtractFlags)
{
- php_int_t value;
+ zend_long value;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) {
return;
}
@@ -776,7 +777,23 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags)
intern->flags = value & SPL_PQUEUE_EXTR_MASK;
- RETURN_INT(intern->flags);
+ RETURN_LONG(intern->flags);
+}
+/* }}} */
+
+/* {{{ proto int SplPriorityQueue::getExtractFlags()
+ Get the flags of extraction*/
+SPL_METHOD(SplPriorityQueue, getExtractFlags)
+{
+ spl_heap_object *intern;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ intern = Z_SPLHEAP_P(getThis());
+
+ RETURN_LONG(intern->flags);
}
/* }}} */
@@ -798,6 +815,22 @@ SPL_METHOD(SplHeap, recoverFromCorruption)
}
/* }}} */
+/* {{{ proto int SplHeap::isCorrupted()
+ Tells if the heap is in a corrupted state*/
+SPL_METHOD(SplHeap, isCorrupted)
+{
+ spl_heap_object *intern;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ intern = Z_SPLHEAP_P(getThis());
+
+ RETURN_BOOL(intern->heap->flags & SPL_HEAP_CORRUPTED);
+}
+/* }}} */
+
/* {{{ proto bool SplPriorityQueue::compare(mixed $a, mixed $b)
compare the priorities */
SPL_METHOD(SplPriorityQueue, compare)
@@ -808,7 +841,7 @@ SPL_METHOD(SplPriorityQueue, compare)
return;
}
- RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC));
+ RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC));
}
/* }}} */
@@ -851,7 +884,7 @@ SPL_METHOD(SplMinHeap, compare)
return;
}
- RETURN_INT(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC));
+ RETURN_LONG(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC));
}
/* }}} */
@@ -865,7 +898,7 @@ SPL_METHOD(SplMaxHeap, compare)
return;
}
- RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC));
+ RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC));
}
/* }}} */
@@ -934,7 +967,7 @@ static void spl_heap_it_get_current_key(zend_object_iterator *iter, zval *key TS
{
spl_heap_object *object = Z_SPLHEAP_P(&iter->data);
- ZVAL_INT(key, object->heap->count - 1);
+ ZVAL_LONG(key, object->heap->count - 1);
}
/* }}} */
@@ -966,7 +999,7 @@ SPL_METHOD(SplHeap, key)
return;
}
- RETURN_INT(intern->heap->count - 1);
+ RETURN_LONG(intern->heap->count - 1);
}
/* }}} */
@@ -1158,6 +1191,7 @@ static const zend_function_entry spl_funcs_SplPriorityQueue[] = {
SPL_ME(SplPriorityQueue, compare, arginfo_heap_compare, ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, insert, arginfo_pqueue_insert, ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, setExtractFlags, arginfo_pqueue_setflags, ZEND_ACC_PUBLIC)
+ SPL_ME(SplPriorityQueue, getExtractFlags, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, top, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplPriorityQueue, extract, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, count, arginfo_splheap_void, ZEND_ACC_PUBLIC)
@@ -1168,6 +1202,7 @@ static const zend_function_entry spl_funcs_SplPriorityQueue[] = {
SPL_ME(SplHeap, next, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, valid, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, recoverFromCorruption, arginfo_splheap_void, ZEND_ACC_PUBLIC)
+ SPL_ME(SplHeap, isCorrupted, arginfo_splheap_void, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -1183,6 +1218,7 @@ static const zend_function_entry spl_funcs_SplHeap[] = {
SPL_ME(SplHeap, next, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, valid, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, recoverFromCorruption, arginfo_splheap_void, ZEND_ACC_PUBLIC)
+ SPL_ME(SplHeap, isCorrupted, arginfo_splheap_void, ZEND_ACC_PUBLIC)
ZEND_FENTRY(compare, NULL, NULL, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT)
{NULL, NULL, NULL}
};
@@ -1226,9 +1262,9 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */
spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator;
- REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH);
- REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY);
- REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA);
+ REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH);
+ REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY);
+ REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA);
return SUCCESS;
}
diff --git a/ext/spl/spl_heap.h b/ext/spl/spl_heap.h
index a3ac4a8f5c..7d0a8a319d 100644
--- a/ext/spl/spl_heap.h
+++ b/ext/spl/spl_heap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 87cdb70007..8b09e3ef37 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,7 +35,7 @@
#include "spl_directory.h"
#include "spl_array.h"
#include "spl_exceptions.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#ifdef accept
#undef accept
@@ -228,7 +228,7 @@ static void spl_recursive_it_get_current_key(zend_object_iterator *iter, zval *k
if (sub_iter->funcs->get_current_key) {
sub_iter->funcs->get_current_key(sub_iter, key TSRMLS_CC);
} else {
- ZVAL_INT(key, iter->index);
+ ZVAL_LONG(key, iter->index);
}
}
@@ -473,7 +473,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
spl_recursive_it_object *intern;
zval *iterator;
zend_class_entry *ce_iterator;
- php_int_t mode, flags;
+ zend_long mode, flags;
int inc_refcount = 1;
zend_error_handling error_handling;
@@ -486,7 +486,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
mode = RIT_SELF_FIRST;
flags = RTIT_BYPASS_KEY;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|izi", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator;
zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator);
@@ -496,7 +496,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (user_caching_it_flags) {
ZVAL_ZVAL(&caching_it_flags, user_caching_it_flags, 1, 0);
} else {
- ZVAL_INT(&caching_it_flags, CIT_CATCH_GET_CHILD);
+ ZVAL_LONG(&caching_it_flags, CIT_CATCH_GET_CHILD);
}
spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, iterator, &caching_it_flags TSRMLS_CC);
zval_ptr_dtor(&caching_it_flags);
@@ -515,7 +515,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
mode = RIT_LEAVES_ONLY;
flags = 0;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ii", &iterator, &mode, &flags) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator;
zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator);
@@ -695,7 +695,7 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth)
return;
}
- RETURN_INT(object->level);
+ RETURN_LONG(object->level);
} /* }}} */
/* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level])
@@ -703,9 +703,9 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth)
SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- php_int_t level = object->level;
+ zend_long level = object->level;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &level) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
return;
}
if (level < 0 || level > object->level) {
@@ -846,9 +846,9 @@ SPL_METHOD(RecursiveIteratorIterator, nextElement)
SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- php_int_t max_depth = -1;
+ zend_long max_depth = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_depth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) {
return;
}
if (max_depth < -1) {
@@ -871,7 +871,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
if (object->max_depth == -1) {
RETURN_FALSE;
} else {
- RETURN_INT(object->max_depth);
+ RETURN_LONG(object->max_depth);
}
} /* }}} */
@@ -879,11 +879,11 @@ static union _zend_function *spl_recursive_it_get_method(zend_object **zobject,
{
union _zend_function *function_handler;
spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject);
- php_int_t level = object->level;
+ zend_long level = object->level;
zval *zobj;
if (!object->iterators) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", zend_get_class_entry(*zobject TSRMLS_CC)->name->val);
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", (*zobject)->ce->name->val);
}
zobj = &object->iterators[level].zobject;
@@ -1088,12 +1088,12 @@ SPL_METHOD(RecursiveTreeIterator, __construct)
Sets prefix parts as used in getPrefix() */
SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
{
- php_int_t part;
+ zend_long part;
char* prefix;
- int prefix_len;
+ size_t prefix_len;
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &part, &prefix, &prefix_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) {
return;
}
@@ -1131,7 +1131,7 @@ SPL_METHOD(RecursiveTreeIterator, setPostfix)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
char* postfix;
- int postfix_len;
+ size_t postfix_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &postfix, &postfix_len) == FAILURE) {
return;
@@ -1222,15 +1222,15 @@ SPL_METHOD(RecursiveTreeIterator, current)
}
spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);
- str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix), 0);
+ str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0);
ptr = str->val;
- memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix));
- ptr += Z_STRSIZE(prefix);
- memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry));
- ptr += Z_STRSIZE(entry);
- memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix));
- ptr += Z_STRSIZE(postfix);
+ memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
+ ptr += Z_STRLEN(prefix);
+ memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry));
+ ptr += Z_STRLEN(entry);
+ memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix));
+ ptr += Z_STRLEN(postfix);
*ptr = 0;
zval_ptr_dtor(&prefix);
@@ -1278,15 +1278,15 @@ SPL_METHOD(RecursiveTreeIterator, key)
spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC);
spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC);
- str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix), 0);
+ str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0);
ptr = str->val;
- memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix));
- ptr += Z_STRSIZE(prefix);
- memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key));
- ptr += Z_STRSIZE(key);
- memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix));
- ptr += Z_STRSIZE(postfix);
+ memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
+ ptr += Z_STRLEN(prefix);
+ memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key));
+ ptr += Z_STRLEN(key);
+ memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix));
+ ptr += Z_STRLEN(postfix);
*ptr = 0;
zval_ptr_dtor(&prefix);
@@ -1387,7 +1387,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
}
p = EG(argument_stack).top_element-2;
- arg_count = (php_uint_t) *p;
+ arg_count = (zend_ulong) *p;
func_params = safe_emalloc(sizeof(zval **), arg_count, 0);
@@ -1457,7 +1457,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_LimitIterator: {
intern->u.limit.offset = 0; /* start at beginning */
intern->u.limit.count = -1; /* get all */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -1475,8 +1475,8 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
}
case DIT_CachingIterator:
case DIT_RecursiveCachingIterator: {
- php_int_t flags = CIT_CALL_TOSTRING;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &zobject, ce_inner, &flags) == FAILURE) {
+ zend_long flags = CIT_CALL_TOSTRING;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -1539,12 +1539,12 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_RegexIterator:
case DIT_RecursiveRegexIterator: {
zend_string *regex;
- php_int_t mode = REGIT_MODE_MATCH;
+ zend_long mode = REGIT_MODE_MATCH;
intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5;
intern->u.regex.flags = 0;
intern->u.regex.preg_flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|iii", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -1554,7 +1554,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
return NULL;
}
intern->u.regex.mode = mode;
- intern->u.regex.regex = STR_COPY(regex);
+ intern->u.regex.regex = zend_string_copy(regex);
intern->u.regex.pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC);
if (intern->u.regex.pce == NULL) {
/* pcre_get_compiled_regex_cache has already sent error */
@@ -1709,7 +1709,7 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T
ZVAL_UNDEF(&intern->current.key);
}
} else {
- ZVAL_INT(&intern->current.key, intern->current.pos);
+ ZVAL_LONG(&intern->current.key, intern->current.pos);
}
return EG(exception) ? FAILURE : SUCCESS;
}
@@ -2037,8 +2037,10 @@ SPL_METHOD(RegexIterator, accept)
if (Z_TYPE(intern->current.data) == IS_UNDEF) {
RETURN_FALSE;
+ } else if (Z_TYPE(intern->current.data) == IS_ARRAY) {
+ RETURN_FALSE;
}
-
+
if (intern->u.regex.flags & REGIT_USE_KEY) {
subject_ptr = &intern->current.key;
} else {
@@ -2049,10 +2051,10 @@ SPL_METHOD(RegexIterator, accept)
use_copy = zend_make_printable_zval(subject_ptr, &subject_copy TSRMLS_CC);
if (use_copy) {
subject = Z_STRVAL(subject_copy);
- subject_len = Z_STRSIZE(subject_copy);
+ subject_len = Z_STRLEN(subject_copy);
} else {
subject = Z_STRVAL_P(subject_ptr);
- subject_len = Z_STRSIZE_P(subject_ptr);
+ subject_len = Z_STRLEN_P(subject_ptr);
}
use_copy = 0;
@@ -2074,8 +2076,7 @@ SPL_METHOD(RegexIterator, accept)
ZVAL_UNDEF(&intern->current.data);
php_pcre_match_impl(intern->u.regex.pce, subject, subject_len, &zcount,
&intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, intern->u.regex.preg_flags, 0 TSRMLS_CC);
- count = zend_hash_num_elements(Z_ARRVAL(intern->current.data));
- RETVAL_BOOL(count > 0);
+ RETVAL_BOOL(Z_LVAL(zcount) > 0);
break;
case REGIT_MODE_SPLIT:
@@ -2136,7 +2137,7 @@ SPL_METHOD(RegexIterator, getRegex)
return;
}
- RETURN_STR(STR_COPY(intern->u.regex.regex));
+ RETURN_STR(zend_string_copy(intern->u.regex.regex));
} /* }}} */
/* {{{ proto bool RegexIterator::getMode()
@@ -2151,7 +2152,7 @@ SPL_METHOD(RegexIterator, getMode)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- RETURN_INT(intern->u.regex.mode);
+ RETURN_LONG(intern->u.regex.mode);
} /* }}} */
/* {{{ proto bool RegexIterator::setMode(int new_mode)
@@ -2159,9 +2160,9 @@ SPL_METHOD(RegexIterator, getMode)
SPL_METHOD(RegexIterator, setMode)
{
spl_dual_it_object *intern;
- php_int_t mode;
+ zend_long mode;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
return;
}
@@ -2187,7 +2188,7 @@ SPL_METHOD(RegexIterator, getFlags)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- RETURN_INT(intern->u.regex.flags);
+ RETURN_LONG(intern->u.regex.flags);
} /* }}} */
/* {{{ proto bool RegexIterator::setFlags(int new_flags)
@@ -2195,9 +2196,9 @@ SPL_METHOD(RegexIterator, getFlags)
SPL_METHOD(RegexIterator, setFlags)
{
spl_dual_it_object *intern;
- php_int_t flags;
+ zend_long flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
return;
}
@@ -2219,7 +2220,7 @@ SPL_METHOD(RegexIterator, getPregFlags)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (intern->u.regex.use_flags) {
- RETURN_INT(intern->u.regex.preg_flags);
+ RETURN_LONG(intern->u.regex.preg_flags);
} else {
return;
}
@@ -2230,9 +2231,9 @@ SPL_METHOD(RegexIterator, getPregFlags)
SPL_METHOD(RegexIterator, setPregFlags)
{
spl_dual_it_object *intern;
- php_int_t preg_flags;
+ zend_long preg_flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &preg_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preg_flags) == FAILURE) {
return;
}
@@ -2254,7 +2255,7 @@ SPL_METHOD(RecursiveRegexIterator, __construct)
SPL_METHOD(RecursiveRegexIterator, getChildren)
{
spl_dual_it_object *intern;
- zval retval, regex;
+ zval retval;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -2264,13 +2265,40 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception)) {
- ZVAL_STR(&regex, STR_COPY(intern->u.regex.regex));
- spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &retval, &regex TSRMLS_CC);
- zval_ptr_dtor(&regex);
+ zval args[5];
+
+ ZVAL_COPY(&args[0], &retval);
+ ZVAL_STR_COPY(&args[1], intern->u.regex.regex);
+ ZVAL_LONG(&args[2], intern->u.regex.mode);
+ ZVAL_LONG(&args[3], intern->u.regex.flags);
+ ZVAL_LONG(&args[4], intern->u.regex.preg_flags);
+
+ spl_instantiate_arg_n(Z_OBJCE_P(getThis()), return_value, 5, args TSRMLS_CC);
+
+ zval_ptr_dtor(&args[1]);
}
zval_ptr_dtor(&retval);
} /* }}} */
+SPL_METHOD(RecursiveRegexIterator, accept)
+{
+ spl_dual_it_object *intern;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
+
+ if (Z_TYPE(intern->current.data) == IS_UNDEF) {
+ RETURN_FALSE;
+ } else if (Z_TYPE(intern->current.data) == IS_ARRAY) {
+ RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0);
+ }
+
+ zend_call_method_with_0_params(getThis(), spl_ce_RegexIterator, NULL, "accept", return_value);
+}
+
#endif
/* {{{ spl_dual_it_dtor */
@@ -2319,7 +2347,7 @@ static void spl_dual_it_free_storage(zend_object *_object TSRMLS_DC)
object->u.regex.pce->refcount--;
}
if (object->u.regex.regex) {
- STR_RELEASE(object->u.regex.regex);
+ zend_string_release(object->u.regex.regex);
}
}
#endif
@@ -2456,6 +2484,7 @@ ZEND_END_ARG_INFO();
static const zend_function_entry spl_funcs_RecursiveRegexIterator[] = {
SPL_ME(RecursiveRegexIterator, __construct, arginfo_rec_regex_it___construct, ZEND_ACC_PUBLIC)
+ SPL_ME(RecursiveRegexIterator, accept, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveFilterIterator, hasChildren, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveRegexIterator, getChildren, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
PHP_FE_END
@@ -2472,7 +2501,7 @@ static inline int spl_limit_it_valid(spl_dual_it_object *intern TSRMLS_DC)
}
}
-static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos TSRMLS_DC)
+static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos TSRMLS_DC)
{
zval zpos;
@@ -2486,7 +2515,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos T
return;
}
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
- ZVAL_INT(&zpos, pos);
+ ZVAL_LONG(&zpos, pos);
spl_dual_it_free(intern TSRMLS_CC);
zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos);
zval_ptr_dtor(&zpos);
@@ -2560,15 +2589,15 @@ SPL_METHOD(LimitIterator, next)
SPL_METHOD(LimitIterator, seek)
{
spl_dual_it_object *intern;
- php_int_t pos;
+ zend_long pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
spl_limit_it_seek(intern, pos TSRMLS_CC);
- RETURN_INT(intern->current.pos);
+ RETURN_LONG(intern->current.pos);
} /* }}} */
/* {{{ proto int LimitIterator::getPosition()
@@ -2577,7 +2606,7 @@ SPL_METHOD(LimitIterator, getPosition)
{
spl_dual_it_object *intern;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- RETURN_INT(intern->current.pos);
+ RETURN_LONG(intern->current.pos);
} /* }}} */
ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0)
@@ -2660,7 +2689,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
return;
}
} else {
- ZVAL_INT(&zflags, intern->u.caching.flags & CIT_PUBLIC);
+ ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC);
spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, &zchildren, &zflags TSRMLS_CC);
zval_ptr_dtor(&zchildren);
}
@@ -2792,7 +2821,7 @@ SPL_METHOD(CachingIterator, __toString)
return;
}
if (Z_TYPE(intern->u.caching.zstr) == IS_STRING) {
- RETURN_STR(STR_COPY(Z_STR_P(&intern->u.caching.zstr)));
+ RETURN_STR(zend_string_copy(Z_STR_P(&intern->u.caching.zstr)));
} else {
RETURN_NULL();
}
@@ -2929,7 +2958,7 @@ SPL_METHOD(CachingIterator, getFlags)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- RETURN_INT(intern->u.caching.flags);
+ RETURN_LONG(intern->u.caching.flags);
}
/* }}} */
@@ -2938,11 +2967,11 @@ SPL_METHOD(CachingIterator, getFlags)
SPL_METHOD(CachingIterator, setFlags)
{
spl_dual_it_object *intern;
- php_int_t flags;
+ zend_long flags;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
return;
}
@@ -2983,7 +3012,7 @@ SPL_METHOD(CachingIterator, count)
return;
}
- RETURN_INT(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache)));
+ RETURN_LONG(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache)));
}
/* }}} */
@@ -3574,7 +3603,7 @@ PHP_FUNCTION(iterator_to_array)
static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
{
- (*(php_int_t*)puser)++;
+ (*(zend_long*)puser)++;
return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
@@ -3584,14 +3613,14 @@ static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRM
PHP_FUNCTION(iterator_count)
{
zval *obj;
- php_int_t count = 0;
+ zend_long count = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
RETURN_FALSE;
}
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) {
- RETURN_INT(count);
+ RETURN_LONG(count);
}
}
/* }}} */
@@ -3599,7 +3628,7 @@ PHP_FUNCTION(iterator_count)
typedef struct {
zval *obj;
zval *args;
- php_int_t count;
+ zend_long count;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} spl_iterator_apply_info;
@@ -3636,7 +3665,7 @@ PHP_FUNCTION(iterator_apply)
apply_info.count = 0;
zend_fcall_info_args(&apply_info.fci, apply_info.args TSRMLS_CC);
if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info TSRMLS_CC) == SUCCESS) {
- RETVAL_INT(apply_info.count);
+ RETVAL_LONG(apply_info.count);
} else {
RETVAL_FALSE;
}
@@ -3682,10 +3711,10 @@ PHP_MINIT_FUNCTION(spl_iterators)
spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator;
spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs;
- REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD);
REGISTER_SPL_INTERFACE(OuterIterator);
REGISTER_SPL_ITERATOR(OuterIterator);
@@ -3718,12 +3747,12 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess);
REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER);
- REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER);
+ REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE);
REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator);
REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator);
@@ -3737,13 +3766,13 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator);
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "USE_KEY", REGIT_USE_KEY);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "INVERT_MATCH",REGIT_INVERTED);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "MATCH", REGIT_MODE_MATCH);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "SPLIT", REGIT_MODE_SPLIT);
- REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "REPLACE", REGIT_MODE_REPLACE);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT", REGIT_MODE_SPLIT);
+ REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE", REGIT_MODE_REPLACE);
REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0);
REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator);
REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator);
@@ -3756,14 +3785,14 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_ITERATOR(EmptyIterator);
REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_LEFT", 0);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_LAST", 2);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_LAST", 4);
- REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_RIGHT", 5);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_LAST", 2);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_LAST", 4);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_RIGHT", 5);
return SUCCESS;
}
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 851436350b..f0740275dc 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -139,11 +139,11 @@ typedef struct _spl_dual_it_object {
dual_it_type dit_type;
union {
struct {
- php_int_t offset;
- php_int_t count;
+ zend_long offset;
+ zend_long count;
} limit;
struct {
- php_int_t flags; /* CIT_* */
+ zend_long flags; /* CIT_* */
zval zstr;
zval zchildren;
zval zcache;
@@ -154,12 +154,12 @@ typedef struct _spl_dual_it_object {
} append;
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
struct {
- int use_flags;
- php_int_t flags;
- regex_mode mode;
- php_int_t preg_flags;
+ zend_long flags;
+ zend_long preg_flags;
pcre_cache_entry *pce;
zend_string *regex;
+ regex_mode mode;
+ int use_flags;
} regex;
#endif
_spl_cbfilter_it_intern *cbfilter;
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 18a2b9699e..d3ce72aaa3 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,7 @@
#include "ext/standard/info.h"
#include "ext/standard/php_array.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"
@@ -81,9 +81,9 @@ PHPAPI zend_object_handlers spl_handler_SplObjectStorage;
typedef struct _spl_SplObjectStorage { /* {{{ */
HashTable storage;
- php_int_t index;
+ zend_long index;
HashPosition pos;
- php_int_t flags;
+ zend_long flags;
zend_function *fptr_get_hash;
HashTable *debug_info;
zend_object std;
@@ -133,7 +133,7 @@ static zend_string *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zv
return NULL;
}
} else {
- zend_string *hash = STR_ALLOC(sizeof(zend_object*), 0);
+ zend_string *hash = zend_string_alloc(sizeof(zend_object*), 0);
memcpy(hash->val, (void*)&Z_OBJ_P(obj), sizeof(zend_object*));
hash->val[hash->len] = '\0';
return hash;
@@ -170,7 +170,7 @@ static zend_string *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zv
}
static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, zend_string *hash) {
- STR_RELEASE(hash);
+ zend_string_release(hash);
/*
if (intern->fptr_get_hash) {
} else {
@@ -338,12 +338,12 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D
add_assoc_zval_ex(&tmp, "obj", sizeof("obj") - 1, &element->obj);
add_assoc_zval_ex(&tmp, "inf", sizeof("inf") - 1, &element->inf);
zend_hash_update(Z_ARRVAL(storage), md5str, &tmp);
- STR_RELEASE(md5str);
+ zend_string_release(md5str);
} ZEND_HASH_FOREACH_END();
zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", sizeof("storage")-1 TSRMLS_CC);
zend_symtable_update(intern->debug_info, zname, &storage);
- STR_RELEASE(zname);
+ zend_string_release(zname);
}
return intern->debug_info;
@@ -398,7 +398,7 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2 TSRMLS_DC) /* {{{
return 1;
}
- return Z_IVAL(result);
+ return Z_LVAL(result);
}
/* }}} */
@@ -523,7 +523,7 @@ SPL_METHOD(SplObjectStorage, addAll)
spl_object_storage_addall(intern, getThis(), other TSRMLS_CC);
- RETURN_INT(zend_hash_num_elements(&intern->storage));
+ RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
/* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os)
@@ -551,7 +551,7 @@ SPL_METHOD(SplObjectStorage, removeAll)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
intern->index = 0;
- RETURN_INT(zend_hash_num_elements(&intern->storage));
+ RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
/* {{{ proto bool SplObjectStorage::removeAllExcept(SplObjectStorage $os)
@@ -578,7 +578,7 @@ SPL_METHOD(SplObjectStorage, removeAllExcept)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
intern->index = 0;
- RETURN_INT(zend_hash_num_elements(&intern->storage));
+ RETURN_LONG(zend_hash_num_elements(&intern->storage));
}
/* }}} */
@@ -600,25 +600,25 @@ SPL_METHOD(SplObjectStorage, contains)
SPL_METHOD(SplObjectStorage, count)
{
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis());
- php_int_t mode = COUNT_NORMAL;
+ zend_long mode = COUNT_NORMAL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
return;
}
if (mode == COUNT_RECURSIVE) {
- php_int_t ret = zend_hash_num_elements(&intern->storage);
+ zend_long ret = zend_hash_num_elements(&intern->storage);
zval *element;
ZEND_HASH_FOREACH_VAL(&intern->storage, element) {
ret += php_count_recursive(element, mode TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
- RETURN_INT(ret);
+ RETURN_LONG(ret);
return;
}
- RETURN_INT(zend_hash_num_elements(&intern->storage));
+ RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
/* {{{ proto void SplObjectStorage::rewind()
@@ -658,7 +658,7 @@ SPL_METHOD(SplObjectStorage, key)
return;
}
- RETURN_INT(intern->index);
+ RETURN_LONG(intern->index);
} /* }}} */
/* {{{ proto mixed SplObjectStorage::current()
@@ -748,7 +748,7 @@ SPL_METHOD(SplObjectStorage, serialize)
/* storage */
smart_str_appendl(&buf, "x:", 2);
- ZVAL_INT(&flags, zend_hash_num_elements(&intern->storage));
+ ZVAL_LONG(&flags, zend_hash_num_elements(&intern->storage));
php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC);
zval_ptr_dtor(&flags);
@@ -792,12 +792,12 @@ SPL_METHOD(SplObjectStorage, unserialize)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis());
char *buf;
- int buf_len;
+ size_t buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
zval entry, pmembers, pcount, inf;
spl_SplObjectStorageElement *element;
- php_int_t count;
+ zend_long count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
return;
@@ -819,13 +819,13 @@ SPL_METHOD(SplObjectStorage, unserialize)
if (!php_var_unserialize(&pcount, &p, s + buf_len, &var_hash TSRMLS_CC)) {
goto outexcept;
}
- if (Z_TYPE(pcount) != IS_INT) {
+ if (Z_TYPE(pcount) != IS_LONG) {
zval_ptr_dtor(&pcount);
goto outexcept;
}
--p; /* for ';' */
- count = Z_IVAL(pcount);
+ count = Z_LVAL(pcount);
while (count-- > 0) {
spl_SplObjectStorageElement *pelement;
@@ -906,7 +906,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (php_int_t)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
return;
} /* }}} */
@@ -983,12 +983,12 @@ typedef enum {
SPL_METHOD(MultipleIterator, __construct)
{
spl_SplObjectStorage *intern;
- php_int_t flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC;
+ zend_long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -1008,7 +1008,7 @@ SPL_METHOD(MultipleIterator, getFlags)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- RETURN_INT(intern->flags);
+ RETURN_LONG(intern->flags);
}
/* }}} */
@@ -1019,7 +1019,7 @@ SPL_METHOD(MultipleIterator, setFlags)
spl_SplObjectStorage *intern;
intern = Z_SPLOBJSTORAGE_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) {
return;
}
}
@@ -1042,7 +1042,7 @@ SPL_METHOD(MultipleIterator, attachIterator)
spl_SplObjectStorageElement *element;
zval compare_result;
- if (Z_TYPE_P(info) != IS_INT && Z_TYPE_P(info) != IS_STRING) {
+ if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0 TSRMLS_CC);
return;
}
@@ -1115,7 +1115,7 @@ SPL_METHOD(MultipleIterator, valid)
spl_SplObjectStorage *intern;
spl_SplObjectStorageElement *element;
zval *it, retval;
- php_int_t expect, valid;
+ zend_long expect, valid;
intern = Z_SPLOBJSTORAGE_P(getThis());
@@ -1200,8 +1200,8 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
if (intern->flags & MIT_KEYS_ASSOC) {
switch (Z_TYPE(element->inf)) {
- case IS_INT:
- add_index_zval(return_value, Z_IVAL(element->inf), &retval);
+ case IS_LONG:
+ add_index_zval(return_value, Z_LVAL(element->inf), &retval);
break;
case IS_STRING:
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval);
@@ -1309,10 +1309,10 @@ PHP_MINIT_FUNCTION(spl_observer)
REGISTER_SPL_STD_CLASS_EX(MultipleIterator, spl_SplObjectStorage_new, spl_funcs_MultipleIterator);
REGISTER_SPL_ITERATOR(MultipleIterator);
- REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY);
- REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL);
- REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC);
- REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC);
+ REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY);
+ REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL);
+ REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC);
+ REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC);
return SUCCESS;
}
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index 51573d732f..640f79cde3 100644
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/spl/tests/bug54281.phpt b/ext/spl/tests/bug54281.phpt
index 71792eaa20..9a19a59ad8 100644
--- a/ext/spl/tests/bug54281.phpt
+++ b/ext/spl/tests/bug54281.phpt
@@ -14,6 +14,6 @@ foreach($it as $k=>$v) { }
--EXPECTF--
Fatal error: Uncaught exception 'LogicException' with message 'The object is in an invalid state as the parent constructor was not called' in %s:%d
Stack trace:
-#0 %s/bug54281.php(8): RecursiveIteratorIterator->rewind()
+#0 %s%ebug54281.php(8): RecursiveIteratorIterator->rewind()
#1 {main}
- thrown in %s/bug54281.php on line 8
+ thrown in %s%ebug54281.php on line 8
diff --git a/ext/spl/tests/bug68128.phpt b/ext/spl/tests/bug68128.phpt
new file mode 100644
index 0000000000..ff41dd4931
--- /dev/null
+++ b/ext/spl/tests/bug68128.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Bug #68128 - RecursiveRegexIterator raises "Array to string conversion" notice
+--FILE--
+<?php
+
+$array = new ArrayIterator(array('a', array('b', 'c')));
+$regex = new RegexIterator($array, '/Array/');
+
+foreach ($regex as $match) {
+ var_dump($match);
+}
+
+$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
+$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^(t)est(\d*)/',
+ RecursiveRegexIterator::ALL_MATCHES, 0, PREG_PATTERN_ORDER);
+
+foreach ($rRegexIterator as $key1 => $value1) {
+
+ if ($rRegexIterator->hasChildren()) {
+
+ // print all children
+ echo "Children: ";
+ foreach ($rRegexIterator->getChildren() as $key => $value) {
+ print_r($value);
+ }
+ echo "\n";
+ } else {
+ echo "No children ";
+ print_r($value1);
+ echo "\n";
+ }
+}
+
+?>
+--EXPECT--
+No children Array
+(
+ [0] => Array
+ (
+ [0] => test1
+ )
+
+ [1] => Array
+ (
+ [0] => t
+ )
+
+ [2] => Array
+ (
+ [0] => 1
+ )
+
+)
+
+Children: Array
+(
+ [0] => Array
+ (
+ [0] => test4
+ )
+
+ [1] => Array
+ (
+ [0] => t
+ )
+
+ [2] => Array
+ (
+ [0] => 4
+ )
+
+)
+Array
+(
+ [0] => Array
+ (
+ [0] => test5
+ )
+
+ [1] => Array
+ (
+ [0] => t
+ )
+
+ [2] => Array
+ (
+ [0] => 5
+ )
+
+)
+
diff --git a/ext/spl/tests/heap_corruption.phpt b/ext/spl/tests/heap_corruption.phpt
index 284ee1db81..5e9dec7855 100644
--- a/ext/spl/tests/heap_corruption.phpt
+++ b/ext/spl/tests/heap_corruption.phpt
@@ -42,6 +42,8 @@ $heap->insert(4);
$heap->allow_compare = false;
+var_dump($heap->isCorrupted());
+
try {
$heap->extract();
}
@@ -56,7 +58,13 @@ catch (Exception $e) {
echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
}
+var_dump($heap->isCorrupted());
+$heap->recoverFromCorruption();
+var_dump($heap->isCorrupted());
?>
--EXPECT--
+bool(false)
Compare Exception: Compare exception
-Corruption Exception: Heap is corrupted, heap properties are no longer ensured. \ No newline at end of file
+Corruption Exception: Heap is corrupted, heap properties are no longer ensured.
+bool(true)
+bool(false) \ No newline at end of file
diff --git a/ext/spl/tests/iterator_048.phpt b/ext/spl/tests/iterator_048.phpt
index bad4e7888a..64ca97f4d6 100644
--- a/ext/spl/tests/iterator_048.phpt
+++ b/ext/spl/tests/iterator_048.phpt
@@ -13,11 +13,6 @@ class MyRecursiveRegexIterator extends RecursiveRegexIterator
var_dump($v);
}
}
-
- function accept()
- {
- return $this->hasChildren() || parent::accept();
- }
}
$ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz'));
diff --git a/ext/spl/tests/iterator_050.phpt b/ext/spl/tests/iterator_050.phpt
index fed4a3b2ee..63d8fbfa9a 100644
--- a/ext/spl/tests/iterator_050.phpt
+++ b/ext/spl/tests/iterator_050.phpt
@@ -46,8 +46,6 @@ array(3) {
[2]=>
%s(1) "2"
}
-
-Notice: Array to string conversion in %siterator_050.php on line %d
int(0)
array(2) {
[0]=>
@@ -69,8 +67,6 @@ array(2) {
[1]=>
%s(1) "1"
}
-
-Notice: Array to string conversion in %siterator_050.php on line %d
object(ArrayIterator)#%d (1) {
%s"storage"%s"ArrayIterator":private]=>
array(9) {
diff --git a/ext/spl/tests/iterator_052.phpt b/ext/spl/tests/iterator_052.phpt
index c68bd5234d..84b3eb993c 100644
--- a/ext/spl/tests/iterator_052.phpt
+++ b/ext/spl/tests/iterator_052.phpt
@@ -46,18 +46,6 @@ var_dump($ar);
<?php exit(0); ?>
--EXPECTF--
bool(true)
-int(0)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
int(1)
array(3) {
@@ -97,85 +85,11 @@ array(3) {
}
}
bool(true)
-int(3)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(4)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
-
-Notice: Array to string conversion in %siterator_052.php on line %d
+bool(false)
bool(true)
-int(5)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(6)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(7)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
-bool(true)
-int(8)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
int(0)
array(2) {
@@ -231,67 +145,11 @@ array(2) {
}
}
bool(true)
-int(3)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
-bool(true)
-int(4)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
-
-Notice: Array to string conversion in %siterator_052.php on line %d
bool(true)
-int(5)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
+bool(false)
bool(true)
-int(6)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
bool(true)
-int(7)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
bool(true)
-int(8)
-array(2) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
-}
object(ArrayIterator)#%d (1) {
["storage":"ArrayIterator":private]=>
array(9) {
diff --git a/ext/spl/tests/iterator_053.phpt b/ext/spl/tests/iterator_053.phpt
index 5d9c740c31..b472523ab6 100644
--- a/ext/spl/tests/iterator_053.phpt
+++ b/ext/spl/tests/iterator_053.phpt
@@ -46,122 +46,14 @@ var_dump($ar);
<?php exit(0); ?>
--EXPECTF--
bool(true)
-int(0)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(1)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(2)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
-bool(true)
-int(3)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(4)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(5)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
+bool(false)
bool(true)
-int(6)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(7)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
-int(8)
-array(3) {
- [0]=>
- array(0) {
- }
- [1]=>
- array(0) {
- }
- [2]=>
- array(0) {
- }
-}
bool(true)
int(0)
array(2) {
@@ -232,20 +124,7 @@ array(2) {
string(1) "4"
}
}
-bool(true)
-int(5)
-array(2) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "5"
- }
- [1]=>
- array(1) {
- [0]=>
- string(1) "5"
- }
-}
+bool(false)
bool(true)
int(6)
array(2) {
diff --git a/ext/spl/tests/iterator_054.phpt b/ext/spl/tests/iterator_054.phpt
index 1f1cd580c1..91266c9571 100644
--- a/ext/spl/tests/iterator_054.phpt
+++ b/ext/spl/tests/iterator_054.phpt
@@ -42,8 +42,6 @@ array(3) {
[2]=>
string(1) "3"
}
-
-Notice: Array to string conversion in %siterator_054.php on line %d
int(7)
array(2) {
[0]=>
diff --git a/ext/spl/tests/spl_pq_top_basic.phpt b/ext/spl/tests/spl_pq_top_basic.phpt
index dcc1cbe4c0..14e0af51cb 100644
--- a/ext/spl/tests/spl_pq_top_basic.phpt
+++ b/ext/spl/tests/spl_pq_top_basic.phpt
@@ -8,6 +8,8 @@ Nathaniel McHugh nat@fishtrap.co.uk
$priorityQueue = new SplPriorityQueue();
+var_dump($priorityQueue->getExtractFlags());
+
$priorityQueue->insert("a", 1);
$priorityQueue->insert("b", 2);
$priorityQueue->insert("c", 0);
@@ -16,6 +18,8 @@ echo "EXTR DEFAULT",PHP_EOL;
echo "value: ",$priorityQueue->top(),PHP_EOL;
$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
+var_dump($priorityQueue->getExtractFlags() & SplPriorityQueue::EXTR_PRIORITY);
+
echo "EXTR_PRIORITY",PHP_EOL;
echo "priority: ",$priorityQueue->top(),PHP_EOL;
@@ -28,8 +32,10 @@ $priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA);
echo "value: ",$priorityQueue->top(),PHP_EOL;
?>
--EXPECT--
+int(1)
EXTR DEFAULT
value: b
+int(2)
EXTR_PRIORITY
priority: 2
EXTR_BOTH
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index 2c19b9d9c4..5c7dfcfa5a 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h
index a75b340e2c..3036809856 100644
--- a/ext/sqlite3/php_sqlite3_structs.h
+++ b/ext/sqlite3/php_sqlite3_structs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,9 +38,9 @@
/* Structure for SQLite Statement Parameter. */
struct php_sqlite3_bound_param {
- php_int_t param_number;
+ zend_long param_number;
zend_string *name;
- php_int_t type;
+ zend_long type;
zval parameter;
};
@@ -91,7 +91,7 @@ static inline php_sqlite3_db_object *php_sqlite3_db_from_obj(zend_object *obj) {
/* Structure for SQLite Database object. */
typedef struct _php_sqlite3_agg_context {
zval zval_context;
- php_int_t row_count;
+ zend_long row_count;
} php_sqlite3_agg_context;
typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt;
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 6643506c1a..af3dec0681 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -102,14 +102,14 @@ PHP_METHOD(sqlite3, open)
php_sqlite3_db_object *db_obj;
zval *object = getThis();
char *filename, *encryption_key, *fullpath;
- int filename_len, encryption_key_len = 0;
- php_int_t flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
+ size_t filename_len, encryption_key_len = 0;
+ zend_long flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
zend_error_handling error_handling;
db_obj = Z_SQLITE3_DB_P(object);
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|is", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -249,7 +249,7 @@ PHP_METHOD(sqlite3, version)
array_init(return_value);
add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion());
- add_assoc_int(return_value, "versionNumber", sqlite3_libversion_number());
+ add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number());
return;
}
@@ -269,7 +269,7 @@ PHP_METHOD(sqlite3, lastInsertRowID)
return;
}
- RETURN_INT(sqlite3_last_insert_rowid(db_obj->db));
+ RETURN_LONG(sqlite3_last_insert_rowid(db_obj->db));
}
/* }}} */
@@ -287,7 +287,7 @@ PHP_METHOD(sqlite3, lastErrorCode)
return;
}
- RETURN_INT(sqlite3_errcode(db_obj->db));
+ RETURN_LONG(sqlite3_errcode(db_obj->db));
}
/* }}} */
@@ -315,13 +315,13 @@ PHP_METHOD(sqlite3, busyTimeout)
{
php_sqlite3_db_object *db_obj;
zval *object = getThis();
- php_int_t ms;
+ zend_long ms;
int return_code;
db_obj = Z_SQLITE3_DB_P(object);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ms)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ms)) {
return;
}
@@ -345,7 +345,7 @@ PHP_METHOD(sqlite3, loadExtension)
zval *object = getThis();
char *extension, *lib_path, *extension_dir, *errtext = NULL;
char fullpath[MAXPATHLEN];
- int extension_len, extension_dir_len;
+ size_t extension_len, extension_dir_len;
db_obj = Z_SQLITE3_DB_P(object);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
@@ -424,7 +424,7 @@ PHP_METHOD(sqlite3, changes)
return;
}
- RETURN_INT(sqlite3_changes(db_obj->db));
+ RETURN_LONG(sqlite3_changes(db_obj->db));
}
/* }}} */
@@ -580,7 +580,7 @@ static void sqlite_value_to_zval(sqlite3_stmt *stmt, int column, zval *data) /*
if ((sqlite3_column_int64(stmt, column)) >= INT_MAX || sqlite3_column_int64(stmt, column) <= INT_MIN) {
ZVAL_STRINGL(data, (char *)sqlite3_column_text(stmt, column), sqlite3_column_bytes(stmt, column));
} else {
- ZVAL_INT(data, sqlite3_column_int64(stmt, column));
+ ZVAL_LONG(data, sqlite3_column_int64(stmt, column));
}
break;
@@ -713,16 +713,16 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s
ZVAL_NULL(&agg_context->zval_context);
}
ZVAL_COPY_VALUE(&zargs[0], &agg_context->zval_context);
- ZVAL_INT(&zargs[1], agg_context->row_count);
+ ZVAL_LONG(&zargs[1], agg_context->row_count);
}
for (i = 0; i < argc; i++) {
switch (sqlite3_value_type(argv[i])) {
case SQLITE_INTEGER:
-#if PHP_INT_MAX > 2147483647
- ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int64(argv[i]));
+#if ZEND_LONG_MAX > 2147483647
+ ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int64(argv[i]));
#else
- ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i]));
+ ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i]));
#endif
break;
@@ -764,11 +764,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s
* or if we are finalizing an aggregate */
if (!Z_ISUNDEF(retval)) {
switch (Z_TYPE(retval)) {
- case IS_INT:
-#if PHP_INT_MAX > 2147483647
- sqlite3_result_int64(context, Z_IVAL(retval));
+ case IS_LONG:
+#if ZEND_LONG_MAX > 2147483647
+ sqlite3_result_int64(context, Z_LVAL(retval));
#else
- sqlite3_result_int(context, Z_IVAL(retval));
+ sqlite3_result_int(context, Z_LVAL(retval));
#endif
break;
@@ -782,7 +782,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s
default:
convert_to_string_ex(&retval);
- sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT);
+ sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT);
break;
}
} else {
@@ -873,13 +873,13 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in
zval_ptr_dtor(&zargs[1]);
efree(zargs);
- //retval ought to contain a ZVAL_INT by now
+ //retval ought to contain a ZVAL_LONG by now
// (the result of a comparison, i.e. most likely -1, 0, or 1)
//I suppose we could accept any scalar return type, though.
- if (Z_TYPE(retval) != IS_INT){
+ if (Z_TYPE(retval) != IS_LONG){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the compare callback (invalid return type). Collation behaviour is undefined.");
}else{
- ret = Z_IVAL(retval);
+ ret = Z_LVAL(retval);
}
zval_ptr_dtor(&retval);
@@ -896,15 +896,15 @@ PHP_METHOD(sqlite3, createFunction)
zval *object = getThis();
php_sqlite3_func *func;
char *sql_func;
- int sql_func_len;
+ size_t sql_func_len;
zval *callback_func;
zend_string *callback_name;
- php_int_t sql_func_num_args = -1;
+ zend_long sql_func_num_args = -1;
db_obj = Z_SQLITE3_DB_P(object);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) {
return;
}
@@ -914,10 +914,10 @@ PHP_METHOD(sqlite3, createFunction)
if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) {
php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
func = (php_sqlite3_func *)ecalloc(1, sizeof(*func));
@@ -947,14 +947,14 @@ PHP_METHOD(sqlite3, createAggregate)
php_sqlite3_func *func;
char *sql_func;
zend_string *callback_name;
- int sql_func_len;
+ size_t sql_func_len;
zval *step_callback, *fini_callback;
- php_int_t sql_func_num_args = -1;
+ zend_long sql_func_num_args = -1;
db_obj = Z_SQLITE3_DB_P(object);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) {
return;
}
@@ -964,17 +964,17 @@ PHP_METHOD(sqlite3, createAggregate)
if (!zend_is_callable(step_callback, 0, &callback_name TSRMLS_CC)) {
php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
if (!zend_is_callable(fini_callback, 0, &callback_name TSRMLS_CC)) {
php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
func = (php_sqlite3_func *)ecalloc(1, sizeof(*func));
@@ -1005,7 +1005,7 @@ PHP_METHOD(sqlite3, createCollation)
php_sqlite3_collation *collation;
char *collation_name;
zend_string *callback_name;
- int collation_name_len;
+ size_t collation_name_len;
zval *callback_func;
db_obj = Z_SQLITE3_DB_P(object);
@@ -1021,10 +1021,10 @@ PHP_METHOD(sqlite3, createCollation)
if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) {
php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
collation = (php_sqlite3_collation *)ecalloc(1, sizeof(*collation));
if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callback_compare) == SQLITE_OK) {
@@ -1186,8 +1186,8 @@ PHP_METHOD(sqlite3, openBlob)
php_sqlite3_db_object *db_obj;
zval *object = getThis();
char *table, *column, *dbname = "main";
- int table_len, column_len, dbname_len;
- php_int_t rowid, flags = 0;
+ size_t table_len, column_len, dbname_len;
+ zend_long rowid, flags = 0;
sqlite3_blob *blob = NULL;
php_stream_sqlite3_data *sqlite3_stream;
php_stream *stream;
@@ -1196,7 +1196,7 @@ PHP_METHOD(sqlite3, openBlob)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) {
return;
}
@@ -1254,7 +1254,7 @@ PHP_METHOD(sqlite3stmt, paramCount)
SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt);
- RETURN_INT(sqlite3_bind_parameter_count(stmt_obj->stmt));
+ RETURN_LONG(sqlite3_bind_parameter_count(stmt_obj->stmt));
}
/* }}} */
@@ -1361,19 +1361,19 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa
if (param->name) {
if (param->name->val[0] != ':') {
/* pre-increment for character + 1 for null */
- zend_string *temp = STR_ALLOC(param->name->len + 1, 0);
+ zend_string *temp = zend_string_alloc(param->name->len + 1, 0);
temp->val[0] = ':';
memmove(temp->val + 1, param->name->val, param->name->len + 1);
param->name = temp;
} else {
- param->name = STR_INIT(param->name->val, param->name->len, 0);
+ param->name = zend_string_init(param->name->val, param->name->len, 0);
}
/* do lookup*/
param->param_number = sqlite3_bind_parameter_index(stmt->stmt, param->name->val);
}
if (param->param_number < 1) {
- STR_RELEASE(param->name);
+ zend_string_release(param->name);
return 0;
}
@@ -1404,7 +1404,7 @@ PHP_METHOD(sqlite3stmt, bindParam)
param.param_number = -1;
param.type = SQLITE3_TEXT;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz|i", &param.param_number, &parameter, &param.type) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &param.param_number, &parameter, &param.type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &param.name, &parameter, &param.type) == FAILURE) {
return;
}
@@ -1438,8 +1438,8 @@ PHP_METHOD(sqlite3stmt, bindValue)
param.param_number = -1;
param.type = SQLITE3_TEXT;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", &param.param_number, &parameter, &param.type) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", &param.name, &parameter, &param.type) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &param.param_number, &parameter, &param.type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", &param.name, &parameter, &param.type) == FAILURE) {
return;
}
}
@@ -1495,11 +1495,11 @@ PHP_METHOD(sqlite3stmt, execute)
switch (param->type) {
case SQLITE_INTEGER:
- convert_to_int(parameter);
-#if PHP_INT_MAX > 2147483647
- sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter));
+ convert_to_long(parameter);
+#if ZEND_LONG_MAX > 2147483647
+ sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter));
#else
- sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter));
+ sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter));
#endif
break;
@@ -1527,14 +1527,14 @@ PHP_METHOD(sqlite3stmt, execute)
sqlite3_bind_blob(stmt_obj->stmt, param->param_number, buffer->val, buffer->len, SQLITE_TRANSIENT);
if (stream) {
- STR_RELEASE(buffer);
+ zend_string_release(buffer);
}
break;
}
case SQLITE3_TEXT:
convert_to_string(parameter);
- sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRSIZE_P(parameter), SQLITE_STATIC);
+ sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRLEN_P(parameter), SQLITE_STATIC);
break;
case SQLITE_NULL:
@@ -1643,7 +1643,7 @@ PHP_METHOD(sqlite3result, numColumns)
return;
}
- RETURN_INT(sqlite3_column_count(result_obj->stmt_obj->stmt));
+ RETURN_LONG(sqlite3_column_count(result_obj->stmt_obj->stmt));
}
/* }}} */
@@ -1653,13 +1653,13 @@ PHP_METHOD(sqlite3result, columnName)
{
php_sqlite3_result *result_obj;
zval *object = getThis();
- php_int_t column = 0;
+ zend_long column = 0;
char *column_name;
result_obj = Z_SQLITE3_RESULT_P(object);
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) {
return;
}
column_name = (char*) sqlite3_column_name(result_obj->stmt_obj->stmt, column);
@@ -1678,12 +1678,12 @@ PHP_METHOD(sqlite3result, columnType)
{
php_sqlite3_result *result_obj;
zval *object = getThis();
- php_int_t column = 0;
+ zend_long column = 0;
result_obj = Z_SQLITE3_RESULT_P(object);
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) {
return;
}
@@ -1691,7 +1691,7 @@ PHP_METHOD(sqlite3result, columnType)
RETURN_FALSE;
}
- RETURN_INT(sqlite3_column_type(result_obj->stmt_obj->stmt, column));
+ RETURN_LONG(sqlite3_column_type(result_obj->stmt_obj->stmt, column));
}
/* }}} */
@@ -1702,12 +1702,12 @@ PHP_METHOD(sqlite3result, fetchArray)
php_sqlite3_result *result_obj;
zval *object = getThis();
int i, ret;
- php_int_t mode = PHP_SQLITE3_BOTH;
+ zend_long mode = PHP_SQLITE3_BOTH;
result_obj = Z_SQLITE3_RESULT_P(object);
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
return;
}
@@ -2170,7 +2170,7 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */
struct php_sqlite3_bound_param *param = (struct php_sqlite3_bound_param*)Z_PTR_P(data);
if (param->name) {
- STR_RELEASE(param->name);
+ zend_string_release(param->name);
}
if (!Z_ISNULL(param->parameter)) {
@@ -2225,19 +2225,19 @@ PHP_MINIT_FUNCTION(sqlite3)
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 22a26941ed..7d8e4d0efe 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -45,7 +45,7 @@
#include "basic_functions.h"
#include "php_string.h"
#include "php_rand.h"
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
#ifdef HAVE_SPL
#include "ext/spl/spl_array.h"
#endif
@@ -99,33 +99,33 @@ PHP_MINIT_FUNCTION(array) /* {{{ */
{
ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL);
- REGISTER_INT_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -141,7 +141,7 @@ PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */
}
/* }}} */
-static void php_set_compare_func(php_int_t sort_type TSRMLS_DC) /* {{{ */
+static void php_set_compare_func(zend_long sort_type TSRMLS_DC) /* {{{ */
{
switch (sort_type & ~PHP_SORT_FLAG_CASE) {
case PHP_SORT_NUMERIC:
@@ -182,13 +182,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{
s = (Bucket *) b;
if (f->key == NULL) {
- ZVAL_INT(&first, f->h);
+ ZVAL_LONG(&first, f->h);
} else {
ZVAL_STR(&first, f->key);
}
if (s->key == 0) {
- ZVAL_INT(&second, s->h);
+ ZVAL_LONG(&second, s->h);
} else {
ZVAL_STR(&second, s->key);
}
@@ -197,13 +197,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{
return 0;
}
- if (EXPECTED(Z_TYPE(result) == IS_INT)) {
- return ZEND_NORMALIZE_BOOL(Z_IVAL(result));
+ if (EXPECTED(Z_TYPE(result) == IS_LONG)) {
+ return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
} else if (Z_TYPE(result) == IS_DOUBLE) {
return ZEND_NORMALIZE_BOOL(Z_DVAL(result));
}
- return ZEND_NORMALIZE_BOOL(zval_get_int(&result));
+ return ZEND_NORMALIZE_BOOL(zval_get_long(&result));
}
/* }}} */
@@ -218,9 +218,9 @@ static int php_array_reverse_key_compare(const void *a, const void *b TSRMLS_DC)
PHP_FUNCTION(krsort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -238,9 +238,9 @@ PHP_FUNCTION(krsort)
PHP_FUNCTION(ksort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -253,9 +253,9 @@ PHP_FUNCTION(ksort)
}
/* }}} */
-PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC) /* {{{ */
+PHPAPI zend_long php_count_recursive(zval *array, zend_long mode TSRMLS_DC) /* {{{ */
{
- php_int_t cnt = 0;
+ zend_long cnt = 0;
zval *element;
if (Z_TYPE_P(array) == IS_ARRAY) {
@@ -288,25 +288,25 @@ PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC) /* {
PHP_FUNCTION(count)
{
zval *array;
- php_int_t mode = COUNT_NORMAL;
- php_int_t cnt;
+ zend_long mode = COUNT_NORMAL;
+ zend_long cnt;
zval *element;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &array, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_ZVAL(array)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(mode)
+ Z_PARAM_LONG(mode)
ZEND_PARSE_PARAMETERS_END();
#endif
switch (Z_TYPE_P(array)) {
case IS_NULL:
- RETURN_INT(0);
+ RETURN_LONG(0);
break;
case IS_ARRAY:
cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
@@ -316,7 +316,7 @@ PHP_FUNCTION(count)
cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC);
} ZEND_HASH_FOREACH_END();
}
- RETURN_INT(cnt);
+ RETURN_LONG(cnt);
break;
case IS_OBJECT: {
#ifdef HAVE_SPL
@@ -324,17 +324,17 @@ PHP_FUNCTION(count)
#endif
/* first, we check if the handler is defined */
if (Z_OBJ_HT_P(array)->count_elements) {
- RETVAL_INT(1);
- if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_IVAL_P(return_value) TSRMLS_CC)) {
+ RETVAL_LONG(1);
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) {
return;
}
}
#ifdef HAVE_SPL
/* if not and the object implements Countable we call its count() method */
- if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
+ if (instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
- RETVAL_INT(zval_get_int(&retval));
+ RETVAL_LONG(zval_get_long(&retval));
zval_ptr_dtor(&retval);
}
return;
@@ -342,7 +342,7 @@ PHP_FUNCTION(count)
#endif
}
default:
- RETURN_INT(1);
+ RETURN_LONG(1);
break;
}
}
@@ -378,13 +378,13 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{
return 0;
}
- if (EXPECTED(Z_TYPE(result) == IS_INT)) {
- return ZEND_NORMALIZE_BOOL(Z_IVAL(result));
+ if (EXPECTED(Z_TYPE(result) == IS_LONG)) {
+ return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
} else if (Z_TYPE(result) == IS_DOUBLE) {
return ZEND_NORMALIZE_BOOL(Z_DVAL(result));
}
- return ZEND_NORMALIZE_BOOL(zval_get_int(&result));
+ return ZEND_NORMALIZE_BOOL(zval_get_long(&result));
}
/* }}} */
@@ -403,8 +403,8 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f
int result = strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, fold_case);
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
return result;
}
/* }}} */
@@ -464,9 +464,9 @@ PHP_FUNCTION(natcasesort)
PHP_FUNCTION(asort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -484,9 +484,9 @@ PHP_FUNCTION(asort)
PHP_FUNCTION(arsort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -504,9 +504,9 @@ PHP_FUNCTION(arsort)
PHP_FUNCTION(sort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -524,9 +524,9 @@ PHP_FUNCTION(sort)
PHP_FUNCTION(rsort)
{
zval *array;
- php_int_t sort_type = PHP_SORT_REGULAR;
+ zend_long sort_type = PHP_SORT_REGULAR;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) {
RETURN_FALSE;
}
@@ -557,7 +557,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{
BG(user_compare_fci).retval = &retval;
BG(user_compare_fci).no_separation = 0;
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- php_int_t ret = zval_get_int(&retval);
+ zend_long ret = zval_get_long(&retval);
zval_ptr_dtor(&retval);
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
@@ -695,7 +695,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
Bucket *s;
zval args[2];
zval retval;
- php_int_t result;
+ zend_long result;
ZVAL_NULL(&args[0]);
ZVAL_NULL(&args[1]);
@@ -704,14 +704,14 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
s = (Bucket *) b;
if (f->key == NULL) {
- ZVAL_INT(&args[0], f->h);
+ ZVAL_LONG(&args[0], f->h);
} else {
- ZVAL_STR(&args[0], STR_COPY(f->key));
+ ZVAL_STR_COPY(&args[0], f->key);
}
if (s->key == NULL) {
- ZVAL_INT(&args[1], s->h);
+ ZVAL_LONG(&args[1], s->h);
} else {
- ZVAL_STR(&args[1], STR_COPY(s->key));
+ ZVAL_STR_COPY(&args[1], s->key);
}
BG(user_compare_fci).param_count = 2;
@@ -719,7 +719,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
BG(user_compare_fci).retval = &retval;
BG(user_compare_fci).no_separation = 0;
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- result = zval_get_int(&retval);
+ result = zval_get_long(&retval);
zval_ptr_dtor(&retval);
} else {
result = 0;
@@ -1230,7 +1230,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
*array, /* array to check in */
*entry, /* pointer to array entry */
res; /* comparison result */
- php_uint_t num_idx;
+ zend_ulong num_idx;
zend_string *str_idx;
zend_bool strict = 0; /* strict comparison or not */
@@ -1256,9 +1256,9 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(STR_COPY(str_idx));
+ RETVAL_STR(zend_string_copy(str_idx));
} else {
- RETVAL_INT(num_idx);
+ RETVAL_LONG(num_idx);
}
return;
}
@@ -1271,9 +1271,9 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
RETURN_TRUE;
} else {
if (str_idx) {
- RETVAL_STR(STR_COPY(str_idx));
+ RETVAL_STR(zend_string_copy(str_idx));
} else {
- RETVAL_INT(num_idx);
+ RETVAL_LONG(num_idx);
}
return;
}
@@ -1339,14 +1339,14 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */
PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */
{
- ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
- memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix));
+ ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
+ memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix));
if (add_underscore) {
- Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_';
+ Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_';
}
- memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
+ memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
return SUCCESS;
}
@@ -1357,19 +1357,22 @@ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int va
PHP_FUNCTION(extract)
{
zval *var_array, *prefix = NULL;
- php_int_t extract_type = EXTR_OVERWRITE;
+ zend_long extract_type = EXTR_OVERWRITE;
zval *entry;
zend_string *var_name;
- php_uint_t num_key;
+ zend_ulong num_key;
int var_exists, count = 0;
int extract_refs = 0;
zend_array *symbol_table;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|iz/", &var_array, &extract_type, &prefix) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|lz/", &var_array, &extract_type, &prefix) == FAILURE) {
return;
}
extract_refs = (extract_type & EXTR_REFS);
+ if (extract_refs) {
+ SEPARATE_ZVAL(var_array);
+ }
extract_type &= 0xff;
if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
@@ -1384,7 +1387,7 @@ PHP_FUNCTION(extract)
if (prefix) {
convert_to_string(prefix);
- if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) {
+ if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier");
return;
}
@@ -1403,9 +1406,9 @@ PHP_FUNCTION(extract)
} else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
zval num;
- ZVAL_INT(&num, num_key);
+ ZVAL_LONG(&num, num_key);
convert_to_string(&num);
- php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC);
+ php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC);
zval_dtor(&num);
} else {
continue;
@@ -1424,7 +1427,7 @@ PHP_FUNCTION(extract)
if (var_exists && var_name->len == sizeof("this")-1 && !strcmp(var_name->val, "this") && EG(scope) && EG(scope)->name->len != 0) {
break;
}
- ZVAL_STR(&final_name, STR_COPY(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
break;
case EXTR_PREFIX_IF_EXISTS:
@@ -1435,7 +1438,7 @@ PHP_FUNCTION(extract)
case EXTR_PREFIX_SAME:
if (!var_exists && var_name->len != 0) {
- ZVAL_STR(&final_name, STR_COPY(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
/* break omitted intentionally */
@@ -1450,19 +1453,19 @@ PHP_FUNCTION(extract)
if (!php_valid_var_name(var_name->val, var_name->len)) {
php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1 TSRMLS_CC);
} else {
- ZVAL_STR(&final_name, STR_COPY(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
}
break;
default:
if (!var_exists) {
- ZVAL_STR(&final_name, STR_COPY(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
break;
}
- if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) {
+ if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
if (extract_refs) {
zval *orig_var;
@@ -1487,7 +1490,7 @@ PHP_FUNCTION(extract)
zval_dtor(&final_name);
} ZEND_HASH_FOREACH_END();
- RETURN_INT(count);
+ RETURN_LONG(count);
}
/* }}} */
@@ -1525,7 +1528,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
PHP_FUNCTION(compact)
{
zval *args = NULL; /* function arguments array */
- int num_args, i;
+ uint32_t num_args, i;
zend_array *symbol_table;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &num_args) == FAILURE) {
@@ -1554,9 +1557,9 @@ PHP_FUNCTION(compact)
PHP_FUNCTION(array_fill)
{
zval *val;
- php_int_t start_key, num;
+ zend_long start_key, num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiz", &start_key, &num, &val) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz", &start_key, &num, &val) == FAILURE) {
return;
}
@@ -1603,16 +1606,16 @@ PHP_FUNCTION(array_fill_keys)
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), entry) {
ZVAL_DEREF(entry);
- if (Z_TYPE_P(entry) == IS_INT) {
+ if (Z_TYPE_P(entry) == IS_LONG) {
zval_add_ref(val);
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), val);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), val);
} else {
zend_string *key = zval_get_string(entry);
zval_add_ref(val);
zend_symtable_update(Z_ARRVAL_P(return_value), key, val);
- STR_RELEASE(key);
+ zend_string_release(key);
}
} ZEND_HASH_FOREACH_END();
}
@@ -1632,7 +1635,7 @@ PHP_FUNCTION(range)
if (zstep) {
if (Z_TYPE_P(zstep) == IS_DOUBLE ||
- (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE)
+ (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE)
) {
is_step_double = 1;
}
@@ -1649,17 +1652,17 @@ PHP_FUNCTION(range)
array_init(return_value);
/* If the range is given as strings, generate an array of characters. */
- if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) {
+ if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) {
int type1, type2;
unsigned char low, high;
- php_int_t lstep = (php_int_t) step;
+ zend_long lstep = (zend_long) step;
- type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0);
- type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0);
+ type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0);
+ type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0);
if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) {
goto double_str;
- } else if (type1 == IS_INT || type2 == IS_INT) {
+ } else if (type1 == IS_LONG || type2 == IS_LONG) {
goto long_str;
}
@@ -1673,7 +1676,7 @@ PHP_FUNCTION(range)
}
for (; low >= high; low -= (unsigned int)lstep) {
if (CG(one_char_string)[low]) {
- ZVAL_INT_STR(&tmp, CG(one_char_string)[low]);
+ ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
} else {
ZVAL_STRINGL(&tmp, (char*)&low, 1);
}
@@ -1689,7 +1692,7 @@ PHP_FUNCTION(range)
}
for (; low <= high; low += (unsigned int)lstep) {
if (CG(one_char_string)[low]) {
- ZVAL_INT_STR(&tmp, CG(one_char_string)[low]);
+ ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
} else {
ZVAL_STRINGL(&tmp, (char*)&low, 1);
}
@@ -1700,7 +1703,7 @@ PHP_FUNCTION(range)
}
} else {
if (CG(one_char_string)[low]) {
- ZVAL_INT_STR(&tmp, CG(one_char_string)[low]);
+ ZVAL_INTERNED_STR(&tmp, CG(one_char_string)[low]);
} else {
ZVAL_STRINGL(&tmp, (char*)&low, 1);
}
@@ -1709,7 +1712,7 @@ PHP_FUNCTION(range)
} else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) {
double low, high, value;
- php_int_t i;
+ zend_long i;
double_str:
low = zval_get_double(zlow);
high = zval_get_double(zhigh);
@@ -1742,20 +1745,20 @@ double_str:
}
} else {
double low, high;
- php_int_t lstep;
+ zend_long lstep;
long_str:
low = zval_get_double(zlow);
high = zval_get_double(zhigh);
- lstep = (php_int_t) step;
+ lstep = (zend_long) step;
- Z_TYPE_INFO(tmp) = IS_INT;
+ Z_TYPE_INFO(tmp) = IS_LONG;
if (low > high) { /* Negative steps */
if (low - high < lstep || lstep <= 0) {
err = 1;
goto err;
}
for (; low >= high; low -= lstep) {
- Z_IVAL(tmp) = (php_int_t)low;
+ Z_LVAL(tmp) = (zend_long)low;
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
} else if (high > low) { /* Positive steps */
@@ -1764,11 +1767,11 @@ long_str:
goto err;
}
for (; low <= high; low += lstep) {
- Z_IVAL(tmp) = (php_int_t)low;
+ Z_LVAL(tmp) = (zend_long)low;
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
} else {
- Z_IVAL(tmp) = (php_int_t)low;
+ Z_LVAL(tmp) = (zend_long)low;
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
}
@@ -1823,8 +1826,8 @@ static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
for (j = 0; j < n_elems; j++) {
p = hash->arData + j;
- if (p->key && !IS_INTERNED(p->key)) {
- STR_RELEASE(p->key);
+ if (p->key) {
+ zend_string_release(p->key);
}
p->h = j;
p->key = NULL;
@@ -1985,7 +1988,7 @@ PHP_FUNCTION(array_push)
}
/* Clean up and return the number of values in the stack */
- RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack)));
+ RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
}
/* }}} */
@@ -1995,7 +1998,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
zval *stack, /* Input stack */
*val; /* Value to be popped */
zend_string *key = NULL;
- php_uint_t index;
+ zend_ulong index;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &stack) == FAILURE) {
@@ -2082,7 +2085,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
zend_hash_rehash(Z_ARRVAL_P(stack));
}
}
- } else if (!key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) {
+ } else if (!key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && index >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) {
Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1;
}
@@ -2129,7 +2132,7 @@ PHP_FUNCTION(array_unshift)
zend_hash_destroy(&old_hash);
/* Clean up and return the number of elements in the stack */
- RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack)));
+ RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
}
/* }}} */
@@ -2145,13 +2148,13 @@ PHP_FUNCTION(array_splice)
HashTable old_hash;
uint idx;
Bucket *p; /* Bucket used for traversing hash */
- php_int_t i,
+ zend_long i,
offset,
length = 0,
repl_num = 0; /* Number of replacement elements */
int num_in; /* Number of elements in the input array */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/i|iz/", &array, &offset, &length, &repl_array) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/l|lz/", &array, &offset, &length, &repl_array) == FAILURE) {
return;
}
@@ -2190,7 +2193,7 @@ PHP_FUNCTION(array_splice)
/* ..and the length */
if (length < 0) {
size = num_in - offset + length;
- } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) {
+ } else if (((zend_ulong) offset + (zend_ulong) length) > (unsigned) num_in) {
size = num_in - offset;
}
@@ -2222,22 +2225,22 @@ PHP_FUNCTION(array_slice)
zval *input, /* Input array */
*z_length = NULL, /* How many elements to get */
*entry; /* An array entry */
- php_int_t offset, /* Offset to get elements from */
+ zend_long offset, /* Offset to get elements from */
length = 0;
zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */
int num_in, /* Number of elements in the input array */
pos; /* Current position in the array */
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ai|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(2, 4)
Z_PARAM_ARRAY(input)
- Z_PARAM_INT(offset)
+ Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(z_length)
Z_PARAM_BOOL(preserve_keys)
@@ -2251,7 +2254,7 @@ PHP_FUNCTION(array_slice)
if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) {
length = num_in;
} else {
- length = zval_get_int(z_length);
+ length = zval_get_long(z_length);
}
/* Clamp the offset.. */
@@ -2265,7 +2268,7 @@ PHP_FUNCTION(array_slice)
/* ..and the length */
if (length < 0) {
length = num_in - offset + length;
- } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) {
+ } else if (((zend_ulong) offset + (zend_ulong) length) > (unsigned) num_in) {
length = num_in - offset;
}
@@ -2404,7 +2407,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
{
zval *src_entry, *dest_entry, *src_zval, *dest_zval;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
int ret;
ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {
@@ -2564,7 +2567,7 @@ PHP_FUNCTION(array_keys)
new_val; /* New value */
int add_key; /* Flag to indicate whether a key should be added */
zend_bool strict = 0; /* do strict comparison */
- php_uint_t num_idx;
+ zend_ulong num_idx;
zend_string *str_idx;
int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function;
@@ -2594,7 +2597,7 @@ PHP_FUNCTION(array_keys)
add_key = 1;
/* Go through input array and add keys to the return array */
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
if (search_value != NULL) {
is_equal_func(&res, search_value, entry TSRMLS_CC);
add_key = zval_is_true(&res);
@@ -2602,9 +2605,9 @@ PHP_FUNCTION(array_keys)
if (add_key) {
if (str_idx) {
- ZVAL_STR(&new_val, STR_COPY(str_idx));
+ ZVAL_STR_COPY(&new_val, str_idx);
} else {
- ZVAL_INT(&new_val, num_idx);
+ ZVAL_LONG(&new_val, num_idx);
}
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &new_val);
}
@@ -2653,21 +2656,21 @@ PHP_FUNCTION(array_count_values)
/* Go through input array and add values to the return array */
myht = Z_ARRVAL_P(input);
ZEND_HASH_FOREACH_VAL(myht, entry) {
- if (Z_TYPE_P(entry) == IS_INT) {
- if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_IVAL_P(entry))) == NULL) {
+ if (Z_TYPE_P(entry) == IS_LONG) {
+ if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_P(entry))) == NULL) {
zval data;
- ZVAL_INT(&data, 1);
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data);
+ ZVAL_LONG(&data, 1);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
} else {
- Z_IVAL_P(tmp)++;
+ Z_LVAL_P(tmp)++;
}
} else if (Z_TYPE_P(entry) == IS_STRING) {
if ((tmp = zend_symtable_find(Z_ARRVAL_P(return_value), Z_STR_P(entry))) == NULL) {
zval data;
- ZVAL_INT(&data, 1);
+ ZVAL_LONG(&data, 1);
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
} else {
- Z_IVAL_P(tmp)++;
+ Z_LVAL_P(tmp)++;
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!");
@@ -2684,9 +2687,9 @@ zend_bool array_column_param_helper(zval *param,
const char *name TSRMLS_DC) {
switch (Z_TYPE_P(param)) {
case IS_DOUBLE:
- convert_to_int_ex(param);
+ convert_to_long_ex(param);
/* fallthrough */
- case IS_INT:
+ case IS_LONG:
return 1;
case IS_OBJECT:
@@ -2736,8 +2739,8 @@ PHP_FUNCTION(array_column)
} else if ((Z_TYPE_P(zcolumn) == IS_STRING) &&
((zcolval = zend_hash_find(ht, Z_STR_P(zcolumn))) == NULL)) {
continue;
- } else if ((Z_TYPE_P(zcolumn) == IS_INT) &&
- ((zcolval = zend_hash_index_find(ht, Z_IVAL_P(zcolumn))) == NULL)) {
+ } else if ((Z_TYPE_P(zcolumn) == IS_LONG) &&
+ ((zcolval = zend_hash_index_find(ht, Z_LVAL_P(zcolumn))) == NULL)) {
continue;
}
@@ -2746,8 +2749,8 @@ PHP_FUNCTION(array_column)
*/
if (zkey && (Z_TYPE_P(zkey) == IS_STRING)) {
zkeyval = zend_hash_find(ht, Z_STR_P(zkey));
- } else if (zkey && (Z_TYPE_P(zkey) == IS_INT)) {
- zkeyval = zend_hash_index_find(ht, Z_IVAL_P(zkey));
+ } else if (zkey && (Z_TYPE_P(zkey) == IS_LONG)) {
+ zkeyval = zend_hash_index_find(ht, Z_LVAL_P(zkey));
}
if (Z_REFCOUNTED_P(zcolval)) {
@@ -2755,8 +2758,8 @@ PHP_FUNCTION(array_column)
}
if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) {
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(zkeyval), zcolval);
- } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_INT) {
- add_index_zval(return_value, Z_IVAL_P(zkeyval), zcolval);
+ } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_LONG) {
+ add_index_zval(return_value, Z_LVAL_P(zkeyval), zcolval);
} else if (zkeyval && Z_TYPE_P(zkeyval) == IS_OBJECT) {
SEPARATE_ZVAL(zkeyval);
convert_to_string(zkeyval);
@@ -2775,7 +2778,7 @@ PHP_FUNCTION(array_reverse)
zval *input, /* Input array */
*entry; /* An entry in the input array */
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_bool preserve_keys = 0; /* whether to preserve keys */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &input, &preserve_keys) == FAILURE) {
@@ -2810,14 +2813,14 @@ PHP_FUNCTION(array_pad)
zval *pads; /* Array to pass to splice */
HashTable *new_hash;/* Return value from splice */
HashTable old_hash;
- php_int_t pad_size; /* Size to pad to */
- php_int_t pad_size_abs; /* Absolute value of pad_size */
- php_int_t input_size; /* Size of the input array */
- php_int_t num_pads; /* How many pads do we need */
+ zend_long pad_size; /* Size to pad to */
+ zend_long pad_size_abs; /* Absolute value of pad_size */
+ zend_long input_size; /* Size of the input array */
+ zend_long num_pads; /* How many pads do we need */
int do_pad; /* Whether we should do padding at all */
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aiz", &input, &pad_size, &pad_value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "alz", &input, &pad_size, &pad_value) == FAILURE) {
return;
}
@@ -2841,7 +2844,7 @@ PHP_FUNCTION(array_pad)
/* Populate the pads array */
num_pads = pad_size_abs - input_size;
- if (num_pads > Z_I(1048576)) {
+ if (num_pads > Z_L(1048576)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
zval_dtor(return_value);
RETURN_FALSE;
@@ -2874,7 +2877,7 @@ PHP_FUNCTION(array_pad)
PHP_FUNCTION(array_flip)
{
zval *array, *entry, data;
- php_uint_t num_idx;
+ zend_ulong num_idx;
zend_string *str_idx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
@@ -2884,18 +2887,18 @@ PHP_FUNCTION(array_flip)
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array)));
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
- if (Z_TYPE_P(entry) == IS_INT) {
+ if (Z_TYPE_P(entry) == IS_LONG) {
if (str_idx) {
- ZVAL_STR(&data, STR_COPY(str_idx));
+ ZVAL_STR_COPY(&data, str_idx);
} else {
- ZVAL_INT(&data, num_idx);
+ ZVAL_LONG(&data, num_idx);
}
- zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
} else if (Z_TYPE_P(entry) == IS_STRING) {
if (str_idx) {
- ZVAL_STR(&data, STR_COPY(str_idx));
+ ZVAL_STR_COPY(&data, str_idx);
} else {
- ZVAL_INT(&data, num_idx);
+ ZVAL_LONG(&data, num_idx);
}
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
} else {
@@ -2912,10 +2915,10 @@ PHP_FUNCTION(array_change_key_case)
zval *array, *entry;
zend_string *string_key;
zend_string *new_key;
- php_uint_t num_key;
- php_int_t change_to_upper=0;
+ zend_ulong num_key;
+ zend_long change_to_upper=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &change_to_upper) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &change_to_upper) == FAILURE) {
return;
}
@@ -2927,14 +2930,14 @@ PHP_FUNCTION(array_change_key_case)
if (!string_key) {
zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
} else {
- new_key = STR_INIT(string_key->val, string_key->len, 0);
+ new_key = zend_string_init(string_key->val, string_key->len, 0);
if (change_to_upper) {
php_strtoupper(new_key->val, new_key->len);
} else {
php_strtolower(new_key->val, new_key->len);
}
zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry);
- STR_RELEASE(new_key);
+ zend_string_release(new_key);
}
} ZEND_HASH_FOREACH_END();
}
@@ -2953,9 +2956,9 @@ PHP_FUNCTION(array_unique)
};
struct bucketindex *arTmp, *cmpdata, *lastkept;
unsigned int i;
- php_int_t sort_type = PHP_SORT_STRING;
+ zend_long sort_type = PHP_SORT_STRING;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &sort_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) {
return;
}
@@ -3035,8 +3038,8 @@ static int zval_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */
return ZEND_NORMALIZE_BOOL(Z_DVAL(result));
}
- convert_to_int(&result);
- return ZEND_NORMALIZE_BOOL(Z_IVAL(result));
+ convert_to_long(&result);
+ return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
}
/* }}} */
@@ -3061,7 +3064,7 @@ static int zval_user_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */
BG(user_compare_fci).no_separation = 0;
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- php_int_t ret = zval_get_int(&retval);
+ zend_long ret = zval_get_long(&retval);
zval_ptr_dtor(&retval);
return ret < 0 ? -1 : ret > 0 ? 1 : 0;;
} else {
@@ -3171,7 +3174,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
int arr_argc, i, c = 0;
uint idx;
Bucket **lists, *list, **ptrs, *p;
- int req_args;
+ uint32_t req_args;
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
@@ -3595,7 +3598,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
int arr_argc, i, c;
uint idx;
Bucket **lists, *list, **ptrs, *p;
- int req_args;
+ uint32_t req_args;
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
@@ -3935,7 +3938,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{
php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC);
ARRAYG(compare_func)(&temp, &ab[r].val, &bb[r].val TSRMLS_CC);
- result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_IVAL(temp);
+ result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
if (result != 0) {
return result;
}
@@ -4008,14 +4011,14 @@ PHP_FUNCTION(array_multisort)
for (k = 0; k < MULTISORT_LAST; k++) {
parse_state[k] = 1;
}
- } else if (Z_TYPE_P(arg) == IS_INT) {
- switch (Z_IVAL_P(arg) & ~PHP_SORT_FLAG_CASE) {
+ } else if (Z_TYPE_P(arg) == IS_LONG) {
+ switch (Z_LVAL_P(arg) & ~PHP_SORT_FLAG_CASE) {
case PHP_SORT_ASC:
case PHP_SORT_DESC:
/* flag allowed here */
if (parse_state[MULTISORT_ORDER] == 1) {
/* Save the flag and make sure then next arg is not the current flag. */
- sort_order = Z_IVAL(args[i]) == PHP_SORT_DESC ? -1 : 1;
+ sort_order = Z_LVAL(args[i]) == PHP_SORT_DESC ? -1 : 1;
parse_state[MULTISORT_ORDER] = 0;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
@@ -4033,7 +4036,7 @@ PHP_FUNCTION(array_multisort)
/* flag allowed here */
if (parse_state[MULTISORT_TYPE] == 1) {
/* Save the flag and make sure then next arg is not the current flag. */
- sort_type = Z_IVAL(args[i]);
+ sort_type = Z_LVAL(args[i]);
parse_state[MULTISORT_TYPE] = 0;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
@@ -4141,12 +4144,12 @@ PHP_FUNCTION(array_multisort)
PHP_FUNCTION(array_rand)
{
zval *input;
- php_int_t randval, num_req = 1;
+ zend_long randval, num_req = 1;
int num_avail;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &input, &num_req) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &input, &num_req) == FAILURE) {
return;
}
@@ -4176,16 +4179,16 @@ PHP_FUNCTION(array_rand)
/* If we are returning a single result, just do it. */
if (Z_TYPE_P(return_value) != IS_ARRAY) {
if (string_key) {
- RETURN_STR(STR_COPY(string_key));
+ RETURN_STR(zend_string_copy(string_key));
} else {
- RETURN_INT(num_key);
+ RETURN_LONG(num_key);
}
} else {
/* Append the result to the return value. */
if (string_key) {
- add_next_index_str(return_value, STR_COPY(string_key));
+ add_next_index_str(return_value, zend_string_copy(string_key));
} else {
- add_next_index_int(return_value, num_key);
+ add_next_index_long(return_value, num_key);
}
}
num_req--;
@@ -4207,7 +4210,7 @@ PHP_FUNCTION(array_sum)
return;
}
- ZVAL_INT(return_value, 0);
+ ZVAL_LONG(return_value, 0);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) {
@@ -4233,7 +4236,7 @@ PHP_FUNCTION(array_product)
return;
}
- ZVAL_INT(return_value, 1);
+ ZVAL_LONG(return_value, 1);
if (!zend_hash_num_elements(Z_ARRVAL_P(input))) {
return;
}
@@ -4245,10 +4248,10 @@ PHP_FUNCTION(array_product)
ZVAL_DUP(&entry_n, entry);
convert_scalar_to_number(&entry_n TSRMLS_CC);
- if (Z_TYPE(entry_n) == IS_INT && Z_TYPE_P(return_value) == IS_INT) {
- dval = (double)Z_IVAL_P(return_value) * (double)Z_IVAL(entry_n);
- if ( (double)PHP_INT_MIN <= dval && dval <= (double)PHP_INT_MAX ) {
- Z_IVAL_P(return_value) *= Z_IVAL(entry_n);
+ if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) {
+ dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n);
+ if ( (double)ZEND_LONG_MIN <= dval && dval <= (double)ZEND_LONG_MAX ) {
+ Z_LVAL_P(return_value) *= Z_LVAL(entry_n);
continue;
}
}
@@ -4328,13 +4331,13 @@ PHP_FUNCTION(array_filter)
zval args[2];
zval retval;
zend_bool have_callback = 0;
- php_int_t use_type = 0;
+ zend_long use_type = 0;
zend_string *string_key;
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
- php_uint_t num_key;
+ zend_ulong num_key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fi", &array, &fci, &fci_cache, &use_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) {
return;
}
@@ -4357,15 +4360,15 @@ PHP_FUNCTION(array_filter)
if (!string_key) {
if (use_type == ARRAY_FILTER_USE_BOTH) {
fci.param_count = 2;
- ZVAL_INT(&args[1], num_key);
+ ZVAL_LONG(&args[1], num_key);
} else if (use_type == ARRAY_FILTER_USE_KEY) {
- ZVAL_INT(&args[0], num_key);
+ ZVAL_LONG(&args[0], num_key);
}
} else {
if (use_type == ARRAY_FILTER_USE_BOTH) {
- ZVAL_STR(&args[1], STR_COPY(string_key));
+ ZVAL_STR_COPY(&args[1], string_key);
} else if (use_type == ARRAY_FILTER_USE_KEY) {
- ZVAL_STR(&args[0], STR_COPY(string_key));
+ ZVAL_STR_COPY(&args[0], string_key);
}
}
}
@@ -4420,7 +4423,8 @@ PHP_FUNCTION(array_map)
zval result;
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
- int i, k, maxlen = 0;
+ int i;
+ uint32_t k, maxlen = 0;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f!+", &fci, &fci_cache, &arrays, &n_arrays) == FAILURE) {
@@ -4436,7 +4440,7 @@ PHP_FUNCTION(array_map)
RETVAL_NULL();
if (n_arrays == 1) {
- php_uint_t num_key;
+ zend_ulong num_key;
zend_string *str_key;
zval *zv, arg;
@@ -4477,7 +4481,7 @@ PHP_FUNCTION(array_map)
}
} ZEND_HASH_FOREACH_END();
} else {
- zend_uint *array_pos = (HashPosition *)ecalloc(n_arrays, sizeof(HashPosition));
+ uint32_t *array_pos = (HashPosition *)ecalloc(n_arrays, sizeof(HashPosition));
for (i = 0; i < n_arrays; i++) {
if (Z_TYPE(arrays[i]) != IS_ARRAY) {
@@ -4505,7 +4509,7 @@ PHP_FUNCTION(array_map)
for (i = 0; i < n_arrays; i++) {
/* If this array still has elements, add the current one to the
* parameter list, otherwise use null value. */
- zend_uint pos = array_pos[i];
+ uint32_t pos = array_pos[i];
while (1) {
if (pos >= Z_ARRVAL(arrays[i])->nNumUsed) {
ZVAL_NULL(&zv);
@@ -4531,7 +4535,7 @@ PHP_FUNCTION(array_map)
for (i = 0; i < n_arrays; i++) {
/* If this array still has elements, add the current one to the
* parameter list, otherwise use null value. */
- zend_uint pos = array_pos[i];
+ uint32_t pos = array_pos[i];
while (1) {
if (pos >= Z_ARRVAL(arrays[i])->nNumUsed) {
ZVAL_NULL(&params[i]);
@@ -4599,8 +4603,8 @@ PHP_FUNCTION(array_key_exists)
RETURN_TRUE;
}
RETURN_FALSE;
- case IS_INT:
- if (zend_hash_index_exists(array, Z_IVAL_P(key))) {
+ case IS_LONG:
+ if (zend_hash_index_exists(array, Z_LVAL_P(key))) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -4622,15 +4626,15 @@ PHP_FUNCTION(array_key_exists)
PHP_FUNCTION(array_chunk)
{
int argc = ZEND_NUM_ARGS(), num_in;
- php_int_t size, current = 0;
+ zend_long size, current = 0;
zend_string *str_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_bool preserve_keys = 0;
zval *input = NULL;
zval chunk;
zval *entry;
- if (zend_parse_parameters(argc TSRMLS_CC, "ai|b", &input, &size, &preserve_keys) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) {
return;
}
/* Do bounds checking for size parameter. */
@@ -4688,7 +4692,7 @@ PHP_FUNCTION(array_chunk)
PHP_FUNCTION(array_combine)
{
zval *values, *keys;
- zend_uint pos_values = 0;
+ uint32_t pos_values = 0;
zval *entry_keys, *entry_values;
int num_keys, num_values;
@@ -4716,15 +4720,15 @@ PHP_FUNCTION(array_combine)
break;
} else if (Z_TYPE(Z_ARRVAL_P(values)->arData[pos_values].val) != IS_UNDEF) {
entry_values = &Z_ARRVAL_P(values)->arData[pos_values].val;
- if (Z_TYPE_P(entry_keys) == IS_INT) {
+ if (Z_TYPE_P(entry_keys) == IS_LONG) {
zval_add_ref(entry_values);
- add_index_zval(return_value, Z_IVAL_P(entry_keys), entry_values);
+ add_index_zval(return_value, Z_LVAL_P(entry_keys), entry_values);
} else {
zend_string *key = zval_get_string(entry_keys);
zval_add_ref(entry_values);
zend_symtable_update(Z_ARRVAL_P(return_value), key, entry_values);
- STR_RELEASE(key);
+ zend_string_release(key);
}
pos_values++;
break;
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 8f21a7735c..65472170e2 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,10 +25,10 @@
/* }}} */
ZEND_BEGIN_MODULE_GLOBALS(assert)
- php_int_t active;
- php_int_t bail;
- php_int_t warning;
- php_int_t quiet_eval;
+ zend_long active;
+ zend_long bail;
+ zend_long warning;
+ zend_long quiet_eval;
zval callback;
char *cb;
ZEND_END_MODULE_GLOBALS(assert)
@@ -58,17 +58,17 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
zval_ptr_dtor(&ASSERTG(callback));
ZVAL_UNDEF(&ASSERTG(callback));
}
- if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value_length)) {
- ZVAL_STRINGL(&ASSERTG(callback), new_value, new_value_length);
+ if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
+ ZVAL_STR_COPY(&ASSERTG(callback), new_value);
}
} else {
if (ASSERTG(cb)) {
pefree(ASSERTG(cb), 1);
}
- if (new_value && new_value_length) {
- ASSERTG(cb) = pemalloc(new_value_length + 1, 1);
- memcpy(ASSERTG(cb), new_value, new_value_length);
- ASSERTG(cb)[new_value_length] = '\0';
+ if (new_value && new_value->len) {
+ ASSERTG(cb) = pemalloc(new_value->len + 1, 1);
+ memcpy(ASSERTG(cb), new_value->val, new_value->len);
+ ASSERTG(cb)[new_value->len] = '\0';
} else {
ASSERTG(cb) = NULL;
}
@@ -98,11 +98,11 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
return SUCCESS;
}
@@ -140,7 +140,8 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */
PHP_FUNCTION(assert)
{
zval *assertion;
- int val, description_len = 0;
+ int val;
+ size_t description_len = 0;
char *myeval = NULL;
char *compiled_string_description, *description = NULL;
@@ -164,7 +165,7 @@ PHP_FUNCTION(assert)
}
compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC);
- if (zend_eval_stringl(myeval, Z_STRSIZE_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
+ if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
if (description_len == 0) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval);
@@ -205,7 +206,7 @@ PHP_FUNCTION(assert)
const char *filename = zend_get_executed_filename(TSRMLS_C);
ZVAL_STRING(&args[0], SAFE_STRING(filename));
- ZVAL_INT (&args[1], lineno);
+ ZVAL_LONG (&args[1], lineno);
ZVAL_STRING(&args[2], SAFE_STRING(myeval));
ZVAL_FALSE(&retval);
@@ -256,12 +257,12 @@ PHP_FUNCTION(assert)
PHP_FUNCTION(assert_options)
{
zval *value = NULL;
- php_int_t what;
+ zend_long what;
int oldint;
int ac = ZEND_NUM_ARGS();
zend_string *key;
- if (zend_parse_parameters(ac TSRMLS_CC, "i|z", &what, &value) == FAILURE) {
+ if (zend_parse_parameters(ac TSRMLS_CC, "l|z", &what, &value) == FAILURE) {
return;
}
@@ -270,48 +271,48 @@ PHP_FUNCTION(assert_options)
oldint = ASSERTG(active);
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
- key = STR_INIT("assert.active", sizeof("assert.active")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(key);
- STR_RELEASE(value_str);
+ key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(key);
+ zend_string_release(value_str);
}
- RETURN_INT(oldint);
+ RETURN_LONG(oldint);
break;
case ASSERT_BAIL:
oldint = ASSERTG(bail);
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
- key = STR_INIT("assert.bail", sizeof("assert.bail")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(key);
- STR_RELEASE(value_str);
+ key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(key);
+ zend_string_release(value_str);
}
- RETURN_INT(oldint);
+ RETURN_LONG(oldint);
break;
case ASSERT_QUIET_EVAL:
oldint = ASSERTG(quiet_eval);
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
- key = STR_INIT("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(key);
- STR_RELEASE(value_str);
+ key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(key);
+ zend_string_release(value_str);
}
- RETURN_INT(oldint);
+ RETURN_LONG(oldint);
break;
case ASSERT_WARNING:
oldint = ASSERTG(warning);
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
- key = STR_INIT("assert.warning", sizeof("assert.warning")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(key);
- STR_RELEASE(value_str);
+ key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(key);
+ zend_string_release(value_str);
}
- RETURN_INT(oldint);
+ RETURN_LONG(oldint);
break;
case ASSERT_CALLBACK:
@@ -331,7 +332,7 @@ PHP_FUNCTION(assert_options)
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown value %ld", what);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown value %pd", what);
break;
}
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 7ee643a7d5..fd1c910234 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -53,17 +53,13 @@ static const short base64_reverse_table[256] = {
};
/* }}} */
-PHPAPI zend_string *php_base64_encode(const unsigned char *str, php_size_t length) /* {{{ */
+PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) /* {{{ */
{
const unsigned char *current = str;
unsigned char *p;
zend_string *result;
- if (length < 0) {
- return NULL;
- }
-
- result = STR_ALLOC(((length + 2) / 3) * 4 * sizeof(char), 0);
+ result = zend_string_alloc(((length + 2) / 3) * 4 * sizeof(char), 0);
p = (unsigned char *)result->val;
while (length > 2) { /* keep going until we have less than 24 bits */
@@ -131,20 +127,20 @@ void php_base64_init(void)
*/
/* }}} */
-PHPAPI zend_string *php_base64_decode(const unsigned char *str, php_size_t length) /* {{{ */
+PHPAPI zend_string *php_base64_decode(const unsigned char *str, size_t length) /* {{{ */
{
return php_base64_decode_ex(str, length, 0);
}
/* }}} */
-PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t length, zend_bool strict) /* {{{ */
+PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) /* {{{ */
{
const unsigned char *current = str;
int ch, i = 0, j = 0, k;
/* this sucks for threaded environments */
zend_string *result;
- result = STR_ALLOC(length, 0);
+ result = zend_string_alloc(length, 0);
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0' && length-- > 0) {
@@ -158,7 +154,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le
continue;
}
}
- STR_FREE(result);
+ zend_string_free(result);
return NULL;
}
continue;
@@ -168,7 +164,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le
if ((!strict && ch < 0) || ch == -1) { /* a space or some other separator character, we simply skip over */
continue;
} else if (ch == -2) {
- STR_FREE(result);
+ zend_string_free(result);
return NULL;
}
@@ -196,7 +192,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le
if (ch == base64_pad) {
switch(i % 4) {
case 1:
- STR_FREE(result);
+ zend_string_free(result);
return NULL;
case 2:
k++;
@@ -216,7 +212,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le
PHP_FUNCTION(base64_encode)
{
char *str;
- int str_len;
+ size_t str_len;
zend_string *result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
@@ -237,7 +233,7 @@ PHP_FUNCTION(base64_decode)
{
char *str;
zend_bool strict = 0;
- int str_len;
+ size_t str_len;
zend_string *result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &strict) == FAILURE) {
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
index dd07db56e1..a31a799c3a 100644
--- a/ext/standard/base64.h
+++ b/ext/standard/base64.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -24,9 +24,9 @@
PHP_FUNCTION(base64_decode);
PHP_FUNCTION(base64_encode);
-PHPAPI extern zend_string *php_base64_encode(const unsigned char *, php_size_t);
-PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, php_size_t, zend_bool);
-PHPAPI extern zend_string *php_base64_decode(const unsigned char *, php_size_t);
+PHPAPI extern zend_string *php_base64_encode(const unsigned char *, size_t);
+PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, zend_bool);
+PHPAPI extern zend_string *php_base64_decode(const unsigned char *, size_t);
#endif /* BASE64_H */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index a00b05d44d..5bcd3d3386 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -99,7 +99,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
#ifndef INADDR_NONE
-#define INADDR_NONE ((php_uint_t) -1)
+#define INADDR_NONE ((zend_ulong) -1)
#endif
#include "zend_globals.h"
@@ -3545,28 +3545,29 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class(TSRMLS_C);
- REGISTER_INT_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("INI_SCANNER_TYPED", ZEND_INI_SCANNER_TYPED, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT);
#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
REGISTER_MATH_CONSTANT(M_E);
@@ -3589,10 +3590,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT);
REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT);
#if ENABLE_TEST_CLASS
test_class_startup();
@@ -3840,7 +3841,8 @@ PHP_FUNCTION(constant)
PHP_NAMED_FUNCTION(php_inet_ntop)
{
char *address;
- int address_len, af = AF_INET;
+ size_t address_len;
+ int af = AF_INET;
char buffer[40];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) {
@@ -3874,7 +3876,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
{
int ret, af = AF_INET;
char *address;
- int address_len;
+ size_t address_len;
char buffer[17];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) {
@@ -3910,11 +3912,11 @@ PHP_NAMED_FUNCTION(php_inet_pton)
PHP_FUNCTION(ip2long)
{
char *addr;
- int addr_len;
+ size_t addr_len;
#ifdef HAVE_INET_PTON
struct in_addr ip;
#else
- php_uint_t ip;
+ zend_ulong ip;
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) {
@@ -3925,7 +3927,7 @@ PHP_FUNCTION(ip2long)
if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) {
RETURN_FALSE;
}
- RETURN_INT(ntohl(ip.s_addr));
+ RETURN_LONG(ntohl(ip.s_addr));
#else
if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) {
/* The only special case when we should return -1 ourselves,
@@ -3934,11 +3936,11 @@ PHP_FUNCTION(ip2long)
if (addr_len == sizeof("255.255.255.255") - 1 &&
!memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1)
) {
- RETURN_INT(0xFFFFFFFF);
+ RETURN_LONG(0xFFFFFFFF);
}
RETURN_FALSE;
}
- RETURN_INT(ntohl(ip));
+ RETURN_LONG(ntohl(ip));
#endif
}
/* }}} */
@@ -3949,8 +3951,8 @@ PHP_FUNCTION(long2ip)
{
/* "It's a long but it's not, PHP ints are signed */
char *ip;
- int ip_len;
- php_uint_t n;
+ size_t ip_len;
+ zend_ulong n;
struct in_addr myaddr;
#ifdef HAVE_INET_PTON
char str[40];
@@ -3984,7 +3986,7 @@ PHP_FUNCTION(long2ip)
PHP_FUNCTION(getenv)
{
char *ptr, *str;
- int str_len;
+ size_t str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
RETURN_FALSE;
@@ -4047,7 +4049,7 @@ PHP_FUNCTION(getenv)
PHP_FUNCTION(putenv)
{
char *setting;
- int setting_len;
+ size_t setting_len;
char *p, **env;
putenv_entry pe;
#ifdef PHP_WIN32
@@ -4176,8 +4178,9 @@ static int parse_opts(char * opts, opt_struct ** result)
{
opt_struct * paras = NULL;
unsigned int i, count = 0;
+ unsigned int opts_len = (unsigned int)strlen(opts);
- for (i = 0; i < strlen(opts); i++) {
+ for (i = 0; i < opts_len; i++) {
if ((opts[i] >= 48 && opts[i] <= 57) ||
(opts[i] >= 65 && opts[i] <= 90) ||
(opts[i] >= 97 && opts[i] <= 122)
@@ -4216,7 +4219,8 @@ PHP_FUNCTION(getopt)
char *options = NULL, **argv = NULL;
char opt[2] = { '\0' };
char *optname;
- int argc = 0, options_len = 0, len, o;
+ int argc = 0, len, o;
+ size_t options_len = 0;
char *php_optarg = NULL;
int php_optind = 1;
zval val, *args = NULL, *p_longopts = NULL;
@@ -4252,7 +4256,7 @@ PHP_FUNCTION(getopt)
argv[pos++] = estrdup(arg_str->val);
- STR_RELEASE(arg_str);
+ zend_string_release(arg_str);
} ZEND_HASH_FOREACH_END();
/* The C Standard requires argv[argc] to be NULL - this might
@@ -4297,7 +4301,7 @@ PHP_FUNCTION(getopt)
opts->opt_char = 0;
opts++;
- STR_RELEASE(arg_str);
+ zend_string_release(arg_str);
} ZEND_HASH_FOREACH_END();
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1));
@@ -4342,7 +4346,7 @@ PHP_FUNCTION(getopt)
/* Add this option / argument pair to the result hash. */
optname_len = strlen(optname);
- if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_INT) {
+ if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) {
/* numeric string */
int optname_int = atoi(optname);
if ((args = zend_hash_index_find(HASH_OF(return_value), optname_int)) != NULL) {
@@ -4386,9 +4390,9 @@ PHP_FUNCTION(flush)
Delay for a given number of seconds */
PHP_FUNCTION(sleep)
{
- php_int_t num;
+ zend_long num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
RETURN_FALSE;
}
if (num < 0) {
@@ -4396,7 +4400,7 @@ PHP_FUNCTION(sleep)
RETURN_FALSE;
}
#ifdef PHP_SLEEP_NON_VOID
- RETURN_INT(php_sleep(num));
+ RETURN_LONG(php_sleep(num));
#else
php_sleep(num);
#endif
@@ -4409,9 +4413,9 @@ PHP_FUNCTION(sleep)
PHP_FUNCTION(usleep)
{
#if HAVE_USLEEP
- php_int_t num;
+ zend_long num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
return;
}
if (num < 0) {
@@ -4428,10 +4432,10 @@ PHP_FUNCTION(usleep)
Delay for a number of seconds and nano seconds */
PHP_FUNCTION(time_nanosleep)
{
- php_int_t tv_sec, tv_nsec;
+ zend_long tv_sec, tv_nsec;
struct timespec php_req, php_rem;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &tv_sec, &tv_nsec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) {
return;
}
@@ -4450,8 +4454,8 @@ PHP_FUNCTION(time_nanosleep)
RETURN_TRUE;
} else if (errno == EINTR) {
array_init(return_value);
- add_assoc_int_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec);
- add_assoc_int_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec);
+ add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec);
+ add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec);
return;
} else if (errno == EINVAL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative");
@@ -4525,9 +4529,9 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args
if (Z_TYPE_P(entry) == IS_STRING) {
if (hash_key->key) {
- add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, STR_COPY(Z_STR_P(entry)));
+ add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, zend_string_copy(Z_STR_P(entry)));
} else {
- add_index_str(retval, hash_key->h, STR_COPY(Z_STR_P(entry)));
+ add_index_str(retval, hash_key->h, zend_string_copy(Z_STR_P(entry)));
}
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
array_init(&tmp);
@@ -4543,7 +4547,7 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args
PHP_FUNCTION(get_cfg_var)
{
char *varname;
- int varname_len;
+ size_t varname_len;
zval *retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) {
@@ -4624,11 +4628,11 @@ error options:
PHP_FUNCTION(error_log)
{
char *message, *opt = NULL, *headers = NULL;
- int message_len, opt_len = 0, headers_len = 0;
+ size_t message_len, opt_len = 0, headers_len = 0;
int opt_err = 0, argc = ZEND_NUM_ARGS();
- php_int_t erropt = 0;
+ zend_long erropt = 0;
- if (zend_parse_parameters(argc TSRMLS_CC, "s|ips", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) {
return;
}
@@ -4703,16 +4707,17 @@ PHP_FUNCTION(error_get_last)
if (PG(last_error_message)) {
array_init(return_value);
- add_assoc_int_ex(return_value, "type", sizeof("type")-1, PG(last_error_type));
+ add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type));
add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message));
add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-");
- add_assoc_int_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno));
+ add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno));
}
}
/* }}} */
/* {{{ proto mixed call_user_func(mixed function_name [, mixed parmeter] [, mixed ...])
- Call a user function which is the first parameter */
+ Call a user function which is the first parameter
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(call_user_func)
{
zval retval;
@@ -4739,7 +4744,8 @@ PHP_FUNCTION(call_user_func)
/* }}} */
/* {{{ proto mixed call_user_func_array(string function_name, array parameters)
- Call a user function which is the first parameter with the arguments contained in array */
+ Call a user function which is the first parameter with the arguments contained in array
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(call_user_func_array)
{
zval *params, retval;
@@ -4780,15 +4786,15 @@ PHP_FUNCTION(forward_static_call)
return;
}
- if (!EG(current_execute_data)->prev_execute_data->func->common.scope) {
+ if (!EX(prev_execute_data)->func->common.scope) {
zend_error(E_ERROR, "Cannot call forward_static_call() when no class scope is active");
}
fci.retval = &retval;
- if (EG(current_execute_data)->called_scope &&
- instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(current_execute_data)->called_scope;
+ if (EX(called_scope) &&
+ instanceof_function(EX(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EX(called_scope);
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
@@ -4812,9 +4818,9 @@ PHP_FUNCTION(forward_static_call_array)
zend_fcall_info_args(&fci, params TSRMLS_CC);
fci.retval = &retval;
- if (EG(current_execute_data)->called_scope &&
- instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(current_execute_data)->called_scope;
+ if (EX(called_scope) &&
+ instanceof_function(EX(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EX(called_scope);
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
@@ -4856,14 +4862,16 @@ static int user_shutdown_function_call(zval *zv TSRMLS_DC) /* {{{ */
zend_string *function_name;
if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name TSRMLS_CC)) {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name->val);
if (function_name) {
- STR_RELEASE(function_name);
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name->val);
+ zend_string_release(function_name);
+ } else {
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist");
}
return 0;
}
if (function_name) {
- STR_RELEASE(function_name);
+ zend_string_release(function_name);
}
if (call_user_function(EG(function_table), NULL,
@@ -4937,11 +4945,11 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_
} else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) {
zval result;
zend_compare_arrays(&result, func1, func2 TSRMLS_CC);
- ret = (Z_IVAL(result) == 0);
+ ret = (Z_LVAL(result) == 0);
} else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) {
zval result;
zend_compare_objects(&result, func1, func2 TSRMLS_CC);
- ret = (Z_IVAL(result) == 0);
+ ret = (Z_LVAL(result) == 0);
} else {
ret = 0;
}
@@ -5004,7 +5012,11 @@ PHP_FUNCTION(register_shutdown_function)
/* Prevent entering of anything but valid callback (syntax check only!) */
if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", callback_name->val);
+ if (callback_name) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", callback_name->val);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback passed");
+ }
efree(shutdown_function_entry.arguments);
RETVAL_FALSE;
} else {
@@ -5019,7 +5031,7 @@ PHP_FUNCTION(register_shutdown_function)
zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry));
}
if (callback_name) {
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
}
}
/* }}} */
@@ -5071,7 +5083,7 @@ ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highl
PHP_FUNCTION(highlight_file)
{
char *filename;
- int filename_len, ret;
+ size_t filename_len, ret;
zend_syntax_highlighter_ini syntax_highlighter_ini;
zend_bool i = 0;
@@ -5112,9 +5124,9 @@ PHP_FUNCTION(highlight_file)
PHP_FUNCTION(php_strip_whitespace)
{
char *filename;
- int filename_len;
+ size_t filename_len;
zend_lex_state original_lex_state;
- zend_file_handle file_handle = {0};
+ zend_file_handle file_handle = {{0}};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
RETURN_FALSE;
@@ -5194,7 +5206,7 @@ PHP_FUNCTION(highlight_string)
PHP_FUNCTION(ini_get)
{
char *varname, *str;
- int varname_len;
+ size_t varname_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) {
return;
@@ -5229,27 +5241,30 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
array_init(&option);
if (ini_entry->orig_value) {
- add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length);
+ add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->orig_value));
} else if (ini_entry->value) {
- add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length);
+ add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->value));
} else {
add_assoc_null(&option, "global_value");
}
if (ini_entry->value) {
- add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length);
+ add_assoc_str(&option, "local_value", zend_string_copy(ini_entry->value));
} else {
add_assoc_null(&option, "local_value");
}
- add_assoc_int(&option, "access", ini_entry->modifiable);
+ add_assoc_long(&option, "access", ini_entry->modifiable);
- add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &option);
} else {
if (ini_entry->value) {
- add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length);
+ zval zv;
+
+ ZVAL_STR_COPY(&zv, ini_entry->value);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
} else {
- add_assoc_null(ini_array, ini_entry->name);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
}
}
}
@@ -5262,7 +5277,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
PHP_FUNCTION(ini_get_all)
{
char *extname = NULL;
- int extname_len = 0, extnumber = 0;
+ size_t extname_len = 0, extnumber = 0;
zend_module_entry *module;
zend_bool details = 1;
@@ -5300,11 +5315,10 @@ static int php_ini_check_path(char *option_name, int option_len, char *new_optio
PHP_FUNCTION(ini_set)
{
zend_string *varname;
- char *new_value;
- int new_value_len;
+ zend_string *new_value;
char *old_value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss", &varname, &new_value, &new_value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &varname, &new_value) == FAILURE) {
return;
}
@@ -5326,14 +5340,14 @@ PHP_FUNCTION(ini_set)
_CHECK_PATH(varname->val, varname->len, "mail.log") ||
_CHECK_PATH(varname->val, varname->len, "java.library.path") ||
_CHECK_PATH(varname->val, varname->len, "vpopmail.directory")) {
- if (php_check_open_basedir(new_value TSRMLS_CC)) {
+ if (php_check_open_basedir(new_value->val TSRMLS_CC)) {
zval_dtor(return_value);
RETURN_FALSE;
}
}
}
- if (zend_alter_ini_entry_ex(varname, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
+ if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
@@ -5358,12 +5372,11 @@ PHP_FUNCTION(ini_restore)
Sets the include_path configuration option */
PHP_FUNCTION(set_include_path)
{
- char *new_value;
- int new_value_len;
+ zend_string *new_value;
char *old_value;
zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &new_value) == FAILURE) {
return;
}
@@ -5375,13 +5388,13 @@ PHP_FUNCTION(set_include_path)
RETVAL_FALSE;
}
- key = STR_INIT("include_path", sizeof("include_path") - 1, 0);
- if (zend_alter_ini_entry_ex(key, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
- STR_RELEASE(key);
+ key = zend_string_init("include_path", sizeof("include_path") - 1, 0);
+ if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
+ zend_string_release(key);
zval_dtor(return_value);
RETURN_FALSE;
}
- STR_RELEASE(key);
+ zend_string_release(key);
}
/* }}} */
@@ -5414,9 +5427,9 @@ PHP_FUNCTION(restore_include_path)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
- key = STR_INIT("include_path", sizeof("include_path")-1, 0);
+ key = zend_string_init("include_path", sizeof("include_path")-1, 0);
zend_restore_ini_entry(key, PHP_INI_STAGE_RUNTIME);
- STR_FREE(key);
+ zend_string_free(key);
}
/* }}} */
@@ -5450,7 +5463,7 @@ PHP_FUNCTION(print_r)
Returns true if client disconnected */
PHP_FUNCTION(connection_aborted)
{
- RETURN_INT(PG(connection_status) & PHP_CONNECTION_ABORTED);
+ RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
}
/* }}} */
@@ -5458,7 +5471,7 @@ PHP_FUNCTION(connection_aborted)
Returns the connection status bitfield */
PHP_FUNCTION(connection_status)
{
- RETURN_INT(PG(connection_status));
+ RETURN_LONG(PG(connection_status));
}
/* }}} */
@@ -5466,23 +5479,22 @@ PHP_FUNCTION(connection_status)
Set whether we want to ignore a user abort event or not */
PHP_FUNCTION(ignore_user_abort)
{
- char *arg = NULL;
- int arg_len = 0;
+ zend_string *arg = NULL;
int old_setting;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &arg) == FAILURE) {
return;
}
old_setting = PG(ignore_user_abort);
if (arg) {
- zend_string *key = STR_INIT("ignore_user_abort", sizeof("ignore_user_abort"), 0);
- zend_alter_ini_entry_ex(key, arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort"), 0);
+ zend_alter_ini_entry_ex(key, arg, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_string_release(key);
}
- RETURN_INT(old_setting);
+ RETURN_LONG(old_setting);
}
/* }}} */
@@ -5492,7 +5504,7 @@ PHP_FUNCTION(ignore_user_abort)
PHP_FUNCTION(getservbyname)
{
char *name, *proto;
- int name_len, proto_len;
+ size_t name_len, proto_len;
struct servent *serv;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) {
@@ -5514,7 +5526,7 @@ PHP_FUNCTION(getservbyname)
RETURN_FALSE;
}
- RETURN_INT(ntohs(serv->s_port));
+ RETURN_LONG(ntohs(serv->s_port));
}
/* }}} */
#endif
@@ -5525,11 +5537,11 @@ PHP_FUNCTION(getservbyname)
PHP_FUNCTION(getservbyport)
{
char *proto;
- int proto_len;
- php_int_t port;
+ size_t proto_len;
+ zend_long port;
struct servent *serv;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &port, &proto, &proto_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) {
return;
}
@@ -5550,7 +5562,7 @@ PHP_FUNCTION(getservbyport)
PHP_FUNCTION(getprotobyname)
{
char *name;
- int name_len;
+ size_t name_len;
struct protoent *ent;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
@@ -5563,7 +5575,7 @@ PHP_FUNCTION(getprotobyname)
RETURN_FALSE;
}
- RETURN_INT(ent->p_proto);
+ RETURN_LONG(ent->p_proto);
}
/* }}} */
#endif
@@ -5573,10 +5585,10 @@ PHP_FUNCTION(getprotobyname)
Returns protocol name associated with protocol number proto */
PHP_FUNCTION(getprotobynumber)
{
- php_int_t proto;
+ zend_long proto;
struct protoent *ent;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &proto) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &proto) == FAILURE) {
return;
}
@@ -5616,10 +5628,10 @@ PHP_FUNCTION(register_tick_function)
if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name TSRMLS_CC)) {
efree(tick_fe.arguments);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid tick callback '%s' passed", function_name->val);
- STR_RELEASE(function_name);
+ zend_string_release(function_name);
RETURN_FALSE;
} else if (function_name) {
- STR_RELEASE(function_name);
+ zend_string_release(function_name);
}
if (Z_TYPE(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE(tick_fe.arguments[0]) != IS_OBJECT) {
@@ -5678,7 +5690,7 @@ PHP_FUNCTION(unregister_tick_function)
PHP_FUNCTION(is_uploaded_file)
{
char *path;
- int path_len;
+ size_t path_len;
if (!SG(rfc1867_uploaded_files)) {
RETURN_FALSE;
@@ -5701,7 +5713,7 @@ PHP_FUNCTION(is_uploaded_file)
PHP_FUNCTION(move_uploaded_file)
{
char *path, *new_path;
- int path_len, new_path_len;
+ size_t path_len, new_path_len;
zend_bool successful = 0;
#ifndef PHP_WIN32
@@ -5777,8 +5789,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
break;
}
- if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_INT) {
- php_uint_t key = (php_uint_t) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1));
+ if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
+ zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) {
array_init(&hash);
find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash);
@@ -5797,7 +5809,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
ZVAL_DUP(&element, arg2);
- if (arg3 && Z_STRSIZE_P(arg3) > 0) {
+ if (arg3 && Z_STRLEN_P(arg3) > 0) {
zend_symtable_update(Z_ARRVAL_P(find_hash), Z_STR_P(arg3), &element);
} else {
add_next_index_zval(find_hash, &element);
@@ -5837,13 +5849,13 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3,
PHP_FUNCTION(parse_ini_file)
{
char *filename = NULL;
- int filename_len = 0;
+ size_t filename_len = 0;
zend_bool process_sections = 0;
- php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL;
+ zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_file_handle fh;
zend_ini_parser_cb_t ini_parser_cb;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bi", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) {
RETURN_FALSE;
}
@@ -5878,12 +5890,12 @@ PHP_FUNCTION(parse_ini_file)
PHP_FUNCTION(parse_ini_string)
{
char *string = NULL, *str = NULL;
- int str_len = 0;
+ size_t str_len = 0;
zend_bool process_sections = 0;
- php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL;
+ zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) {
RETURN_FALSE;
}
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index ee79269cae..eaac7a1609 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -167,7 +167,7 @@ typedef struct _php_basic_globals {
char *locale_string;
char *strtok_last;
char strtok_table[256];
- php_uint_t strtok_len;
+ zend_ulong strtok_len;
char str_ebuf[40];
zend_fcall_info array_walk_fci;
zend_fcall_info_cache array_walk_fci_cache;
@@ -178,9 +178,9 @@ typedef struct _php_basic_globals {
zval active_ini_file_section;
/* pageinfo.c */
- php_int_t page_uid;
- php_int_t page_gid;
- php_int_t page_inode;
+ zend_long page_uid;
+ zend_long page_gid;
+ zend_long page_inode;
time_t page_mtime;
/* filestat.c && main/streams/streams.c */
@@ -204,11 +204,11 @@ typedef struct _php_basic_globals {
zend_class_entry *incomplete_class;
unsigned serialize_lock; /* whether to use the locally supplied var_hash instead (__sleep/__wakeup) */
struct {
- void *var_hash;
+ struct php_serialize_data *data;
unsigned level;
} serialize;
struct {
- void *var_hash;
+ struct php_unserialize_data *data;
unsigned level;
} unserialize;
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index c5a4b47744..a76fb136a3 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -61,7 +61,7 @@ static void browscap_entry_dtor_request(zval *zvalue) /* {{{ */
zend_hash_destroy(Z_ARRVAL_P(zvalue));
efree(Z_ARR_P(zvalue));
} else if (Z_TYPE_P(zvalue) == IS_STRING) {
- STR_RELEASE(Z_STR_P(zvalue));
+ zend_string_release(Z_STR_P(zvalue));
}
}
/* }}} */
@@ -71,7 +71,7 @@ static void browscap_entry_dtor_persistent(zval *zvalue) /* {{{ */ {
zend_hash_destroy(Z_ARRVAL_P(zvalue));
free(Z_ARR_P(zvalue));
} else if (Z_TYPE_P(zvalue) == IS_STRING) {
- STR_RELEASE(Z_STR_P(zvalue));
+ zend_string_release(Z_STR_P(zvalue));
}
}
/* }}} */
@@ -83,15 +83,15 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */
zend_string *res;
char *lc_pattern;
- res = STR_SAFE_ALLOC(Z_STRSIZE_P(pattern), 2, 4, persistent);
+ res = zend_string_safe_alloc(Z_STRLEN_P(pattern), 2, 4, persistent);
t = res->val;
- lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern));
+ lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern));
t[j++] = '\xA7'; /* section sign */
t[j++] = '^';
- for (i=0; i<Z_STRSIZE_P(pattern); i++, j++) {
+ for (i=0; i<Z_STRLEN_P(pattern); i++, j++) {
switch (lc_pattern[i]) {
case '?':
t[j] = '.';
@@ -163,26 +163,26 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
}
/* Set proper value for true/false settings */
- if ((Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) ||
- (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) ||
- (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1))
+ if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) ||
+ (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) ||
+ (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1))
) {
- ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent));
+ ZVAL_NEW_STR(&new_property, zend_string_init("1", sizeof("1")-1, persistent));
} else if (
- (Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) ||
- (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) ||
- (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) ||
- (Z_STRSIZE_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1))
+ (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) ||
+ (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) ||
+ (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) ||
+ (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1))
) {
// TODO: USE STR_EMPTY_ALLOC()?
- ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent));
+ ZVAL_NEW_STR(&new_property, zend_string_init("", sizeof("")-1, persistent));
} else { /* Other than true/false setting */
- ZVAL_STR(&new_property, STR_DUP(Z_STR_P(arg2), persistent));
+ ZVAL_STR(&new_property, zend_string_dup(Z_STR_P(arg2), persistent));
}
- new_key = STR_DUP(Z_STR_P(arg1), persistent);
+ new_key = zend_string_dup(Z_STR_P(arg1), persistent);
zend_str_tolower(new_key->val, new_key->len);
zend_hash_update(Z_ARRVAL(bdata->current_section), new_key, &new_property);
- STR_RELEASE(new_key);
+ zend_string_release(new_key);
}
break;
case ZEND_INI_PARSER_SECTION: {
@@ -203,12 +203,12 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
pefree(bdata->current_section_name, persistent);
}
bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1),
- Z_STRSIZE_P(arg1), persistent);
+ Z_STRLEN_P(arg1), persistent);
zend_hash_update(bdata->htab, Z_STR_P(arg1), &bdata->current_section);
ZVAL_STR(&processed, Z_STR_P(arg1));
- ZVAL_STR(&unprocessed, STR_DUP(Z_STR_P(arg1), persistent));
+ ZVAL_STR(&unprocessed, zend_string_dup(Z_STR_P(arg1), persistent));
convert_browscap_pattern(&processed, persistent);
zend_hash_str_update(Z_ARRVAL(bdata->current_section), "browser_name_regex", sizeof("browser_name_regex")-1, &processed);
@@ -221,7 +221,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
static int browscap_read_file(char *filename, browser_data *browdata, int persistent TSRMLS_DC) /* {{{ */
{
- zend_file_handle fh = {0};
+ zend_file_handle fh = {{0}};
if (filename == NULL || filename[0] == '\0') {
return FAILURE;
@@ -296,7 +296,7 @@ PHP_INI_MH(OnChangeBrowscap)
if (bdata->filename[0] != '\0') {
browscap_bdata_dtor(bdata, 0 TSRMLS_CC);
}
- if (VCWD_REALPATH(new_value, bdata->filename) == NULL) {
+ if (VCWD_REALPATH(new_value->val, bdata->filename) == NULL) {
return FAILURE;
}
return SUCCESS;
@@ -379,16 +379,14 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar
number of characters changed in the user agent being checked versus
the previous match found and the current match. */
if (Z_TYPE_P(found_browser_entry) == IS_ARRAY) {
- int i, prev_len = 0, curr_len = 0, ua_len;
- zval *current_match;
+ size_t i, prev_len = 0, curr_len = 0;
+ zval *current_match = zend_hash_str_find(Z_ARRVAL_P(browser), "browser_name_pattern", sizeof("browser_name_pattern")-1);
- if ((current_match = zend_hash_str_find(Z_ARRVAL_P(browser), "browser_name_pattern", sizeof("browser_name_pattern")-1)) == NULL) {
+ if (!current_match) {
return 0;
}
- ua_len = lookup_browser_length;
-
- for (i = 0; i < Z_STRSIZE_P(previous_match); i++) {
+ for (i = 0; i < Z_STRLEN_P(previous_match); i++) {
switch (Z_STRVAL_P(previous_match)[i]) {
case '?':
case '*':
@@ -400,7 +398,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar
}
}
- for (i = 0; i < Z_STRSIZE_P(current_match); i++) {
+ for (i = 0; i < Z_STRLEN_P(current_match); i++) {
switch (Z_STRVAL_P(current_match)[i]) {
case '?':
case '*':
@@ -414,7 +412,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar
/* Pick which browser pattern replaces the least amount of
characters when compared to the original user agent string... */
- if (ua_len - prev_len > ua_len - curr_len) {
+ if (prev_len < curr_len) {
ZVAL_COPY_VALUE(found_browser_entry, browser);
}
}
@@ -438,7 +436,7 @@ static void browscap_zval_copy_ctor(zval *p) /* {{{ */
PHP_FUNCTION(get_browser)
{
char *agent_name = NULL;
- int agent_name_len = 0;
+ size_t agent_name_len = 0;
zend_bool return_array = 0;
zval *agent, *z_agent_name, *http_user_agent;
zval found_browser_entry;
@@ -465,9 +463,9 @@ PHP_FUNCTION(get_browser)
}
if (agent_name == NULL) {
- zend_string *key = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0);
+ zend_string *key = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(key TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF ||
(http_user_agent = zend_hash_str_find(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) == NULL
) {
@@ -475,7 +473,7 @@ PHP_FUNCTION(get_browser)
RETURN_FALSE;
}
agent_name = Z_STRVAL_P(http_user_agent);
- agent_name_len = Z_STRSIZE_P(http_user_agent);
+ agent_name_len = Z_STRLEN_P(http_user_agent);
}
lookup_browser_name = estrndup(agent_name, agent_name_len);
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 67952163aa..7a5f0effa0 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -338,7 +338,9 @@ fi
dnl
dnl Check for available functions
dnl
-AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p log2 hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
+dnl log2 could be used to improve the log function, however it requires C99. The check for log2 should be turned on,
+dnl as soon as we support C99.
+AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
AC_FUNC_FNMATCH
dnl
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index 6ff40d57c8..a515b492b8 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
PHP_NAMED_FUNCTION(php_if_crc32)
{
char *p;
- int nr;
+ size_t nr;
php_uint32 crcinit = 0;
register php_uint32 crc;
@@ -39,7 +39,7 @@ PHP_NAMED_FUNCTION(php_if_crc32)
for (; nr--; ++p) {
crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ];
}
- RETVAL_INT(crc^0xFFFFFFFF);
+ RETVAL_LONG(crc^0xFFFFFFFF);
}
/* }}} */
diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h
index be9a99e6e2..222967dd25 100644
--- a/ext/standard/crc32.h
+++ b/ext/standard/crc32.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
index 6df81ca029..1aeff9e679 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/credits.h b/ext/standard/credits.h
index a1f57360a5..0a501526f8 100644
--- a/ext/standard/credits.h
+++ b/ext/standard/credits.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
index f77bbdf157..fa1b1325e0 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -1,9 +1,9 @@
/*
DO NOT EDIT THIS FILE!
- it has been automaticaly created by php5/scripts/credits from
- the information found in the various php5/ext/.../CREDITS and
- php5/sapi/.../CREDITS files
+ it has been automaticaly created by php7/scripts/credits from
+ the information found in the various php7/ext/.../CREDITS and
+ php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h
index 634a370329..8f0b8264ce 100644
--- a/ext/standard/credits_sapi.h
+++ b/ext/standard/credits_sapi.h
@@ -1,9 +1,9 @@
/*
DO NOT EDIT THIS FILE!
- it has been automaticaly created by php5/scripts/credits from
- the information found in the various php5/ext/.../CREDITS and
- php5/sapi/.../CREDITS files
+ it has been automaticaly created by php7/scripts/credits from
+ the information found in the various php7/ext/.../CREDITS and
+ php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 47436398ff..9599e2f056 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -102,18 +102,18 @@
PHP_MINIT_FUNCTION(crypt) /* {{{ */
{
- REGISTER_INT_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT);
#ifdef PHP_SHA256_CRYPT
- REGISTER_INT_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef PHP_SHA512_CRYPT
- REGISTER_INT_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT);
#endif
#if PHP_USE_PHP_CRYPT_R
@@ -136,7 +136,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */
static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-static void php_to64(char *s, php_int_t v, int n) /* {{{ */
+static void php_to64(char *s, zend_long v, int n) /* {{{ */
{
while (--n >= 0) {
*s++ = itoa64[v&0x3f];
@@ -160,7 +160,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
out = php_md5_crypt_r(password, salt, output);
if (out) {
- return STR_INIT(out, strlen(out), 0);
+ return zend_string_init(out, strlen(out), 0);
}
return NULL;
} else if (salt[0]=='$' && salt[1]=='6' && salt[2]=='$') {
@@ -173,7 +173,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
efree(output);
return NULL;
} else {
- result = STR_INIT(output, strlen(output), 0);
+ result = zend_string_init(output, strlen(output), 0);
memset(output, 0, PHP_MAX_SALT_LEN);
efree(output);
return result;
@@ -188,7 +188,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
efree(output);
return NULL;
} else {
- result = STR_INIT(output, strlen(output), 0);
+ result = zend_string_init(output, strlen(output), 0);
memset(output, 0, PHP_MAX_SALT_LEN);
efree(output);
return result;
@@ -207,11 +207,11 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
crypt_res = php_crypt_blowfish_rn(password, salt, output, sizeof(output));
if (!crypt_res) {
- memset(output, 0, PHP_MAX_SALT_LEN + 1);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1);
return NULL;
} else {
- result = STR_INIT(output, strlen(output), 0);
- memset(output, 0, PHP_MAX_SALT_LEN + 1);
+ result = zend_string_init(output, strlen(output), 0);
+ ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1);
return result;
}
} else {
@@ -222,7 +222,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
if (!crypt_res) {
return NULL;
} else {
- result = STR_INIT(crypt_res, strlen(crypt_res), 0);
+ result = zend_string_init(crypt_res, strlen(crypt_res), 0);
return result;
}
}
@@ -243,7 +243,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
if (!crypt_res) {
return FAILURE;
} else {
- result = STR_INIT(crypt_res, strlen(crypt_res), 0);
+ result = zend_string_init(crypt_res, strlen(crypt_res), 0);
return result;
}
}
@@ -259,7 +259,7 @@ PHP_FUNCTION(crypt)
{
char salt[PHP_MAX_SALT_LEN + 1];
char *str, *salt_in = NULL;
- int str_len, salt_in_len = 0;
+ size_t str_len, salt_in_len = 0;
zend_string *result;
salt[0] = salt[PHP_MAX_SALT_LEN] = '\0';
diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c
index bf731b256f..5f28bd7b9f 100644
--- a/ext/standard/crypt_sha256.c
+++ b/ext/standard/crypt_sha256.c
@@ -372,7 +372,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha256_rounds_prefix) - 1;
char *endp;
- php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10);
+ zend_ulong srounds = ZEND_STRTOUL(num, &endp, 10);
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
@@ -520,7 +520,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
if (rounds_custom) {
#ifdef PHP_WIN32
- int n = _snprintf(cp, MAX(0, buflen), "%s%u$", sha256_rounds_prefix, rounds);
+ int n = _snprintf(cp, MAX(0, buflen), "%s" ZEND_ULONG_FMT "$", sha256_rounds_prefix, rounds);
#else
int n = snprintf(cp, MAX(0, buflen), "%s%zu$", sha256_rounds_prefix, rounds);
#endif
@@ -571,18 +571,17 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
inside the SHA256 implementation as well. */
sha256_init_ctx(&ctx);
sha256_finish_ctx(&ctx, alt_result);
- memset(temp_result, '\0', sizeof(temp_result));
- memset(p_bytes, '\0', key_len);
- memset(s_bytes, '\0', salt_len);
- memset(&ctx, '\0', sizeof(ctx));
- memset(&alt_ctx, '\0', sizeof(alt_ctx));
+ ZEND_SECURE_ZERO(temp_result, sizeof(temp_result));
+ ZEND_SECURE_ZERO(p_bytes, key_len);
+ ZEND_SECURE_ZERO(s_bytes, salt_len);
+ ZEND_SECURE_ZERO(&ctx, sizeof(ctx));
+ ZEND_SECURE_ZERO(&alt_ctx, sizeof(alt_ctx));
if (copied_key != NULL) {
- memset(copied_key, '\0', key_len);
-
+ ZEND_SECURE_ZERO(copied_key, key_len);
}
if (copied_salt != NULL) {
- memset(copied_salt, '\0', salt_len);
+ ZEND_SECURE_ZERO(copied_salt, salt_len);
}
return buffer;
diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c
index f0732e3e17..df5f3d109e 100644
--- a/ext/standard/crypt_sha512.c
+++ b/ext/standard/crypt_sha512.c
@@ -405,7 +405,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha512_rounds_prefix) - 1;
char *endp;
- php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10);
+ zend_ulong srounds = ZEND_STRTOUL(num, &endp, 10);
if (*endp == '$') {
salt = endp + 1;
@@ -555,7 +555,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
if (rounds_custom) {
#ifdef PHP_WIN32
- int n = _snprintf(cp, MAX(0, buflen), "%s%u$", sha512_rounds_prefix, rounds);
+ int n = _snprintf(cp, MAX(0, buflen), "%s" ZEND_ULONG_FMT "$", sha512_rounds_prefix, rounds);
#else
int n = snprintf(cp, MAX(0, buflen), "%s%zu$", sha512_rounds_prefix, rounds);
#endif
@@ -619,16 +619,16 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
inside the SHA512 implementation as well. */
sha512_init_ctx(&ctx);
sha512_finish_ctx(&ctx, alt_result);
- memset(temp_result, '\0', sizeof(temp_result));
- memset(p_bytes, '\0', key_len);
- memset(s_bytes, '\0', salt_len);
- memset(&ctx, '\0', sizeof(ctx));
- memset(&alt_ctx, '\0', sizeof(alt_ctx));
+ ZEND_SECURE_ZERO(temp_result, sizeof(temp_result));
+ ZEND_SECURE_ZERO(p_bytes, key_len);
+ ZEND_SECURE_ZERO(s_bytes, salt_len);
+ ZEND_SECURE_ZERO(&ctx, sizeof(ctx));
+ ZEND_SECURE_ZERO(&alt_ctx, sizeof(alt_ctx));
if (copied_key != NULL) {
- memset(copied_key, '\0', key_len);
+ ZEND_SECURE_ZERO(copied_key, key_len);
}
if (copied_salt != NULL) {
- memset(copied_salt, '\0', salt_len);
+ ZEND_SECURE_ZERO(copied_salt, salt_len);
}
return buffer;
diff --git a/ext/standard/css.c b/ext/standard/css.c
index 9ce6138015..f4469bea30 100644
--- a/ext/standard/css.c
+++ b/ext/standard/css.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/css.h b/ext/standard/css.h
index b3c79f2429..408abc1787 100644
--- a/ext/standard/css.h
+++ b/ext/standard/css.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
index 326e9e21b8..1718b75729 100644
--- a/ext/standard/cyr_convert.c
+++ b/ext/standard/cyr_convert.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -201,11 +201,11 @@ _cyr_mac = {
* d - x-cp866
* m - x-mac-cyrillic
*****************************************************************************/
-static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to TSRMLS_DC)
+static char * php_convert_cyr_string(unsigned char *str, size_t length, char from, char to TSRMLS_DC)
{
const unsigned char *from_table, *to_table;
unsigned char tmp;
- int i;
+ size_t i;
from_table = NULL;
to_table = NULL;
@@ -258,8 +258,7 @@ static char * php_convert_cyr_string(unsigned char *str, int length, char from,
if (!str)
return (char *)str;
- for( i = 0; i<length; i++)
- {
+ for (i = 0; i < length; i++) {
tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
}
@@ -272,16 +271,16 @@ static char * php_convert_cyr_string(unsigned char *str, int length, char from,
PHP_FUNCTION(convert_cyr_string)
{
char *input, *fr_cs, *to_cs;
- int input_len, fr_cs_len, to_cs_len;
+ size_t input_len, fr_cs_len, to_cs_len;
zend_string *str;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &input, &input_len, &fr_cs, &fr_cs_len, &to_cs, &to_cs_len) == FAILURE) {
return;
}
- str = STR_INIT(input, input_len, 0);
+ str = zend_string_init(input, input_len, 0);
- php_convert_cyr_string(str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC);
+ php_convert_cyr_string((unsigned char *) str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC);
RETVAL_NEW_STR(str);
}
/* }}} */
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
index 6b16be2960..41cce1aaa3 100644
--- a/ext/standard/cyr_convert.h
+++ b/ext/standard/cyr_convert.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 8743708ad9..39f8669038 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -86,9 +86,9 @@ char *strptime(const char *s, const char *format, struct tm *tm);
PHP_FUNCTION(strptime)
{
char *ts;
- int ts_length;
+ size_t ts_length;
char *format;
- int format_length;
+ size_t format_length;
struct tm parsed_time;
char *unparsed_part;
@@ -104,14 +104,14 @@ PHP_FUNCTION(strptime)
}
array_init(return_value);
- add_assoc_int(return_value, "tm_sec", parsed_time.tm_sec);
- add_assoc_int(return_value, "tm_min", parsed_time.tm_min);
- add_assoc_int(return_value, "tm_hour", parsed_time.tm_hour);
- add_assoc_int(return_value, "tm_mday", parsed_time.tm_mday);
- add_assoc_int(return_value, "tm_mon", parsed_time.tm_mon);
- add_assoc_int(return_value, "tm_year", parsed_time.tm_year);
- add_assoc_int(return_value, "tm_wday", parsed_time.tm_wday);
- add_assoc_int(return_value, "tm_yday", parsed_time.tm_yday);
+ add_assoc_long(return_value, "tm_sec", parsed_time.tm_sec);
+ add_assoc_long(return_value, "tm_min", parsed_time.tm_min);
+ add_assoc_long(return_value, "tm_hour", parsed_time.tm_hour);
+ add_assoc_long(return_value, "tm_mday", parsed_time.tm_mday);
+ add_assoc_long(return_value, "tm_mon", parsed_time.tm_mon);
+ add_assoc_long(return_value, "tm_year", parsed_time.tm_year);
+ add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday);
+ add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday);
add_assoc_string(return_value, "unparsed", unparsed_part);
}
/* }}} */
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index bb6673497c..0edaff1b00 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index bf79a391cf..7b4ab1cd3e 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -148,44 +148,44 @@ PHP_MINIT_FUNCTION(dir)
pathsep_str[1] = '\0';
REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT);
#ifdef HAVE_GLOB
#ifdef GLOB_BRACE
- REGISTER_INT_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_BRACE 0
#endif
#ifdef GLOB_MARK
- REGISTER_INT_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_MARK 0
#endif
#ifdef GLOB_NOSORT
- REGISTER_INT_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_NOSORT 0
#endif
#ifdef GLOB_NOCHECK
- REGISTER_INT_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_NOCHECK 0
#endif
#ifdef GLOB_NOESCAPE
- REGISTER_INT_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_NOESCAPE 0
#endif
#ifdef GLOB_ERR
- REGISTER_INT_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT);
#else
# define GLOB_ERR 0
#endif
@@ -201,8 +201,8 @@ PHP_MINIT_FUNCTION(dir)
/* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */
#define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR)
- REGISTER_INT_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT);
#endif /* HAVE_GLOB */
@@ -214,7 +214,7 @@ PHP_MINIT_FUNCTION(dir)
static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
{
char *dirname;
- int dir_len;
+ size_t dir_len;
zval *zcontext = NULL;
php_stream_context *context = NULL;
php_stream *dirp;
@@ -273,7 +273,7 @@ PHP_FUNCTION(closedir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
@@ -292,7 +292,8 @@ PHP_FUNCTION(closedir)
PHP_FUNCTION(chroot)
{
char *str;
- int ret, str_len;
+ int ret;
+ size_t str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
RETURN_FALSE;
@@ -323,7 +324,8 @@ PHP_FUNCTION(chroot)
PHP_FUNCTION(chdir)
{
char *str;
- int ret, str_len;
+ int ret;
+ size_t str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) {
RETURN_FALSE;
@@ -387,7 +389,7 @@ PHP_FUNCTION(rewinddir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
@@ -406,7 +408,7 @@ PHP_NAMED_FUNCTION(php_if_readdir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
@@ -429,14 +431,14 @@ PHP_FUNCTION(glob)
char *result;
#endif
char *pattern = NULL;
- int pattern_len;
- php_int_t flags = 0;
+ size_t pattern_len;
+ zend_long flags = 0;
glob_t globbuf;
int n;
int ret;
zend_bool basedir_limit = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &pattern, &pattern_len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) {
return;
}
@@ -524,7 +526,7 @@ no_results:
* able to filter directories out.
*/
if (flags & GLOB_ONLYDIR) {
- php_stat_t s;
+ zend_stat_t s;
if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) {
continue;
@@ -552,14 +554,14 @@ no_results:
PHP_FUNCTION(scandir)
{
char *dirn;
- int dirn_len;
- php_int_t flags = 0;
+ size_t dirn_len;
+ zend_long flags = 0;
zend_string **namelist;
int n, i;
zval *zcontext = NULL;
php_stream_context *context = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) {
return;
}
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 2f92c82d2c..6ea69e5b81 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -54,7 +54,7 @@
PHPAPI PHP_FUNCTION(dl)
{
char *filename;
- int filename_len;
+ size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
@@ -83,7 +83,7 @@ PHPAPI PHP_FUNCTION(dl)
}
php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC);
- if (Z_IVAL_P(return_value) == 1) {
+ if (Z_LVAL_P(return_value) == 1) {
EG(full_tables_cleanup) = 1;
}
}
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
index eee70472b5..50ed19afc0 100644
--- a/ext/standard/dl.h
+++ b/ext/standard/dl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 3ad926820d..13a1ab75df 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -153,7 +153,7 @@ PHP_FUNCTION(gethostname)
PHP_FUNCTION(gethostbyaddr)
{
char *addr;
- int addr_len;
+ size_t addr_len;
zend_string *hostname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) {
@@ -203,10 +203,10 @@ static zend_string *php_gethostbyaddr(char *ip)
#endif
if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') {
- return STR_INIT(ip, strlen(ip), 0);
+ return zend_string_init(ip, strlen(ip), 0);
}
- return STR_INIT(hp->h_name, strlen(hp->h_name), 0);
+ return zend_string_init(hp->h_name, strlen(hp->h_name), 0);
}
/* }}} */
@@ -215,7 +215,7 @@ static zend_string *php_gethostbyaddr(char *ip)
PHP_FUNCTION(gethostbyname)
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) {
return;
@@ -230,7 +230,7 @@ PHP_FUNCTION(gethostbyname)
PHP_FUNCTION(gethostbynamel)
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
struct hostent *hp;
struct in_addr in;
int i;
@@ -263,13 +263,13 @@ static zend_string *php_gethostbyname(char *name)
hp = gethostbyname(name);
if (!hp || !*(hp->h_addr_list)) {
- return STR_INIT(name, strlen(name), 0);
+ return zend_string_init(name, strlen(name), 0);
}
memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr));
address = inet_ntoa(in);
- return STR_INIT(address, strlen(address), 0);
+ return zend_string_init(address, strlen(address), 0);
}
/* }}} */
@@ -345,7 +345,7 @@ PHP_FUNCTION(dns_check_record)
#endif
u_char ans[MAXPACKET];
char *hostname, *rectype = NULL;
- int hostname_len, rectype_len = 0;
+ size_t hostname_len, rectype_len = 0;
int type = T_MX, i;
#if defined(HAVE_DNS_SEARCH)
struct sockaddr_storage from;
@@ -456,10 +456,10 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
add_assoc_string(subarray, "host", name);
add_assoc_string(subarray, "class", "IN");
- add_assoc_int(subarray, "ttl", ttl);
+ add_assoc_long(subarray, "ttl", ttl);
if (raw) {
- add_assoc_int(subarray, "type", type);
+ add_assoc_long(subarray, "type", type);
add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen);
cp += dlen;
return cp;
@@ -477,7 +477,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
CHECKCP(2);
add_assoc_string(subarray, "type", "MX");
GETSHORT(n, cp);
- add_assoc_int(subarray, "pri", n);
+ add_assoc_long(subarray, "pri", n);
/* no break; */
case DNS_T_CNAME:
if (type == DNS_T_CNAME) {
@@ -523,7 +523,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
zend_string *tp;
add_assoc_string(subarray, "type", "TXT");
- tp = STR_ALLOC(dlen, 0);
+ tp = zend_string_alloc(dlen, 0);
array_init(&entries);
@@ -535,7 +535,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
}
if (n) {
memcpy(tp->val + l2 , cp + l1 + 1, n);
- add_next_index_stringl(&entries, cp + l1 + 1, n);
+ add_next_index_stringl(&entries, (char *) cp + l1 + 1, n);
}
l1 = l1 + n + 1;
l2 = l2 + n;
@@ -564,15 +564,15 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
add_assoc_string(subarray, "rname", name);
CHECKCP(5*4);
GETLONG(n, cp);
- add_assoc_int(subarray, "serial", n);
+ add_assoc_long(subarray, "serial", n);
GETLONG(n, cp);
- add_assoc_int(subarray, "refresh", n);
+ add_assoc_long(subarray, "refresh", n);
GETLONG(n, cp);
- add_assoc_int(subarray, "retry", n);
+ add_assoc_long(subarray, "retry", n);
GETLONG(n, cp);
- add_assoc_int(subarray, "expire", n);
+ add_assoc_long(subarray, "expire", n);
GETLONG(n, cp);
- add_assoc_int(subarray, "minimum-ttl", n);
+ add_assoc_long(subarray, "minimum-ttl", n);
break;
case DNS_T_AAAA:
tp = (u_char*)name;
@@ -614,7 +614,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
CHECKCP(1);
n = ((int)cp[0]) & 0xFF;
cp++;
- add_assoc_int(subarray, "masklen", n);
+ add_assoc_long(subarray, "masklen", n);
tp = (u_char*)name;
if (n > 15) {
have_v6_break = 1;
@@ -689,11 +689,11 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
CHECKCP(3*2);
add_assoc_string(subarray, "type", "SRV");
GETSHORT(n, cp);
- add_assoc_int(subarray, "pri", n);
+ add_assoc_long(subarray, "pri", n);
GETSHORT(n, cp);
- add_assoc_int(subarray, "weight", n);
+ add_assoc_long(subarray, "weight", n);
GETSHORT(n, cp);
- add_assoc_int(subarray, "port", n);
+ add_assoc_long(subarray, "port", n);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
if (n < 0) {
return NULL;
@@ -705,9 +705,9 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
CHECKCP(2*2);
add_assoc_string(subarray, "type", "NAPTR");
GETSHORT(n, cp);
- add_assoc_int(subarray, "order", n);
+ add_assoc_long(subarray, "order", n);
GETSHORT(n, cp);
- add_assoc_int(subarray, "pref", n);
+ add_assoc_long(subarray, "pref", n);
CHECKCP(1);
n = (cp[0] & 0xFF);
@@ -753,7 +753,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
PHP_FUNCTION(dns_get_record)
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
long type_param = PHP_DNS_ANY;
zval *authns = NULL, *addtl = NULL;
int type_to_fetch;
@@ -965,7 +965,7 @@ PHP_FUNCTION(dns_get_record)
PHP_FUNCTION(dns_get_mx)
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
zval *mx_list, *weight_list = NULL;
int count, qdc;
u_short type, weight;
@@ -1047,7 +1047,7 @@ PHP_FUNCTION(dns_get_mx)
cp += i;
add_next_index_string(mx_list, buf);
if (weight_list) {
- add_next_index_int(weight_list, weight);
+ add_next_index_long(weight_list, weight);
}
}
php_dns_free_handle(handle);
@@ -1059,20 +1059,20 @@ PHP_FUNCTION(dns_get_mx)
#if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32)
PHP_MINIT_FUNCTION(dns) {
- REGISTER_INT_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
#endif /* HAVE_FULL_DNS_FUNCS */
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index 7ef53dd0e7..865ad30b3e 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 2008-2009 The PHP Group |
+----------------------------------------------------------------------+
@@ -44,7 +44,7 @@
PHP_FUNCTION(dns_get_mx) /* {{{ */
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
zval *mx_list, *weight_list = NULL;
DNS_STATUS status; /* Return value of DnsQuery_A() function */
@@ -77,7 +77,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */
add_next_index_string(mx_list, pRec->Data.MX.pNameExchange);
if (weight_list) {
- add_next_index_int(weight_list, srv->wPriority);
+ add_next_index_long(weight_list, srv->wPriority);
}
}
@@ -93,7 +93,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */
PHP_FUNCTION(dns_check_record)
{
char *hostname, *rectype = NULL;
- int hostname_len, rectype_len = 0;
+ size_t hostname_len, rectype_len = 0;
int type = DNS_TYPE_MX;
DNS_STATUS status; /* Return value of DnsQuery_A() function */
@@ -158,10 +158,10 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
add_assoc_string(subarray, "host", pRec->pName);
add_assoc_string(subarray, "class", "IN");
- add_assoc_int(subarray, "ttl", ttl);
+ add_assoc_long(subarray, "ttl", ttl);
if (raw) {
- add_assoc_int(subarray, "type", type);
+ add_assoc_long(subarray, "type", type);
add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength);
return;
}
@@ -177,7 +177,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
case DNS_TYPE_MX:
add_assoc_string(subarray, "type", "MX");
- add_assoc_int(subarray, "pri", pRec->Data.Srv.wPriority);
+ add_assoc_long(subarray, "pri", pRec->Data.Srv.wPriority);
/* no break; */
case DNS_TYPE_CNAME:
@@ -219,7 +219,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
txt_len += strlen(data_txt->pStringArray[i]) + 1;
}
- txt = STR_SAFE_ALLOC(txt_len, 2, 0, 0);
+ txt = zend_string_safe_alloc(txt_len, 2, 0, 0);
txt_dst = txt->val;
for (i = 0; i < count; i++) {
int len = strlen(data_txt->pStringArray[i]);
@@ -241,11 +241,11 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
add_assoc_string(subarray, "mname", data_soa->pNamePrimaryServer);
add_assoc_string(subarray, "rname", data_soa->pNameAdministrator);
- add_assoc_int(subarray, "serial", data_soa->dwSerialNo);
- add_assoc_int(subarray, "refresh", data_soa->dwRefresh);
- add_assoc_int(subarray, "retry", data_soa->dwRetry);
- add_assoc_int(subarray, "expire", data_soa->dwExpire);
- add_assoc_int(subarray, "minimum-ttl", data_soa->dwDefaultTtl);
+ add_assoc_long(subarray, "serial", data_soa->dwSerialNo);
+ add_assoc_long(subarray, "refresh", data_soa->dwRefresh);
+ add_assoc_long(subarray, "retry", data_soa->dwRetry);
+ add_assoc_long(subarray, "expire", data_soa->dwExpire);
+ add_assoc_long(subarray, "minimum-ttl", data_soa->dwDefaultTtl);
}
break;
@@ -309,9 +309,9 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
DNS_SRV_DATA *data_srv = &pRec->Data.Srv;
add_assoc_string(subarray, "type", "SRV");
- add_assoc_int(subarray, "pri", data_srv->wPriority);
- add_assoc_int(subarray, "weight", data_srv->wWeight);
- add_assoc_int(subarray, "port", data_srv->wPort);
+ add_assoc_long(subarray, "pri", data_srv->wPriority);
+ add_assoc_long(subarray, "weight", data_srv->wWeight);
+ add_assoc_long(subarray, "port", data_srv->wPort);
add_assoc_string(subarray, "target", data_srv->pNameTarget);
}
break;
@@ -322,8 +322,8 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr;
add_assoc_string(subarray, "type", "NAPTR");
- add_assoc_int(subarray, "order", data_naptr->wOrder);
- add_assoc_int(subarray, "pref", data_naptr->wPreference);
+ add_assoc_long(subarray, "order", data_naptr->wOrder);
+ add_assoc_long(subarray, "pref", data_naptr->wPreference);
add_assoc_string(subarray, "flags", data_naptr->pFlags);
add_assoc_string(subarray, "services", data_naptr->pService);
add_assoc_string(subarray, "regex", data_naptr->pRegularExpression);
@@ -346,7 +346,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw,
PHP_FUNCTION(dns_get_record)
{
char *hostname;
- int hostname_len;
+ size_t hostname_len;
long type_param = PHP_DNS_ANY;
zval *authns = NULL, *addtl = NULL;
int type, type_to_fetch, first_query = 1, store_results = 1;
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 72878f9c9e..28f01b338f 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -171,7 +171,7 @@ err:
static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
char *cmd;
- int cmd_len;
+ size_t cmd_len;
zval *ret_code=NULL, *ret_array=NULL;
int ret;
@@ -200,7 +200,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
if (ret_code) {
zval_dtor(ret_code);
- ZVAL_INT(ret_code, ret);
+ ZVAL_LONG(ret_code, ret);
}
}
/* }}} */
@@ -247,7 +247,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
TSRMLS_FETCH();
- cmd = STR_ALLOC(2 * l, 0);
+ cmd = zend_string_alloc(2 * l, 0);
for (x = 0, y = 0; x < l; x++) {
int mb_len = php_mblen(str + x, (l - x));
@@ -320,7 +320,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
if ((estimate - y) > 4096) {
/* realloc if the estimate was way overill
* Arbitrary cutoff point of 4096 */
- cmd = STR_REALLOC(cmd, y, 0);
+ cmd = zend_string_realloc(cmd, y, 0);
}
cmd->len = y;
@@ -339,7 +339,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
TSRMLS_FETCH();
- cmd = STR_ALLOC(4 * l + 2, 0); /* worst case */
+ cmd = zend_string_alloc(4 * l + 2, 0); /* worst case */
#ifdef PHP_WIN32
cmd->val[y++] = '"';
@@ -387,7 +387,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
if ((estimate - y) > 4096) {
/* realloc if the estimate was way overill
* Arbitrary cutoff point of 4096 */
- cmd = STR_REALLOC(cmd, y, 0);
+ cmd = zend_string_realloc(cmd, y, 0);
}
cmd->len = y;
return cmd;
@@ -399,8 +399,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
PHP_FUNCTION(escapeshellcmd)
{
char *command;
- int command_len;
- char *cmd = NULL;
+ size_t command_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) {
return;
@@ -419,8 +418,7 @@ PHP_FUNCTION(escapeshellcmd)
PHP_FUNCTION(escapeshellarg)
{
char *argument;
- int argument_len;
- char *cmd = NULL;
+ size_t argument_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) {
return;
@@ -438,7 +436,7 @@ PHP_FUNCTION(shell_exec)
{
FILE *in;
char *command;
- int command_len;
+ size_t command_len;
zend_string *ret;
php_stream *stream;
@@ -470,9 +468,9 @@ PHP_FUNCTION(shell_exec)
Change the priority of the current process */
PHP_FUNCTION(proc_nice)
{
- php_int_t pri;
+ zend_long pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pri) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) {
RETURN_FALSE;
}
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
index 8ffe471408..79b0574e28 100644
--- a/ext/standard/exec.h
+++ b/ext/standard/exec.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 1b599b84a0..446da20fb3 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,7 +35,7 @@
#include "php_open_temporary_file.h"
#include "ext/standard/basic_functions.h"
#include "php_ini.h"
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
#include <stdio.h>
#include <stdlib.h>
@@ -188,135 +188,135 @@ PHP_MINIT_FUNCTION(file)
REGISTER_INI_ENTRIES();
- REGISTER_INT_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT);
#ifdef PF_INET
- REGISTER_INT_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT);
#elif defined(AF_INET)
- REGISTER_INT_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT);
#endif
#if HAVE_IPV6
# ifdef PF_INET6
- REGISTER_INT_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT);
# elif defined(AF_INET6)
- REGISTER_INT_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT);
# endif
#endif
#ifdef PF_UNIX
- REGISTER_INT_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT);
#elif defined(AF_UNIX)
- REGISTER_INT_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef IPPROTO_IP
/* most people will use this one when calling socket() or socketpair() */
- REGISTER_INT_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef IPPROTO_TCP
- REGISTER_INT_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef IPPROTO_UDP
- REGISTER_INT_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef IPPROTO_ICMP
- REGISTER_INT_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef IPPROTO_RAW
- REGISTER_INT_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT);
#ifdef SOCK_RAW
- REGISTER_INT_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef SOCK_SEQPACKET
- REGISTER_INT_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT);
#endif
#ifdef SOCK_RDM
- REGISTER_INT_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT);
#ifdef HAVE_FNMATCH
- REGISTER_INT_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT);
# ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */
- REGISTER_INT_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT);
# endif
#endif
@@ -342,9 +342,9 @@ PHP_FUNCTION(flock)
zval *arg1, *arg3 = NULL;
int act;
php_stream *stream;
- php_int_t operation = 0;
+ zend_long operation = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &arg1, &operation, &arg3) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &arg1, &operation, &arg3) == FAILURE) {
return;
}
@@ -358,14 +358,14 @@ PHP_FUNCTION(flock)
if (arg3) {
zval_dtor(arg3);
- ZVAL_INT(arg3, 0);
+ ZVAL_LONG(arg3, 0);
}
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0);
if (php_stream_lock(stream, act)) {
if (operation && errno == EWOULDBLOCK && arg3) {
- ZVAL_INT(arg3, 1);
+ ZVAL_LONG(arg3, 1);
}
RETURN_FALSE;
}
@@ -380,7 +380,7 @@ PHP_FUNCTION(flock)
PHP_FUNCTION(get_meta_tags)
{
char *filename;
- int filename_len;
+ size_t filename_len;
zend_bool use_include_path = 0;
int in_tag = 0, done = 0;
int looking_for_val = 0, have_name = 0, have_content = 0;
@@ -523,17 +523,17 @@ PHP_FUNCTION(get_meta_tags)
PHP_FUNCTION(file_get_contents)
{
char *filename;
- int filename_len;
+ size_t filename_len;
zend_bool use_include_path = 0;
php_stream *stream;
- php_int_t offset = -1;
- php_int_t maxlen = PHP_STREAM_COPY_ALL;
+ zend_long offset = -1;
+ zend_long maxlen = PHP_STREAM_COPY_ALL;
zval *zcontext = NULL;
php_stream_context *context = NULL;
zend_string *contents;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
return;
}
@@ -552,13 +552,13 @@ PHP_FUNCTION(file_get_contents)
}
if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", offset);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_LONG_FMT " in the stream", offset);
php_stream_close(stream);
RETURN_FALSE;
}
if (maxlen > INT_MAX) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %ld to %d bytes", maxlen, INT_MAX);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %pd to %d bytes", maxlen, INT_MAX);
maxlen = INT_MAX;
}
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
@@ -577,17 +577,17 @@ PHP_FUNCTION(file_put_contents)
{
php_stream *stream;
char *filename;
- int filename_len;
+ size_t filename_len;
zval *data;
- php_int_t numbytes = 0;
- php_int_t flags = 0;
+ zend_long numbytes = 0;
+ zend_long flags = 0;
zval *zcontext = NULL;
php_stream_context *context = NULL;
php_stream *srcstream = NULL;
char mode[3] = "wb";
char ret_ok = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|ir!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) {
return;
}
@@ -628,30 +628,30 @@ PHP_FUNCTION(file_put_contents)
switch (Z_TYPE_P(data)) {
case IS_RESOURCE: {
- php_size_t len;
+ size_t len;
if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) {
ret_ok = 0;
} else {
- if (len > PHP_INT_MAX) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %zu to " ZEND_INT_FMT " bytes", len, PHP_INT_MAX);
- len = PHP_INT_MAX;
+ if (len > ZEND_LONG_MAX) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %zu to " ZEND_LONG_FMT " bytes", len, ZEND_LONG_MAX);
+ len = ZEND_LONG_MAX;
}
numbytes = len;
}
break;
}
case IS_NULL:
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_FALSE:
case IS_TRUE:
convert_to_string_ex(data);
case IS_STRING:
- if (Z_STRSIZE_P(data)) {
- numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data));
- if (numbytes != Z_STRSIZE_P(data)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data));
+ if (Z_STRLEN_P(data)) {
+ numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data));
+ if (numbytes != Z_STRLEN_P(data)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pl of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data));
numbytes = -1;
}
}
@@ -659,7 +659,7 @@ PHP_FUNCTION(file_put_contents)
case IS_ARRAY:
if (zend_hash_num_elements(Z_ARRVAL_P(data))) {
- php_size_t bytes_written;
+ size_t bytes_written;
zval *tmp;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(data), tmp) {
@@ -670,11 +670,11 @@ PHP_FUNCTION(file_put_contents)
if (bytes_written != str->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %zd bytes to %s", str->len, filename);
ret_ok = 0;
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
}
- STR_RELEASE(str);
+ zend_string_release(str);
} ZEND_HASH_FOREACH_END();
}
break;
@@ -684,9 +684,9 @@ PHP_FUNCTION(file_put_contents)
zval out;
if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) {
- numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out));
- if (numbytes != Z_STRSIZE(out)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out));
+ numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out));
+ if (numbytes != Z_STRLEN(out)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out));
numbytes = -1;
}
zval_dtor(&out);
@@ -703,7 +703,7 @@ PHP_FUNCTION(file_put_contents)
RETURN_FALSE;
}
- RETURN_INT(numbytes);
+ RETURN_LONG(numbytes);
}
/* }}} */
@@ -714,11 +714,11 @@ PHP_FUNCTION(file_put_contents)
PHP_FUNCTION(file)
{
char *filename;
- int filename_len;
+ size_t filename_len;
char *p, *s, *e;
register int i = 0;
char eol_marker = '\n';
- php_int_t flags = 0;
+ zend_long flags = 0;
zend_bool use_include_path;
zend_bool include_new_line;
zend_bool skip_blank_lines;
@@ -728,11 +728,11 @@ PHP_FUNCTION(file)
zend_string *target_buf;
/* Parse arguments */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir!", &filename, &filename_len, &flags, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) {
return;
}
if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "'" ZEND_INT_FMT "' flag is not supported", flags);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "'" ZEND_LONG_FMT "' flag is not supported", flags);
RETURN_FALSE;
}
@@ -795,7 +795,7 @@ parse_eol:
}
if (target_buf) {
- STR_FREE(target_buf);
+ zend_string_free(target_buf);
}
php_stream_close(stream);
}
@@ -806,7 +806,7 @@ parse_eol:
PHP_FUNCTION(tempnam)
{
char *dir, *prefix;
- int dir_len, prefix_len;
+ size_t dir_len, prefix_len;
char *opened_path;
int fd;
zend_string *p;
@@ -832,7 +832,7 @@ PHP_FUNCTION(tempnam)
RETVAL_STRING(opened_path);
efree(opened_path);
}
- STR_RELEASE(p);
+ zend_string_release(p);
}
/* }}} */
@@ -861,7 +861,7 @@ PHP_NAMED_FUNCTION(php_if_tmpfile)
PHP_NAMED_FUNCTION(php_if_fopen)
{
char *filename, *mode;
- int filename_len, mode_len;
+ size_t filename_len, mode_len;
zend_bool use_include_path = 0;
zval *zcontext = NULL;
php_stream *stream;
@@ -903,7 +903,7 @@ PHPAPI PHP_FUNCTION(fclose)
PHP_STREAM_TO_ZVAL(stream, arg1);
if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a valid stream resource", stream->res->handle);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%pd is not a valid stream resource", stream->res->handle);
RETURN_FALSE;
}
@@ -922,7 +922,7 @@ PHPAPI PHP_FUNCTION(fclose)
PHP_FUNCTION(popen)
{
char *command, *mode;
- int command_len, mode_len;
+ size_t command_len, mode_len;
FILE *fp;
php_stream *stream;
char *posix_mode;
@@ -977,7 +977,7 @@ PHP_FUNCTION(pclose)
FG(pclose_wait) = 1;
zend_list_close(stream->res);
FG(pclose_wait) = 0;
- RETURN_INT(FG(pclose_ret));
+ RETURN_LONG(FG(pclose_ret));
}
/* }}} */
@@ -1007,13 +1007,13 @@ PHPAPI PHP_FUNCTION(feof)
PHPAPI PHP_FUNCTION(fgets)
{
zval *arg1;
- php_int_t len = 1024;
+ zend_long len = 1024;
char *buf = NULL;
int argc = ZEND_NUM_ARGS();
size_t line_len = 0;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &len) == FAILURE) {
RETURN_FALSE;
}
@@ -1091,7 +1091,7 @@ PHPAPI PHP_FUNCTION(fgetc)
PHPAPI PHP_FUNCTION(fgetss)
{
zval *fd;
- php_int_t bytes = 0;
+ zend_long bytes = 0;
size_t len = 0;
size_t actual_len, retval_len;
char *buf = NULL, *retval;
@@ -1100,7 +1100,7 @@ PHPAPI PHP_FUNCTION(fgetss)
char *allowed_tags=NULL;
int allowed_tags_len=0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|iS", &fd, &bytes, &allowed) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed) == FAILURE) {
RETURN_FALSE;
}
@@ -1153,7 +1153,8 @@ PHPAPI PHP_FUNCTION(fgetss)
Implements a mostly ANSI compatible fscanf() */
PHP_FUNCTION(fscanf)
{
- int result, format_len, type, argc = 0;
+ int result, type, argc = 0;
+ size_t format_len;
zval *args = NULL;
zval *file_handle;
char *buf, *format;
@@ -1194,25 +1195,29 @@ PHPAPI PHP_FUNCTION(fwrite)
{
zval *arg1;
char *arg2;
- int arg2len;
+ size_t arg2len;
int ret;
int num_bytes;
- php_int_t arg3 = 0;
+ zend_long arg3 = 0;
char *buffer = NULL;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &arg2, &arg2len, &arg3) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 2) {
num_bytes = arg2len;
} else {
- num_bytes = MAX(0, MIN((int)arg3, arg2len));
+ if (arg3 > 0) {
+ num_bytes = MIN((size_t)arg3, arg2len);
+ } else {
+ num_bytes = 0;
+ }
}
if (!num_bytes) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
PHP_STREAM_TO_ZVAL(stream, arg1);
@@ -1222,7 +1227,7 @@ PHPAPI PHP_FUNCTION(fwrite)
efree(buffer);
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1273,7 +1278,7 @@ PHPAPI PHP_FUNCTION(rewind)
PHPAPI PHP_FUNCTION(ftell)
{
zval *arg1;
- php_int_t ret;
+ zend_long ret;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) {
@@ -1286,7 +1291,7 @@ PHPAPI PHP_FUNCTION(ftell)
if (ret == -1) {
RETURN_FALSE;
}
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
@@ -1295,16 +1300,16 @@ PHPAPI PHP_FUNCTION(ftell)
PHPAPI PHP_FUNCTION(fseek)
{
zval *arg1;
- php_int_t arg2, whence = SEEK_SET;
+ zend_long arg2, whence = SEEK_SET;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &arg2, &whence) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, arg1);
- RETURN_INT(php_stream_seek(stream, arg2, whence));
+ RETURN_LONG(php_stream_seek(stream, arg2, whence));
}
/* }}} */
@@ -1312,7 +1317,7 @@ PHPAPI PHP_FUNCTION(fseek)
*/
/* DEPRECATED APIs: Use php_stream_mkdir() instead */
-PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC)
+PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options TSRMLS_DC)
{
int ret;
@@ -1327,7 +1332,7 @@ PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC)
return ret;
}
-PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC)
+PHPAPI int php_mkdir(const char *dir, zend_long mode TSRMLS_DC)
{
return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC);
}
@@ -1338,13 +1343,13 @@ PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC)
PHP_FUNCTION(mkdir)
{
char *dir;
- int dir_len;
+ size_t dir_len;
zval *zcontext = NULL;
- php_int_t mode = 0777;
+ zend_long mode = 0777;
zend_bool recursive = 0;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ibr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) {
RETURN_FALSE;
}
@@ -1359,7 +1364,7 @@ PHP_FUNCTION(mkdir)
PHP_FUNCTION(rmdir)
{
char *dir;
- int dir_len;
+ size_t dir_len;
zval *zcontext = NULL;
php_stream_context *context;
@@ -1378,7 +1383,7 @@ PHP_FUNCTION(rmdir)
PHP_FUNCTION(readfile)
{
char *filename;
- int filename_len;
+ size_t filename_len;
int size = 0;
zend_bool use_include_path = 0;
zval *zcontext = NULL;
@@ -1395,7 +1400,7 @@ PHP_FUNCTION(readfile)
if (stream) {
size = php_stream_passthru(stream);
php_stream_close(stream);
- RETURN_INT(size);
+ RETURN_LONG(size);
}
RETURN_FALSE;
@@ -1406,7 +1411,7 @@ PHP_FUNCTION(readfile)
Return or change the umask */
PHP_FUNCTION(umask)
{
- php_int_t arg1 = 0;
+ zend_long arg1 = 0;
int oldumask;
oldumask = umask(077);
@@ -1415,7 +1420,7 @@ PHP_FUNCTION(umask)
BG(umask) = oldumask;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &arg1) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) {
RETURN_FALSE;
}
@@ -1425,7 +1430,7 @@ PHP_FUNCTION(umask)
umask(arg1);
}
- RETURN_INT(oldumask);
+ RETURN_LONG(oldumask);
}
/* }}} */
@@ -1444,7 +1449,7 @@ PHPAPI PHP_FUNCTION(fpassthru)
PHP_STREAM_TO_ZVAL(stream, arg1);
size = php_stream_passthru(stream);
- RETURN_INT(size);
+ RETURN_LONG(size);
}
/* }}} */
@@ -1453,7 +1458,7 @@ PHPAPI PHP_FUNCTION(fpassthru)
PHP_FUNCTION(rename)
{
char *old_name, *new_name;
- int old_name_len, new_name_len;
+ size_t old_name_len, new_name_len;
zval *zcontext = NULL;
php_stream_wrapper *wrapper;
php_stream_context *context;
@@ -1490,7 +1495,7 @@ PHP_FUNCTION(rename)
PHP_FUNCTION(unlink)
{
char *filename;
- int filename_len;
+ size_t filename_len;
php_stream_wrapper *wrapper;
zval *zcontext = NULL;
php_stream_context *context = NULL;
@@ -1521,10 +1526,10 @@ PHP_FUNCTION(unlink)
PHP_NAMED_FUNCTION(php_if_ftruncate)
{
zval *fp;
- php_int_t size;
+ zend_long size;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &fp, &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &fp, &size) == FAILURE) {
RETURN_FALSE;
}
@@ -1565,30 +1570,42 @@ PHP_NAMED_FUNCTION(php_if_fstat)
array_init(return_value);
- ZVAL_INT(&stat_dev, stat_ssb.sb.st_dev);
- ZVAL_INT(&stat_ino, stat_ssb.sb.st_ino);
- ZVAL_INT(&stat_mode, stat_ssb.sb.st_mode);
- ZVAL_INT(&stat_nlink, stat_ssb.sb.st_nlink);
- ZVAL_INT(&stat_uid, stat_ssb.sb.st_uid);
- ZVAL_INT(&stat_gid, stat_ssb.sb.st_gid);
+ ZVAL_LONG(&stat_dev, stat_ssb.sb.st_dev);
+ ZVAL_LONG(&stat_ino, stat_ssb.sb.st_ino);
+ ZVAL_LONG(&stat_mode, stat_ssb.sb.st_mode);
+ ZVAL_LONG(&stat_nlink, stat_ssb.sb.st_nlink);
+ ZVAL_LONG(&stat_uid, stat_ssb.sb.st_uid);
+ ZVAL_LONG(&stat_gid, stat_ssb.sb.st_gid);
#ifdef HAVE_ST_RDEV
- ZVAL_INT(&stat_rdev, stat_ssb.sb.st_rdev);
+# ifdef PHP_WIN32
+ /* It is unsigned, so if a negative came from userspace, it'll
+ convert to UINT_MAX, but we wan't to keep the userspace value.
+ Almost the same as in php_fstat. This is ugly, but otherwise
+ we would have to maintain a fully compatible struct stat. */
+ if ((int)stat_ssb.sb.st_rdev < 0) {
+ ZVAL_LONG(&stat_rdev, (int)stat_ssb.sb.st_rdev);
+ } else {
+ ZVAL_LONG(&stat_rdev, stat_ssb.sb.st_rdev);
+ }
+# else
+ ZVAL_LONG(&stat_rdev, stat_ssb.sb.st_rdev);
+# endif
#else
- ZVAL_INT(&stat_rdev, -1);
+ ZVAL_LONG(&stat_rdev, -1);
#endif
- ZVAL_INT(&stat_size, stat_ssb.sb.st_size);
- ZVAL_INT(&stat_atime, stat_ssb.sb.st_atime);
- ZVAL_INT(&stat_mtime, stat_ssb.sb.st_mtime);
- ZVAL_INT(&stat_ctime, stat_ssb.sb.st_ctime);
+ ZVAL_LONG(&stat_size, stat_ssb.sb.st_size);
+ ZVAL_LONG(&stat_atime, stat_ssb.sb.st_atime);
+ ZVAL_LONG(&stat_mtime, stat_ssb.sb.st_mtime);
+ ZVAL_LONG(&stat_ctime, stat_ssb.sb.st_ctime);
#ifdef HAVE_ST_BLKSIZE
- ZVAL_INT(&stat_blksize, stat_ssb.sb.st_blksize);
+ ZVAL_LONG(&stat_blksize, stat_ssb.sb.st_blksize);
#else
- ZVAL_INT(&stat_blksize,-1);
+ ZVAL_LONG(&stat_blksize,-1);
#endif
#ifdef HAVE_ST_BLOCKS
- ZVAL_INT(&stat_blocks, stat_ssb.sb.st_blocks);
+ ZVAL_LONG(&stat_blocks, stat_ssb.sb.st_blocks);
#else
- ZVAL_INT(&stat_blocks,-1);
+ ZVAL_LONG(&stat_blocks,-1);
#endif
/* Store numeric indexes in propper order */
zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev);
@@ -1627,7 +1644,7 @@ PHP_NAMED_FUNCTION(php_if_fstat)
PHP_FUNCTION(copy)
{
char *source, *target;
- int source_len, target_len;
+ size_t source_len, target_len;
zval *zcontext = NULL;
php_stream_context *context;
@@ -1764,10 +1781,10 @@ safe_to_copy:
PHPAPI PHP_FUNCTION(fread)
{
zval *arg1;
- php_int_t len;
+ zend_long len;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &len) == FAILURE) {
RETURN_FALSE;
}
@@ -1778,11 +1795,11 @@ PHPAPI PHP_FUNCTION(fread)
RETURN_FALSE;
}
- ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0));
- Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
+ ZVAL_NEW_STR(return_value, zend_string_alloc(len, 0));
+ Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
/* needed because recv/read/gzread doesnt put a null at the end*/
- Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0;
+ Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
}
/* }}} */
@@ -1792,12 +1809,12 @@ static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t le
unsigned char last_chars[2] = { 0, 0 };
while (len > 0) {
- inc_len = (*ptr == '\0' ? 1: php_mblen(ptr, len));
+ inc_len = (*ptr == '\0' ? 1 : php_mblen(ptr, len));
switch (inc_len) {
case -2:
case -1:
inc_len = 1;
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
break;
case 0:
goto quit_loop;
@@ -1837,7 +1854,7 @@ PHP_FUNCTION(fputcsv)
zval *fp = NULL, *fields = NULL;
int ret;
char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL;
- int delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
+ size_t delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|sss",
&fp, &fields, &delimiter_str, &delimiter_str_len,
@@ -1884,12 +1901,12 @@ PHP_FUNCTION(fputcsv)
PHP_STREAM_TO_ZVAL(stream, fp);
ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC);
- RETURN_INT(ret);
+ RETURN_LONG(ret);
}
/* }}} */
-/* {{{ PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */
-PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC)
+/* {{{ PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */
+PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC)
{
int count, i = 0, ret;
zval *field_tmp;
@@ -1926,13 +1943,13 @@ PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter,
}
smart_str_appendc(&csvline, enclosure);
} else {
- smart_str_appendl(&csvline, field_str->val, field_str->len);
+ smart_str_append(&csvline, field_str);
}
if (++i != count) {
smart_str_appendl(&csvline, &delimiter, 1);
}
- STR_RELEASE(field_str);
+ zend_string_release(field_str);
} ZEND_HASH_FOREACH_END();
smart_str_appendc(&csvline, '\n');
@@ -1956,7 +1973,7 @@ PHP_FUNCTION(fgetcsv)
/* first section exactly as php_fgetss */
- php_int_t len = 0;
+ zend_long len = 0;
size_t buf_len;
char *buf;
php_stream *stream;
@@ -1964,11 +1981,11 @@ PHP_FUNCTION(fgetcsv)
{
zval *fd, *len_zv = NULL;
char *delimiter_str = NULL;
- int delimiter_str_len = 0;
+ size_t delimiter_str_len = 0;
char *enclosure_str = NULL;
- int enclosure_str_len = 0;
+ size_t enclosure_str_len = 0;
char *escape_str = NULL;
- int escape_str_len = 0;
+ size_t escape_str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|zsss",
&fd, &len_zv, &delimiter_str, &delimiter_str_len,
@@ -2015,7 +2032,7 @@ PHP_FUNCTION(fgetcsv)
}
if (len_zv != NULL && Z_TYPE_P(len_zv) != IS_NULL) {
- len = zval_get_int(len_zv);
+ len = zval_get_long(len_zv);
if (len < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
RETURN_FALSE;
@@ -2053,7 +2070,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
zend_bool first_field = 1;
/* initialize internal state */
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
/* Now into new section that parses buf for delimiter/enclosure fields */
@@ -2079,7 +2096,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
tptr = temp;
- inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0);
+ inc_len = (bptr < limit ? (*bptr == '\0' ? 1 : php_mblen(bptr, limit - bptr)): 0);
if (inc_len == 1) {
char *tmp = bptr;
while ((*tmp != delimiter) && isspace((int)*(unsigned char *)tmp)) {
@@ -2168,7 +2185,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
case -2:
case -1:
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
/* break is omitted intentionally */
case 1:
/* we need to determine if the enclosure is
@@ -2223,7 +2240,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
}
break;
}
- inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0);
+ inc_len = (bptr < limit ? (*bptr == '\0' ? 1 : php_mblen(bptr, limit - bptr)): 0);
}
quit_loop_2:
@@ -2236,7 +2253,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
case -2:
case -1:
inc_len = 1;
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
/* break is omitted intentionally */
case 1:
if (*bptr == delimiter) {
@@ -2247,7 +2264,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
break;
}
bptr += inc_len;
- inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0);
+ inc_len = (bptr < limit ? (*bptr == '\0' ? 1 : php_mblen(bptr, limit - bptr)): 0);
}
quit_loop_3:
@@ -2267,7 +2284,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
case -2:
case -1:
inc_len = 1;
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
/* break is omitted intentionally */
case 1:
if (*bptr == delimiter) {
@@ -2278,7 +2295,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
break;
}
bptr += inc_len;
- inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0);
+ inc_len = (bptr < limit ? (*bptr == '\0' ? 1 : php_mblen(bptr, limit - bptr)): 0);
}
quit_loop_4:
memcpy(tptr, hunk_begin, bptr - hunk_begin);
@@ -2309,7 +2326,7 @@ out:
PHP_FUNCTION(realpath)
{
char *filename;
- int filename_len;
+ size_t filename_len;
char resolved_path_buff[MAXPATHLEN];
#ifndef FAST_ZPP
@@ -2453,10 +2470,10 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC)
PHP_FUNCTION(fnmatch)
{
char *pattern, *filename;
- int pattern_len, filename_len;
- php_int_t flags = 0;
+ size_t pattern_len, filename_len;
+ zend_long flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|i", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) {
return;
}
diff --git a/ext/standard/file.h b/ext/standard/file.h
index b667a29233..ec60b86e99 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,6 +23,8 @@
#ifndef FILE_H
#define FILE_H
+#include "php_network.h"
+
PHP_MINIT_FUNCTION(file);
PHP_MSHUTDOWN_FUNCTION(file);
@@ -73,14 +75,14 @@ PHP_FUNCTION(sys_get_temp_dir);
PHP_MINIT_FUNCTION(user_streams);
PHPAPI int php_le_stream_context(TSRMLS_D);
-PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
+PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block TSRMLS_DC);
PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC);
PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC);
PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
-PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC);
-PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC);
+PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options TSRMLS_DC);
+PHPAPI int php_mkdir(const char *dir, zend_long mode TSRMLS_DC);
PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC);
-PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC);
+PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC);
#define META_DEF_BUFSIZE 8192
@@ -117,8 +119,8 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC);
typedef struct {
int pclose_ret;
size_t def_chunk_size;
- php_int_t auto_detect_line_endings;
- php_int_t default_socket_timeout;
+ zend_long auto_detect_line_endings;
+ zend_long default_socket_timeout;
char *user_agent; /* for the http wrapper */
char *from_address; /* for the ftp and http wrappers */
const char *user_stream_current_filename; /* for simple recursion protection */
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 8e24fec657..6a06a55d94 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -158,7 +158,7 @@ static int php_disk_total_space(char *path, double *space TSRMLS_DC) /* {{{ */
/* i know - this is ugly, but i works <thies@thieso.net> */
bytestotal = TotalNumberOfBytes.HighPart *
- (double) (((php_uint_t)1) << 31) * 2.0 +
+ (double) (((zend_ulong)1) << 31) * 2.0 +
TotalNumberOfBytes.LowPart;
} else { /* If it's not available, we just use GetDiskFreeSpace */
if (GetDiskFreeSpace(path,
@@ -233,7 +233,7 @@ PHP_FUNCTION(disk_total_space)
{
double bytestotal;
char *path;
- int path_len;
+ size_t path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) {
return;
@@ -290,7 +290,7 @@ static int php_disk_free_space(char *path, double *space TSRMLS_DC) /* {{{ */
/* i know - this is ugly, but i works <thies@thieso.net> */
bytesfree = FreeBytesAvailableToCaller.HighPart *
- (double) (((php_uint_t)1) << 31) * 2.0 +
+ (double) (((zend_ulong)1) << 31) * 2.0 +
FreeBytesAvailableToCaller.LowPart;
} else { /* If it's not available, we just use GetDiskFreeSpace */
if (GetDiskFreeSpace(path,
@@ -368,7 +368,7 @@ PHP_FUNCTION(disk_free_space)
{
double bytesfree;
char *path;
- int path_len;
+ size_t path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) {
return;
@@ -420,7 +420,7 @@ PHPAPI int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC)
static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
zval *group;
#if !defined(WINDOWS)
gid_t gid;
@@ -437,9 +437,9 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
if(wrapper && wrapper->wops->stream_metadata) {
int option;
void *value;
- if (Z_TYPE_P(group) == IS_INT) {
+ if (Z_TYPE_P(group) == IS_LONG) {
option = PHP_STREAM_META_GROUP;
- value = &Z_IVAL_P(group);
+ value = &Z_LVAL_P(group);
} else if (Z_TYPE_P(group) == IS_STRING) {
option = PHP_STREAM_META_GROUP_NAME;
value = Z_STRVAL_P(group);
@@ -465,8 +465,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
/* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */
RETURN_FALSE;
#else
- if (Z_TYPE_P(group) == IS_INT) {
- gid = (gid_t)Z_IVAL_P(group);
+ if (Z_TYPE_P(group) == IS_LONG) {
+ gid = (gid_t)Z_LVAL_P(group);
} else if (Z_TYPE_P(group) == IS_STRING) {
if(php_get_gid_by_name(Z_STRVAL_P(group), &gid TSRMLS_CC) != SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group));
@@ -557,7 +557,7 @@ PHPAPI uid_t php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC)
static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
{
char *filename;
- int filename_len;
+ size_t filename_len;
zval *user;
#if !defined(WINDOWS)
uid_t uid;
@@ -574,9 +574,9 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
if(wrapper && wrapper->wops->stream_metadata) {
int option;
void *value;
- if (Z_TYPE_P(user) == IS_INT) {
+ if (Z_TYPE_P(user) == IS_LONG) {
option = PHP_STREAM_META_OWNER;
- value = &Z_IVAL_P(user);
+ value = &Z_LVAL_P(user);
} else if (Z_TYPE_P(user) == IS_STRING) {
option = PHP_STREAM_META_OWNER_NAME;
value = Z_STRVAL_P(user);
@@ -603,8 +603,8 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
RETURN_FALSE;
#else
- if (Z_TYPE_P(user) == IS_INT) {
- uid = (uid_t)Z_IVAL_P(user);
+ if (Z_TYPE_P(user) == IS_LONG) {
+ uid = (uid_t)Z_LVAL_P(user);
} else if (Z_TYPE_P(user) == IS_STRING) {
if(php_get_uid_by_name(Z_STRVAL_P(user), &uid TSRMLS_CC) != SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user));
@@ -667,13 +667,13 @@ PHP_FUNCTION(lchown)
PHP_FUNCTION(chmod)
{
char *filename;
- int filename_len;
- php_int_t mode;
+ size_t filename_len;
+ zend_long mode;
int ret;
mode_t imode;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &filename, &filename_len, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) {
return;
}
@@ -713,15 +713,15 @@ PHP_FUNCTION(chmod)
PHP_FUNCTION(touch)
{
char *filename;
- int filename_len;
- php_int_t filetime = 0, fileatime = 0;
+ size_t filename_len;
+ zend_long filetime = 0, fileatime = 0;
int ret, argc = ZEND_NUM_ARGS();
FILE *file;
struct utimbuf newtimebuf;
struct utimbuf *newtime = &newtimebuf;
php_stream_wrapper *wrapper;
- if (zend_parse_parameters(argc TSRMLS_CC, "p|ii", &filename, &filename_len, &filetime, &fileatime) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) {
return;
}
@@ -829,7 +829,7 @@ PHP_FUNCTION(clearstatcache)
{
zend_bool clear_realpath_cache = 0;
char *filename = NULL;
- int filename_len = 0;
+ size_t filename_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) {
return;
@@ -962,21 +962,21 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
switch (type) {
case FS_PERMS:
- RETURN_INT((php_int_t)ssb.sb.st_mode);
+ RETURN_LONG((zend_long)ssb.sb.st_mode);
case FS_INODE:
- RETURN_INT((php_int_t)ssb.sb.st_ino);
+ RETURN_LONG((zend_long)ssb.sb.st_ino);
case FS_SIZE:
- RETURN_INT((php_int_t)ssb.sb.st_size);
+ RETURN_LONG((zend_long)ssb.sb.st_size);
case FS_OWNER:
- RETURN_INT((php_int_t)ssb.sb.st_uid);
+ RETURN_LONG((zend_long)ssb.sb.st_uid);
case FS_GROUP:
- RETURN_INT((php_int_t)ssb.sb.st_gid);
+ RETURN_LONG((zend_long)ssb.sb.st_gid);
case FS_ATIME:
- RETURN_INT((php_int_t)ssb.sb.st_atime);
+ RETURN_LONG((zend_long)ssb.sb.st_atime);
case FS_MTIME:
- RETURN_INT((php_int_t)ssb.sb.st_mtime);
+ RETURN_LONG((zend_long)ssb.sb.st_mtime);
case FS_CTIME:
- RETURN_INT((php_int_t)ssb.sb.st_ctime);
+ RETURN_LONG((zend_long)ssb.sb.st_ctime);
case FS_TYPE:
if (S_ISLNK(ssb.sb.st_mode)) {
RETURN_STRING("link");
@@ -1012,30 +1012,41 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
case FS_STAT:
array_init(return_value);
- ZVAL_INT(&stat_dev, stat_sb->st_dev);
- ZVAL_INT(&stat_ino, stat_sb->st_ino);
- ZVAL_INT(&stat_mode, stat_sb->st_mode);
- ZVAL_INT(&stat_nlink, stat_sb->st_nlink);
- ZVAL_INT(&stat_uid, stat_sb->st_uid);
- ZVAL_INT(&stat_gid, stat_sb->st_gid);
+ ZVAL_LONG(&stat_dev, stat_sb->st_dev);
+ ZVAL_LONG(&stat_ino, stat_sb->st_ino);
+ ZVAL_LONG(&stat_mode, stat_sb->st_mode);
+ ZVAL_LONG(&stat_nlink, stat_sb->st_nlink);
+ ZVAL_LONG(&stat_uid, stat_sb->st_uid);
+ ZVAL_LONG(&stat_gid, stat_sb->st_gid);
#ifdef HAVE_ST_RDEV
- ZVAL_INT(&stat_rdev, stat_sb->st_rdev);
+# ifdef PHP_WIN32
+ /* It is unsigned, so if a negative came from userspace, it'll
+ convert to UINT_MAX, but we wan't to keep the userspace value.
+ Almost the same as in php_if_fstat. */
+ if ((int)stat_sb->st_rdev < 0) {
+ ZVAL_LONG(&stat_rdev, (int)stat_sb->st_rdev);
+ } else {
+ ZVAL_LONG(&stat_rdev, stat_sb->st_rdev);
+ }
+# else
+ ZVAL_LONG(&stat_rdev, stat_sb->st_rdev);
+# endif
#else
- ZVAL_INT(&stat_rdev, -1);
+ ZVAL_LONG(&stat_rdev, -1);
#endif
- ZVAL_INT(&stat_size, stat_sb->st_size);
- ZVAL_INT(&stat_atime, stat_sb->st_atime);
- ZVAL_INT(&stat_mtime, stat_sb->st_mtime);
- ZVAL_INT(&stat_ctime, stat_sb->st_ctime);
+ ZVAL_LONG(&stat_size, stat_sb->st_size);
+ ZVAL_LONG(&stat_atime, stat_sb->st_atime);
+ ZVAL_LONG(&stat_mtime, stat_sb->st_mtime);
+ ZVAL_LONG(&stat_ctime, stat_sb->st_ctime);
#ifdef HAVE_ST_BLKSIZE
- ZVAL_INT(&stat_blksize, stat_sb->st_blksize);
+ ZVAL_LONG(&stat_blksize, stat_sb->st_blksize);
#else
- ZVAL_INT(&stat_blksize,-1);
+ ZVAL_LONG(&stat_blksize,-1);
#endif
#ifdef HAVE_ST_BLOCKS
- ZVAL_INT(&stat_blocks, stat_sb->st_blocks);
+ ZVAL_LONG(&stat_blocks, stat_sb->st_blocks);
#else
- ZVAL_INT(&stat_blocks,-1);
+ ZVAL_LONG(&stat_blocks,-1);
#endif
/* Store numeric indexes in propper order */
zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev);
@@ -1081,7 +1092,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
# define FileFunction(name, funcnum) \
void name(INTERNAL_FUNCTION_PARAMETERS) { \
char *filename; \
- int filename_len; \
+ size_t filename_len; \
\
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \
return; \
@@ -1093,7 +1104,7 @@ void name(INTERNAL_FUNCTION_PARAMETERS) { \
# define FileFunction(name, funcnum) \
void name(INTERNAL_FUNCTION_PARAMETERS) { \
char *filename; \
- int filename_len; \
+ size_t filename_len; \
\
ZEND_PARSE_PARAMETERS_START(1, 1) \
Z_PARAM_PATH(filename, filename_len) \
@@ -1201,7 +1212,7 @@ PHP_FUNCTION(realpath_cache_size)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- RETURN_INT(realpath_cache_size(TSRMLS_C));
+ RETURN_LONG(realpath_cache_size(TSRMLS_C));
}
/* {{{ proto bool realpath_cache_get()
@@ -1223,19 +1234,19 @@ PHP_FUNCTION(realpath_cache_get)
array_init(&entry);
/* bucket->key is unsigned long */
- if (ZEND_INT_MAX >= bucket->key) {
- add_assoc_int(&entry, "key", bucket->key);
+ if (ZEND_LONG_MAX >= bucket->key) {
+ add_assoc_long_ex(&entry, "key", sizeof("key") - 1, bucket->key);
} else {
- add_assoc_double(&entry, "key", (double)bucket->key);
+ add_assoc_double_ex(&entry, "key", sizeof("key") - 1, (double)bucket->key);
}
- add_assoc_bool(&entry, "is_dir", bucket->is_dir);
- add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len);
- add_assoc_int(&entry, "expires", bucket->expires);
+ add_assoc_bool_ex(&entry, "is_dir", sizeof("is_dir") - 1, bucket->is_dir);
+ add_assoc_stringl_ex(&entry, "realpath", sizeof("realpath") - 1, bucket->realpath, bucket->realpath_len);
+ add_assoc_long_ex(&entry, "expires", sizeof("expires") - 1, bucket->expires);
#ifdef PHP_WIN32
- add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid);
- add_assoc_bool(&entry, "is_wvalid", bucket->is_wvalid);
- add_assoc_bool(&entry, "is_readable", bucket->is_readable);
- add_assoc_bool(&entry, "is_writable", bucket->is_writable);
+ add_assoc_bool_ex(&entry, "is_rvalid", sizeof("is_rvalid") - 1, bucket->is_rvalid);
+ add_assoc_bool_ex(&entry, "is_wvalid", sizeof("is_wvalid") - 1, bucket->is_wvalid);
+ add_assoc_bool_ex(&entry, "is_readable", sizeof("is_readable") - 1, bucket->is_readable);
+ add_assoc_bool_ex(&entry, "is_writable", sizeof("is_writable") - 1, bucket->is_writable);
#endif
zend_hash_str_update(Z_ARRVAL_P(return_value), bucket->path, bucket->path_len, &entry);
bucket = bucket->next;
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 7944cdc4c7..f0f49950bb 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "ext/standard/basic_functions.h"
#include "ext/standard/file.h"
#include "ext/standard/php_string.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* {{{ rot13 stream filter implementation */
static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -263,14 +263,14 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {
convert_to_string_ex(tmp);
smart_str_appendc(&tags_ss, '<');
- smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_append(&tags_ss, Z_STR_P(tmp));
smart_str_appendc(&tags_ss, '>');
} ZEND_HASH_FOREACH_END();
smart_str_0(&tags_ss);
} else {
/* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */
convert_to_string_ex(filterparams);
- smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRSIZE_P(filterparams));
+ smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRLEN_P(filterparams));
}
}
@@ -322,14 +322,14 @@ struct _php_conv {
typedef struct _php_conv_base64_encode {
php_conv _super;
- unsigned char erem[3];
+ const char *lbchars;
+ size_t lbchars_len;
size_t erem_len;
unsigned int line_ccnt;
unsigned int line_len;
- const char *lbchars;
int lbchars_dup;
- size_t lbchars_len;
int persistent;
+ unsigned char erem[3];
} php_conv_base64_encode;
static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_p, size_t *in_left, char **out_p, size_t *out_left);
@@ -735,12 +735,12 @@ static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *ins
typedef struct _php_conv_qprint_encode {
php_conv _super;
+ const char *lbchars;
+ size_t lbchars_len;
int opts;
unsigned int line_ccnt;
unsigned int line_len;
- const char *lbchars;
int lbchars_dup;
- size_t lbchars_len;
int persistent;
unsigned int lb_ptr;
unsigned int lb_cnt;
@@ -987,11 +987,11 @@ static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst,
typedef struct _php_conv_qprint_decode {
php_conv _super;
+ const char *lbchars;
+ size_t lbchars_len;
int scan_stat;
unsigned int next_char;
- const char *lbchars;
int lbchars_dup;
- size_t lbchars_len;
int persistent;
unsigned int lb_ptr;
unsigned int lb_cnt;
@@ -1224,7 +1224,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr
*pretval_len = str->len;
memcpy(*pretval, str->val, str->len + 1);
- STR_RELEASE(str);
+ zend_string_release(str);
} else {
return PHP_CONV_ERR_NOT_FOUND;
}
@@ -1232,7 +1232,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr
}
#if IT_WAS_USED
-static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t *pretval, char *field_name, size_t field_name_len)
+static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, zend_long *pretval, char *field_name, size_t field_name_len)
{
zval **tmpval;
@@ -1241,13 +1241,13 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t *
if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) {
zval tmp, *ztval = *tmpval;
- if (Z_TYPE_PP(tmpval) != IS_INT) {
+ if (Z_TYPE_PP(tmpval) != IS_LONG) {
tmp = *ztval;
zval_copy_ctor(&tmp);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
ztval = &tmp;
}
- *pretval = Z_IVAL_P(ztval);
+ *pretval = Z_LVAL_P(ztval);
} else {
return PHP_CONV_ERR_NOT_FOUND;
}
@@ -1255,7 +1255,7 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t *
}
#endif
-static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, php_uint_t *pretval, char *field_name, size_t field_name_len)
+static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, zend_ulong *pretval, char *field_name, size_t field_name_len)
{
zval *tmpval;
@@ -1264,15 +1264,15 @@ static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, php_uint_t
if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) {
zval tmp;
- if (Z_TYPE_P(tmpval) != IS_INT) {
+ if (Z_TYPE_P(tmpval) != IS_LONG) {
ZVAL_DUP(&tmp, tmpval);;
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
tmpval = &tmp;
}
- if (Z_IVAL_P(tmpval) < 0) {
+ if (Z_LVAL_P(tmpval) < 0) {
*pretval = 0;
} else {
- *pretval = Z_IVAL_P(tmpval);
+ *pretval = Z_LVAL_P(tmpval);
}
} else {
return PHP_CONV_ERR_NOT_FOUND;
@@ -1306,7 +1306,7 @@ static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretva
#if IT_WAS_USED
static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len)
{
- php_int_t l;
+ zend_long l;
php_conv_err_t err;
*pretval = 0;
@@ -1320,7 +1320,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie
static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len)
{
- php_uint_t l;
+ zend_ulong l;
php_conv_err_t err;
*pretval = 0;
@@ -1699,7 +1699,7 @@ static int strfilter_convert_append_bucket(
}
}
- if (out_buf_size - ocnt > 0) {
+ if (out_buf_size > ocnt) {
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
goto out_failure;
}
@@ -1831,9 +1831,9 @@ static php_stream_filter_factory strfilter_convert_factory = {
/* {{{ consumed filter implementation */
typedef struct _php_consumed_filter_data {
- int persistent;
size_t consumed;
- off_t offset;
+ zend_off_t offset;
+ int persistent;
} php_consumed_filter_data;
static php_stream_filter_status_t consumed_filter_filter(
@@ -1926,8 +1926,8 @@ typedef enum _php_chunked_filter_state {
} php_chunked_filter_state;
typedef struct _php_chunked_filter_data {
- php_chunked_filter_state state;
size_t chunk_size;
+ php_chunked_filter_state state;
int persistent;
} php_chunked_filter_data;
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index 05e0175311..d5d73f4c36 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
index ab9c445561..14405022b6 100644
--- a/ext/standard/flock_compat.h
+++ b/ext/standard/flock_compat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 3c570d32ee..8f211d0236 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -52,11 +52,11 @@ static char HEXCHARS[] = "0123456789ABCDEF";
/* php_spintf_appendchar() {{{ */
inline static void
-php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC)
+php_sprintf_appendchar(zend_string **buffer, size_t *pos, char add TSRMLS_DC)
{
if (!*buffer || (*pos + 1) >= (*buffer)->len) {
PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), (*buffer)->len));
- *buffer = STR_REALLOC(*buffer, (*buffer)->len << 1, 0);
+ *buffer = zend_string_realloc(*buffer, (*buffer)->len << 1, 0);
}
PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos));
(*buffer)->val[(*pos)++] = add;
@@ -65,14 +65,14 @@ php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC
/* php_spintf_appendstring() {{{ */
inline static void
-php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add,
- php_size_t min_width, php_size_t max_width, char padding,
- php_size_t alignment, php_size_t len, int neg, int expprec, int always_sign)
+php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add,
+ size_t min_width, size_t max_width, char padding,
+ size_t alignment, size_t len, int neg, int expprec, int always_sign)
{
- register php_size_t npad;
- php_size_t req_size;
- php_size_t copy_len;
- php_size_t m_width;
+ register size_t npad;
+ size_t req_size;
+ size_t copy_len;
+ size_t m_width;
copy_len = (expprec ? MIN(max_width, len) : len);
npad = (min_width < copy_len) ? 0 : min_width - copy_len;
@@ -88,7 +88,7 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add,
req_size = *pos + m_width + 1;
if (!*buffer || req_size > (*buffer)->len) {
- zend_size_t size = (*buffer)->len;
+ size_t size = (*buffer)->len;
while (req_size > size) {
if (size > ZEND_SIZE_MAX/2) {
zend_error_noreturn(E_ERROR, "Field width %zd is too long", req_size);
@@ -96,7 +96,7 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add,
size <<= 1;
}
PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", size));
- *buffer = STR_REALLOC(*buffer, size, 0);
+ *buffer = zend_string_realloc(*buffer, size, 0);
}
if (alignment == ALIGN_RIGHT) {
if ((neg || always_sign) && padding=='0') {
@@ -122,21 +122,21 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add,
/* php_spintf_appendint() {{{ */
inline static void
-php_sprintf_appendint(zend_string **buffer, php_size_t *pos, php_int_t number,
- php_size_t width, char padding, php_size_t alignment,
+php_sprintf_appendint(zend_string **buffer, size_t *pos, zend_long number,
+ size_t width, char padding, size_t alignment,
int always_sign)
{
char numbuf[NUM_BUF_SIZE];
- register php_uint_t magn, nmagn;
+ register zend_ulong magn, nmagn;
register unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
*buffer, pos, &(*buffer)->len, number, width, padding, alignment));
if (number < 0) {
neg = 1;
- magn = ((php_uint_t) -(number + 1)) + 1;
+ magn = ((zend_ulong) -(number + 1)) + 1;
} else {
- magn = (php_uint_t) number;
+ magn = (zend_ulong) number;
}
/* Can't right-pad 0's on integers */
@@ -166,17 +166,17 @@ php_sprintf_appendint(zend_string **buffer, php_size_t *pos, php_int_t number,
/* php_spintf_appenduint() {{{ */
inline static void
-php_sprintf_appenduint(zend_string **buffer, php_size_t *pos,
- php_uint_t number,
- php_size_t width, char padding, php_size_t alignment)
+php_sprintf_appenduint(zend_string **buffer, size_t *pos,
+ zend_ulong number,
+ size_t width, char padding, size_t alignment)
{
char numbuf[NUM_BUF_SIZE];
- register php_uint_t magn, nmagn;
+ register zend_ulong magn, nmagn;
register unsigned int i = NUM_BUF_SIZE - 1;
PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
*buffer, pos, &(*buffer)->len, number, width, padding, alignment));
- magn = (php_uint_t) number;
+ magn = (zend_ulong) number;
/* Can't right-pad 0's on integers */
if (alignment == 0 && padding == '0') padding = ' ';
@@ -198,17 +198,17 @@ php_sprintf_appenduint(zend_string **buffer, php_size_t *pos,
/* php_spintf_appenddouble() {{{ */
inline static void
-php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos,
+php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
double number,
- php_size_t width, char padding,
- php_size_t alignment, int precision,
+ size_t width, char padding,
+ size_t alignment, int precision,
int adjust, char fmt,
int always_sign
TSRMLS_DC)
{
char num_buf[NUM_BUF_SIZE];
char *s = NULL;
- php_size_t s_len = 0;
+ size_t s_len = 0;
int is_negative = 0;
#ifdef HAVE_LOCALE_H
struct lconv *lconv;
@@ -290,13 +290,13 @@ php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos,
/* php_spintf_appendd2n() {{{ */
inline static void
-php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number,
- php_size_t width, char padding, php_size_t alignment, int n,
+php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number,
+ size_t width, char padding, size_t alignment, int n,
char *chartable, int expprec)
{
char numbuf[NUM_BUF_SIZE];
- register php_uint_t num;
- register php_uint_t i = NUM_BUF_SIZE - 1;
+ register zend_ulong num;
+ register zend_ulong i = NUM_BUF_SIZE - 1;
register int andbits = (1 << n) - 1;
PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
@@ -304,7 +304,7 @@ php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number,
chartable));
PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
- num = (php_uint_t) number;
+ num = (zend_ulong) number;
numbuf[i] = '\0';
do {
@@ -321,11 +321,11 @@ php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number,
/* php_spintf_getnumber() {{{ */
inline static int
-php_sprintf_getnumber(char *buffer, php_size_t *pos)
+php_sprintf_getnumber(char *buffer, size_t *pos)
{
char *endptr;
- register php_int_t num = ZEND_STRTOI(&buffer[*pos], &endptr, 10);
- register php_size_t i = 0;
+ register zend_long num = ZEND_STRTOL(&buffer[*pos], &endptr, 10);
+ register size_t i = 0;
if (endptr != NULL) {
i = (endptr - &buffer[*pos]);
@@ -371,14 +371,14 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
zval *newargs = NULL;
zval *args, *z_format;
int argc;
- php_size_t size = 240, inpos = 0, outpos = 0, temppos;
+ size_t size = 240, inpos = 0, outpos = 0, temppos;
int alignment, currarg, adjusting, argnum, width, precision;
char *format, padding;
zend_string *result;
int always_sign;
int format_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) {
+ if (zend_parse_parameters(param_count TSRMLS_CC, "+", &args, &argc) == FAILURE) {
return NULL;
}
@@ -414,12 +414,12 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
}
format = Z_STRVAL(args[format_offset]);
- format_len = Z_STRSIZE(args[format_offset]);
- result = STR_ALLOC(size, 0);
+ format_len = Z_STRLEN(args[format_offset]);
+ result = zend_string_alloc(size, 0);
currarg = 1;
- while (inpos < Z_STRSIZE(args[format_offset])) {
+ while (inpos < Z_STRLEN(args[format_offset])) {
int expprec = 0;
zval *tmp;
@@ -561,20 +561,20 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
alignment,
str->len,
0, expprec, 0);
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
case 'd':
php_sprintf_appendint(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment,
always_sign);
break;
case 'u':
php_sprintf_appenduint(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment);
break;
@@ -594,33 +594,33 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
case 'c':
php_sprintf_appendchar(&result, &outpos,
- (char) zval_get_int(tmp) TSRMLS_CC);
+ (char) zval_get_long(tmp) TSRMLS_CC);
break;
case 'o':
php_sprintf_append2n(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment, 3,
hexchars, expprec);
break;
case 'x':
php_sprintf_append2n(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment, 4,
hexchars, expprec);
break;
case 'X':
php_sprintf_append2n(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment, 4,
HEXCHARS, expprec);
break;
case 'b':
php_sprintf_append2n(&result, &outpos,
- zval_get_int(tmp),
+ zval_get_long(tmp),
width, padding, alignment, 1,
hexchars, expprec);
break;
@@ -678,14 +678,14 @@ PHP_FUNCTION(vsprintf)
PHP_FUNCTION(user_printf)
{
zend_string *result;
- php_size_t rlen;
+ size_t rlen;
if ((result=php_formatted_print(ZEND_NUM_ARGS(), 0, 0 TSRMLS_CC))==NULL) {
RETURN_FALSE;
}
rlen = PHPWRITE(result->val, result->len);
- STR_FREE(result);
- RETURN_INT(rlen);
+ zend_string_free(result);
+ RETURN_LONG(rlen);
}
/* }}} */
@@ -694,14 +694,14 @@ PHP_FUNCTION(user_printf)
PHP_FUNCTION(vprintf)
{
zend_string *result;
- php_size_t rlen;
+ size_t rlen;
if ((result=php_formatted_print(ZEND_NUM_ARGS(), 1, 0 TSRMLS_CC))==NULL) {
RETURN_FALSE;
}
rlen = PHPWRITE(result->val, result->len);
- STR_FREE(result);
- RETURN_INT(rlen);
+ zend_string_free(result);
+ RETURN_LONG(rlen);
}
/* }}} */
@@ -729,8 +729,8 @@ PHP_FUNCTION(fprintf)
php_stream_write(stream, result->val, result->len);
- RETVAL_INT(result->len);
- STR_FREE(result);
+ RETVAL_LONG(result->len);
+ zend_string_free(result);
}
/* }}} */
@@ -758,8 +758,8 @@ PHP_FUNCTION(vfprintf)
php_stream_write(stream, result->val, result->len);
- RETVAL_INT(result->len);
- STR_FREE(result);
+ RETVAL_LONG(result->len);
+ zend_string_free(result);
}
/* }}} */
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index 72f892b60b..090d3f8f32 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -32,31 +32,31 @@
static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *host;
- int host_len;
- php_int_t port = -1;
+ size_t host_len;
+ zend_long port = -1;
zval *zerrno = NULL, *zerrstr = NULL;
double timeout = FG(default_socket_timeout);
- php_uint_t conv;
+ zend_ulong conv;
struct timeval tv;
char *hashkey = NULL;
php_stream *stream = NULL;
int err;
char *hostname = NULL;
- php_int_t hostname_len;
+ zend_long hostname_len;
zend_string *errstr = NULL;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) {
RETURN_FALSE;
}
if (persistent) {
- spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_INT_FMT, host, port);
+ spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
}
if (port > 0) {
- hostname_len = spprintf(&hostname, 0, "%s:" ZEND_INT_FMT, host, port);
+ hostname_len = spprintf(&hostname, 0, "%s:" ZEND_LONG_FMT, host, port);
} else {
hostname_len = host_len;
hostname = host;
@@ -69,7 +69,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, 0);
+ ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
zval_dtor(zerrstr);
@@ -83,7 +83,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
efree(hostname);
}
if (stream == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:" ZEND_INT_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val);
}
if (hashkey) {
@@ -93,21 +93,21 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (stream == NULL) {
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, err);
+ ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
/* no need to dup; we need to efree buf anyway */
zval_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (!zerrstr && errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
RETURN_FALSE;
}
if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
php_stream_to_zval(stream, return_value);
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index 8ecb889162..7a9b67eb8c 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index 709d90840b..536fccaa3e 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -32,7 +32,7 @@
PHP_FUNCTION(ftok)
{
char *pathname, *proj;
- int pathname_len, proj_len;
+ size_t pathname_len, proj_len;
key_t k;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &pathname, &pathname_len, &proj, &proj_len) == FAILURE) {
@@ -41,16 +41,16 @@ PHP_FUNCTION(ftok)
if (pathname_len == 0){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid");
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
if (proj_len != 1){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid");
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
if (php_check_open_basedir(pathname TSRMLS_CC)) {
- RETURN_INT(-1);
+ RETURN_LONG(-1);
}
k = ftok(pathname, proj[0]);
@@ -58,7 +58,7 @@ PHP_FUNCTION(ftok)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno));
}
- RETURN_INT(k);
+ RETURN_LONG(k);
}
/* }}} */
#endif
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index ae7f28b7da..2bf4e02a41 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -498,7 +498,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
} else if (read_write == 2) {
/* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */
if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "overwrite")) != NULL) {
- allow_overwrite = Z_IVAL_P(tmpzval);
+ allow_overwrite = Z_LVAL_P(tmpzval);
}
if (result <= 299 && result >= 200) {
if (allow_overwrite) {
@@ -529,12 +529,12 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
/* set resume position if applicable */
if (context &&
(tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL &&
- Z_TYPE_P(tmpzval) == IS_INT &&
- Z_IVAL_P(tmpzval) > 0) {
- php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_IVAL_P(tmpzval));
+ Z_TYPE_P(tmpzval) == IS_LONG &&
+ Z_LVAL_P(tmpzval) > 0) {
+ php_stream_printf(stream TSRMLS_CC, "REST %pd\r\n", Z_LVAL_P(tmpzval));
result = GET_FTP_RESULT(stream);
if (result < 300 || result > 399) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_IVAL_P(tmpzval));
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %pd", Z_LVAL_P(tmpzval));
goto errexit;
}
}
@@ -632,11 +632,11 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count
tmp_len = MIN(sizeof(ent->d_name), basename->len - 1);
memcpy(ent->d_name, basename->val, tmp_len);
ent->d_name[tmp_len - 1] = '\0';
- STR_RELEASE(basename);
+ zend_string_release(basename);
/* Trim off trailing whitespace characters */
tmp_len--;
- while (tmp_len >= 0 &&
+ while (tmp_len > 0 &&
(ent->d_name[tmp_len] == '\n' || ent->d_name[tmp_len] == '\r' ||
ent->d_name[tmp_len] == '\t' || ent->d_name[tmp_len] == ' ')) {
ent->d_name[tmp_len--] = '\0';
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 928c26293e..3dd18ee0fd 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +41,7 @@ PHP_FUNCTION(header)
zend_bool rep = 1;
sapi_header_line ctr = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &ctr.line,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line,
&ctr.line_len, &rep, &ctr.response_code) == FAILURE)
return;
@@ -97,7 +97,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
encoded_value = php_url_encode(value, value_len);
len += encoded_value->len;
} else if (value) {
- encoded_value = STR_INIT(value, value_len, 0);
+ encoded_value = zend_string_init(value, value_len, 0);
len += encoded_value->len;
}
@@ -118,7 +118,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
*/
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, 1, 0 TSRMLS_CC);
snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s; Max-Age=0", name, dt->val);
- STR_FREE(dt);
+ zend_string_free(dt);
} else {
snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value->val : "");
if (expires > 0) {
@@ -129,23 +129,23 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
/* check to make sure that the year does not exceed 4 digits in length */
p = zend_memrchr(dt->val, '-', dt->len);
if (!p || *(p + 5) != ' ') {
- STR_FREE(dt);
+ zend_string_free(dt);
efree(cookie);
- STR_FREE(encoded_value);
+ zend_string_free(encoded_value);
zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999");
return FAILURE;
}
strlcat(cookie, dt->val, len + 100);
- STR_FREE(dt);
+ zend_string_free(dt);
- snprintf(tsdelta, sizeof(tsdelta), "%li", (long) difftime(expires, time(NULL)));
+ snprintf(tsdelta, sizeof(tsdelta), ZEND_LONG_FMT, (zend_long) difftime(expires, time(NULL)));
strlcat(cookie, COOKIE_MAX_AGE, len + 100);
strlcat(cookie, tsdelta, len + 100);
}
}
if (encoded_value) {
- STR_FREE(encoded_value);
+ zend_string_free(encoded_value);
}
if (path && path_len > 0) {
@@ -178,11 +178,11 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
PHP_FUNCTION(setcookie)
{
char *name, *value = NULL, *path = NULL, *domain = NULL;
- php_int_t expires = 0;
+ zend_long expires = 0;
zend_bool secure = 0, httponly = 0;
- int name_len, value_len = 0, path_len = 0, domain_len = 0;
+ size_t name_len, value_len = 0, path_len = 0, domain_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
&name_len, &value, &value_len, &expires, &path,
&path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
return;
@@ -201,11 +201,11 @@ PHP_FUNCTION(setcookie)
PHP_FUNCTION(setrawcookie)
{
char *name, *value = NULL, *path = NULL, *domain = NULL;
- php_int_t expires = 0;
+ zend_long expires = 0;
zend_bool secure = 0, httponly = 0;
- int name_len, value_len = 0, path_len = 0, domain_len = 0;
+ size_t name_len, value_len = 0, path_len = 0, domain_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
&name_len, &value, &value_len, &expires, &path,
&path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
return;
@@ -239,7 +239,7 @@ PHP_FUNCTION(headers_sent)
switch(ZEND_NUM_ARGS()) {
case 2:
zval_dtor(arg2);
- ZVAL_INT(arg2, line);
+ ZVAL_LONG(arg2, line);
case 1:
zval_dtor(arg1);
if (file) {
@@ -289,21 +289,21 @@ PHP_FUNCTION(headers_list)
Sets a response code, or returns the current HTTP response code */
PHP_FUNCTION(http_response_code)
{
- php_int_t response_code = 0;
+ zend_long response_code = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &response_code) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) {
return;
}
if (response_code)
{
- php_int_t old_response_code;
+ zend_long old_response_code;
old_response_code = SG(sapi_headers).http_response_code;
SG(sapi_headers).http_response_code = response_code;
if (old_response_code) {
- RETURN_INT(old_response_code);
+ RETURN_LONG(old_response_code);
}
RETURN_TRUE;
@@ -313,7 +313,7 @@ PHP_FUNCTION(http_response_code)
RETURN_FALSE;
}
- RETURN_INT(SG(sapi_headers).http_response_code);
+ RETURN_LONG(SG(sapi_headers).http_response_code);
}
/* }}} */
diff --git a/ext/standard/head.h b/ext/standard/head.h
index 59b1518676..e32810a6f3 100644
--- a/ext/standard/head.h
+++ b/ext/standard/head.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 7df76708a9..dfe30d9b3e 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -392,9 +392,9 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC)
if (zenc != NULL) {
charset_hint = (char *)zend_multibyte_get_encoding_name(zenc);
if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) {
- if ((len == 4) /* sizeof (none|auto|pass) */ &&
+ if ((len == 4) /* sizeof (auto|pass) */ &&
+ /* XXX should the "wchar" be ignored as well?? */
(!memcmp("pass", charset_hint, 4) ||
- !memcmp("auto", charset_hint, 4) ||
!memcmp("auto", charset_hint, 4))) {
charset_hint = NULL;
len = 0;
@@ -790,7 +790,7 @@ static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type)
*/
static inline int process_numeric_entity(const char **buf, unsigned *code_point)
{
- php_int_t code_l;
+ zend_long code_l;
int hexadecimal = (**buf == 'x' || **buf == 'X'); /* TODO: XML apparently disallows "X" */
char *endptr;
@@ -804,7 +804,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point)
return FAILURE;
}
- code_l = ZEND_STRTOI(*buf, &endptr, hexadecimal ? 16 : 10);
+ code_l = ZEND_STRTOL(*buf, &endptr, hexadecimal ? 16 : 10);
/* we're guaranteed there were valid digits, so *endptr > buf */
*buf = endptr;
@@ -813,7 +813,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point)
/* many more are invalid, but that depends on whether it's HTML
* (and which version) or XML. */
- if (code_l > Z_I(0x10FFFF))
+ if (code_l > Z_L(0x10FFFF))
return FAILURE;
if (code_point != NULL)
@@ -856,7 +856,7 @@ static inline int process_named_entity_html(const char **buf, const char **start
static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2)
{
const entity_cp_map *s;
- php_uint_t hash = zend_inline_hash_func(start, length);
+ zend_ulong hash = zend_inline_hash_func(start, length);
s = ht->buckets[hash % ht->num_elems];
while (s->entity) {
@@ -1112,11 +1112,11 @@ PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen
if (oldlen > new_size) {
/* overflow, refuse to do anything */
- ret = STR_INIT((char*)old, oldlen, 0);
+ ret = zend_string_init((char*)old, oldlen, 0);
retlen = oldlen;
goto empty_source;
}
- ret = STR_ALLOC(new_size, 0);
+ ret = zend_string_alloc(new_size, 0);
ret->val[0] = '\0';
ret->len = oldlen;
retlen = oldlen;
@@ -1275,7 +1275,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle
}
}
- replaced = STR_ALLOC(maxlen, 0);
+ replaced = zend_string_alloc(maxlen, 0);
len = 0;
cursor = 0;
while (cursor < oldlen) {
@@ -1288,7 +1288,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle
/* guarantee we have at least 40 bytes to write.
* In HTML5, entities may take up to 33 bytes */
if (len > maxlen - 40) { /* maxlen can never be smaller than 128 */
- replaced = STR_SAFE_REALLOC(replaced, maxlen, 1, 128, 0);
+ replaced = zend_string_safe_realloc(replaced, maxlen, 1, 128, 0);
maxlen += 128;
}
@@ -1301,7 +1301,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle
len += replacement_len;
continue;
} else {
- STR_FREE(replaced);
+ zend_string_free(replaced);
return STR_EMPTY_ALLOC();
}
} else { /* SUCCESS */
@@ -1420,7 +1420,7 @@ encode_amp:
/* at this point maxlen - len >= 40 */
if (maxlen - len < ent_len + 2 /* & and ; */) {
/* ent_len < oldlen, which is certainly <= SIZE_MAX/2 */
- replaced = STR_SAFE_REALLOC(replaced, maxlen, 1, ent_len + 128, 0);
+ replaced = zend_string_safe_realloc(replaced, maxlen, 1, ent_len + 128, 0);
maxlen += ent_len + 128;
}
replaced->val[len++] = '&';
@@ -1444,19 +1444,19 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
{
zend_string *str, *hint_charset = NULL;
char *default_charset;
- php_int_t flags = ENT_COMPAT;
+ zend_long flags = ENT_COMPAT;
zend_string *replaced;
zend_bool double_encode = 1;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(flags)
+ Z_PARAM_LONG(flags)
Z_PARAM_STR_EX(hint_charset, 1, 0)
Z_PARAM_BOOL(double_encode);
ZEND_PARSE_PARAMETERS_END();
@@ -1477,18 +1477,18 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
*/
void register_html_constants(INIT_FUNC_ARGS)
{
- REGISTER_INT_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS);
}
/* }}} */
@@ -1505,11 +1505,11 @@ PHP_FUNCTION(htmlspecialchars)
PHP_FUNCTION(htmlspecialchars_decode)
{
char *str;
- int str_len;
- php_int_t quote_style = ENT_COMPAT;
+ size_t str_len;
+ zend_long quote_style = ENT_COMPAT;
zend_string *replaced;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &quote_style) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &quote_style) == FAILURE) {
return;
}
@@ -1527,12 +1527,11 @@ PHP_FUNCTION(html_entity_decode)
{
zend_string *str, *hint_charset = NULL;
char *default_charset;
- size_t new_len = 0;
- php_int_t quote_style = ENT_COMPAT;
+ zend_long quote_style = ENT_COMPAT;
zend_string *replaced;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS", &str,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str,
&quote_style, &hint_charset) == FAILURE) {
return;
}
@@ -1540,7 +1539,7 @@ PHP_FUNCTION(html_entity_decode)
ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(quote_style)
+ Z_PARAM_LONG(quote_style)
Z_PARAM_STR(hint_charset)
ZEND_PARSE_PARAMETERS_END();
#endif
@@ -1626,20 +1625,20 @@ static inline void write_s3row_data(
Returns the internal translation table used by htmlspecialchars and htmlentities */
PHP_FUNCTION(get_html_translation_table)
{
- php_int_t all = HTML_SPECIALCHARS,
+ zend_long all = HTML_SPECIALCHARS,
flags = ENT_COMPAT;
int doctype;
entity_table_opt entity_table;
const enc_to_uni *to_uni_table = NULL;
char *charset_hint = NULL;
- int charset_hint_len;
+ size_t charset_hint_len;
enum entity_charset charset;
/* in this function we have to jump through some loops because we're
* getting the translated table from data structures that are optimized for
* random access, not traversal */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls",
&all, &flags, &charset_hint, &charset_hint_len) == FAILURE) {
return;
}
diff --git a/ext/standard/html.h b/ext/standard/html.h
index 0777130e0f..c7c297c90b 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/html_tables.h b/ext/standard/html_tables.h
index 83c78b5d78..4680343f2c 100644
--- a/ext/standard/html_tables.h
+++ b/ext/standard/html_tables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1094,18 +1094,17 @@ static const uni_to_enc unimap_macroman[] = {
#define ENT_STAGE3_INDEX(k) ((k) & 0x3F)
#define ENT_CODE_POINT_FROM_STAGES(i,j,k) (((i) << 12) | ((j) << 6) | (k))
-/* Table should be organized with a leading row telling the size of
- * the table and the default entity (maybe NULL) and the rest being
- * normal rows ordered by code point so that we can do a binary search */
+/* The default entity may be NULL. Binary search is still possible while
+ is senseless as there are just two rows (see also find_entity_for_char()). */
typedef union {
struct {
- unsigned size; /* number of remaining entries in the table */
const char *default_entity;
+ unsigned size; /* number of remaining entries in the table */
unsigned short default_entity_len;
} leading_entry;
struct {
- unsigned second_cp; /* second code point */
const char *entity;
+ unsigned second_cp; /* second code point */
unsigned short entity_len;
} normal_entry;
} entity_multicodepoint_row;
@@ -1145,258 +1144,258 @@ typedef struct {
/* {{{ Start of double code point tables for HTML5 */
static const entity_multicodepoint_row multi_cp_html5_0003C[] = {
- { {01, "lt", 2} },
- { {0x020D2, "nvlt", 4} },
+ { {"lt", 01, 2} },
+ { {"nvlt", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_0003D[] = {
- { {01, "equals", 6} },
- { {0x020E5, "bne", 3} },
+ { {"equals", 01, 6} },
+ { {"bne", 0x020E5, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_0003E[] = {
- { {01, "gt", 2} },
- { {0x020D2, "nvgt", 4} },
+ { {"gt", 01, 2} },
+ { {"nvgt", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_00066[] = {
- { {01, NULL , 0} },
- { {0x0006A, "fjlig", 5} },
+ { {NULL, 01, 0} },
+ { {"fjlig", 0x0006A, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_0205F[] = {
- { {01, "MediumSpace", 11} },
- { {0x0200A, "ThickSpace", 10} },
+ { {"MediumSpace", 01, 11} },
+ { {"ThickSpace", 0x0200A, 10} },
};
static const entity_multicodepoint_row multi_cp_html5_0219D[] = {
- { {01, "rarrw", 5} },
- { {0x00338, "nrarrw", 6} },
+ { {"rarrw", 01, 5} },
+ { {"nrarrw", 0x00338, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_02202[] = {
- { {01, "part", 4} },
- { {0x00338, "npart", 5} },
+ { {"part", 01, 4} },
+ { {"npart", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02220[] = {
- { {01, "angle", 5} },
- { {0x020D2, "nang", 4} },
+ { {"angle", 01, 5} },
+ { {"nang", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02229[] = {
- { {01, "cap", 3} },
- { {0x0FE00, "caps", 4} },
+ { {"cap", 01, 3} },
+ { {"caps", 0x0FE00, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_0222A[] = {
- { {01, "cup", 3} },
- { {0x0FE00, "cups", 4} },
+ { {"cup", 01, 3} },
+ { {"cups", 0x0FE00, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_0223C[] = {
- { {01, "sim", 3} },
- { {0x020D2, "nvsim", 5} },
+ { {"sim", 01, 3} },
+ { {"nvsim", 0x020D2, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_0223D[] = {
- { {01, "bsim", 4} },
- { {0x00331, "race", 4} },
+ { {"bsim", 01, 4} },
+ { {"race", 0x00331, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_0223E[] = {
- { {01, "ac", 2} },
- { {0x00333, "acE", 3} },
+ { {"ac", 01, 2} },
+ { {"acE", 0x00333, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_02242[] = {
- { {01, "esim", 4} },
- { {0x00338, "nesim", 5} },
+ { {"esim", 01, 4} },
+ { {"nesim", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_0224B[] = {
- { {01, "apid", 4} },
- { {0x00338, "napid", 5} },
+ { {"apid", 01, 4} },
+ { {"napid", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_0224D[] = {
- { {01, "CupCap", 6} },
- { {0x020D2, "nvap", 4} },
+ { {"CupCap", 01, 6} },
+ { {"nvap", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_0224E[] = {
- { {01, "bump", 4} },
- { {0x00338, "nbump", 5} },
+ { {"bump", 01, 4} },
+ { {"nbump", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_0224F[] = {
- { {01, "HumpEqual", 9} },
- { {0x00338, "nbumpe", 6} },
+ { {"HumpEqual", 01, 9} },
+ { {"nbumpe", 0x00338, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_02250[] = {
- { {01, "esdot", 5} },
- { {0x00338, "nedot", 5} },
+ { {"esdot", 01, 5} },
+ { {"nedot", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02261[] = {
- { {01, "Congruent", 9} },
- { {0x020E5, "bnequiv", 7} },
+ { {"Congruent", 01, 9} },
+ { {"bnequiv", 0x020E5, 7} },
};
static const entity_multicodepoint_row multi_cp_html5_02264[] = {
- { {01, "leq", 3} },
- { {0x020D2, "nvle", 4} },
+ { {"leq", 01, 3} },
+ { {"nvle", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02265[] = {
- { {01, "ge", 2} },
- { {0x020D2, "nvge", 4} },
+ { {"ge", 01, 2} },
+ { {"nvge", 0x020D2, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02266[] = {
- { {01, "lE", 2} },
- { {0x00338, "nlE", 3} },
+ { {"lE", 01, 2} },
+ { {"nlE", 0x00338, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_02267[] = {
- { {01, "geqq", 4} },
- { {0x00338, "NotGreaterFullEqual", 19} },
+ { {"geqq", 01, 4} },
+ { {"NotGreaterFullEqual", 0x00338, 19} },
};
static const entity_multicodepoint_row multi_cp_html5_02268[] = {
- { {01, "lneqq", 5} },
- { {0x0FE00, "lvertneqq", 9} },
+ { {"lneqq", 01, 5} },
+ { {"lvertneqq", 0x0FE00, 9} },
};
static const entity_multicodepoint_row multi_cp_html5_02269[] = {
- { {01, "gneqq", 5} },
- { {0x0FE00, "gvertneqq", 9} },
+ { {"gneqq", 01, 5} },
+ { {"gvertneqq", 0x0FE00, 9} },
};
static const entity_multicodepoint_row multi_cp_html5_0226A[] = {
- { {02, "ll", 2} },
- { {0x00338, "nLtv", 4} },
- { {0x020D2, "nLt", 3} },
+ { {"ll", 02, 2} },
+ { {"nLtv", 0x00338, 4} },
+ { {"nLt", 0x020D2, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_0226B[] = {
- { {02, "gg", 2} },
- { {0x00338, "NotGreaterGreater", 17} },
- { {0x020D2, "nGt", 3} },
+ { {"gg", 02, 2} },
+ { {"NotGreaterGreater", 0x00338, 17} },
+ { {"nGt", 0x020D2, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_0227F[] = {
- { {01, "SucceedsTilde", 13} },
- { {0x00338, "NotSucceedsTilde", 16} },
+ { {"SucceedsTilde", 01, 13} },
+ { {"NotSucceedsTilde", 0x00338, 16} },
};
static const entity_multicodepoint_row multi_cp_html5_02282[] = {
- { {01, "sub", 3} },
- { {0x020D2, "vnsub", 5} },
+ { {"sub", 01, 3} },
+ { {"vnsub", 0x020D2, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02283[] = {
- { {01, "sup", 3} },
- { {0x020D2, "nsupset", 7} },
+ { {"sup", 01, 3} },
+ { {"nsupset", 0x020D2, 7} },
};
static const entity_multicodepoint_row multi_cp_html5_0228A[] = {
- { {01, "subsetneq", 9} },
- { {0x0FE00, "vsubne", 6} },
+ { {"subsetneq", 01, 9} },
+ { {"vsubne", 0x0FE00, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_0228B[] = {
- { {01, "supsetneq", 9} },
- { {0x0FE00, "vsupne", 6} },
+ { {"supsetneq", 01, 9} },
+ { {"vsupne", 0x0FE00, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_0228F[] = {
- { {01, "sqsub", 5} },
- { {0x00338, "NotSquareSubset", 15} },
+ { {"sqsub", 01, 5} },
+ { {"NotSquareSubset", 0x00338, 15} },
};
static const entity_multicodepoint_row multi_cp_html5_02290[] = {
- { {01, "sqsupset", 8} },
- { {0x00338, "NotSquareSuperset", 17} },
+ { {"sqsupset", 01, 8} },
+ { {"NotSquareSuperset", 0x00338, 17} },
};
static const entity_multicodepoint_row multi_cp_html5_02293[] = {
- { {01, "sqcap", 5} },
- { {0x0FE00, "sqcaps", 6} },
+ { {"sqcap", 01, 5} },
+ { {"sqcaps", 0x0FE00, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_02294[] = {
- { {01, "sqcup", 5} },
- { {0x0FE00, "sqcups", 6} },
+ { {"sqcup", 01, 5} },
+ { {"sqcups", 0x0FE00, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_022B4[] = {
- { {01, "LeftTriangleEqual", 17} },
- { {0x020D2, "nvltrie", 7} },
+ { {"LeftTriangleEqual", 01, 17} },
+ { {"nvltrie", 0x020D2, 7} },
};
static const entity_multicodepoint_row multi_cp_html5_022B5[] = {
- { {01, "RightTriangleEqual", 18} },
- { {0x020D2, "nvrtrie", 7} },
+ { {"RightTriangleEqual", 01, 18} },
+ { {"nvrtrie", 0x020D2, 7} },
};
static const entity_multicodepoint_row multi_cp_html5_022D8[] = {
- { {01, "Ll", 2} },
- { {0x00338, "nLl", 3} },
+ { {"Ll", 01, 2} },
+ { {"nLl", 0x00338, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_022D9[] = {
- { {01, "Gg", 2} },
- { {0x00338, "nGg", 3} },
+ { {"Gg", 01, 2} },
+ { {"nGg", 0x00338, 3} },
};
static const entity_multicodepoint_row multi_cp_html5_022DA[] = {
- { {01, "lesseqgtr", 9} },
- { {0x0FE00, "lesg", 4} },
+ { {"lesseqgtr", 01, 9} },
+ { {"lesg", 0x0FE00, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_022DB[] = {
- { {01, "gtreqless", 9} },
- { {0x0FE00, "gesl", 4} },
+ { {"gtreqless", 01, 9} },
+ { {"gesl", 0x0FE00, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_022F5[] = {
- { {01, "isindot", 7} },
- { {0x00338, "notindot", 8} },
+ { {"isindot", 01, 7} },
+ { {"notindot", 0x00338, 8} },
};
static const entity_multicodepoint_row multi_cp_html5_022F9[] = {
- { {01, "isinE", 5} },
- { {0x00338, "notinE", 6} },
+ { {"isinE", 01, 5} },
+ { {"notinE", 0x00338, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_02933[] = {
- { {01, "rarrc", 5} },
- { {0x00338, "nrarrc", 6} },
+ { {"rarrc", 01, 5} },
+ { {"nrarrc", 0x00338, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_029CF[] = {
- { {01, "LeftTriangleBar", 15} },
- { {0x00338, "NotLeftTriangleBar", 18} },
+ { {"LeftTriangleBar", 01, 15} },
+ { {"NotLeftTriangleBar", 0x00338, 18} },
};
static const entity_multicodepoint_row multi_cp_html5_029D0[] = {
- { {01, "RightTriangleBar", 16} },
- { {0x00338, "NotRightTriangleBar", 19} },
+ { {"RightTriangleBar", 01, 16} },
+ { {"NotRightTriangleBar", 0x00338, 19} },
};
static const entity_multicodepoint_row multi_cp_html5_02A6D[] = {
- { {01, "congdot", 7} },
- { {0x00338, "ncongdot", 8} },
+ { {"congdot", 01, 7} },
+ { {"ncongdot", 0x00338, 8} },
};
static const entity_multicodepoint_row multi_cp_html5_02A70[] = {
- { {01, "apE", 3} },
- { {0x00338, "napE", 4} },
+ { {"apE", 01, 3} },
+ { {"napE", 0x00338, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02A7D[] = {
- { {01, "les", 3} },
- { {0x00338, "nles", 4} },
+ { {"les", 01, 3} },
+ { {"nles", 0x00338, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02A7E[] = {
- { {01, "ges", 3} },
- { {0x00338, "nges", 4} },
+ { {"ges", 01, 3} },
+ { {"nges", 0x00338, 4} },
};
static const entity_multicodepoint_row multi_cp_html5_02AA1[] = {
- { {01, "LessLess", 8} },
- { {0x00338, "NotNestedLessLess", 17} },
+ { {"LessLess", 01, 8} },
+ { {"NotNestedLessLess", 0x00338, 17} },
};
static const entity_multicodepoint_row multi_cp_html5_02AA2[] = {
- { {01, "GreaterGreater", 14} },
- { {0x00338, "NotNestedGreaterGreater", 23} },
+ { {"GreaterGreater", 01, 14} },
+ { {"NotNestedGreaterGreater", 0x00338, 23} },
};
static const entity_multicodepoint_row multi_cp_html5_02AAC[] = {
- { {01, "smte", 4} },
- { {0x0FE00, "smtes", 5} },
+ { {"smte", 01, 4} },
+ { {"smtes", 0x0FE00, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02AAD[] = {
- { {01, "late", 4} },
- { {0x0FE00, "lates", 5} },
+ { {"late", 01, 4} },
+ { {"lates", 0x0FE00, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02AAF[] = {
- { {01, "preceq", 6} },
- { {0x00338, "NotPrecedesEqual", 16} },
+ { {"preceq", 01, 6} },
+ { {"NotPrecedesEqual", 0x00338, 16} },
};
static const entity_multicodepoint_row multi_cp_html5_02AB0[] = {
- { {01, "SucceedsEqual", 13} },
- { {0x00338, "NotSucceedsEqual", 16} },
+ { {"SucceedsEqual", 01, 13} },
+ { {"NotSucceedsEqual", 0x00338, 16} },
};
static const entity_multicodepoint_row multi_cp_html5_02AC5[] = {
- { {01, "subE", 4} },
- { {0x00338, "nsubE", 5} },
+ { {"subE", 01, 4} },
+ { {"nsubE", 0x00338, 5} },
};
static const entity_multicodepoint_row multi_cp_html5_02AC6[] = {
- { {01, "supseteqq", 9} },
- { {0x00338, "nsupseteqq", 10} },
+ { {"supseteqq", 01, 9} },
+ { {"nsupseteqq", 0x00338, 10} },
};
static const entity_multicodepoint_row multi_cp_html5_02ACB[] = {
- { {01, "subsetneqq", 10} },
- { {0x0FE00, "vsubnE", 6} },
+ { {"subsetneqq", 01, 10} },
+ { {"vsubnE", 0x0FE00, 6} },
};
static const entity_multicodepoint_row multi_cp_html5_02ACC[] = {
- { {01, "supnE", 5} },
- { {0x0FE00, "varsupsetneqq", 13} },
+ { {"supnE", 01, 5} },
+ { {"varsupsetneqq", 0x0FE00, 13} },
};
static const entity_multicodepoint_row multi_cp_html5_02AFD[] = {
- { {01, "parsl", 5} },
- { {0x020E5, "nparsl", 6} },
+ { {"parsl", 01, 5} },
+ { {"nparsl", 0x020E5, 6} },
};
/* End of double code point tables }}} */
diff --git a/ext/standard/html_tables/html_table_gen.php b/ext/standard/html_tables/html_table_gen.php
index 2aae24475a..45ae5f832b 100644
--- a/ext/standard/html_tables/html_table_gen.php
+++ b/ext/standard/html_tables/html_table_gen.php
@@ -1,7 +1,7 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,7 @@
$t = <<<CODE
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-%s The PHP Group |
+----------------------------------------------------------------------+
@@ -371,18 +371,17 @@ $t = <<<'CODE'
#define ENT_STAGE3_INDEX(k) ((k) & 0x3F)
#define ENT_CODE_POINT_FROM_STAGES(i,j,k) (((i) << 12) | ((j) << 6) | (k))
-/* Table should be organized with a leading row telling the size of
- * the table and the default entity (maybe NULL) and the rest being
- * normal rows ordered by code point so that we can do a binary search */
+/* The default entity may be NULL. Binary search is still possible while
+ is senseless as there are just two rows (see also find_entity_for_char()). */
typedef union {
struct {
- unsigned size; /* number of remaining entries in the table */
const char *default_entity;
+ unsigned size; /* number of remaining entries in the table */
unsigned short default_entity_len;
} leading_entry;
struct {
- unsigned second_cp; /* second code point */
const char *entity;
+ unsigned second_cp; /* second code point */
unsigned short entity_len;
} normal_entry;
} entity_multicodepoint_row;
@@ -475,16 +474,16 @@ foreach ($multicp_rows as $k => $v) {
if (key_exists("default", $v)) {
if ($v['default'] == 'GT') /* hack to make > translate to &gt; not GT; */
$v['default'] = "gt";
- echo "\t{ {", sprintf("%02d", count($v) - 1),
- ",\t\t", sprintf("\"%-21s", $v["default"].'",'), "\t",
+ echo "\t{ {", sprintf("\"%-21s", $v["default"].'",'),
+ "\t", sprintf("%02d", (count($v) - 1)), ",\t\t",
sprintf("% 2d", strlen($v["default"])), '} },', "\n";
} else {
- echo "\t{ {", sprintf("%02d", count($v)),
- ",\t\t", sprintf("%-22s", 'NULL'), ",\t0} },\n";
+ echo "\t{ {", sprintf("%-22s", 'NULL,'),
+ "\t", sprintf("%02d", count($v)), ",\t\t0} },\n";
}
unset($v["default"]);
foreach ($v as $l => $w) {
- echo "\t{ {", sprintf("0x%05s", $l), ",\t", sprintf("\"%-21s", $w.'",'), "\t",
+ echo "\t{ {", sprintf("\"%-21s", $w.'",'), "\t", sprintf("0x%05s", $l), ",\t",
sprintf("% 2d", strlen($w)), '} },', "\n";
}
echo "};\n";
diff --git a/ext/standard/http.c b/ext/standard/http.c
index d5eb78e417..9174163b7d 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -34,8 +34,8 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
zend_string *key = NULL;
char *newprefix, *p;
const char *prop_name;
- int arg_sep_len, newprefix_len, prop_len;
- php_uint_t idx;
+ size_t arg_sep_len, newprefix_len, prop_len;
+ zend_ulong idx;
zval *zdata = NULL, copyzval;
if (!ht) {
@@ -66,7 +66,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
/* private or protected property access outside of the class */
continue;
}
- zend_unmangle_property_name_ex(key->val, key->len, &tmp, &prop_name, &prop_len);
+ zend_unmangle_property_name_ex(key, &tmp, &prop_name, &prop_len);
} else {
prop_name = key->val;
prop_len = key->len;
@@ -95,7 +95,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
memcpy(p, ekey->val, ekey->len);
p += ekey->len;
- STR_FREE(ekey);
+ zend_string_free(ekey);
if (key_suffix) {
memcpy(p, key_suffix, key_suffix_len);
@@ -109,7 +109,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
char *ekey;
int ekey_len;
/* Is an integer key */
- ekey_len = spprintf(&ekey, 0, "%ld", idx);
+ ekey_len = spprintf(&ekey, 0, "%pd", idx);
newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -159,18 +159,14 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
} else {
ekey = php_url_encode(prop_name, prop_len);
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
- STR_FREE(ekey);
+ smart_str_append(formstr, ekey);
+ zend_string_free(ekey);
} else {
- char *ekey;
- int ekey_len;
/* Numeric key */
if (num_prefix) {
smart_str_appendl(formstr, num_prefix, num_prefix_len);
}
- ekey_len = spprintf(&ekey, 0, "%ld", idx);
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
+ smart_str_append_long(formstr, idx);
}
smart_str_appendl(formstr, key_suffix, key_suffix_len);
smart_str_appendl(formstr, "=", 1);
@@ -178,22 +174,16 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
case IS_STRING: {
zend_string *ekey;
if (enc_type == PHP_QUERY_RFC3986) {
- ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata));
+ ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata));
} else {
- ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata));
+ ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata));
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
- STR_FREE(ekey);
+ smart_str_append(formstr, ekey);
+ zend_string_free(ekey);
}
break;
- case IS_INT:
- {
- char *ekey;
- int ekey_len;
- ekey_len = spprintf(&ekey, 0, "%ld", Z_IVAL_P(zdata));
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
- }
+ case IS_LONG:
+ smart_str_append_long(formstr, Z_LVAL_P(zdata));
break;
case IS_FALSE:
smart_str_appendl(formstr, "0", sizeof("0")-1);
@@ -217,13 +207,13 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
ZVAL_DUP(&copyzval, zdata);
convert_to_string_ex(&copyzval);
if (enc_type == PHP_QUERY_RFC3986) {
- ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval));
+ ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval));
} else {
- ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval));
+ ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval));
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
+ smart_str_append(formstr, ekey);
zval_ptr_dtor(&copyzval);
- STR_FREE(ekey);
+ zend_string_free(ekey);
}
}
}
@@ -239,11 +229,11 @@ PHP_FUNCTION(http_build_query)
{
zval *formdata;
char *prefix = NULL, *arg_sep=NULL;
- int arg_sep_len = 0, prefix_len = 0;
+ size_t arg_sep_len = 0, prefix_len = 0;
smart_str formstr = {0};
- php_int_t enc_type = PHP_QUERY_RFC1738;
+ zend_long enc_type = PHP_QUERY_RFC1738;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssi", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) {
RETURN_FALSE;
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 4359c34efa..27c6cf6248 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "php_network.h"
#include "php_ini.h"
#include "ext/standard/basic_functions.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include <stdio.h>
#include <stdlib.h>
@@ -160,7 +160,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
if (!context ||
(tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) == NULL ||
Z_TYPE_P(tmpzval) != IS_STRING ||
- Z_STRSIZE_P(tmpzval) <= 0) {
+ Z_STRLEN_P(tmpzval) <= 0) {
php_url_free(resource);
return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context);
}
@@ -169,8 +169,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
use_ssl = 0;
use_proxy = 1;
- transport_len = Z_STRSIZE_P(tmpzval);
- transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval));
+ transport_len = Z_STRLEN_P(tmpzval);
+ transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
} else {
/* Normal http request (possibly with proxy) */
@@ -190,10 +190,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
if (context &&
(tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING &&
- Z_STRSIZE_P(tmpzval) > 0) {
+ Z_STRLEN_P(tmpzval) > 0) {
use_proxy = 1;
- transport_len = Z_STRSIZE_P(tmpzval);
- transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval));
+ transport_len = Z_STRLEN_P(tmpzval);
+ transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
} else {
transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port);
}
@@ -218,7 +218,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
if (errstr) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr->val);
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
errstr = NULL;
}
@@ -271,7 +271,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
} while (*s != 0);
}
} ZEND_HASH_FOREACH_END();
- } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) {
+ } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) {
s = Z_STRVAL_P(tmpzval);
do {
while (*s == ' ' || *s == '\t') s++;
@@ -346,20 +346,20 @@ finish:
php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) {
- redirect_max = zval_get_int(tmpzval);
+ redirect_max = zval_get_long(tmpzval);
}
if (context && (tmpzval = php_stream_context_get_option(context, "http", "method")) != NULL) {
- if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) {
+ if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) {
/* As per the RFC, automatically redirected requests MUST NOT use other methods than
* GET and HEAD unless it can be confirmed by the user */
if (!redirected
- || (Z_STRSIZE_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0)
- || (Z_STRSIZE_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0)
+ || (Z_STRLEN_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0)
+ || (Z_STRLEN_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0)
) {
- scratch_len = strlen(path) + 29 + Z_STRSIZE_P(tmpzval);
+ scratch_len = strlen(path) + 29 + Z_STRLEN_P(tmpzval);
scratch = emalloc(scratch_len);
- strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) + 1);
+ strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) + 1);
strncat(scratch, " ", 1);
}
}
@@ -422,7 +422,7 @@ finish:
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) {
if (Z_TYPE_P(tmpheader) == IS_STRING) {
- smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRSIZE_P(tmpheader));
+ smart_str_append(&tmpstr, Z_STR_P(tmpheader));
smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1);
}
} ZEND_HASH_FOREACH_END();
@@ -433,11 +433,11 @@ finish:
smart_str_free(&tmpstr);
}
}
- if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) {
+ if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) {
/* Remove newlines and spaces from start and end php_trim will estrndup() */
- tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC);
+ tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC);
}
- if (tmp && strlen(tmp) > 0) {
+ if (tmp && tmp[0] != '\0') {
char *s;
user_headers = estrdup(tmp);
@@ -537,7 +537,7 @@ finish:
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
}
- STR_FREE(stmp);
+ zend_string_free(stmp);
}
/* if the user has configured who they are, send a From: line */
@@ -609,9 +609,9 @@ finish:
context &&
!(have_header & HTTP_HEADER_CONTENT_LENGTH) &&
(tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL &&
- Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0
+ Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0
) {
- scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval));
php_stream_write(stream, scratch, scratch_len);
have_header |= HTTP_HEADER_CONTENT_LENGTH;
}
@@ -624,9 +624,9 @@ finish:
/* Request content, such as for POST requests */
if (header_init && context &&
(tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL &&
- Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) {
+ Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) {
if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) {
- scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval));
php_stream_write(stream, scratch, scratch_len);
}
if (!(have_header & HTTP_HEADER_TYPE)) {
@@ -635,7 +635,7 @@ finish:
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded");
}
php_stream_write(stream, "\r\n", sizeof("\r\n")-1);
- php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval));
+ php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
} else {
php_stream_write(stream, "\r\n", sizeof("\r\n")-1);
}
@@ -731,7 +731,7 @@ finish:
if (!strncasecmp(http_header_line, "Location: ", 10)) {
if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) {
- follow_location = zval_get_int(tmpzval);
+ follow_location = zval_get_long(tmpzval);
} else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) {
/* we shouldn't redirect automatically
if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307)
@@ -749,7 +749,7 @@ finish:
/* create filter to decode response body */
if (!(options & STREAM_ONLY_GET_HEADERS)) {
- php_int_t decode = 1;
+ zend_long decode = 1;
if (context && (tmpzval = php_stream_context_get_option(context, "http", "auto_decode")) != NULL) {
decode = zend_is_true(tmpzval TSRMLS_CC);
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 24576fd671..54159e3785 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -72,28 +72,28 @@ struct gfxinfo {
* Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */
PHP_MINIT_FUNCTION(imagetypes)
{
- REGISTER_INT_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT);
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
- REGISTER_INT_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT);
#endif
- REGISTER_INT_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */
- REGISTER_INT_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */
+ REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
@@ -237,7 +237,7 @@ static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC)
} while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
if (bufz) {
- STR_RELEASE(bufz);
+ zend_string_release(bufz);
}
if (status == Z_OK) {
@@ -366,8 +366,8 @@ static unsigned short php_read2(php_stream * stream TSRMLS_DC)
{
unsigned char a[2];
- /* just return 0 if we hit the end-of-file */
- if((php_stream_read(stream, (char*)a, sizeof(a))) <= 0) return 0;
+ /* return 0 if we couldn't read enough data */
+ if((php_stream_read(stream, a, sizeof(a))) < sizeof(a)) return 0;
return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]);
}
@@ -425,13 +425,13 @@ static unsigned int php_next_marker(php_stream * stream, int last_marker, int co
* skip over a variable-length block; assumes proper length marker */
static int php_skip_variable(php_stream * stream TSRMLS_DC)
{
- off_t length = ((unsigned int)php_read2(stream TSRMLS_CC));
+ zend_off_t length = ((unsigned int)php_read2(stream TSRMLS_CC));
if (length < 2) {
return 0;
}
length = length - 2;
- php_stream_seek(stream, (long)length, SEEK_CUR);
+ php_stream_seek(stream, (zend_long)length, SEEK_CUR);
return 1;
}
/* }}} */
@@ -453,7 +453,7 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSR
buffer = emalloc(length);
- if (php_stream_read(stream, buffer, (long) length) <= 0) {
+ if (php_stream_read(stream, buffer, (zend_long) length) <= 0) {
efree(buffer);
return 0;
}
@@ -647,7 +647,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC)
#endif
result->channels = php_read2(stream TSRMLS_CC); /* Csiz */
- if (result->channels < 0 || result->channels > 256) {
+ if (result->channels == 0 && php_stream_eof(stream) || result->channels > 256) {
efree(result);
return NULL;
}
@@ -1160,9 +1160,9 @@ PHPAPI char * php_image_type_to_mime_type(int image_type)
Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
PHP_FUNCTION(image_type_to_mime_type)
{
- php_int_t p_image_type;
+ zend_long p_image_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &p_image_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &p_image_type) == FAILURE) {
return;
}
@@ -1174,10 +1174,10 @@ PHP_FUNCTION(image_type_to_mime_type)
Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
PHP_FUNCTION(image_type_to_extension)
{
- php_int_t image_type;
+ zend_long image_type;
zend_bool inc_dot=1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|b", &image_type, &inc_dot) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &image_type, &inc_dot) == FAILURE) {
RETURN_FALSE;
}
@@ -1364,19 +1364,19 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA
}
if (result) {
- char temp[MAX_LENGTH_OF_ZEND_INT * 2 + sizeof("width=\"\" height=\"\"")];
+ char temp[MAX_LENGTH_OF_LONG * 2 + sizeof("width=\"\" height=\"\"")];
array_init(return_value);
- add_index_int(return_value, 0, result->width);
- add_index_int(return_value, 1, result->height);
- add_index_int(return_value, 2, itype);
+ add_index_long(return_value, 0, result->width);
+ add_index_long(return_value, 1, result->height);
+ add_index_long(return_value, 2, itype);
snprintf(temp, sizeof(temp), "width=\"%d\" height=\"%d\"", result->width, result->height);
add_index_string(return_value, 3, temp);
if (result->bits != 0) {
- add_assoc_int(return_value, "bits", result->bits);
+ add_assoc_long(return_value, "bits", result->bits);
}
if (result->channels != 0) {
- add_assoc_int(return_value, "channels", result->channels);
+ add_assoc_long(return_value, "channels", result->channels);
}
add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype));
efree(result);
@@ -1393,7 +1393,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
zval *info = NULL;
php_stream *stream = NULL;
char *input;
- int input_len;
+ size_t input_len;
const int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc TSRMLS_CC, "s|z/", &input, &input_len, &info) == FAILURE) {
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index fb63703792..011407da29 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -42,7 +42,7 @@ static void incomplete_class_message(zval *object, int error_type TSRMLS_DC)
if (class_name) {
php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name->val);
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
} else {
php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, "unknown");
}
@@ -141,7 +141,7 @@ PHPAPI zend_string *php_lookup_class_name(zval *object)
object_properties = Z_OBJPROP_P(object);
if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL) {
- return STR_COPY(Z_STR_P(val));
+ return zend_string_copy(Z_STR_P(val));
}
return NULL;
@@ -150,7 +150,7 @@ PHPAPI zend_string *php_lookup_class_name(zval *object)
/* {{{ php_store_class_name
*/
-PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len)
+PHPAPI void php_store_class_name(zval *object, const char *name, uint32_t len)
{
zval val;
TSRMLS_FETCH();
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 07c183df8e..bc0ddddcc0 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -69,7 +69,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */
new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
written = php_output_write(new_str->val, new_str->len TSRMLS_CC);
- STR_FREE(new_str);
+ zend_string_free(new_str);
return written;
}
/* }}} */
@@ -196,10 +196,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
{
zval *data, *tmp, tmp2;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
zend_string *key;
- key = STR_INIT(name, name_length, 0);
+ key = zend_string_init(name, name_length, 0);
zend_is_auto_global(key TSRMLS_CC);
if ((data = zend_hash_find(&EG(symbol_table).ht, key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) {
@@ -219,7 +219,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
php_info_print(string_key->val);
}
} else {
- php_info_printf("%ld", num_key);
+ php_info_printf(ZEND_ULONG_FMT, num_key);
}
php_info_print("\"]");
if (!sapi_module.phpinfo_as_text) {
@@ -244,10 +244,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
}
if (!sapi_module.phpinfo_as_text) {
- if (Z_STRSIZE(tmp2) == 0) {
+ if (Z_STRLEN(tmp2) == 0) {
php_info_print("<i>no value</i>");
} else {
- php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2));
+ php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2));
}
} else {
php_info_print(Z_STRVAL(tmp2));
@@ -264,7 +264,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
}
} ZEND_HASH_FOREACH_END();
}
- STR_FREE(key);
+ zend_string_free(key);
}
/* }}} */
@@ -585,6 +585,8 @@ PHPAPI zend_string *php_get_uname(char mode)
char *winver = php_get_windows_name();
char wincpu[20];
+ ZEND_ASSERT(winver != NULL);
+
php_get_windows_cpu(wincpu, sizeof(wincpu));
dwBuild = (DWORD)(HIWORD(dwVersion));
@@ -655,7 +657,7 @@ PHPAPI zend_string *php_get_uname(char mode)
php_uname = PHP_UNAME;
#endif
#endif
- return STR_INIT(php_uname, strlen(php_uname), 0);
+ return zend_string_init(php_uname, strlen(php_uname), 0);
}
/* }}} */
@@ -833,7 +835,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
}
php_info_print_box_end();
- STR_FREE(php_uname);
+ zend_string_free(php_uname);
}
zend_ini_sort_entries(TSRMLS_C);
@@ -1143,22 +1145,22 @@ PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
*/
void register_phpinfo_constants(INIT_FUNC_ARGS)
{
- REGISTER_INT_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
}
/* }}} */
@@ -1166,9 +1168,9 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
Output a page of useful information about PHP and the current request */
PHP_FUNCTION(phpinfo)
{
- php_int_t flag = PHP_INFO_ALL;
+ zend_long flag = PHP_INFO_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
return;
}
@@ -1187,7 +1189,7 @@ PHP_FUNCTION(phpinfo)
PHP_FUNCTION(phpversion)
{
char *ext_name = NULL;
- int ext_name_len = 0;
+ size_t ext_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext_name, &ext_name_len) == FAILURE) {
return;
@@ -1210,9 +1212,9 @@ PHP_FUNCTION(phpversion)
Prints the list of people who've contributed to the PHP project */
PHP_FUNCTION(phpcredits)
{
- php_int_t flag = PHP_CREDITS_ALL;
+ zend_long flag = PHP_CREDITS_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
return;
}
@@ -1243,7 +1245,7 @@ PHP_FUNCTION(php_sapi_name)
PHP_FUNCTION(php_uname)
{
char *mode = "a";
- int modelen = sizeof("a")-1;
+ size_t modelen = sizeof("a")-1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
return;
diff --git a/ext/standard/info.h b/ext/standard/info.h
index 8be58160ed..a28ac564ab 100644
--- a/ext/standard/info.h
+++ b/ext/standard/info.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index 9102b4b07a..75bbdd22ce 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -178,16 +178,16 @@ static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
PHP_FUNCTION(iptcembed)
{
char *iptcdata, *jpeg_file;
- int iptcdata_len, jpeg_file_len;
- php_int_t spool = 0;
+ size_t iptcdata_len, jpeg_file_len;
+ zend_long spool = 0;
FILE *fp;
unsigned int marker, done = 0;
int inx;
unsigned char *spoolbuf = NULL, *poi = NULL;
- struct stat sb;
+ zend_stat_t sb;
zend_bool written = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|i", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) {
return;
}
@@ -201,7 +201,7 @@ PHP_FUNCTION(iptcembed)
}
if (spool < 2) {
- fstat(fileno(fp), &sb);
+ zend_fstat(fileno(fp), &sb);
poi = spoolbuf = safe_emalloc(1, iptcdata_len + sizeof(psheader) + sb.st_size + 1024, 1);
memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1);
@@ -300,9 +300,9 @@ PHP_FUNCTION(iptcparse)
{
int inx = 0, len;
unsigned int tagsfound = 0;
- unsigned char *buffer, recnum, dataset, key[ 16 ];
- char *str;
- int str_len;
+ unsigned char *buffer, recnum, dataset;
+ char *str, key[16];
+ size_t str_len;
zval values, *element;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) != SUCCESS) {
@@ -334,8 +334,8 @@ PHP_FUNCTION(iptcparse)
if((inx+6) >= str_len) {
break;
}
- len = (((php_int_t) buffer[ inx + 2 ]) << 24) + (((php_int_t) buffer[ inx + 3 ]) << 16) +
- (((php_int_t) buffer[ inx + 4 ]) << 8) + (((php_int_t) buffer[ inx + 5 ]));
+ len = (((zend_long) buffer[ inx + 2 ]) << 24) + (((zend_long) buffer[ inx + 3 ]) << 16) +
+ (((zend_long) buffer[ inx + 4 ]) << 8) + (((zend_long) buffer[ inx + 5 ]));
inx += 6;
} else { /* short tag */
len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index 311173a137..8bfa05555b 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -83,9 +83,9 @@ static void lcg_seed(TSRMLS_D) /* {{{ */
LCG(s1) = 1;
}
#ifdef ZTS
- LCG(s2) = (long) tsrm_thread_id();
+ LCG(s2) = (zend_long) tsrm_thread_id();
#else
- LCG(s2) = (long) getpid();
+ LCG(s2) = (zend_long) getpid();
#endif
/* Add entropy to s2 by calling gettimeofday() again */
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index 232366e030..df822f45d4 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -94,8 +94,8 @@ PHP_FUNCTION(levenshtein)
int argc = ZEND_NUM_ARGS();
char *str1, *str2;
char *callback_name;
- int str1_len, str2_len, callback_len;
- php_int_t cost_ins, cost_rep, cost_del;
+ size_t str1_len, str2_len, callback_len;
+ zend_long cost_ins, cost_rep, cost_del;
int distance = -1;
switch (argc) {
@@ -107,7 +107,7 @@ PHP_FUNCTION(levenshtein)
break;
case 5: /* more general version: calc cost by ins/rep/del weights */
- if (zend_parse_parameters(5 TSRMLS_CC, "ssiii", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
+ if (zend_parse_parameters(5 TSRMLS_CC, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
return;
}
distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del);
@@ -128,7 +128,7 @@ PHP_FUNCTION(levenshtein)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long");
}
- RETURN_INT(distance);
+ RETURN_LONG(distance);
}
/* }}} */
diff --git a/ext/standard/link.c b/ext/standard/link.c
index 4265823616..4618ffe983 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -55,7 +55,7 @@
PHP_FUNCTION(readlink)
{
char *link;
- int link_len;
+ size_t link_len;
char buff[MAXPATHLEN];
int ret;
@@ -86,8 +86,8 @@ PHP_FUNCTION(linkinfo)
{
char *link;
char *dirname;
- int link_len, dir_len;
- struct stat sb;
+ size_t link_len, dir_len;
+ zend_stat_t sb;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) {
@@ -106,11 +106,11 @@ PHP_FUNCTION(linkinfo)
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
efree(dirname);
- RETURN_INT(-1L);
+ RETURN_LONG(-1L);
}
efree(dirname);
- RETURN_INT((long) sb.st_dev);
+ RETURN_LONG((zend_long) sb.st_dev);
}
/* }}} */
@@ -119,7 +119,7 @@ PHP_FUNCTION(linkinfo)
PHP_FUNCTION(symlink)
{
char *topath, *frompath;
- int topath_len, frompath_len;
+ size_t topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
@@ -177,7 +177,7 @@ PHP_FUNCTION(symlink)
PHP_FUNCTION(link)
{
char *topath, *frompath;
- int topath_len, frompath_len;
+ size_t topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c
index 8a04fb3f77..ab904d9571 100644
--- a/ext/standard/link_win32.c
+++ b/ext/standard/link_win32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -63,7 +63,7 @@ TODO:
PHP_FUNCTION(readlink)
{
char *link;
- int link_len;
+ size_t link_len;
char target[MAXPATHLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) {
@@ -87,8 +87,8 @@ PHP_FUNCTION(readlink)
PHP_FUNCTION(linkinfo)
{
char *link;
- int link_len;
- php_stat_t sb;
+ size_t link_len;
+ zend_stat_t sb;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) {
@@ -98,10 +98,10 @@ PHP_FUNCTION(linkinfo)
ret = VCWD_STAT(link, &sb);
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
- RETURN_INT(-1L);
+ RETURN_LONG(Z_L(-1));
}
- RETURN_INT((long) sb.st_dev);
+ RETURN_LONG((zend_long) sb.st_dev);
}
/* }}} */
@@ -110,7 +110,7 @@ PHP_FUNCTION(linkinfo)
PHP_FUNCTION(symlink)
{
char *topath, *frompath;
- int topath_len, frompath_len;
+ size_t topath_len, frompath_len;
BOOLEAN ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
@@ -190,7 +190,7 @@ PHP_FUNCTION(symlink)
PHP_FUNCTION(link)
{
char *topath, *frompath;
- int topath_len, frompath_len;
+ size_t topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 1bd2fa9016..96363f4cb9 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -72,7 +72,7 @@
*p = ' '; \
} \
-extern php_int_t php_getuid(TSRMLS_D);
+extern zend_long php_getuid(TSRMLS_D);
/* {{{ proto int ezmlm_hash(string addr)
Calculate EZMLM list hash value. */
@@ -80,19 +80,19 @@ PHP_FUNCTION(ezmlm_hash)
{
char *str = NULL;
unsigned int h = 5381;
- int j, str_len;
+ size_t j, str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
for (j = 0; j < str_len; j++) {
- h = (h + (h << 5)) ^ (unsigned long) (unsigned char) tolower(str[j]);
+ h = (h + (h << 5)) ^ (zend_ulong) (unsigned char) tolower(str[j]);
}
h = (h % 53);
- RETURN_INT((int) h);
+ RETURN_LONG((zend_long) h);
}
/* }}} */
@@ -103,8 +103,8 @@ PHP_FUNCTION(mail)
char *to=NULL, *message=NULL, *headers=NULL, *headers_trimmed=NULL;
char *subject=NULL;
zend_string *extra_cmd=NULL;
- int to_len, message_len, headers_len = 0;
- int subject_len, i;
+ size_t to_len, message_len, headers_len = 0;
+ size_t subject_len, i;
char *force_extra_parameters = INI_STR("mail.force_extra_parameters");
char *to_r, *subject_r;
char *p, *e;
@@ -182,7 +182,7 @@ PHP_FUNCTION(mail)
}
if (extra_cmd) {
- STR_RELEASE(extra_cmd);
+ zend_string_release(extra_cmd);
}
if (to_r != to) {
efree(to_r);
@@ -259,7 +259,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s\n", date_str->val, zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : "");
- STR_FREE(date_str);
+ zend_string_free(date_str);
if (hdr) {
php_mail_log_crlf_to_spaces(tmp);
@@ -285,11 +285,11 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char
f = php_basename(tmp, strlen(tmp), NULL, 0 TSRMLS_CC);
if (headers != NULL) {
- spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f->val, headers);
+ spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\n%s", php_getuid(TSRMLS_C), f->val, headers);
} else {
- spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s", php_getuid(TSRMLS_C), f->val);
+ spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(TSRMLS_C), f->val);
}
- STR_RELEASE(f);
+ zend_string_release(f);
}
if (!sendmail_path) {
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 267b8c0170..7014e6c938 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -219,7 +219,16 @@ static double php_asinh(double z)
#ifdef HAVE_ASINH
return(asinh(z));
#else
+# ifdef _WIN64
+ if (z >= 0) {
+ return log(z + sqrt(z * z + 1));
+ }
+ else {
+ return -log(-z + sqrt(z * z + 1));
+ }
+# else
return(log(z + sqrt(1 + pow(z, 2))) / log(M_E));
+# endif
#endif
}
/* }}} */
@@ -231,7 +240,15 @@ static double php_acosh(double x)
#ifdef HAVE_ACOSH
return(acosh(x));
#else
+# ifdef _WIN64
+ if (x >= 1) {
+ return log(x + sqrt(x * x - 1));
+ } else {
+ return (DBL_MAX+DBL_MAX)-(DBL_MAX+DBL_MAX);
+ }
+# else
return(log(x + sqrt(x * x - 1)));
+# endif
#endif
}
/* }}} */
@@ -285,11 +302,11 @@ PHP_FUNCTION(abs)
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(fabs(Z_DVAL_P(value)));
- } else if (Z_TYPE_P(value) == IS_INT) {
- if (Z_IVAL_P(value) == ZEND_INT_MIN) {
- RETURN_DOUBLE(-(double)ZEND_INT_MIN);
+ } else if (Z_TYPE_P(value) == IS_LONG) {
+ if (Z_LVAL_P(value) == ZEND_LONG_MIN) {
+ RETURN_DOUBLE(-(double)ZEND_LONG_MIN);
} else {
- RETURN_INT(Z_IVAL_P(value) < 0 ? -Z_IVAL_P(value) : Z_IVAL_P(value));
+ RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
}
}
RETURN_FALSE;
@@ -309,7 +326,7 @@ PHP_FUNCTION(ceil)
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(ceil(Z_DVAL_P(value)));
- } else if (Z_TYPE_P(value) == IS_INT) {
+ } else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
}
RETURN_FALSE;
@@ -329,7 +346,7 @@ PHP_FUNCTION(floor)
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(floor(Z_DVAL_P(value)));
- } else if (Z_TYPE_P(value) == IS_INT) {
+ } else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
}
RETURN_FALSE;
@@ -342,11 +359,11 @@ PHP_FUNCTION(round)
{
zval *value;
int places = 0;
- php_int_t precision = 0;
- php_int_t mode = PHP_ROUND_HALF_UP;
+ zend_long precision = 0;
+ zend_long mode = PHP_ROUND_HALF_UP;
double return_val;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", &value, &precision, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &value, &precision, &mode) == FAILURE) {
return;
}
@@ -356,15 +373,15 @@ PHP_FUNCTION(round)
convert_scalar_to_number_ex(value);
switch (Z_TYPE_P(value)) {
- case IS_INT:
+ case IS_LONG:
/* Simple case - long that doesn't need to be rounded. */
if (places >= 0) {
- RETURN_DOUBLE((double) Z_IVAL_P(value));
+ RETURN_DOUBLE((double) Z_LVAL_P(value));
}
/* break omitted intentionally */
case IS_DOUBLE:
- return_val = (Z_TYPE_P(value) == IS_INT) ? (double)Z_IVAL_P(value) : Z_DVAL_P(value);
+ return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value);
return_val = _php_math_round(return_val, places, mode);
RETURN_DOUBLE(return_val);
break;
@@ -926,9 +943,9 @@ PHP_FUNCTION(rad2deg)
/*
* Convert a string representation of a base(2-36) number to a long.
*/
-PHPAPI php_int_t _php_math_basetolong(zval *arg, int base)
+PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
{
- php_int_t num = 0, digit, onum;
+ zend_long num = 0, digit, onum;
int i;
char c, *s;
@@ -938,7 +955,7 @@ PHPAPI php_int_t _php_math_basetolong(zval *arg, int base)
s = Z_STRVAL_P(arg);
- for (i = Z_STRSIZE_P(arg); i > 0; i--) {
+ for (i = Z_STRLEN_P(arg); i > 0; i--) {
c = *s++;
digit = (c >= '0' && c <= '9') ? c - '0'
@@ -959,7 +976,7 @@ PHPAPI php_int_t _php_math_basetolong(zval *arg, int base)
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
- return ZEND_INT_MAX;
+ return ZEND_LONG_MAX;
}
}
@@ -973,12 +990,12 @@ PHPAPI php_int_t _php_math_basetolong(zval *arg, int base)
*/
PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
{
- php_int_t num = 0;
+ zend_long num = 0;
double fnum = 0;
int i;
int mode = 0;
char c, *s;
- php_int_t cutoff;
+ zend_long cutoff;
int cutlim;
if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
@@ -987,10 +1004,10 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
s = Z_STRVAL_P(arg);
- cutoff = ZEND_INT_MAX / base;
- cutlim = ZEND_INT_MAX % base;
+ cutoff = ZEND_LONG_MAX / base;
+ cutlim = ZEND_LONG_MAX % base;
- for (i = Z_STRSIZE_P(arg); i > 0; i--) {
+ for (i = Z_STRLEN_P(arg); i > 0; i--) {
c = *s++;
/* might not work for EBCDIC */
@@ -1024,7 +1041,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
if (mode == 1) {
ZVAL_DOUBLE(ret, fnum);
} else {
- ZVAL_INT(ret, num);
+ ZVAL_LONG(ret, num);
}
return SUCCESS;
}
@@ -1038,15 +1055,15 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC)
{
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- char buf[(sizeof(php_uint_t) << 3) + 1];
+ char buf[(sizeof(zend_ulong) << 3) + 1];
char *ptr, *end;
- php_uint_t value;
+ zend_ulong value;
- if (Z_TYPE_P(arg) != IS_INT || base < 2 || base > 36) {
+ if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) {
return STR_EMPTY_ALLOC();
}
- value = Z_IVAL_P(arg);
+ value = Z_LVAL_P(arg);
end = ptr = buf + sizeof(buf) - 1;
*ptr = '\0';
@@ -1056,7 +1073,7 @@ PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC)
value /= base;
} while (ptr > buf && value);
- return STR_INIT(ptr, end - ptr, 0);
+ return zend_string_init(ptr, end - ptr, 0);
}
/* }}} */
@@ -1069,7 +1086,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
{
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- if ((Z_TYPE_P(arg) != IS_INT && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) {
+ if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) {
return STR_EMPTY_ALLOC();
}
@@ -1092,7 +1109,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
fvalue /= base;
} while (ptr > buf && fabs(fvalue) >= 1);
- return STR_INIT(ptr, end - ptr, 0);
+ return zend_string_init(ptr, end - ptr, 0);
}
return _php_math_longtobase(arg, base TSRMLS_CC);
@@ -1157,7 +1174,7 @@ PHP_FUNCTION(decbin)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
return;
}
- convert_to_int_ex(arg);
+ convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 2 TSRMLS_CC);
RETURN_STR(result);
}
@@ -1173,7 +1190,7 @@ PHP_FUNCTION(decoct)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
return;
}
- convert_to_int_ex(arg);
+ convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 8 TSRMLS_CC);
RETURN_STR(result);
}
@@ -1189,7 +1206,7 @@ PHP_FUNCTION(dechex)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
return;
}
- convert_to_int_ex(arg);
+ convert_to_long_ex(arg);
result = _php_math_longtobase(arg, 16 TSRMLS_CC);
RETURN_STR(result);
}
@@ -1200,10 +1217,10 @@ PHP_FUNCTION(dechex)
PHP_FUNCTION(base_convert)
{
zval *number, temp;
- php_int_t frombase, tobase;
+ zend_long frombase, tobase;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &number, &frombase, &tobase) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &number, &frombase, &tobase) == FAILURE) {
return;
}
convert_to_string_ex(number);
@@ -1292,7 +1309,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
if (is_negative) {
reslen++;
}
- res = STR_ALLOC(reslen, 0);
+ res = zend_string_alloc(reslen, 0);
s = tmpbuf->val + tmpbuf->len - 1;
t = res->val + reslen;
@@ -1341,7 +1358,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
}
res->len = reslen;
- STR_RELEASE(tmpbuf);
+ zend_string_release(tmpbuf);
return res;
}
@@ -1350,20 +1367,20 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin
PHP_FUNCTION(number_format)
{
double num;
- php_int_t dec = 0;
+ zend_long dec = 0;
char *thousand_sep = NULL, *dec_point = NULL;
char thousand_sep_chr = ',', dec_point_chr = '.';
- int thousand_sep_len = 0, dec_point_len = 0;
+ size_t thousand_sep_len = 0, dec_point_len = 0;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|is!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_DOUBLE(num)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(dec)
+ Z_PARAM_LONG(dec)
Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0)
Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0)
ZEND_PARSE_PARAMETERS_END();
@@ -1422,22 +1439,22 @@ PHP_FUNCTION(fmod)
Returns the integer division of the numerator by the divisor */
PHP_FUNCTION(intdiv)
{
- php_int_t numerator, divisor;
+ zend_long numerator, divisor;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &numerator, &divisor) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &numerator, &divisor) == FAILURE) {
return;
}
if (divisor == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
RETURN_BOOL(0);
- } else if (divisor == -1 && numerator == PHP_INT_MIN) {
+ } else if (divisor == -1 && numerator == ZEND_LONG_MIN) {
/* Prevent overflow error/crash
We don't return a float here as that violates function contract */
- RETURN_INT(0);
+ RETURN_LONG(0);
}
- RETURN_INT(numerator/divisor);
+ RETURN_LONG(numerator/divisor);
}
/* }}} */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 1a1b9d335b..e5359c2bcf 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -61,7 +61,7 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_MD5Update(&context, arg->val, arg->len);
PHP_MD5Final(digest, &context);
if (raw_output) {
- RETURN_STRINGL(digest, 16);
+ RETURN_STRINGL((char *) digest, 16);
} else {
make_digest_ex(md5str, digest, 16);
RETVAL_STRING(md5str);
@@ -75,13 +75,13 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_NAMED_FUNCTION(php_if_md5_file)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_bool raw_output = 0;
char md5str[33];
unsigned char buf[1024];
unsigned char digest[16];
PHP_MD5_CTX context;
- php_size_t n;
+ size_t n;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
@@ -99,16 +99,20 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
PHP_MD5Update(&context, buf, n);
}
- PHP_MD5Final(digest, &context);
-
- php_stream_close(stream);
+ /* XXX this probably can be improved with some number of retries */
+ if (!php_stream_eof(stream)) {
+ php_stream_close(stream);
+ PHP_MD5Final(digest, &context);
- if (n<0) {
RETURN_FALSE;
}
+ php_stream_close(stream);
+
+ PHP_MD5Final(digest, &context);
+
if (raw_output) {
- RETURN_STRINGL(digest, 16);
+ RETURN_STRINGL((char *) digest, 16);
} else {
make_digest_ex(md5str, digest, 16);
RETVAL_STRING(md5str);
@@ -384,5 +388,5 @@ PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx)
result[14] = ctx->d >> 16;
result[15] = ctx->d >> 24;
- memset(ctx, 0, sizeof(*ctx));
+ ZEND_SECURE_ZERO(ctx, sizeof(*ctx));
}
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
index 43f425e402..d62ade6b26 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
index 880f6c5103..5327869a50 100644
--- a/ext/standard/metaphone.c
+++ b/ext/standard/metaphone.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,7 +25,7 @@
#include "php.h"
#include "php_metaphone.h"
-static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional);
+static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional);
/* {{{ proto string metaphone(string text[, int phones])
Break english phrases down into their phonemes */
@@ -33,9 +33,9 @@ PHP_FUNCTION(metaphone)
{
zend_string *str;
zend_string *result = NULL;
- php_int_t phones = 0;
+ zend_long phones = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &phones) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &phones) == FAILURE) {
return;
}
@@ -43,7 +43,7 @@ PHP_FUNCTION(metaphone)
RETVAL_STR(result);
} else {
if (result) {
- STR_FREE(result);
+ zend_string_free(result);
}
RETURN_FALSE;
}
@@ -142,7 +142,7 @@ static char Lookahead(char *word, int how_far)
* could be one though; or more too). */
#define Phonize(c) { \
if (p_idx >= max_buffer_len) { \
- *phoned_word = STR_REALLOC(*phoned_word, 2 * sizeof(char) + max_buffer_len, 0); \
+ *phoned_word = zend_string_realloc(*phoned_word, 2 * sizeof(char) + max_buffer_len, 0); \
max_buffer_len += 2; \
} \
(*phoned_word)->val[p_idx++] = c; \
@@ -151,7 +151,7 @@ static char Lookahead(char *word, int how_far)
/* Slap a null character on the end of the phoned word */
#define End_Phoned_Word { \
if (p_idx == max_buffer_len) { \
- *phoned_word = STR_REALLOC(*phoned_word, 1 * sizeof(char) + max_buffer_len, 0); \
+ *phoned_word = zend_string_realloc(*phoned_word, 1 * sizeof(char) + max_buffer_len, 0); \
max_buffer_len += 1; \
} \
(*phoned_word)->val[p_idx] = '\0'; \
@@ -165,11 +165,11 @@ static char Lookahead(char *word, int how_far)
/* {{{ metaphone
*/
-static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional)
+static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional)
{
int w_idx = 0; /* point in the phonization we're at. */
int p_idx = 0; /* end of the phoned phrase */
- php_size_t max_buffer_len = 0; /* maximum length of the destination buffer */
+ size_t max_buffer_len = 0; /* maximum length of the destination buffer */
/*-- Parameter checks --*/
/* Negative phoneme length is meaningless */
@@ -187,10 +187,10 @@ static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_pho
/*-- Allocate memory for our phoned_phrase --*/
if (max_phonemes == 0) { /* Assume largest possible */
max_buffer_len = word_len;
- *phoned_word = STR_ALLOC(sizeof(char) * word_len + 1, 0);
+ *phoned_word = zend_string_alloc(sizeof(char) * word_len + 1, 0);
} else {
max_buffer_len = max_phonemes;
- *phoned_word = STR_ALLOC(sizeof(char) * max_phonemes + 1, 0);
+ *phoned_word = zend_string_alloc(sizeof(char) * max_phonemes + 1, 0);
}
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 58ecbdc881..811731ee20 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -73,11 +73,11 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode)
offset = timelib_get_time_zone_info(tp.tv_sec, get_timezone_info(TSRMLS_C));
array_init(return_value);
- add_assoc_int(return_value, "sec", tp.tv_sec);
- add_assoc_int(return_value, "usec", tp.tv_usec);
+ add_assoc_long(return_value, "sec", tp.tv_sec);
+ add_assoc_long(return_value, "usec", tp.tv_usec);
- add_assoc_int(return_value, "minuteswest", -offset->offset / SEC_IN_MIN);
- add_assoc_int(return_value, "dsttime", offset->is_dst);
+ add_assoc_long(return_value, "minuteswest", -offset->offset / SEC_IN_MIN);
+ add_assoc_long(return_value, "dsttime", offset->is_dst);
timelib_time_offset_dtor(offset);
} else {
@@ -111,10 +111,10 @@ PHP_FUNCTION(gettimeofday)
PHP_FUNCTION(getrusage)
{
struct rusage usg;
- php_int_t pwho = 0;
+ zend_long pwho = 0;
int who = RUSAGE_SELF;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &pwho) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &pwho) == FAILURE) {
return;
}
@@ -130,7 +130,7 @@ PHP_FUNCTION(getrusage)
array_init(return_value);
#define PHP_RUSAGE_PARA(a) \
- add_assoc_int(return_value, #a, usg.a)
+ add_assoc_long(return_value, #a, usg.a)
#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */
PHP_RUSAGE_PARA(ru_oublock);
PHP_RUSAGE_PARA(ru_inblock);
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
index 2af8a677c5..0a8b0dc666 100644
--- a/ext/standard/microtime.h
+++ b/ext/standard/microtime.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 613a58b5fd..07206c8b7b 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -55,7 +55,6 @@
#define INC_OUTPUTPOS(a,b) \
if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \
- efree(argv); \
efree(formatcodes); \
efree(formatargs); \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow in format string", code); \
@@ -82,15 +81,22 @@ static int machine_endian_long_map[4];
static int big_endian_long_map[4];
static int little_endian_long_map[4];
+#if SIZEOF_ZEND_LONG > 4
+/* Mappings of bytes from quads (64bit) for all endian environments */
+static int machine_endian_longlong_map[8];
+static int big_endian_longlong_map[8];
+static int little_endian_longlong_map[8];
+#endif
+
/* {{{ php_pack
*/
-static void php_pack(zval *val, php_size_t size, int *map, char *output)
+static void php_pack(zval *val, size_t size, int *map, char *output)
{
int i;
char *v;
- convert_to_int_ex(val);
- v = (char *) &Z_IVAL_P(val);
+ convert_to_long_ex(val);
+ v = (char *) &Z_LVAL_P(val);
for (i = 0; i < size; i++) {
*output++ = v[map[i]];
@@ -98,8 +104,8 @@ static void php_pack(zval *val, php_size_t size, int *map, char *output)
}
/* }}} */
-/* pack() idea stolen from Perl (implemented formats behave the same as there)
- * Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @.
+/* pack() idea stolen from Perl (implemented formats behave the same as there except J and P)
+ * Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, q, Q, J, P, f, d, x, X, @.
*/
/* {{{ proto string pack(string format, mixed arg1 [, mixed arg2 [, mixed ...]])
Takes one or more arguments and packs them into a binary string according to the format argument */
@@ -126,7 +132,7 @@ PHP_FUNCTION(pack)
convert_to_string_ex(&argv[0]);
format = Z_STRVAL(argv[0]);
- formatlen = Z_STRSIZE(argv[0]);
+ formatlen = Z_STRLEN(argv[0]);
/* We have a maximum of <formatlen> format codes to deal with */
formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0);
@@ -185,7 +191,7 @@ PHP_FUNCTION(pack)
SEPARATE_ZVAL(&argv[currentarg]);
}
convert_to_string_ex(&argv[currentarg]);
- arg = Z_STRSIZE(argv[currentarg]);
+ arg = Z_STRLEN(argv[currentarg]);
if (code == 'Z') {
/* add one because Z is always NUL-terminated:
* pack("Z*", "aa") === "aa\0"
@@ -198,6 +204,16 @@ PHP_FUNCTION(pack)
break;
/* Use as many args as specified */
+ case 'q':
+ case 'Q':
+ case 'J':
+ case 'P':
+#if SIZEOF_ZEND_LONG < 8
+ efree(formatcodes);
+ efree(formatargs);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "64-bit format codes are not available for 32-bit versions of PHP");
+ RETURN_FALSE;
+#endif
case 'c':
case 'C':
case 's':
@@ -280,6 +296,15 @@ PHP_FUNCTION(pack)
INC_OUTPUTPOS(arg,4) /* 32 bit per arg */
break;
+#if SIZEOF_ZEND_LONG > 4
+ case 'q':
+ case 'Q':
+ case 'J':
+ case 'P':
+ INC_OUTPUTPOS(arg,8) /* 32 bit per arg */
+ break;
+#endif
+
case 'f':
INC_OUTPUTPOS(arg,sizeof(float))
break;
@@ -329,7 +354,7 @@ PHP_FUNCTION(pack)
(str->len < arg_cp) ? str->len : arg_cp);
outputpos += arg;
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
@@ -372,7 +397,7 @@ PHP_FUNCTION(pack)
}
outputpos++;
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
@@ -430,6 +455,27 @@ PHP_FUNCTION(pack)
break;
}
+#if SIZEOF_ZEND_LONG > 4
+ case 'q':
+ case 'Q':
+ case 'J':
+ case 'P': {
+ int *map = machine_endian_longlong_map;
+
+ if (code == 'J') {
+ map = big_endian_longlong_map;
+ } else if (code == 'P') {
+ map = little_endian_longlong_map;
+ }
+
+ while (arg-- > 0) {
+ php_pack(&argv[currentarg++], 8, map, &output[outputpos]);
+ outputpos += 8;
+ }
+ break;
+ }
+#endif
+
case 'f': {
while (arg-- > 0) {
float v = (float) zval_get_double(&argv[currentarg++]);
@@ -480,9 +526,9 @@ PHP_FUNCTION(pack)
/* {{{ php_unpack
*/
-static php_int_t php_unpack(char *data, php_size_t size, int issigned, int *map)
+static zend_long php_unpack(char *data, size_t size, int issigned, int *map)
{
- php_int_t result;
+ zend_long result;
char *cresult = (char *) &result;
int i;
@@ -506,7 +552,7 @@ static php_int_t php_unpack(char *data, php_size_t size, int issigned, int *map)
* chars1, chars2, and ints.
* Numeric pack types will return numbers, a and A will return strings,
* f and d will return doubles.
- * Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, x, X, @.
+ * Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, q, Q, J, P, f, d, x, X, @.
*/
/* {{{ proto array unpack(string format, string input)
Unpack binary string into named array elements according to format argument */
@@ -514,7 +560,7 @@ PHP_FUNCTION(unpack)
{
char *format, *input;
zend_string *formatarg, *inputarg;
- php_size_t formatlen, inputpos, inputlen;
+ size_t formatlen, inputpos, inputlen;
int i;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg,
@@ -622,6 +668,20 @@ PHP_FUNCTION(unpack)
size = 4;
break;
+ /* Use 8 bytes of input */
+ case 'q':
+ case 'Q':
+ case 'J':
+ case 'P':
+#if SIZEOF_ZEND_LONG > 4
+ size = 8;
+ break;
+#else
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "64-bit format codes are not available for 32-bit versions of PHP");
+ zval_dtor(return_value);
+ RETURN_FALSE;
+#endif
+
/* Use sizeof(float) bytes of input */
case 'f':
size = sizeof(float);
@@ -661,7 +721,7 @@ PHP_FUNCTION(unpack)
switch ((int) type) {
case 'a': {
/* a will not strip any trailing whitespace or null padding */
- php_size_t len = inputlen - inputpos; /* Remaining string */
+ size_t len = inputlen - inputpos; /* Remaining string */
/* If size was given take minimum of len and size */
if ((size >= 0) && (len > size)) {
@@ -676,7 +736,7 @@ PHP_FUNCTION(unpack)
case 'A': {
/* A will strip any trailing whitespace */
char padn = '\0'; char pads = ' '; char padt = '\t'; char padc = '\r'; char padl = '\n';
- php_size_t len = inputlen - inputpos; /* Remaining string */
+ size_t len = inputlen - inputpos; /* Remaining string */
/* If size was given take minimum of len and size */
if ((size >= 0) && (len > size)) {
@@ -703,7 +763,7 @@ PHP_FUNCTION(unpack)
case 'Z': {
/* Z will strip everything after the first null character */
char pad = '\0';
- php_size_t s,
+ size_t s,
len = inputlen - inputpos; /* Remaining string */
/* If size was given take minimum of len and size */
@@ -727,11 +787,11 @@ PHP_FUNCTION(unpack)
case 'h':
case 'H': {
- php_size_t len = (inputlen - inputpos) * 2; /* Remaining */
+ size_t len = (inputlen - inputpos) * 2; /* Remaining */
int nibbleshift = (type == 'h') ? 0 : 4;
int first = 1;
char *buf;
- php_size_t ipos, opos;
+ size_t ipos, opos;
/* If size was given take minimum of len and size */
if (size >= 0 && len > (size * 2)) {
@@ -771,8 +831,8 @@ PHP_FUNCTION(unpack)
case 'c':
case 'C': {
int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0;
- php_int_t v = php_unpack(&input[inputpos], 1, issigned, byte_map);
- add_assoc_int(return_value, n, v);
+ zend_long v = php_unpack(&input[inputpos], 1, issigned, byte_map);
+ add_assoc_long(return_value, n, v);
break;
}
@@ -780,7 +840,7 @@ PHP_FUNCTION(unpack)
case 'S':
case 'n':
case 'v': {
- php_int_t v;
+ zend_long v;
int issigned = 0;
int *map = machine_endian_short_map;
@@ -793,13 +853,13 @@ PHP_FUNCTION(unpack)
}
v = php_unpack(&input[inputpos], 2, issigned, map);
- add_assoc_int(return_value, n, v);
+ add_assoc_long(return_value, n, v);
break;
}
case 'i':
case 'I': {
- php_int_t v;
+ zend_long v;
int issigned = 0;
if (type == 'i') {
@@ -807,7 +867,7 @@ PHP_FUNCTION(unpack)
}
v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
- add_assoc_int(return_value, n, v);
+ add_assoc_long(return_value, n, v);
break;
}
@@ -817,7 +877,7 @@ PHP_FUNCTION(unpack)
case 'V': {
int issigned = 0;
int *map = machine_endian_long_map;
- php_int_t v = 0;
+ zend_long v = 0;
if (type == 'l' || type == 'L') {
issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
@@ -829,21 +889,53 @@ PHP_FUNCTION(unpack)
map = little_endian_long_map;
}
- if (SIZEOF_ZEND_INT > 4 && issigned) {
+ if (SIZEOF_ZEND_LONG > 4 && issigned) {
v = ~INT_MAX;
}
v |= php_unpack(&input[inputpos], 4, issigned, map);
- if (SIZEOF_ZEND_INT > 4) {
+ if (SIZEOF_ZEND_LONG > 4) {
if (type == 'l') {
v = (signed int) v;
} else {
v = (unsigned int) v;
}
}
- add_assoc_int(return_value, n, v);
+ add_assoc_long(return_value, n, v);
+ break;
+ }
+
+#if SIZEOF_ZEND_LONG > 4
+ case 'q':
+ case 'Q':
+ case 'J':
+ case 'P': {
+ int issigned = 0;
+ int *map = machine_endian_longlong_map;
+ long v = 0;
+
+ if (type == 'q' || type == 'Q') {
+ issigned = input[inputpos + (machine_little_endian ? 7 : 0)] & 0x80;
+ } else if (type == 'J') {
+ issigned = input[inputpos] & 0x80;
+ map = big_endian_longlong_map;
+ } else if (type == 'P') {
+ issigned = input[inputpos + 7] & 0x80;
+ map = little_endian_longlong_map;
+ }
+
+ v = php_unpack(&input[inputpos], 8, issigned, map);
+
+ if (type == 'q') {
+ v = (signed long int) v;
+ } else {
+ v = (unsigned long int) v;
+ }
+
+ add_assoc_long(return_value, n, v);
break;
}
+#endif
case 'f': {
float v;
@@ -948,11 +1040,38 @@ PHP_MINIT_FUNCTION(pack)
little_endian_long_map[1] = 1;
little_endian_long_map[2] = 2;
little_endian_long_map[3] = 3;
+
+#if SIZEOF_ZEND_LONG > 4
+ machine_endian_longlong_map[0] = 0;
+ machine_endian_longlong_map[1] = 1;
+ machine_endian_longlong_map[2] = 2;
+ machine_endian_longlong_map[3] = 3;
+ machine_endian_longlong_map[4] = 4;
+ machine_endian_longlong_map[5] = 5;
+ machine_endian_longlong_map[6] = 6;
+ machine_endian_longlong_map[7] = 7;
+ big_endian_longlong_map[0] = 7;
+ big_endian_longlong_map[1] = 6;
+ big_endian_longlong_map[2] = 5;
+ big_endian_longlong_map[3] = 4;
+ big_endian_longlong_map[4] = 3;
+ big_endian_longlong_map[5] = 2;
+ big_endian_longlong_map[6] = 1;
+ big_endian_longlong_map[7] = 0;
+ little_endian_longlong_map[0] = 0;
+ little_endian_longlong_map[1] = 1;
+ little_endian_longlong_map[2] = 2;
+ little_endian_longlong_map[3] = 3;
+ little_endian_longlong_map[4] = 4;
+ little_endian_longlong_map[5] = 5;
+ little_endian_longlong_map[6] = 6;
+ little_endian_longlong_map[7] = 7;
+#endif
}
else {
zval val;
- int size = sizeof(Z_IVAL(val));
- Z_IVAL(val)=0; /*silence a warning*/
+ int size = sizeof(Z_LVAL(val));
+ Z_LVAL(val)=0; /*silence a warning*/
/* Where to get hi to lo bytes from */
byte_map[0] = size - 1;
@@ -980,6 +1099,33 @@ PHP_MINIT_FUNCTION(pack)
little_endian_long_map[1] = size - 2;
little_endian_long_map[2] = size - 3;
little_endian_long_map[3] = size - 4;
+
+#if SIZEOF_ZEND_LONG > 4
+ machine_endian_longlong_map[0] = size - 8;
+ machine_endian_longlong_map[1] = size - 7;
+ machine_endian_longlong_map[2] = size - 6;
+ machine_endian_longlong_map[3] = size - 5;
+ machine_endian_longlong_map[0] = size - 4;
+ machine_endian_longlong_map[1] = size - 3;
+ machine_endian_longlong_map[2] = size - 2;
+ machine_endian_longlong_map[3] = size - 1;
+ big_endian_longlong_map[0] = size - 8;
+ big_endian_longlong_map[1] = size - 7;
+ big_endian_longlong_map[2] = size - 6;
+ big_endian_longlong_map[3] = size - 5;
+ big_endian_longlong_map[0] = size - 4;
+ big_endian_longlong_map[1] = size - 3;
+ big_endian_longlong_map[2] = size - 2;
+ big_endian_longlong_map[3] = size - 1;
+ little_endian_longlong_map[0] = size - 1;
+ little_endian_longlong_map[1] = size - 2;
+ little_endian_longlong_map[2] = size - 3;
+ little_endian_longlong_map[3] = size - 4;
+ little_endian_longlong_map[0] = size - 5;
+ little_endian_longlong_map[1] = size - 6;
+ little_endian_longlong_map[2] = size - 7;
+ little_endian_longlong_map[3] = size - 8;
+#endif
}
return SUCCESS;
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
index 601cc202c2..dc4c7d6173 100644
--- a/ext/standard/pack.h
+++ b/ext/standard/pack.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index 7381100fab..8db9995d27 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -59,7 +59,7 @@
*/
PHPAPI void php_statpage(TSRMLS_D)
{
- php_stat_t *pstat;
+ zend_stat_t *pstat;
pstat = sapi_get_stat(TSRMLS_C);
@@ -79,14 +79,14 @@ PHPAPI void php_statpage(TSRMLS_D)
/* {{{ php_getuid
*/
-php_int_t php_getuid(TSRMLS_D)
+zend_long php_getuid(TSRMLS_D)
{
php_statpage(TSRMLS_C);
return (BG(page_uid));
}
/* }}} */
-php_int_t php_getgid(TSRMLS_D)
+zend_long php_getgid(TSRMLS_D)
{
php_statpage(TSRMLS_C);
return (BG(page_gid));
@@ -96,7 +96,7 @@ php_int_t php_getgid(TSRMLS_D)
Get PHP script owner's UID */
PHP_FUNCTION(getmyuid)
{
- php_int_t uid;
+ zend_long uid;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -106,7 +106,7 @@ PHP_FUNCTION(getmyuid)
if (uid < 0) {
RETURN_FALSE;
} else {
- RETURN_INT(uid);
+ RETURN_LONG(uid);
}
}
/* }}} */
@@ -115,7 +115,7 @@ PHP_FUNCTION(getmyuid)
Get PHP script owner's GID */
PHP_FUNCTION(getmygid)
{
- php_int_t gid;
+ zend_long gid;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -125,7 +125,7 @@ PHP_FUNCTION(getmygid)
if (gid < 0) {
RETURN_FALSE;
} else {
- RETURN_INT(gid);
+ RETURN_LONG(gid);
}
}
/* }}} */
@@ -134,7 +134,7 @@ PHP_FUNCTION(getmygid)
Get current process ID */
PHP_FUNCTION(getmypid)
{
- php_int_t pid;
+ zend_long pid;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -144,7 +144,7 @@ PHP_FUNCTION(getmypid)
if (pid < 0) {
RETURN_FALSE;
} else {
- RETURN_INT(pid);
+ RETURN_LONG(pid);
}
}
/* }}} */
@@ -161,7 +161,7 @@ PHP_FUNCTION(getmyinode)
if (BG(page_inode) < 0) {
RETURN_FALSE;
} else {
- RETURN_INT(BG(page_inode));
+ RETURN_LONG(BG(page_inode));
}
}
/* }}} */
@@ -176,7 +176,7 @@ PHPAPI time_t php_getlastmod(TSRMLS_D)
Get time of last page modification */
PHP_FUNCTION(getlastmod)
{
- php_int_t lm;
+ zend_long lm;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -186,7 +186,7 @@ PHP_FUNCTION(getlastmod)
if (lm < 0) {
RETURN_FALSE;
} else {
- RETURN_INT(lm);
+ RETURN_LONG(lm);
}
}
/* }}} */
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
index 1dbe6ce1e6..ec5823246a 100644
--- a/ext/standard/pageinfo.h
+++ b/ext/standard/pageinfo.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@ PHP_FUNCTION(getlastmod);
PHPAPI void php_statpage(TSRMLS_D);
PHPAPI time_t php_getlastmod(TSRMLS_D);
-extern php_int_t php_getuid(TSRMLS_D);
-extern php_int_t php_getgid(TSRMLS_D);
+extern zend_long php_getuid(TSRMLS_D);
+extern zend_long php_getgid(TSRMLS_D);
#endif
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 23e0ae4259..0f75272d0e 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,10 +37,10 @@
PHP_MINIT_FUNCTION(password) /* {{{ */
{
- REGISTER_INT_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -86,23 +86,23 @@ static int php_password_salt_to64(const char *str, const size_t str_len, const s
if ((int) str_len < 0) {
return FAILURE;
}
- buffer = php_base64_encode((unsigned char*) str, (int) str_len);
+ buffer = php_base64_encode((unsigned char*) str, str_len);
if (buffer->len < out_len) {
/* Too short of an encoded string generated */
- STR_RELEASE(buffer);
+ zend_string_release(buffer);
return FAILURE;
}
for (pos = 0; pos < out_len; pos++) {
if (buffer->val[pos] == '+') {
ret[pos] = '.';
} else if (buffer->val[pos] == '=') {
- STR_FREE(buffer);
+ zend_string_free(buffer);
return FAILURE;
} else {
ret[pos] = buffer->val[pos];
}
}
- STR_FREE(buffer);
+ zend_string_free(buffer);
return SUCCESS;
}
/* }}} */
@@ -163,7 +163,7 @@ static int php_password_make_salt(size_t length, char *ret TSRMLS_DC) /* {{{ */
efree(result);
return FAILURE;
}
- memcpy(ret, result, (int) length);
+ memcpy(ret, result, length);
efree(result);
efree(buffer);
ret[length] = 0;
@@ -174,7 +174,7 @@ static int php_password_make_salt(size_t length, char *ret TSRMLS_DC) /* {{{ */
PHP_FUNCTION(password_get_info)
{
php_password_algo algo;
- int hash_len;
+ size_t hash_len;
char *hash, *algo_name;
zval options;
@@ -182,11 +182,6 @@ PHP_FUNCTION(password_get_info)
return;
}
- if (hash_len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied password hash too long to safely identify");
- RETURN_FALSE;
- }
-
array_init(&options);
algo = php_password_determine_algo(hash, (size_t) hash_len);
@@ -195,9 +190,9 @@ PHP_FUNCTION(password_get_info)
switch (algo) {
case PHP_PASSWORD_BCRYPT:
{
- php_int_t cost = PHP_PASSWORD_BCRYPT_COST;
- sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost);
- add_assoc_int(&options, "cost", cost);
+ zend_long cost = PHP_PASSWORD_BCRYPT_COST;
+ sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost);
+ add_assoc_long(&options, "cost", cost);
}
break;
case PHP_PASSWORD_UNKNOWN:
@@ -207,29 +202,24 @@ PHP_FUNCTION(password_get_info)
array_init(return_value);
- add_assoc_int(return_value, "algo", algo);
+ add_assoc_long(return_value, "algo", algo);
add_assoc_string(return_value, "algoName", algo_name);
add_assoc_zval(return_value, "options", &options);
}
PHP_FUNCTION(password_needs_rehash)
{
- php_int_t new_algo = 0;
+ zend_long new_algo = 0;
php_password_algo algo;
- int hash_len;
+ size_t hash_len;
char *hash;
HashTable *options = 0;
zval *option_buffer;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) {
return;
}
- if (hash_len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied password hash too long to safely identify");
- RETURN_FALSE;
- }
-
algo = php_password_determine_algo(hash, (size_t) hash_len);
if (algo != new_algo) {
@@ -239,21 +229,21 @@ PHP_FUNCTION(password_needs_rehash)
switch (algo) {
case PHP_PASSWORD_BCRYPT:
{
- php_int_t new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
+ zend_long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
- if (Z_TYPE_P(option_buffer) != IS_INT) {
+ if (Z_TYPE_P(option_buffer) != IS_LONG) {
zval cast_option_buffer;
ZVAL_DUP(&cast_option_buffer, option_buffer);
- convert_to_int(&cast_option_buffer);
- new_cost = Z_IVAL(cast_option_buffer);
+ convert_to_long(&cast_option_buffer);
+ new_cost = Z_LVAL(cast_option_buffer);
zval_dtor(&cast_option_buffer);
} else {
- new_cost = Z_IVAL_P(option_buffer);
+ new_cost = Z_LVAL_P(option_buffer);
}
}
- sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost);
+ sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost);
if (cost != new_cost) {
RETURN_TRUE;
}
@@ -271,7 +261,7 @@ Verify a hash created using crypt() or password_hash() */
PHP_FUNCTION(password_verify)
{
int status = 0, i;
- int password_len, hash_len;
+ size_t password_len, hash_len;
char *password, *hash;
zend_string *ret;
@@ -283,7 +273,7 @@ PHP_FUNCTION(password_verify)
}
if (ret->len != hash_len || hash_len < 13) {
- STR_FREE(ret);
+ zend_string_free(ret);
RETURN_FALSE;
}
@@ -295,7 +285,7 @@ PHP_FUNCTION(password_verify)
status |= (ret->val[i] ^ hash[i]);
}
- STR_FREE(ret);
+ zend_string_free(ret);
RETURN_BOOL(status == 0);
@@ -307,48 +297,48 @@ Hash a password */
PHP_FUNCTION(password_hash)
{
char *hash_format, *hash, *salt, *password;
- php_int_t algo = 0;
- int password_len = 0, hash_len;
+ zend_long algo = 0;
+ size_t password_len = 0, hash_len;
size_t salt_len = 0, required_salt_len = 0, hash_format_len;
HashTable *options = 0;
zval *option_buffer;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &password, &password_len, &algo, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &password, &password_len, &algo, &options) == FAILURE) {
return;
}
switch (algo) {
case PHP_PASSWORD_BCRYPT:
{
- php_int_t cost = PHP_PASSWORD_BCRYPT_COST;
+ zend_long cost = PHP_PASSWORD_BCRYPT_COST;
if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) {
- if (Z_TYPE_P(option_buffer) != IS_INT) {
+ if (Z_TYPE_P(option_buffer) != IS_LONG) {
zval cast_option_buffer;
ZVAL_DUP(&cast_option_buffer, option_buffer);
- convert_to_int(&cast_option_buffer);
- cost = Z_IVAL(cast_option_buffer);
+ convert_to_long(&cast_option_buffer);
+ cost = Z_LVAL(cast_option_buffer);
zval_dtor(&cast_option_buffer);
} else {
- cost = Z_IVAL_P(option_buffer);
+ cost = Z_LVAL_P(option_buffer);
}
}
if (cost < 4 || cost > 31) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_INT_FMT, cost);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
RETURN_NULL();
}
required_salt_len = 22;
hash_format = emalloc(8);
- sprintf(hash_format, "$2y$%02ld$", cost);
+ sprintf(hash_format, "$2y$%02ld$", (long) cost);
hash_format_len = 7;
}
break;
case PHP_PASSWORD_UNKNOWN:
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_INT_FMT, algo);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_LONG_FMT, algo);
RETURN_NULL();
}
@@ -358,10 +348,10 @@ PHP_FUNCTION(password_hash)
size_t buffer_len;
switch (Z_TYPE_P(option_buffer)) {
case IS_STRING:
- buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRSIZE_P(option_buffer));
- buffer_len_int = Z_STRSIZE_P(option_buffer);
+ buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRLEN_P(option_buffer));
+ buffer_len_int = Z_STRLEN_P(option_buffer);
break;
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
case IS_OBJECT: {
zval cast_option_buffer;
@@ -369,8 +359,8 @@ PHP_FUNCTION(password_hash)
ZVAL_DUP(&cast_option_buffer, option_buffer);
convert_to_string(&cast_option_buffer);
if (Z_TYPE(cast_option_buffer) == IS_STRING) {
- buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer));
- buffer_len_int = Z_STRSIZE(cast_option_buffer);
+ buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer));
+ buffer_len_int = Z_STRLEN(cast_option_buffer);
zval_dtor(&cast_option_buffer);
break;
}
@@ -409,7 +399,7 @@ PHP_FUNCTION(password_hash)
salt_len = required_salt_len;
} else {
salt = safe_emalloc(required_salt_len, 1, 1);
- memcpy(salt, buffer, (int) required_salt_len);
+ memcpy(salt, buffer, required_salt_len);
salt_len = required_salt_len;
}
efree(buffer);
@@ -443,7 +433,7 @@ PHP_FUNCTION(password_hash)
efree(hash);
if (result->len < 13) {
- STR_FREE(result);
+ zend_string_free(result);
RETURN_FALSE;
}
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index 2154e603fa..d86121b277 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -107,7 +107,7 @@ PHPAPI HashTable* php_splice(HashTable *, int, int, zval *, int, HashTable *);
PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC);
PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC);
PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC);
-PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC);
+PHPAPI zend_long php_count_recursive(zval *array, zend_long mode TSRMLS_DC);
#define PHP_SORT_REGULAR 0
#define PHP_SORT_NUMERIC 1
diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h
index 04c85427c3..d8029b2f4f 100644
--- a/ext/standard/php_assert.h
+++ b/ext/standard/php_assert.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
index dbe1891af3..467809dbf5 100644
--- a/ext/standard/php_browscap.h
+++ b/ext/standard/php_browscap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
index a23811c320..c861187649 100644
--- a/ext/standard/php_crypt.h
+++ b/ext/standard/php_crypt.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 3098f247ef..dc4e27b112 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -206,7 +206,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
}
/* Don't leave anything around in vm they could use. */
- memset(final, 0, sizeof(final));
+ ZEND_SECURE_ZERO(final, sizeof(final));
/* Then something really weird... */
for (i = pwl; i != 0; i >>= 1) {
@@ -288,7 +288,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
*p = '\0';
- memset(final, 0, sizeof(final));
+ ZEND_SECURE_ZERO(final, sizeof(final));
_destroyCtx1:
diff --git a/ext/standard/php_crypt_r.h b/ext/standard/php_crypt_r.h
index 8b78d95d3d..da5744c9df 100644
--- a/ext/standard/php_crypt_r.h
+++ b/ext/standard/php_crypt_r.h
@@ -1,7 +1,7 @@
/* $Id$ */
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
index 2b9313aac4..c7999277da 100644
--- a/ext/standard/php_dir.h
+++ b/ext/standard/php_dir.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h
index 5823f5f20f..f37bce539a 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index e3fc582cd2..6e915bdf1d 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index 4f29553aea..e32c4a2cb9 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index bf4a62ff2b..575e8fff98 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -178,7 +178,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
int mode_rw = 0;
php_stream * stream = NULL;
char *p, *token, *pathdup;
- php_int_t max_memory;
+ zend_long max_memory;
FILE *file = NULL;
if (!strncasecmp(path, "php://", 6)) {
@@ -190,7 +190,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
max_memory = PHP_STREAM_MAX_MEM;
if (!strncasecmp(path, "/maxmemory:", 11)) {
path += 11;
- max_memory = ZEND_STRTOI(path, NULL, 10);
+ max_memory = ZEND_STRTOL(path, NULL, 10);
if (max_memory < 0) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Max memory must be >= 0");
return NULL;
@@ -286,7 +286,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
} else if (!strncasecmp(path, "fd/", 3)) {
const char *start;
char *end;
- php_int_t fildes_ori;
+ zend_long fildes_ori;
int dtablesize;
if (strcmp(sapi_module.name, "cli")) {
@@ -304,7 +304,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
}
start = &path[3];
- fildes_ori = ZEND_STRTOI(start, &end, 10);
+ fildes_ori = ZEND_STRTOL(start, &end, 10);
if (end == start || *end != '\0') {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
"php://fd/ stream must be specified in the form php://fd/<orig fd>");
@@ -326,7 +326,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
fd = dup(fildes_ori);
if (fd == -1) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
- "Error duping file descriptor " ZEND_INT_FMT "; possibly it doesn't exist: "
+ "Error duping file descriptor " ZEND_LONG_FMT "; possibly it doesn't exist: "
"[%d]: %s", fildes_ori, errno, strerror(errno));
return NULL;
}
@@ -380,9 +380,9 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
#if defined(S_IFSOCK) && !defined(WIN32) && !defined(__BEOS__)
do {
- php_stat_t st;
+ zend_stat_t st;
memset(&st, 0, sizeof(st));
- if (php_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
+ if (zend_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
stream = php_stream_sock_open_from_socket(fd, NULL);
if (stream) {
stream->ops = &php_stream_socket_ops;
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
index 341c7ad829..084efc291c 100644
--- a/ext/standard/php_fopen_wrappers.h
+++ b/ext/standard/php_fopen_wrappers.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h
index 7e702c942f..54666031fe 100644
--- a/ext/standard/php_ftok.h
+++ b/ext/standard/php_ftok.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h
index 54321b39a2..0979348314 100644
--- a/ext/standard/php_http.h
+++ b/ext/standard/php_http.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -22,7 +22,7 @@
#define PHP_HTTP_H
#include "php.h"
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
const char *num_prefix, int num_prefix_len,
diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h
index c8bb4ccc7a..3853b0e6c3 100644
--- a/ext/standard/php_image.h
+++ b/ext/standard/php_image.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index 804ca05206..177e960765 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,19 +28,18 @@
#define PHP_SET_CLASS_ATTRIBUTES(struc) \
/* OBJECTS_FIXME: Fix for new object model */ \
- if (Z_OBJ_HT_P(struc)->get_class_entry && \
- Z_OBJCE_P(struc) == BG(incomplete_class)) { \
+ if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
class_name = php_lookup_class_name(struc); \
if (!class_name) { \
- class_name = STR_INIT(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
+ class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
} \
incomplete_class = 1; \
} else { \
- class_name = zend_get_object_classname(Z_OBJ_P(struc) TSRMLS_CC); \
+ class_name = zend_string_copy(Z_OBJCE_P(struc)->name); \
}
#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
- STR_RELEASE(class_name)
+ zend_string_release(class_name)
#define PHP_CLASS_ATTRIBUTES \
zend_string *class_name; \
@@ -55,7 +54,7 @@ extern "C" {
PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D);
PHPAPI zend_string *php_lookup_class_name(zval *object);
-PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len);
+PHPAPI void php_store_class_name(zval *object, const char *name, uint32_t len);
#ifdef __cplusplus
};
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
index a076aea343..af0269ce78 100644
--- a/ext/standard/php_iptc.h
+++ b/ext/standard/php_iptc.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index 82141e6af2..dcc82e9511 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
index 1ca4acee25..2633a33ae4 100644
--- a/ext/standard/php_link.h
+++ b/ext/standard/php_link.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
index 925f58ebd5..f7ee5e983a 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index f8be7da42c..7fb6909e7f 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,7 +25,7 @@
PHPAPI zend_string *_php_math_number_format(double, int, char, char);
PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t);
PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC);
-PHPAPI php_int_t _php_math_basetolong(zval *arg, int base);
+PHPAPI zend_long _php_math_basetolong(zval *arg, int base);
PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC);
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
index 14da9d8191..100b1a8bc2 100644
--- a/ext/standard/php_metaphone.h
+++ b/ext/standard/php_metaphone.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_password.h b/ext/standard/php_password.h
index a38af97626..66adc07934 100644
--- a/ext/standard/php_password.h
+++ b/ext/standard/php_password.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
index dd41c57d88..bbdf16d385 100644
--- a/ext/standard/php_rand.h
+++ b/ext/standard/php_rand.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -42,19 +42,19 @@
#endif
#define RAND_RANGE(__n, __min, __max, __tmax) \
- (__n) = (__min) + (php_int_t) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
+ (__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
/* MT Rand */
-#define PHP_MT_RAND_MAX ((php_int_t) (0x7FFFFFFF)) /* (1<<31) - 1 */
+#define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
#ifdef PHP_WIN32
-#define GENERATE_SEED() (((php_int_t) (time(0) * GetCurrentProcessId())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C))))
+#define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
#else
-#define GENERATE_SEED() (((php_int_t) (time(0) * getpid())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C))))
+#define GENERATE_SEED() (((zend_long) (time(0) * getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
#endif
-PHPAPI void php_srand(php_int_t seed TSRMLS_DC);
-PHPAPI php_int_t php_rand(TSRMLS_D);
+PHPAPI void php_srand(zend_long seed TSRMLS_DC);
+PHPAPI zend_long php_rand(TSRMLS_D);
PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC);
PHPAPI php_uint32 php_mt_rand(TSRMLS_D);
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
deleted file mode 100644
index f4913f7b99..0000000000
--- a/ext/standard/php_smart_str.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_SMART_STR_H
-#define PHP_SMART_STR_H
-
-#include "php_smart_str_public.h"
-
-#include <stdlib.h>
-#ifndef SMART_STR_USE_REALLOC
-#include <zend.h>
-#endif
-
-#define smart_str_0(x) do { \
- if ((x)->s) { \
- (x)->s->val[(x)->s->len] = '\0'; \
- } \
-} while (0)
-
-#ifndef SMART_STR_PREALLOC
-#define SMART_STR_PREALLOC 128
-#endif
-
-#ifndef SMART_STR_START_SIZE
-#define SMART_STR_START_SIZE 78
-#endif
-
-
-#ifdef SMART_STR_USE_REALLOC
-#define SMART_STR_DO_REALLOC(b, w) do { \
- int oldlen = (b)->s->len; \
- (b)->s = erealloc((buf)->s, _STR_HEADER_SIZE + (b)->a + 1); \
- (b)->s->len = oldlen; \
-} while (0)
-#else
-#define SMART_STR_DO_REALLOC(b, w) do { \
- (b)->s = perealloc((b)->s, _STR_HEADER_SIZE + (b)->a + 1, (w)); \
-} while (0)
-#endif
-
-
-#define smart_str_alloc4(d, n, what, newlen) do { \
- if (!(d)->s) { \
- newlen = (n); \
- (d)->a = newlen < SMART_STR_START_SIZE \
- ? SMART_STR_START_SIZE \
- : newlen + SMART_STR_PREALLOC; \
- (d)->s = STR_ALLOC((d)->a, (what)); \
- (d)->s->len = 0; \
- } else { \
- newlen = (d)->s->len + (n); \
- if (newlen >= (d)->a) { \
- (d)->a = newlen + SMART_STR_PREALLOC; \
- SMART_STR_DO_REALLOC((d), (what)); \
- } \
- } \
-} while (0)
-
-#define smart_str_alloc(d, n, what) \
- smart_str_alloc4((d), (n), (what), newlen)
-
-/* wrapper */
-
-#define smart_str_appends_ex(dest, src, what) \
- smart_str_appendl_ex((dest), (src), strlen(src), (what))
-#define smart_str_appends(dest, src) \
- smart_str_appendl((dest), (src), strlen(src))
-
-#define smart_str_appendc(dest, c) \
- smart_str_appendc_ex((dest), (c), 0)
-#define smart_str_free(s) \
- smart_str_free_ex((s), 0)
-#define smart_str_appendl(dest, src, len) \
- smart_str_appendl_ex((dest), (src), (len), 0)
-#define smart_str_append(dest, src) \
- smart_str_append_ex((dest), (src), 0)
-#define smart_str_append_int(dest, val) \
- smart_str_append_int_ex((dest), (val), 0)
-#define smart_str_append_off_t(dest, val) \
- smart_str_append_off_t_ex((dest), (val), 0)
-#define smart_str_append_unsigned(dest, val) \
- smart_str_append_unsigned_ex((dest), (val), 0)
-
-#define smart_str_appendc_ex(dest, ch, what) do { \
- register size_t __nl; \
- smart_str_alloc4((dest), 1, (what), __nl); \
- (dest)->s->len = __nl; \
- ((unsigned char *) (dest)->s->val)[(dest)->s->len - 1] = (ch); \
-} while (0)
-
-#define smart_str_free_ex(buf, what) do { \
- smart_str *__s = (smart_str *) (buf); \
- if (__s->s) { \
- STR_RELEASE(__s->s); \
- __s->s = NULL; \
- } \
- __s->a = 0; \
-} while (0)
-
-#define smart_str_appendl_ex(dest, src, nlen, what) do { \
- register size_t __nl; \
- smart_str *__dest = (smart_str *) (dest); \
- \
- smart_str_alloc4(__dest, (nlen), (what), __nl); \
- memcpy(__dest->s->val + __dest->s->len, (src), (nlen)); \
- __dest->s->len = __nl; \
-} while (0)
-
-/*
- * these could be replaced using a braced-group inside an expression
- * for GCC compatible compilers, e.g.
- *
- * #define f(..) ({char *r;..;__r;})
- */
-
-static inline char *smart_str_print_long(char *buf, zend_int_t num) {
- char *r;
- _zend_print_signed_to_buf(buf, num, zend_int_t, r);
- return r;
-}
-
-static inline char *smart_str_print_unsigned(char *buf, zend_int_t num) {
- char *r;
- _zend_print_unsigned_to_buf(buf, num, zend_uint_t, r);
- return r;
-}
-
-#define smart_str_append_generic_ex(dest, num, type, vartype, func) do { \
- char __b[32]; \
- char *__t; \
- _zend_print##func##_to_buf (__b + sizeof(__b) - 1, (num), vartype, __t); \
- smart_str_appendl_ex((dest), __t, __b + sizeof(__b) - 1 - __t, (type)); \
-} while (0)
-
-#define smart_str_append_unsigned_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _unsigned)
-
-#define smart_str_append_int_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _signed)
-
-#define smart_str_append_off_t_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), zend_off_t, _signed)
-
-#define smart_str_append_ex(dest, src, what) \
- smart_str_appendl_ex((dest), ((smart_str *)(src))->s->val, \
- ((smart_str *)(src))->s->len, (what));
-
-#define smart_str_setl(dest, src, nlen) do { \
- smart_str_free((dest)); \
- smart_str_appendl_ex((dest), (src), (nlen), 0); \
-} while (0)
-
-#define smart_str_sets(dest, src) \
- smart_str_setl((dest), (src), strlen(src));
-
-#endif
diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h
index 83d59054dd..e052574a34 100644
--- a/ext/standard/php_smart_string.h
+++ b/ext/standard/php_smart_string.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -89,8 +89,6 @@
smart_string_append_ex((dest), (src), 0)
#define smart_string_append_long(dest, val) \
smart_string_append_long_ex((dest), (val), 0)
-#define smart_string_append_off_t(dest, val) \
- smart_string_append_off_t_ex((dest), (val), 0)
#define smart_string_append_unsigned(dest, val) \
smart_string_append_unsigned_ex((dest), (val), 0)
@@ -119,33 +117,17 @@
__dest->len = __nl; \
} while (0)
-static inline char *smart_string_print_long(char *buf, php_int_t num) {
- char *r;
- _zend_print_signed_to_buf(buf, num, unsigned long, r);
- return r;
-}
-
-static inline char *smart_string_print_unsigned(char *buf, php_int_t num) {
- char *r;
- _zend_print_unsigned_to_buf(buf, num, unsigned long, r);
- return r;
-}
-
#define smart_string_append_generic_ex(dest, num, type, vartype, func) do { \
char __b[32]; \
- char *__t; \
- _zend_print##func##_to_buf(__b + sizeof(__b) - 1, (num), vartype, __t); \
+ char *__t = zend_print##func##_to_buf(__b + sizeof(__b) - 1, (num)); \
smart_string_appendl_ex((dest), __t, __b + sizeof(__b) - 1 - __t, (type)); \
} while (0)
#define smart_string_append_unsigned_ex(dest, num, type) \
- smart_string_append_generic_ex((dest), (num), (type), unsigned long, _unsigned)
+ smart_string_append_generic_ex((dest), (num), (type), zend_ulong, _ulong)
#define smart_string_append_long_ex(dest, num, type) \
- smart_string_append_generic_ex((dest), (num), (type), unsigned long, _signed)
-
-#define smart_string_append_off_t_ex(dest, num, type) \
- smart_string_append_generic_ex((dest), (num), (type), off_t, _signed)
+ smart_string_append_generic_ex((dest), (num), (type), zend_ulong, _long)
#define smart_string_append_ex(dest, src, what) \
smart_string_appendl_ex((dest), ((smart_string *)(src))->c, \
diff --git a/ext/standard/php_smart_string_public.h b/ext/standard/php_smart_string_public.h
index 215f182224..d4cd1180a4 100644
--- a/ext/standard/php_smart_string_public.h
+++ b/ext/standard/php_smart_string_public.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h
index d7476cb397..5f1716d849 100644
--- a/ext/standard/php_standard.h
+++ b/ext/standard/php_standard.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 325467d534..0b655bfbdf 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -120,25 +120,25 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out);
PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len);
-PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen);
-PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC);
-PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int freeit, char *what, php_size_t wlength TSRMLS_DC);
-PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC);
-PHPAPI void php_stripcslashes(char *str, php_size_t *len);
+PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen);
+PHPAPI zend_string *php_addslashes(char *str, size_t length, int should_free TSRMLS_DC);
+PHPAPI zend_string *php_addcslashes(const char *str, size_t length, int freeit, char *what, size_t wlength TSRMLS_DC);
+PHPAPI void php_stripslashes(char *str, size_t *len TSRMLS_DC);
+PHPAPI void php_stripcslashes(char *str, size_t *len);
PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t sufflen TSRMLS_DC);
PHPAPI size_t php_dirname(char *str, size_t len);
PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len);
-PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, char *needle,
- php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count);
-PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle,
- php_size_t needle_len, char *str, php_size_t str_len);
-PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC);
-PHPAPI size_t php_strip_tags(char *rbuf, php_size_t len, int *state, char *allow, php_size_t allow_len);
-PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces);
-PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count);
-PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result);
-PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC);
-PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit);
+PHPAPI zend_string *php_str_to_str_ex(char *haystack, size_t length, char *needle,
+ size_t needle_len, char *str, size_t str_len, int case_sensitivity, size_t *replace_count);
+PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle,
+ size_t needle_len, char *str, size_t str_len);
+PHPAPI char *php_trim(char *c, size_t len, char *what, size_t what_len, zval *return_value, int mode TSRMLS_DC);
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *state, char *allow, size_t allow_len);
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len, zend_bool allow_tag_spaces);
+PHPAPI size_t php_char_to_str_ex(char *str, size_t len, char from, char *to, size_t to_len, zval *result, int case_sensitivity, size_t *replace_count);
+PHPAPI size_t php_char_to_str(char *str, size_t len, char from, char *to, size_t to_len, zval *result);
+PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value TSRMLS_DC);
+PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit);
PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
@@ -154,12 +154,13 @@ PHPAPI char *php_strerror(int errnum);
#ifndef HAVE_MBLEN
# define php_mblen(ptr, len) 1
+# define php_mb_reset()
+#elif defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
+# define php_mblen(ptr, len) ((int) mbrlen(ptr, len, &BG(mblen_state)))
+# define php_mb_reset() memset(&BG(mblen_state), 0, sizeof(BG(mblen_state)))
#else
-# if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
-# define php_mblen(ptr, len) ((ptr) == NULL ? memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))): (int)mbrlen(ptr, len, &BG(mblen_state)))
-# else
-# define php_mblen(ptr, len) mblen(ptr, len)
-# endif
+# define php_mblen(ptr, len) mblen(ptr, len)
+# define php_mb_reset() mblen(NULL, 0)
#endif
void register_string_constants(INIT_FUNC_ARGS);
diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h
index 8b71f87e5e..e6d8152b1b 100644
--- a/ext/standard/php_type.h
+++ b/ext/standard/php_type.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h
index 670fa3f63e..0c8ceb72a3 100644
--- a/ext/standard/php_uuencode.h
+++ b/ext/standard/php_uuencode.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -24,8 +24,8 @@
PHP_FUNCTION(convert_uudecode);
PHP_FUNCTION(convert_uuencode);
-PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len);
-PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len);
+PHPAPI zend_string *php_uudecode(char *src, size_t src_len);
+PHPAPI zend_string *php_uuencode(char *src, size_t src_len);
#endif /* PHP_UUENCODE_H */
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 2dc13f4012..23225cdc42 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -22,7 +22,7 @@
#define PHP_VAR_H
#include "ext/standard/basic_functions.h"
-#include "ext/standard/php_smart_str_public.h"
+#include "zend_smart_str_public.h"
PHP_FUNCTION(var_dump);
PHP_FUNCTION(var_export);
@@ -38,7 +38,10 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC);
PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC);
-typedef HashTable* php_serialize_data_t;
+struct php_serialize_data {
+ HashTable ht;
+ uint32_t n;
+};
struct php_unserialize_data {
void *first;
@@ -47,71 +50,67 @@ struct php_unserialize_data {
void *last_dtor;
};
-typedef struct php_unserialize_data* php_unserialize_data_t;
+typedef struct php_serialize_data *php_serialize_data_t;
+typedef struct php_unserialize_data *php_unserialize_data_t;
-PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *var_hash TSRMLS_DC);
+PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *data TSRMLS_DC);
PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC);
PHPAPI int php_var_unserialize_ref(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC);
PHPAPI int php_var_unserialize_intern(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC);
-#define PHP_VAR_SERIALIZE_INIT(var_hash_ptr) \
+#define PHP_VAR_SERIALIZE_INIT(d) \
do { \
/* fprintf(stderr, "SERIALIZE_INIT == lock: %u, level: %u\n", BG(serialize_lock), BG(serialize).level); */ \
if (BG(serialize_lock) || !BG(serialize).level) { \
- ALLOC_HASHTABLE(var_hash_ptr); \
- zend_hash_init((var_hash_ptr), 16, NULL, NULL, 0); \
+ (d) = (php_serialize_data_t) emalloc(sizeof(struct php_serialize_data)); \
+ zend_hash_init(&(d)->ht, 16, NULL, ZVAL_PTR_DTOR, 0); \
+ (d)->n = 0; \
if (!BG(serialize_lock)) { \
- BG(serialize).var_hash = (void *)(var_hash_ptr); \
+ BG(serialize).data = d; \
BG(serialize).level = 1; \
} \
} else { \
- (var_hash_ptr) = (php_serialize_data_t)BG(serialize).var_hash; \
+ (d) = BG(serialize).data; \
++BG(serialize).level; \
} \
} while(0)
-#define PHP_VAR_SERIALIZE_DESTROY(var_hash_ptr) \
+#define PHP_VAR_SERIALIZE_DESTROY(d) \
do { \
/* fprintf(stderr, "SERIALIZE_DESTROY == lock: %u, level: %u\n", BG(serialize_lock), BG(serialize).level); */ \
- if (BG(serialize_lock) || !BG(serialize).level) { \
- zend_hash_destroy((var_hash_ptr)); \
- FREE_HASHTABLE(var_hash_ptr); \
- } else { \
- if (!--BG(serialize).level) { \
- zend_hash_destroy((php_serialize_data_t)BG(serialize).var_hash); \
- FREE_HASHTABLE((php_serialize_data_t)BG(serialize).var_hash); \
- BG(serialize).var_hash = NULL; \
- } \
+ if (BG(serialize_lock) || BG(serialize).level == 1) { \
+ zend_hash_destroy(&(d)->ht); \
+ efree((d)); \
+ } \
+ if (!BG(serialize_lock) && !--BG(serialize).level) { \
+ BG(serialize).data = NULL; \
} \
} while (0)
-#define PHP_VAR_UNSERIALIZE_INIT(var_hash_ptr) \
+#define PHP_VAR_UNSERIALIZE_INIT(d) \
do { \
/* fprintf(stderr, "UNSERIALIZE_INIT == lock: %u, level: %u\n", BG(serialize_lock), BG(unserialize).level); */ \
if (BG(serialize_lock) || !BG(unserialize).level) { \
- (var_hash_ptr) = (php_unserialize_data_t)ecalloc(1, sizeof(struct php_unserialize_data)); \
+ (d) = (php_unserialize_data_t)ecalloc(1, sizeof(struct php_unserialize_data)); \
if (!BG(serialize_lock)) { \
- BG(unserialize).var_hash = (void *)(var_hash_ptr); \
+ BG(unserialize).data = (d); \
BG(unserialize).level = 1; \
} \
} else { \
- (var_hash_ptr) = (php_unserialize_data_t)BG(unserialize).var_hash; \
+ (d) = BG(unserialize).data; \
++BG(unserialize).level; \
} \
} while (0)
-#define PHP_VAR_UNSERIALIZE_DESTROY(var_hash_ptr) \
+#define PHP_VAR_UNSERIALIZE_DESTROY(d) \
do { \
/* fprintf(stderr, "UNSERIALIZE_DESTROY == lock: %u, level: %u\n", BG(serialize_lock), BG(unserialize).level); */ \
- if (BG(serialize_lock) || !BG(unserialize).level) { \
- var_destroy(&(var_hash_ptr)); \
- efree(var_hash_ptr); \
- } else { \
- if (!--BG(unserialize).level) { \
- var_destroy(&(var_hash_ptr)); \
- efree((var_hash_ptr)); \
- BG(unserialize).var_hash = NULL; \
- } \
+ if (BG(serialize_lock) || BG(unserialize).level == 1) { \
+ var_destroy(&(d)); \
+ efree((d)); \
+ } \
+ if (!BG(serialize_lock) && !--BG(unserialize).level) { \
+ BG(unserialize).data = NULL; \
} \
} while (0)
@@ -120,50 +119,4 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hash, zval *val);
PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rval);
PHPAPI void var_destroy(php_unserialize_data_t *var_hash);
-PHPAPI zend_class_entry *php_create_empty_class(char *class_name, int len);
-
-static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */
-{
- if (name_len == sizeof("GLOBALS") - 1 && !memcmp(name, "GLOBALS", sizeof("GLOBALS") - 1)) {
- if (!silent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite");
- }
- return FAILURE;
- } else if (name[0] == '_' &&
- (
- (name_len == sizeof("_GET") - 1 && !memcmp(name, "_GET", sizeof("_GET") - 1)) ||
- (name_len == sizeof("_POST") - 1 && !memcmp(name, "_POST", sizeof("_POST") - 1)) ||
- (name_len == sizeof("_COOKIE") - 1 && !memcmp(name, "_COOKIE", sizeof("_COOKIE") - 1)) ||
- (name_len == sizeof("_ENV") - 1 && !memcmp(name, "_ENV", sizeof("_ENV") - 1)) ||
- (name_len == sizeof("_SERVER") - 1 && !memcmp(name, "_SERVER", sizeof("_SERVER") - 1)) ||
- (name_len == sizeof("_SESSION") - 1 && !memcmp(name, "_SESSION", sizeof("_SESSION") - 1)) ||
- (name_len == sizeof("_FILES") - 1 && !memcmp(name, "_FILES", sizeof("_FILES") - 1)) ||
- (name_len == sizeof("_REQUEST") -1 && !memcmp(name, "_REQUEST", sizeof("_REQUEST") - 1))
- )
- ) {
- if (!silent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted super-global (%s) variable overwrite", name);
- }
- return FAILURE;
- } else if (name[0] == 'H' &&
- (
- (name_len == sizeof("HTTP_POST_VARS") - 1 && !memcmp(name, "HTTP_POST_VARS", sizeof("HTTP_POST_VARS") - 1)) ||
- (name_len == sizeof("HTTP_GET_VARS") - 1 && !memcmp(name, "HTTP_GET_VARS", sizeof("HTTP_GET_VARS") - 1)) ||
- (name_len == sizeof("HTTP_COOKIE_VARS") - 1 && !memcmp(name, "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS") - 1)) ||
- (name_len == sizeof("HTTP_ENV_VARS") - 1 && !memcmp(name, "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS") - 1)) ||
- (name_len == sizeof("HTTP_SERVER_VARS") - 1 && !memcmp(name, "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS") - 1)) ||
- (name_len == sizeof("HTTP_SESSION_VARS") - 1 && !memcmp(name, "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS") - 1)) ||
- (name_len == sizeof("HTTP_RAW_POST_DATA") - 1 && !memcmp(name, "HTTP_RAW_POST_DATA", sizeof("HTTP_RAW_POST_DATA") - 1)) ||
- (name_len == sizeof("HTTP_POST_FILES") - 1 && !memcmp(name, "HTTP_POST_FILES", sizeof("HTTP_POST_FILES") - 1))
- )
- ) {
- if (!silent) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted long input array (%s) overwrite", name);
- }
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
#endif /* PHP_VAR_H */
diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
index b3ea4f8f4d..3e34b8f8be 100644
--- a/ext/standard/php_versioning.h
+++ b/ext/standard/php_versioning.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 903b3a7be1..66c0c2e7e3 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -110,7 +110,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) {
zend_string *str = zval_get_string(element);
uint el_len = str->len;
- STR_RELEASE(str);
+ zend_string_release(str);
if (el_len == 0) {
continue;
@@ -162,7 +162,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
p += str->len + 1;
}
next_element:
- STR_RELEASE(str);
+ zend_string_release(str);
} ZEND_HASH_FOREACH_END();
assert((uint)(p - env.envp) <= sizeenv);
@@ -260,9 +260,9 @@ PHP_FUNCTION(proc_terminate)
{
zval *zproc;
struct php_process_handle *proc;
- php_int_t sig_no = SIGTERM;
+ zend_long sig_no = SIGTERM;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zproc, &sig_no) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) {
RETURN_FALSE;
}
@@ -300,7 +300,7 @@ PHP_FUNCTION(proc_close)
FG(pclose_wait) = 1;
zend_list_close(Z_RES_P(zproc));
FG(pclose_wait) = 0;
- RETURN_INT(FG(pclose_ret));
+ RETURN_LONG(FG(pclose_ret));
}
/* }}} */
@@ -328,7 +328,7 @@ PHP_FUNCTION(proc_get_status)
array_init(return_value);
add_assoc_string(return_value, "command", proc->command);
- add_assoc_int(return_value, "pid", (php_int_t) proc->child);
+ add_assoc_long(return_value, "pid", (zend_long) proc->child);
#ifdef PHP_WIN32
@@ -368,9 +368,9 @@ PHP_FUNCTION(proc_get_status)
add_assoc_bool(return_value, "running", running);
add_assoc_bool(return_value, "signaled", signaled);
add_assoc_bool(return_value, "stopped", stopped);
- add_assoc_int(return_value, "exitcode", exitcode);
- add_assoc_int(return_value, "termsig", termsig);
- add_assoc_int(return_value, "stopsig", stopsig);
+ add_assoc_long(return_value, "exitcode", exitcode);
+ add_assoc_long(return_value, "termsig", termsig);
+ add_assoc_long(return_value, "stopsig", stopsig);
}
/* }}} */
@@ -417,7 +417,7 @@ struct php_proc_open_descriptor_item {
PHP_FUNCTION(proc_open)
{
char *command, *cwd=NULL;
- int command_len, cwd_len = 0;
+ size_t command_len, cwd_len = 0;
zval *descriptorspec;
zval *pipes;
zval *environment = NULL;
@@ -427,7 +427,7 @@ PHP_FUNCTION(proc_open)
int i;
zval *descitem = NULL;
zend_string *str_index;
- php_uint_t nindex;
+ zend_ulong nindex;
struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS];
#ifdef PHP_WIN32
PROCESS_INFORMATION pi;
@@ -471,14 +471,14 @@ PHP_FUNCTION(proc_open)
if (other_options) {
zval *item = zend_hash_str_find(Z_ARRVAL_P(other_options), "suppress_errors", sizeof("suppress_errors") - 1);
if (item != NULL) {
- if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) {
+ if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
suppress_errors = 1;
}
}
item = zend_hash_str_find(Z_ARRVAL_P(other_options), "bypass_shell", sizeof("bypass_shell") - 1);
if (item != NULL) {
- if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) {
+ if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
bypass_shell = 1;
}
}
@@ -534,7 +534,7 @@ PHP_FUNCTION(proc_open)
#else
descriptors[ndesc].childend = dup(fd);
if (descriptors[ndesc].childend < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %ld - %s", nindex, strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to dup File-Handle for descriptor %pd - %s", nindex, strerror(errno));
goto exit_fail;
}
#endif
@@ -584,7 +584,7 @@ PHP_FUNCTION(proc_open)
#endif
descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY;
#ifdef PHP_WIN32
- if (Z_STRSIZE_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b')
+ if (Z_STRLEN_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b')
descriptors[ndesc].mode_flags |= O_BINARY;
#endif
diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h
index 8545f201f2..955cca2e3d 100644
--- a/ext/standard/proc_open.h
+++ b/ext/standard/proc_open.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 1d13d56678..c7eddc576b 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -96,7 +96,7 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt
i--;
}
- retval = STR_ALLOC(buf_size, 0);
+ retval = zend_string_alloc(buf_size, 0);
i = length; p1 = str; p2 = (unsigned char*)retval->val;
decoded_len = 0;
@@ -147,12 +147,12 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt
PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t length) /* {{{ */
{
- php_uint_t lp = 0;
+ zend_ulong lp = 0;
unsigned char c, *d;
char *hex = "0123456789ABCDEF";
zend_string *ret;
- ret = STR_SAFE_ALLOC(3, (length + (((3 * length)/(PHP_QPRINT_MAXL-9)) + 1)), 0, 0);
+ ret = zend_string_safe_alloc(3, (length + (((3 * length)/(PHP_QPRINT_MAXL-9)) + 1)), 0, 0);
d = (unsigned char*)ret->val;
while (length--) {
@@ -187,7 +187,7 @@ PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t lengt
}
}
*d = '\0';
- ret = STR_REALLOC(ret, d - (unsigned char*)ret->val, 0);
+ ret = zend_string_realloc(ret, d - (unsigned char*)ret->val, 0);
return ret;
}
/* }}} */
@@ -204,7 +204,7 @@ PHP_FUNCTION(quoted_printable_decode)
zend_string *arg1;
char *str_in;
zend_string *str_out;
- php_size_t i = 0, j = 0, k;
+ size_t i = 0, j = 0, k;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg1) == FAILURE) {
return;
@@ -216,7 +216,7 @@ PHP_FUNCTION(quoted_printable_decode)
}
str_in = arg1->val;
- str_out = STR_ALLOC(arg1->len, 0);
+ str_out = zend_string_alloc(arg1->len, 0);
while (str_in[i]) {
switch (str_in[i]) {
case '=':
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
index 7055d05717..99d3db8451 100644
--- a/ext/standard/quot_print.h
+++ b/ext/standard/quot_print.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 972f015948..55388e3c13 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,7 +38,7 @@
/* {{{ php_srand
*/
-PHPAPI void php_srand(php_int_t seed TSRMLS_DC)
+PHPAPI void php_srand(zend_long seed TSRMLS_DC)
{
#ifdef ZTS
BG(rand_seed) = (unsigned int) seed;
@@ -59,9 +59,9 @@ PHPAPI void php_srand(php_int_t seed TSRMLS_DC)
/* {{{ php_rand
*/
-PHPAPI php_int_t php_rand(TSRMLS_D)
+PHPAPI zend_long php_rand(TSRMLS_D)
{
- php_int_t ret;
+ zend_long ret;
if (!BG(rand_is_seeded)) {
php_srand(GENERATE_SEED() TSRMLS_CC);
@@ -229,9 +229,9 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D)
Seeds random number generator */
PHP_FUNCTION(srand)
{
- php_int_t seed = 0;
+ zend_long seed = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
return;
if (ZEND_NUM_ARGS() == 0)
@@ -245,9 +245,9 @@ PHP_FUNCTION(srand)
Seeds Mersenne Twister random number generator */
PHP_FUNCTION(mt_srand)
{
- php_int_t seed = 0;
+ zend_long seed = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
return;
if (ZEND_NUM_ARGS() == 0)
@@ -288,12 +288,12 @@ PHP_FUNCTION(mt_srand)
Returns a random number */
PHP_FUNCTION(rand)
{
- php_int_t min;
- php_int_t max;
- php_int_t number;
+ zend_long min;
+ zend_long max;
+ zend_long number;
int argc = ZEND_NUM_ARGS();
- if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE)
+ if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE)
return;
number = php_rand(TSRMLS_C);
@@ -301,7 +301,7 @@ PHP_FUNCTION(rand)
RAND_RANGE(number, min, max, PHP_RAND_MAX);
}
- RETURN_INT(number);
+ RETURN_LONG(number);
}
/* }}} */
@@ -309,16 +309,16 @@ PHP_FUNCTION(rand)
Returns a random number from Mersenne Twister */
PHP_FUNCTION(mt_rand)
{
- php_int_t min;
- php_int_t max;
- php_int_t number;
+ zend_long min;
+ zend_long max;
+ zend_long number;
int argc = ZEND_NUM_ARGS();
if (argc != 0) {
- if (zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) {
return;
} else if (max < min) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_INT_FMT ") is smaller than min(" ZEND_INT_FMT ")", max, min);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than min(" ZEND_LONG_FMT ")", max, min);
RETURN_FALSE;
}
}
@@ -335,12 +335,12 @@ PHP_FUNCTION(mt_rand)
* Update:
* I talked with Cokus via email and it won't ruin the algorithm
*/
- number = (php_int_t) (php_mt_rand(TSRMLS_C) >> 1);
+ number = (zend_long) (php_mt_rand(TSRMLS_C) >> 1);
if (argc == 2) {
RAND_RANGE(number, min, max, PHP_MT_RAND_MAX);
}
- RETURN_INT(number);
+ RETURN_LONG(number);
}
/* }}} */
@@ -352,7 +352,7 @@ PHP_FUNCTION(getrandmax)
return;
}
- RETURN_INT(PHP_RAND_MAX);
+ RETURN_LONG(PHP_RAND_MAX);
}
/* }}} */
@@ -368,7 +368,7 @@ PHP_FUNCTION(mt_getrandmax)
* Melo: it could be 2^^32 but we only use 2^^31 to maintain
* compatibility with the previous php_rand
*/
- RETURN_INT(PHP_MT_RAND_MAX); /* 2^^31 */
+ RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */
}
/* }}} */
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index 815d7c7290..62437831bb 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -356,7 +356,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
* must not be a mixture of XPG3 specs and non-XPG3 specs
* in the same format string.
*/
- value = ZEND_STRTOUI(format-1, &end, 10);
+ value = ZEND_STRTOUL(format-1, &end, 10);
if (*end != '$') {
goto notXpg;
}
@@ -403,7 +403,7 @@ xpgCheckDone:
* Parse any width specifier.
*/
if (isdigit(UCHAR(*ch))) {
- value = ZEND_STRTOUI(format-1, &format, 10);
+ value = ZEND_STRTOUL(format-1, &format, 10);
flags |= SCAN_WIDTH;
ch = format++;
}
@@ -582,7 +582,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
{
int numVars, nconversions, totalVars = -1;
int i, result;
- php_int_t value;
+ zend_long value;
int objIndex;
char *end, *baseString;
zval *current;
@@ -590,7 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
int base = 0;
int underflow = 0;
size_t width;
- php_int_t (*fn)() = NULL;
+ zend_long (*fn)() = NULL;
char *ch, sch;
int flags;
char buf[64]; /* Temporary buffer to hold scanned number
@@ -708,7 +708,7 @@ literal:
flags |= SCAN_SUPPRESS;
ch = format++;
} else if ( isdigit(UCHAR(*ch))) {
- value = ZEND_STRTOUI(format-1, &end, 10);
+ value = ZEND_STRTOUL(format-1, &end, 10);
if (*end == '$') {
format = end+1;
ch = format++;
@@ -720,7 +720,7 @@ literal:
* Parse any width specifier.
*/
if ( isdigit(UCHAR(*ch))) {
- width = ZEND_STRTOUI(format-1, &format, 10);
+ width = ZEND_STRTOUL(format-1, &format, 10);
ch = format++;
} else {
width = 0;
@@ -744,9 +744,9 @@ literal:
} else if (numVars) {
current = Z_REFVAL(args[objIndex++]);
zval_ptr_dtor(current);
- ZVAL_INT(current, (php_int_t)(string - baseString) );
+ ZVAL_LONG(current, (zend_long)(string - baseString) );
} else {
- add_index_int(return_value, objIndex++, string - baseString);
+ add_index_long(return_value, objIndex++, string - baseString);
}
}
nconversions++;
@@ -756,29 +756,29 @@ literal:
case 'D':
op = 'i';
base = 10;
- fn = (php_int_t (*)())ZEND_STRTOI_PTR;
+ fn = (zend_long (*)())ZEND_STRTOL_PTR;
break;
case 'i':
op = 'i';
base = 0;
- fn = (php_int_t (*)())ZEND_STRTOI_PTR;
+ fn = (zend_long (*)())ZEND_STRTOL_PTR;
break;
case 'o':
op = 'i';
base = 8;
- fn = (php_int_t (*)())ZEND_STRTOI_PTR;
+ fn = (zend_long (*)())ZEND_STRTOL_PTR;
break;
case 'x':
case 'X':
op = 'i';
base = 16;
- fn = (php_int_t (*)())ZEND_STRTOI_PTR;
+ fn = (zend_long (*)())ZEND_STRTOL_PTR;
break;
case 'u':
op = 'i';
base = 10;
flags |= SCAN_UNSIGNED;
- fn = (php_int_t (*)())ZEND_STRTOUI_PTR;
+ fn = (zend_long (*)())ZEND_STRTOUL_PTR;
break;
case 'f':
@@ -1049,9 +1049,9 @@ addToInt:
*/
if (!(flags & SCAN_SUPPRESS)) {
*end = '\0';
- value = (php_int_t) (*fn)(buf, NULL, base);
+ value = (zend_long) (*fn)(buf, NULL, base);
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
- snprintf(buf, sizeof(buf), ZEND_UINT_FMT, value); /* INTL: ISO digit */
+ snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */
if (numVars && objIndex >= argCount) {
break;
} else if (numVars) {
@@ -1068,9 +1068,9 @@ addToInt:
} else if (numVars) {
current = Z_REFVAL(args[objIndex++]);
zval_ptr_dtor(current);
- ZVAL_INT(current, value);
+ ZVAL_LONG(current, value);
} else {
- add_index_int(return_value, objIndex++, value);
+ add_index_long(return_value, objIndex++, value);
}
}
}
@@ -1190,8 +1190,8 @@ done:
scan_set_error_return( numVars, return_value );
result = SCAN_ERROR_EOF;
} else if (numVars) {
- convert_to_int(return_value );
- Z_IVAL_P(return_value) = nconversions;
+ convert_to_long(return_value );
+ Z_LVAL_P(return_value) = nconversions;
} else if (nconversions < totalVars) {
/* TODO: not all elements converted. we need to prune the list - cc */
}
@@ -1203,7 +1203,7 @@ done:
static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */
{
if (numVars) {
- ZVAL_INT(return_value, SCAN_ERROR_EOF); /* EOF marker */
+ ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */
} else {
/* convert_to_null calls destructor */
convert_to_null(return_value);
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
index 8d5fee22e1..ddb9803512 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index 4e8c68f13b..249828fb3d 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -46,10 +46,10 @@ PHP_FUNCTION(sha1)
sha1str[0] = '\0';
PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, arg->val, arg->len);
+ PHP_SHA1Update(&context, (unsigned char *) arg->val, arg->len);
PHP_SHA1Final(digest, &context);
if (raw_output) {
- RETURN_STRINGL(digest, 20);
+ RETURN_STRINGL((char *) digest, 20);
} else {
make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str);
@@ -65,13 +65,13 @@ PHP_FUNCTION(sha1)
PHP_FUNCTION(sha1_file)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_bool raw_output = 0;
char sha1str[41];
unsigned char buf[1024];
unsigned char digest[20];
PHP_SHA1_CTX context;
- int n;
+ size_t n;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
@@ -85,7 +85,7 @@ PHP_FUNCTION(sha1_file)
PHP_SHA1Init(&context);
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
+ while ((n = php_stream_read(stream, (char *) buf, sizeof(buf))) > 0) {
PHP_SHA1Update(&context, buf, n);
}
@@ -93,12 +93,8 @@ PHP_FUNCTION(sha1_file)
php_stream_close(stream);
- if (n<0) {
- RETURN_FALSE;
- }
-
if (raw_output) {
- RETURN_STRINGL(digest, 20);
+ RETURN_STRINGL((char *) digest, 20);
} else {
make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str);
@@ -180,7 +176,7 @@ PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context)
context.
*/
PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input,
- php_size_t inputLen)
+ size_t inputLen)
{
unsigned int i, index, partLen;
diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h
index 72c793f656..14787892e7 100644
--- a/ext/standard/sha1.h
+++ b/ext/standard/sha1.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -31,7 +31,7 @@ typedef struct {
} PHP_SHA1_CTX;
PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *);
-PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, php_size_t);
+PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t);
PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest);
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
index af9a719d39..feb9a6780e 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@
PHP_FUNCTION(soundex)
{
char *str;
- int i, _small, str_len, code, last;
+ size_t i, _small, str_len, code, last;
char soundex[4 + 1];
static char soundex_table[26] =
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index baa28a14b1..f864994d28 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -51,11 +51,11 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
Creates a pair of connected, indistinguishable socket streams */
PHP_FUNCTION(stream_socket_pair)
{
- php_int_t domain, type, protocol;
+ zend_long domain, type, protocol;
php_stream *s1, *s2;
php_socket_t pair[2];
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll",
&domain, &type, &protocol)) {
RETURN_FALSE;
}
@@ -88,7 +88,7 @@ PHP_FUNCTION(stream_socket_pair)
PHP_FUNCTION(stream_socket_client)
{
char *host;
- int host_len;
+ size_t host_len;
zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
double timeout = FG(default_socket_timeout);
php_timeout_ull conv;
@@ -96,13 +96,13 @@ PHP_FUNCTION(stream_socket_client)
char *hashkey = NULL;
php_stream *stream = NULL;
int err;
- php_int_t flags = PHP_STREAM_CLIENT_CONNECT;
+ zend_long flags = PHP_STREAM_CLIENT_CONNECT;
zend_string *errstr = NULL;
php_stream_context *context = NULL;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dir", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) {
RETURN_FALSE;
}
@@ -123,7 +123,7 @@ PHP_FUNCTION(stream_socket_client)
#endif
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, 0);
+ ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
zval_dtor(zerrstr);
@@ -141,7 +141,7 @@ PHP_FUNCTION(stream_socket_client)
zend_string *quoted_host = php_addslashes(host, host_len, 0 TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", quoted_host->val, errstr == NULL ? "Unknown error" : errstr->val);
- STR_RELEASE(quoted_host);
+ zend_string_release(quoted_host);
}
if (hashkey) {
@@ -151,19 +151,19 @@ PHP_FUNCTION(stream_socket_client)
if (stream == NULL) {
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, err);
+ ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
zval_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
RETURN_FALSE;
}
if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
php_stream_to_zval(stream, return_value);
@@ -176,17 +176,17 @@ PHP_FUNCTION(stream_socket_client)
PHP_FUNCTION(stream_socket_server)
{
char *host;
- int host_len;
+ size_t host_len;
zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
php_stream *stream = NULL;
int err = 0;
- php_int_t flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN;
+ zend_long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN;
zend_string *errstr = NULL;
php_stream_context *context = NULL;
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/ir", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/lr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) {
RETURN_FALSE;
}
@@ -198,7 +198,7 @@ PHP_FUNCTION(stream_socket_server)
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, 0);
+ ZVAL_LONG(zerrno, 0);
}
if (zerrstr) {
zval_dtor(zerrstr);
@@ -216,19 +216,19 @@ PHP_FUNCTION(stream_socket_server)
if (stream == NULL) {
if (zerrno) {
zval_dtor(zerrno);
- ZVAL_INT(zerrno, err);
+ ZVAL_LONG(zerrno, err);
}
if (zerrstr && errstr) {
zval_dtor(zerrstr);
ZVAL_STR(zerrstr, errstr);
} else if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
RETURN_FALSE;
}
if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
php_stream_to_zval(stream, return_value);
@@ -284,7 +284,7 @@ PHP_FUNCTION(stream_socket_accept)
}
if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
}
/* }}} */
@@ -321,13 +321,13 @@ PHP_FUNCTION(stream_socket_sendto)
{
php_stream *stream;
zval *zstream;
- php_int_t flags = 0;
+ zend_long flags = 0;
char *data, *target_addr = NULL;
- int datalen, target_addr_len = 0;
+ size_t datalen, target_addr_len = 0;
php_sockaddr_storage sa;
socklen_t sl = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|is", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
RETURN_FALSE;
}
php_stream_from_zval(stream, zstream);
@@ -340,7 +340,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
}
- RETURN_INT(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC));
+ RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC));
}
/* }}} */
@@ -351,12 +351,12 @@ PHP_FUNCTION(stream_socket_recvfrom)
php_stream *stream;
zval *zstream, *zremote = NULL;
zend_string *remote_addr = NULL;
- php_int_t to_read = 0;
+ zend_long to_read = 0;
zend_string *read_buf;
- php_int_t flags = 0;
+ zend_long flags = 0;
int recvd;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|iz/", &zstream, &to_read, &flags, &zremote) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz/", &zstream, &to_read, &flags, &zremote) == FAILURE) {
RETURN_FALSE;
}
@@ -372,7 +372,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
RETURN_FALSE;
}
- read_buf = STR_ALLOC(to_read, 0);
+ read_buf = zend_string_alloc(to_read, 0);
recvd = php_stream_xport_recvfrom(stream, read_buf->val, to_read, flags, NULL, NULL,
zremote ? &remote_addr : NULL
@@ -387,7 +387,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
RETURN_NEW_STR(read_buf);
}
- STR_FREE(read_buf);
+ zend_string_free(read_buf);
RETURN_FALSE;
}
/* }}} */
@@ -398,11 +398,11 @@ PHP_FUNCTION(stream_get_contents)
{
php_stream *stream;
zval *zsrc;
- php_int_t maxlen = PHP_STREAM_COPY_ALL,
+ zend_long maxlen = PHP_STREAM_COPY_ALL,
desiredpos = -1L;
zend_string *contents;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ii", &zsrc, &maxlen, &desiredpos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) {
RETURN_FALSE;
}
@@ -423,13 +423,13 @@ PHP_FUNCTION(stream_get_contents)
if (seek_res != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Failed to seek to position %ld in the stream", desiredpos);
+ "Failed to seek to position %pd in the stream", desiredpos);
RETURN_FALSE;
}
}
if (maxlen > INT_MAX) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %ld to %d bytes", maxlen, INT_MAX);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "maxlen truncated from %pd to %d bytes", maxlen, INT_MAX);
maxlen = INT_MAX;
}
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
@@ -446,11 +446,11 @@ PHP_FUNCTION(stream_copy_to_stream)
{
php_stream *src, *dest;
zval *zsrc, *zdest;
- php_int_t maxlen = PHP_STREAM_COPY_ALL, pos = 0;
+ zend_long maxlen = PHP_STREAM_COPY_ALL, pos = 0;
size_t len;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ii", &zsrc, &zdest, &maxlen, &pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) {
RETURN_FALSE;
}
@@ -458,7 +458,7 @@ PHP_FUNCTION(stream_copy_to_stream)
php_stream_from_zval(dest, zdest);
if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", pos);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_LONG_FMT " in the stream", pos);
RETURN_FALSE;
}
@@ -467,7 +467,7 @@ PHP_FUNCTION(stream_copy_to_stream)
if (ret != SUCCESS) {
RETURN_FALSE;
}
- RETURN_INT(len);
+ RETURN_LONG(len);
}
/* }}} */
@@ -511,7 +511,7 @@ PHP_FUNCTION(stream_get_meta_data)
}
#endif
- add_assoc_int(return_value, "unread_bytes", stream->writepos - stream->readpos);
+ add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos);
add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0);
if (stream->orig_path) {
@@ -541,7 +541,7 @@ PHP_FUNCTION(stream_get_transports)
if ((stream_xport_hash = php_stream_xport_get_hash())) {
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) {
- add_next_index_str(return_value, STR_COPY(stream_xport));
+ add_next_index_str(return_value, zend_string_copy(stream_xport));
} ZEND_HASH_FOREACH_END();
} else {
RETURN_FALSE;
@@ -564,7 +564,7 @@ PHP_FUNCTION(stream_get_wrappers)
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) {
if (stream_protocol) {
- add_next_index_str(return_value, STR_COPY(stream_protocol));
+ add_next_index_str(return_value, zend_string_copy(stream_protocol));
}
} ZEND_HASH_FOREACH_END();
} else {
@@ -619,7 +619,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
php_stream *stream;
int ret = 0;
zend_string *key;
- php_uint_t num_ind;
+ zend_ulong num_ind;
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
return 0;
@@ -723,10 +723,10 @@ PHP_FUNCTION(stream_select)
fd_set rfds, wfds, efds;
php_socket_t max_fd = 0;
int retval, sets = 0;
- php_int_t usec = 0;
+ zend_long usec = 0;
int set_count, max_set_count = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
return;
FD_ZERO(&rfds);
@@ -763,9 +763,9 @@ PHP_FUNCTION(stream_select)
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (sec != NULL) {
- convert_to_int_ex(sec);
+ convert_to_long_ex(sec);
- if (Z_IVAL_P(sec) < 0) {
+ if (Z_LVAL_P(sec) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0");
RETURN_FALSE;
} else if (usec < 0) {
@@ -775,10 +775,10 @@ PHP_FUNCTION(stream_select)
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000);
+ tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = Z_IVAL_P(sec);
+ tv.tv_sec = Z_LVAL_P(sec);
tv.tv_usec = usec;
}
@@ -798,7 +798,7 @@ PHP_FUNCTION(stream_select)
if (e_array != NULL) {
zend_hash_clean(Z_ARRVAL_P(e_array));
}
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
}
@@ -814,7 +814,7 @@ PHP_FUNCTION(stream_select)
if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC);
if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC);
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
/* }}} */
@@ -827,16 +827,16 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco
zval zvs[6];
int i;
- ZVAL_INT(&zvs[0], notifycode);
- ZVAL_INT(&zvs[1], severity);
+ ZVAL_LONG(&zvs[0], notifycode);
+ ZVAL_LONG(&zvs[1], severity);
if (xmsg) {
ZVAL_STRING(&zvs[2], xmsg);
} else {
ZVAL_NULL(&zvs[2]);
}
- ZVAL_INT(&zvs[3], xcode);
- ZVAL_INT(&zvs[4], bytes_sofar);
- ZVAL_INT(&zvs[5], bytes_max);
+ ZVAL_LONG(&zvs[3], xcode);
+ ZVAL_LONG(&zvs[4], bytes_sofar);
+ ZVAL_LONG(&zvs[5], bytes_max);
if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, zvs, 0, NULL TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier");
@@ -963,7 +963,7 @@ PHP_FUNCTION(stream_context_set_option)
zval *options = NULL, *zcontext = NULL, *zvalue = NULL;
php_stream_context *context;
char *wrappername, *optionname;
- int wrapperlen, optionlen;
+ size_t wrapperlen, optionlen;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"rssz", &zcontext, &wrappername, &wrapperlen,
@@ -1117,13 +1117,13 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
zval *zstream;
php_stream *stream;
char *filtername;
- int filternamelen;
- php_int_t read_write = 0;
+ size_t filternamelen;
+ zend_long read_write = 0;
zval *filterparams = NULL;
php_stream_filter *filter = NULL;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|iz", &zstream,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream,
&filtername, &filternamelen, &read_write, &filterparams) == FAILURE) {
RETURN_FALSE;
}
@@ -1241,13 +1241,13 @@ PHP_FUNCTION(stream_filter_remove)
PHP_FUNCTION(stream_get_line)
{
char *str = NULL;
- int str_len = 0;
- php_int_t max_length;
+ size_t str_len = 0;
+ zend_long max_length;
zval *zstream;
zend_string *buf;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
RETURN_FALSE;
}
@@ -1276,10 +1276,10 @@ PHP_FUNCTION(stream_set_blocking)
{
zval *arg1;
int block;
- php_int_t arg2;
+ zend_long arg2;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
return;
}
@@ -1302,12 +1302,12 @@ PHP_FUNCTION(stream_set_blocking)
PHP_FUNCTION(stream_set_timeout)
{
zval *socket;
- php_int_t seconds, microseconds = 0;
+ zend_long seconds, microseconds = 0;
struct timeval t;
php_stream *stream;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &socket, &seconds, &microseconds) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &socket, &seconds, &microseconds) == FAILURE) {
return;
}
@@ -1337,11 +1337,11 @@ PHP_FUNCTION(stream_set_write_buffer)
{
zval *arg1;
int ret;
- php_int_t arg2;
+ zend_long arg2;
size_t buff;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
RETURN_FALSE;
}
@@ -1356,7 +1356,7 @@ PHP_FUNCTION(stream_set_write_buffer)
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff);
}
- RETURN_INT(ret == 0 ? 0 : EOF);
+ RETURN_LONG(ret == 0 ? 0 : EOF);
}
/* }}} */
@@ -1365,16 +1365,16 @@ PHP_FUNCTION(stream_set_write_buffer)
PHP_FUNCTION(stream_set_chunk_size)
{
int ret;
- php_int_t csize;
+ zend_long csize;
zval *zstream;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &csize) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &csize) == FAILURE) {
RETURN_FALSE;
}
if (csize <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_INT_FMT, csize);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize);
RETURN_FALSE;
}
/* stream.chunk_size is actually a size_t, but php_stream_set_option
@@ -1390,7 +1390,7 @@ PHP_FUNCTION(stream_set_chunk_size)
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL);
- RETURN_INT(ret > 0 ? (php_int_t)ret : (php_int_t)EOF);
+ RETURN_LONG(ret > 0 ? (zend_long)ret : (zend_long)EOF);
}
/* }}} */
@@ -1400,11 +1400,11 @@ PHP_FUNCTION(stream_set_read_buffer)
{
zval *arg1;
int ret;
- php_int_t arg2;
+ zend_long arg2;
size_t buff;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
RETURN_FALSE;
}
@@ -1419,7 +1419,7 @@ PHP_FUNCTION(stream_set_read_buffer)
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff);
}
- RETURN_INT(ret == 0 ? 0 : EOF);
+ RETURN_LONG(ret == 0 ? 0 : EOF);
}
/* }}} */
@@ -1427,13 +1427,13 @@ PHP_FUNCTION(stream_set_read_buffer)
Enable or disable a specific kind of crypto on the stream */
PHP_FUNCTION(stream_socket_enable_crypto)
{
- php_int_t cryptokind = 0;
+ zend_long cryptokind = 0;
zval *zstream, *zsessstream = NULL;
php_stream *stream, *sessstream = NULL;
zend_bool enable, cryptokindnull;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|i!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|l!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
RETURN_FALSE;
}
@@ -1448,7 +1448,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
RETURN_FALSE;
}
- cryptokind = Z_IVAL_P(val);
+ cryptokind = Z_LVAL_P(val);
}
if (zsessstream) {
@@ -1466,7 +1466,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
RETURN_FALSE;
case 0:
- RETURN_INT(0);
+ RETURN_LONG(0);
default:
RETURN_TRUE;
@@ -1479,7 +1479,7 @@ Determine what file will be opened by calls to fopen() with a relative path */
PHP_FUNCTION(stream_resolve_include_path)
{
char *filename, *resolved_path;
- int filename_len;
+ size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
@@ -1558,11 +1558,11 @@ PHP_FUNCTION(stream_supports_lock)
disallowed. */
PHP_FUNCTION(stream_socket_shutdown)
{
- php_int_t how;
+ zend_long how;
zval *zstream;
php_stream *stream;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &how) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) {
RETURN_FALSE;
}
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
index 926cf2d5b5..a65f86e3a4 100644
--- a/ext/standard/streamsfuncs.h
+++ b/ext/standard/streamsfuncs.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 4ead166495..706a3eb075 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -56,7 +56,7 @@
#include "zend_execute.h"
#include "php_globals.h"
#include "basic_functions.h"
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
#include <Zend/zend_exceptions.h>
#ifdef ZTS
#include "TSRM.h"
@@ -81,13 +81,13 @@
*/
void register_string_constants(INIT_FUNC_ARGS)
{
- REGISTER_INT_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
#ifdef HAVE_LOCALECONV
/* If last members of struct lconv equal CHAR_MAX, no grouping is done */
@@ -97,25 +97,25 @@ void register_string_constants(INIT_FUNC_ARGS)
# define CHAR_MAX 127
# endif
- REGISTER_INT_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef HAVE_LOCALE_H
- REGISTER_INT_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
# ifdef LC_MESSAGES
- REGISTER_INT_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
# endif
#endif
}
/* }}} */
-int php_tag_find(char *tag, php_size_t len, char *set);
+int php_tag_find(char *tag, size_t len, char *set);
/* this is read-only, so it's ok */
static char hexconvtab[] = "0123456789abcdef";
@@ -132,7 +132,7 @@ static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen)
zend_string *result;
size_t i, j;
- result = STR_SAFE_ALLOC(oldlen, 2 * sizeof(char), 0, 0);
+ result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0);
for (i = j = 0; i < oldlen; i++) {
result->val[j++] = hexconvtab[old[i] >> 4];
@@ -149,7 +149,7 @@ static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen)
static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen)
{
size_t target_length = oldlen >> 1;
- zend_string *str = STR_ALLOC(target_length, 0);
+ zend_string *str = zend_string_alloc(target_length, 0);
unsigned char *ret = (unsigned char *)str->val;
size_t i, j;
@@ -164,7 +164,7 @@ static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen)
} else if (c >= 'A' && c <= 'F') {
d = (c - 'A' + 10) << 4;
} else {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
c = old[j++];
@@ -175,7 +175,7 @@ static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen)
} else if (c >= 'A' && c <= 'F') {
d |= c - 'A' + 10;
} else {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
ret[i] = d;
@@ -282,9 +282,9 @@ PHP_FUNCTION(hex2bin)
static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */
{
zend_string *s11, *s22;
- php_int_t start = 0, len = 0;
+ zend_long start = 0, len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", &s11,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", &s11,
&s22, &start, &len) == FAILURE) {
return;
}
@@ -296,11 +296,11 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
/* look at substr() function for more information */
if (start < 0) {
- start += (php_int_t)s11->len;
+ start += (zend_long)s11->len;
if (start < 0) {
start = 0;
}
- } else if ((php_size_t)start > s11->len) {
+ } else if ((size_t)start > s11->len) {
RETURN_FALSE;
}
@@ -311,21 +311,21 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
}
}
- if (len > (php_int_t)s11->len - start) {
+ if (len > (zend_long)s11->len - start) {
len = s11->len - start;
}
if(len == 0) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
if (behavior == STR_STRSPN) {
- RETURN_INT(php_strspn(s11->val + start /*str1_start*/,
+ RETURN_LONG(php_strspn(s11->val + start /*str1_start*/,
s22->val /*str2_start*/,
s11->val + start + len /*str1_end*/,
s22->val + s22->len /*str2_end*/));
} else if (behavior == STR_STRCSPN) {
- RETURN_INT(php_strcspn(s11->val + start /*str1_start*/,
+ RETURN_LONG(php_strcspn(s11->val + start /*str1_start*/,
s22->val /*str2_start*/,
s11->val + start + len /*str1_end*/,
s22->val + s22->len /*str2_end*/));
@@ -354,7 +354,7 @@ PHP_FUNCTION(strcspn)
#if HAVE_NL_LANGINFO
PHP_MINIT_FUNCTION(nl_langinfo)
{
-#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
+#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
#ifdef ABDAY_1
REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1);
REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2);
@@ -524,10 +524,10 @@ PHP_MINIT_FUNCTION(nl_langinfo)
Query language and locale information */
PHP_FUNCTION(nl_langinfo)
{
- php_int_t item;
+ zend_long item;
char *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &item) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) {
return;
}
@@ -692,7 +692,7 @@ PHP_FUNCTION(nl_langinfo)
#endif
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '" ZEND_INT_FMT "' is not valid", item);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '" ZEND_LONG_FMT "' is not valid", item);
RETURN_FALSE;
}
/* }}} */
@@ -718,7 +718,7 @@ PHP_FUNCTION(strcoll)
return;
}
- RETURN_INT(strcoll((const char *) s1->val,
+ RETURN_LONG(strcoll((const char *) s1->val,
(const char *) s2->val));
}
/* }}} */
@@ -729,7 +729,7 @@ PHP_FUNCTION(strcoll)
* it needs to be incrementing.
* Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors)
*/
-static inline int php_charmask(unsigned char *input, php_size_t len, char *mask TSRMLS_DC)
+static inline int php_charmask(unsigned char *input, size_t len, char *mask TSRMLS_DC)
{
unsigned char *end;
unsigned char c;
@@ -778,10 +778,10 @@ static inline int php_charmask(unsigned char *input, php_size_t len, char *mask
* mode 3 : trim left and right
* what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0')
*/
-PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC)
+PHPAPI char *php_trim(char *c, size_t len, char *what, size_t what_len, zval *return_value, int mode TSRMLS_DC)
{
- register php_int_t i;
- int trimmed = 0;
+ register size_t i;
+ size_t trimmed = 0;
char mask[256];
if (what) {
@@ -802,12 +802,15 @@ PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len,
c += trimmed;
}
if (mode & 2) {
- for (i = len - 1; i >= 0; i--) {
- if (mask[(unsigned char)c[i]]) {
- len--;
- } else {
- break;
- }
+ if (len > 0) {
+ i = len - 1;
+ do {
+ if (mask[(unsigned char)c[i]]) {
+ len--;
+ } else {
+ break;
+ }
+ } while (i-- != 0);
}
}
@@ -872,33 +875,24 @@ PHP_FUNCTION(ltrim)
Wraps buffer to selected number of characters using string break char */
PHP_FUNCTION(wordwrap)
{
- zend_string *text, *breakchar = NULL, *breakchar_save = NULL;
- php_size_t newtextlen, chk;
+ zend_string *text;
+ char *breakchar = "\n";
+ size_t newtextlen, chk, breakchar_len = 1;
size_t alloced;
- php_int_t current = 0, laststart = 0, lastspace = 0;
- php_int_t linelength = 75;
+ zend_long current = 0, laststart = 0, lastspace = 0;
+ zend_long linelength = 75;
zend_bool docut = 0;
zend_string *newtext;
- breakchar = breakchar_save = STR_INIT("\n", 1, 1);
- if (!breakchar) {
- return;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iSb", &text, &linelength, &breakchar, &docut) == FAILURE) {
- STR_FREE(breakchar);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lsb", &text, &linelength, &breakchar, &breakchar_len, &docut) == FAILURE) {
return;
}
- if (breakchar != breakchar_save) {
- STR_FREE(breakchar_save);
- }
-
if (text->len == 0) {
RETURN_EMPTY_STRING();
}
- if (breakchar->len == 0) {
+ if (breakchar_len == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Break string cannot be empty");
RETURN_FALSE;
}
@@ -910,21 +904,21 @@ PHP_FUNCTION(wordwrap)
/* Special case for a single-character break as it needs no
additional storage space */
- if (breakchar->len == 1 && !docut) {
- newtext = STR_INIT(text->val, text->len, 0);
+ if (breakchar_len == 1 && !docut) {
+ newtext = zend_string_init(text->val, text->len, 0);
laststart = lastspace = 0;
for (current = 0; current < text->len; current++) {
- if (text->val[current] == breakchar->val[0]) {
+ if (text->val[current] == breakchar[0]) {
laststart = lastspace = current + 1;
} else if (text->val[current] == ' ') {
if (current - laststart >= linelength) {
- newtext->val[current] = breakchar->val[0];
+ newtext->val[current] = breakchar[0];
laststart = current + 1;
}
lastspace = current;
} else if (current - laststart >= linelength && laststart != lastspace) {
- newtext->val[lastspace] = breakchar->val[0];
+ newtext->val[lastspace] = breakchar[0];
laststart = lastspace + 1;
}
}
@@ -933,13 +927,13 @@ PHP_FUNCTION(wordwrap)
} else {
/* Multiple character line break or forced cut */
if (linelength > 0) {
- chk = (php_size_t)(text->len/linelength + 1);
- newtext = STR_ALLOC(chk * breakchar->len + text->len, 0);
- alloced = text->len + chk * breakchar->len + 1;
+ chk = (size_t)(text->len/linelength + 1);
+ newtext = zend_string_alloc(chk * breakchar_len + text->len, 0);
+ alloced = text->len + chk * breakchar_len + 1;
} else {
chk = text->len;
- alloced = text->len * (breakchar->len + 1) + 1;
- newtext = STR_ALLOC(text->len * (breakchar->len + 1), 0);
+ alloced = text->len * (breakchar_len + 1) + 1;
+ newtext = zend_string_alloc(text->len * (breakchar_len + 1), 0);
}
/* now keep track of the actual new text length */
@@ -948,18 +942,18 @@ PHP_FUNCTION(wordwrap)
laststart = lastspace = 0;
for (current = 0; current < text->len; current++) {
if (chk <= 0) {
- alloced += (php_size_t) (((text->len - current + 1)/linelength + 1) * breakchar->len) + 1;
- newtext = STR_REALLOC(newtext, alloced, 0);
- chk = (php_size_t) ((text->len - current)/linelength) + 1;
+ alloced += (size_t) (((text->len - current + 1)/linelength + 1) * breakchar_len) + 1;
+ newtext = zend_string_realloc(newtext, alloced, 0);
+ chk = (size_t) ((text->len - current)/linelength) + 1;
}
/* when we hit an existing break, copy to new buffer, and
* fix up laststart and lastspace */
- if (text->val[current] == breakchar->val[0]
- && current + breakchar->len < text->len
- && !strncmp(text->val+current, breakchar->val, breakchar->len)) {
- memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart + breakchar->len);
- newtextlen += current - laststart + breakchar->len;
- current += breakchar->len - 1;
+ if (text->val[current] == breakchar[0]
+ && current + breakchar_len < text->len
+ && !strncmp(text->val+current, breakchar, breakchar_len)) {
+ memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart + breakchar_len);
+ newtextlen += current - laststart + breakchar_len;
+ current += breakchar_len - 1;
laststart = lastspace = current + 1;
chk--;
}
@@ -969,8 +963,8 @@ PHP_FUNCTION(wordwrap)
if (current - laststart >= linelength) {
memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart);
newtextlen += current - laststart;
- memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len);
- newtextlen += breakchar->len;
+ memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ newtextlen += breakchar_len;
laststart = current + 1;
chk--;
}
@@ -983,8 +977,8 @@ PHP_FUNCTION(wordwrap)
&& docut && laststart >= lastspace) {
memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart);
newtextlen += current - laststart;
- memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len);
- newtextlen += breakchar->len;
+ memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ newtextlen += breakchar_len;
laststart = lastspace = current;
chk--;
}
@@ -995,8 +989,8 @@ PHP_FUNCTION(wordwrap)
&& laststart < lastspace) {
memcpy(newtext->val + newtextlen, text->val + laststart, lastspace - laststart);
newtextlen += lastspace - laststart;
- memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len);
- newtextlen += breakchar->len;
+ memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ newtextlen += breakchar_len;
laststart = lastspace = lastspace + 1;
chk--;
}
@@ -1010,7 +1004,7 @@ PHP_FUNCTION(wordwrap)
newtext->val[newtextlen] = '\0';
/* free unused memory */
- newtext = STR_REALLOC(newtext, newtextlen, 0);
+ newtext = zend_string_realloc(newtext, newtextlen, 0);
RETURN_NEW_STR(newtext);
}
@@ -1019,41 +1013,36 @@ PHP_FUNCTION(wordwrap)
/* {{{ php_explode
*/
-PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit)
+PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit)
{
- char *p1, *p2, *endp;
-
- endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str);
-
- p1 = Z_STRVAL_P(str);
- p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp);
+ char *p1 = str->val;
+ char *endp = str->val + str->len;
+ char *p2 = (char *) php_memnstr(str->val, delim->val, delim->len, endp);
if (p2 == NULL) {
- add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str));
+ add_next_index_str(return_value, zend_string_copy(str));
} else {
do {
add_next_index_stringl(return_value, p1, p2 - p1);
- p1 = p2 + Z_STRSIZE_P(delim);
- } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL &&
- --limit > 1);
+ p1 = p2 + delim->len;
+ p2 = (char *) php_memnstr(p1, delim->val, delim->len, endp);
+ } while (p2 != NULL && --limit > 1);
- if (p1 <= endp)
- add_next_index_stringl(return_value, p1, endp-p1);
+ if (p1 <= endp) {
+ add_next_index_stringl(return_value, p1, endp - p1);
+ }
}
}
/* }}} */
/* {{{ php_explode_negative_limit
*/
-PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, php_int_t limit)
+PHPAPI void php_explode_negative_limit(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit)
{
#define EXPLODE_ALLOC_STEP 64
- char *p1, *p2, *endp;
-
- endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str);
-
- p1 = Z_STRVAL_P(str);
- p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp);
+ char *p1 = str->val;
+ char *endp = str->val + str->len;
+ char *p2 = (char *) php_memnstr(str->val, delim->val, delim->len, endp);
if (p2 == NULL) {
/*
@@ -1061,8 +1050,8 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu
by doing nothing we return empty array
*/
} else {
- php_size_t allocated = EXPLODE_ALLOC_STEP, found = 0;
- php_int_t i, to_return;
+ size_t allocated = EXPLODE_ALLOC_STEP, found = 0;
+ zend_long i, to_return;
char **positions = emalloc(allocated * sizeof(char *));
positions[found++] = p1;
@@ -1071,14 +1060,15 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu
allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */
positions = erealloc(positions, allocated*sizeof(char *));
}
- positions[found++] = p1 = p2 + Z_STRSIZE_P(delim);
- } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL);
+ positions[found++] = p1 = p2 + delim->len;
+ p2 = (char *) php_memnstr(p1, delim->val, delim->len, endp);
+ } while (p2 != NULL);
to_return = limit + found;
/* limit is at least -1 therefore no need of bounds checking : i will be always less than found */
- for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */
+ for (i = 0; i < to_return; i++) { /* this checks also for to_return > 0 */
add_next_index_stringl(return_value, positions[i],
- (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i]);
+ (positions[i+1] - delim->len) - positions[i]);
}
efree(positions);
}
@@ -1091,11 +1081,10 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu
PHP_FUNCTION(explode)
{
zend_string *str, *delim;
- php_int_t limit = PHP_INT_MAX; /* No limit */
- zval zdelim, zstr;
+ zend_long limit = ZEND_LONG_MAX; /* No limit */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|i", &delim, &str, &limit) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &str, &limit) == FAILURE) {
return;
}
#else
@@ -1103,7 +1092,7 @@ PHP_FUNCTION(explode)
Z_PARAM_STR(delim)
Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(limit)
+ Z_PARAM_LONG(limit)
ZEND_PARSE_PARAMETERS_END();
#endif
@@ -1116,17 +1105,15 @@ PHP_FUNCTION(explode)
if (str->len == 0) {
if (limit >= 0) {
- add_next_index_stringl(return_value, "", sizeof("") - 1);
+ add_next_index_str(return_value, STR_EMPTY_ALLOC());
}
return;
}
- ZVAL_STR(&zstr, str);
- ZVAL_STR(&zdelim, delim);
if (limit > 1) {
- php_explode(&zdelim, &zstr, return_value, limit);
+ php_explode(delim, str, return_value, limit);
} else if (limit < 0) {
- php_explode_negative_limit(&zdelim, &zstr, return_value, limit);
+ php_explode_negative_limit(delim, str, return_value, limit);
} else {
add_index_stringl(return_value, 0, str->val, str->len);
}
@@ -1139,7 +1126,7 @@ PHP_FUNCTION(explode)
/* {{{ php_implode
*/
-PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
+PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value TSRMLS_DC)
{
zval *tmp;
smart_str implstr = {0};
@@ -1156,11 +1143,11 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
again:
switch (Z_TYPE_P(tmp)) {
case IS_STRING:
- smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp));
+ smart_str_append(&implstr, Z_STR_P(tmp));
break;
- case IS_INT:
- smart_str_append_int(&implstr, Z_IVAL_P(tmp));
+ case IS_LONG:
+ smart_str_append_long(&implstr, Z_LVAL_P(tmp));
break;
case IS_TRUE:
@@ -1173,11 +1160,11 @@ again:
case IS_DOUBLE: {
char *stmp;
- php_size_t str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp));
+ size_t str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp));
smart_str_appendl(&implstr, stmp, str_len);
efree(stmp);
- }
break;
+ }
case IS_REFERENCE:
tmp = Z_REFVAL_P(tmp);
@@ -1185,14 +1172,14 @@ again:
default:
str = zval_get_string(tmp);
- smart_str_appendl(&implstr, str->val, str->len);
- STR_RELEASE(str);
+ smart_str_append(&implstr, str);
+ zend_string_release(str);
break;
}
if (++i != numelems) {
- smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim));
+ smart_str_append(&implstr, delim);
}
} ZEND_HASH_FOREACH_END();
@@ -1211,7 +1198,8 @@ again:
Joins array elements placing glue string between items and return one string */
PHP_FUNCTION(implode)
{
- zval *arg1 = NULL, *arg2 = NULL, *delim, *arr, tmp;
+ zval *arg1, *arg2 = NULL, *arr;
+ zend_string *delim;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &arg1, &arg2) == FAILURE) {
@@ -1231,20 +1219,15 @@ PHP_FUNCTION(implode)
return;
}
- ZVAL_EMPTY_STRING(&tmp);
- delim = &tmp;
-
- SEPARATE_ZVAL(arg1);
+ delim = STR_EMPTY_ALLOC();
arr = arg1;
} else {
if (Z_TYPE_P(arg1) == IS_ARRAY) {
+ delim = zval_get_string(arg2);
arr = arg1;
- convert_to_string_ex(arg2);
- delim = arg2;
} else if (Z_TYPE_P(arg2) == IS_ARRAY) {
+ delim = zval_get_string(arg1);
arr = arg2;
- convert_to_string_ex(arg1);
- delim = arg1;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments passed");
return;
@@ -1252,6 +1235,7 @@ PHP_FUNCTION(implode)
}
php_implode(delim, arr, return_value TSRMLS_CC);
+ zend_string_release(delim);
}
/* }}} */
@@ -1266,7 +1250,7 @@ PHP_FUNCTION(strtok)
char *token_end;
char *p;
char *pe;
- int skipped = 0;
+ size_t skipped = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &tok) == FAILURE) {
return;
@@ -1360,7 +1344,7 @@ PHP_FUNCTION(strtoupper)
return;
}
- result = STR_INIT(arg->val, arg->len, 0);
+ result = zend_string_init(arg->val, arg->len, 0);
php_strtoupper(result->val, result->len);
RETURN_NEW_STR(result);
}
@@ -1400,7 +1384,7 @@ PHP_FUNCTION(strtolower)
ZEND_PARSE_PARAMETERS_END();
#endif
- result = STR_INIT(str->val, str->len, 0);
+ result = zend_string_init(str->val, str->len, 0);
php_strtolower(result->val, result->len);
RETURN_NEW_STR(result);
}
@@ -1419,13 +1403,13 @@ PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t
cnt = len;
state = 0;
while (cnt > 0) {
- inc_len = (*c == '\0' ? 1: php_mblen(c, cnt));
+ inc_len = (*c == '\0' ? 1 : php_mblen(c, cnt));
switch (inc_len) {
case -2:
case -1:
inc_len = 1;
- php_ignore_value(php_mblen(NULL, 0));
+ php_mb_reset();
break;
case 0:
goto quit_loop;
@@ -1474,14 +1458,14 @@ quit_loop:
if (state == 1) {
cend = c;
}
- if (suffix != NULL && sufflen < (uint)(cend - comp) &&
+ if (suffix != NULL && sufflen < (size_t)(cend - comp) &&
memcmp(cend - sufflen, suffix, sufflen) == 0) {
cend -= sufflen;
}
len = cend - comp;
- ret = STR_INIT(comp, len, 0);
+ ret = zend_string_init(comp, len, 0);
return ret;
}
/* }}} */
@@ -1491,7 +1475,7 @@ quit_loop:
PHP_FUNCTION(basename)
{
char *string, *suffix = NULL;
- int string_len, suffix_len = 0;
+ size_t string_len, suffix_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) {
return;
@@ -1515,13 +1499,13 @@ PHP_FUNCTION(dirname)
{
char *str;
zend_string *ret;
- int str_len;
+ size_t str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
}
- ret = STR_INIT(str, str_len, 0);
+ ret = zend_string_init(str, str_len, 0);
ret->len = zend_dirname(ret->val, str_len);
RETURN_NEW_STR(ret);
@@ -1534,11 +1518,12 @@ PHP_FUNCTION(pathinfo)
{
zval tmp;
char *path, *dirname;
- int path_len, have_basename;
- php_int_t opt = PHP_PATHINFO_ALL;
+ size_t path_len;
+ int have_basename;
+ zend_long opt = PHP_PATHINFO_ALL;
zend_string *ret = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &path_len, &opt) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) {
return;
}
@@ -1557,12 +1542,12 @@ PHP_FUNCTION(pathinfo)
if (have_basename) {
ret = php_basename(path, path_len, NULL, 0 TSRMLS_CC);
- add_assoc_str(&tmp, "basename", STR_COPY(ret));
+ add_assoc_str(&tmp, "basename", zend_string_copy(ret));
}
if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) {
const char *p;
- int idx;
+ ptrdiff_t idx;
if (!have_basename) {
ret = php_basename(path, path_len, NULL, 0 TSRMLS_CC);
@@ -1578,7 +1563,7 @@ PHP_FUNCTION(pathinfo)
if ((opt & PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) {
const char *p;
- int idx;
+ ptrdiff_t idx;
/* Have we already looked up the basename? */
if (!have_basename && !ret) {
@@ -1592,7 +1577,7 @@ PHP_FUNCTION(pathinfo)
}
if (ret) {
- STR_RELEASE(ret);
+ zend_string_release(ret);
}
if (opt == PHP_PATHINFO_ALL) {
@@ -1663,8 +1648,8 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end)
static int php_needle_char(zval *needle, char *target TSRMLS_DC)
{
switch (Z_TYPE_P(needle)) {
- case IS_INT:
- *target = (char)Z_IVAL_P(needle);
+ case IS_LONG:
+ *target = (char)Z_LVAL_P(needle);
return SUCCESS;
case IS_NULL:
case IS_FALSE:
@@ -1680,11 +1665,11 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC)
{
zval holder = *needle;
zval_copy_ctor(&(holder));
- convert_to_int(&(holder));
- if(Z_TYPE(holder) != IS_INT) {
+ convert_to_long(&(holder));
+ if(Z_TYPE(holder) != IS_LONG) {
return FAILURE;
}
- *target = (char)Z_IVAL(holder);
+ *target = (char)Z_LVAL(holder);
return SUCCESS;
}
default: {
@@ -1702,7 +1687,7 @@ PHP_FUNCTION(stristr)
zval *needle;
zend_string *haystack;
char *found = NULL;
- php_size_t found_offset;
+ size_t found_offset;
char *haystack_dup;
char needle_char[2];
zend_bool part = 0;
@@ -1715,13 +1700,13 @@ PHP_FUNCTION(stristr)
if (Z_TYPE_P(needle) == IS_STRING) {
char *orig_needle;
- if (!Z_STRSIZE_P(needle)) {
+ if (!Z_STRLEN_P(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle");
efree(haystack_dup);
RETURN_FALSE;
}
- orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle));
- found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRSIZE_P(needle));
+ orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
+ found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRLEN_P(needle));
efree(orig_needle);
} else {
if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) {
@@ -1756,7 +1741,7 @@ PHP_FUNCTION(strstr)
zend_string *haystack;
char *found = NULL;
char needle_char[2];
- php_int_t found_offset;
+ zend_long found_offset;
zend_bool part = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &needle, &part) == FAILURE) {
@@ -1764,12 +1749,12 @@ PHP_FUNCTION(strstr)
}
if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRSIZE_P(needle)) {
+ if (!Z_STRLEN_P(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle");
RETURN_FALSE;
}
- found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack->val + haystack->len);
+ found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack->val + haystack->len);
} else {
if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
@@ -1803,10 +1788,10 @@ PHP_FUNCTION(strpos)
zend_string *haystack;
char *found = NULL;
char needle_char[2];
- php_int_t offset = 0;
+ zend_long offset = 0;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &needle, &offset) == FAILURE) {
return;
}
#else
@@ -1814,24 +1799,24 @@ PHP_FUNCTION(strpos)
Z_PARAM_STR(haystack)
Z_PARAM_ZVAL(needle)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(offset)
+ Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
#endif
- if (offset < 0 || offset > haystack->len) {
+ if (offset < 0 || (size_t)offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRSIZE_P(needle)) {
+ if (!Z_STRLEN_P(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle");
RETURN_FALSE;
}
found = (char*)php_memnstr(haystack->val + offset,
Z_STRVAL_P(needle),
- Z_STRSIZE_P(needle),
+ Z_STRLEN_P(needle),
haystack->val + haystack->len);
} else {
if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) {
@@ -1846,7 +1831,7 @@ PHP_FUNCTION(strpos)
}
if (found) {
- RETURN_INT(found - haystack->val);
+ RETURN_LONG(found - haystack->val);
} else {
RETURN_FALSE;
}
@@ -1859,16 +1844,16 @@ PHP_FUNCTION(stripos)
{
char *found = NULL;
zend_string *haystack;
- php_int_t offset = 0;
+ zend_long offset = 0;
char *needle_dup = NULL, *haystack_dup;
char needle_char[2];
zval *needle;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &needle, &offset) == FAILURE) {
return;
}
- if (offset < 0 || offset > haystack->len) {
+ if (offset < 0 || (size_t)offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
@@ -1881,14 +1866,14 @@ PHP_FUNCTION(stripos)
php_strtolower(haystack_dup, haystack->len);
if (Z_TYPE_P(needle) == IS_STRING) {
- if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack->len) {
+ if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack->len) {
efree(haystack_dup);
RETURN_FALSE;
}
- needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle));
- php_strtolower(needle_dup, Z_STRSIZE_P(needle));
- found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack->len);
+ needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
+ php_strtolower(needle_dup, Z_STRLEN_P(needle));
+ found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack->len);
} else {
if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) {
efree(haystack_dup);
@@ -1908,7 +1893,7 @@ PHP_FUNCTION(stripos)
}
if (found) {
- RETURN_INT(found - haystack_dup);
+ RETURN_LONG(found - haystack_dup);
} else {
RETURN_FALSE;
}
@@ -1922,12 +1907,12 @@ PHP_FUNCTION(strrpos)
zval *zneedle;
char *needle;
zend_string *haystack;
- php_size_t needle_len;
- php_int_t offset = 0;
+ size_t needle_len;
+ zend_long offset = 0;
char *p, *e, ord_needle[2];
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &zneedle, &offset) == FAILURE) {
RETURN_FALSE;
}
#else
@@ -1935,13 +1920,13 @@ PHP_FUNCTION(strrpos)
Z_PARAM_STR(haystack)
Z_PARAM_ZVAL(zneedle)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(offset)
+ Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
#endif
if (Z_TYPE_P(zneedle) == IS_STRING) {
needle = Z_STRVAL_P(zneedle);
- needle_len = Z_STRSIZE_P(zneedle);
+ needle_len = Z_STRLEN_P(zneedle);
} else {
if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
@@ -1956,20 +1941,20 @@ PHP_FUNCTION(strrpos)
}
if (offset >= 0) {
- if (offset > haystack->len) {
+ if ((size_t)offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack->val + offset;
+ p = haystack->val + (size_t)offset;
e = haystack->val + haystack->len - needle_len;
} else {
- if (offset < -INT_MAX || -offset > haystack->len) {
+ if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
p = haystack->val;
- if (needle_len > -offset) {
+ if (needle_len > (size_t)(-offset)) {
e = haystack->val + haystack->len - needle_len;
} else {
e = haystack->val + haystack->len + offset;
@@ -1980,7 +1965,7 @@ PHP_FUNCTION(strrpos)
/* Single character search can shortcut memcmps */
while (e >= p) {
if (*e == *needle) {
- RETURN_INT(e - p + (offset > 0 ? offset : 0));
+ RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
@@ -1989,7 +1974,7 @@ PHP_FUNCTION(strrpos)
while (e >= p) {
if (memcmp(e, needle, needle_len) == 0) {
- RETURN_INT(e - p + (offset > 0 ? offset : 0));
+ RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
@@ -2005,18 +1990,18 @@ PHP_FUNCTION(strripos)
zval *zneedle;
char *needle;
zend_string *haystack;
- php_size_t needle_len;
- php_int_t offset = 0;
+ size_t needle_len;
+ zend_long offset = 0;
char *p, *e, ord_needle[2];
char *needle_dup, *haystack_dup;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &zneedle, &offset) == FAILURE) {
RETURN_FALSE;
}
if (Z_TYPE_P(zneedle) == IS_STRING) {
needle = Z_STRVAL_P(zneedle);
- needle_len = Z_STRSIZE_P(zneedle);
+ needle_len = Z_STRLEN_P(zneedle);
} else {
if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
@@ -2034,7 +2019,7 @@ PHP_FUNCTION(strripos)
/* Single character search can shortcut memcmps
Can also avoid tolower emallocs */
if (offset >= 0) {
- if (offset > haystack->len) {
+ if ((size_t)offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
@@ -2042,7 +2027,7 @@ PHP_FUNCTION(strripos)
e = haystack->val + haystack->len - 1;
} else {
p = haystack->val;
- if (offset < -INT_MAX || -offset > haystack->len) {
+ if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
@@ -2052,7 +2037,7 @@ PHP_FUNCTION(strripos)
*ord_needle = tolower(*needle);
while (e >= p) {
if (tolower(*e) == *ord_needle) {
- RETURN_INT(e - p + (offset > 0 ? offset : 0));
+ RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
@@ -2065,7 +2050,7 @@ PHP_FUNCTION(strripos)
php_strtolower(haystack_dup, haystack->len);
if (offset >= 0) {
- if (offset > haystack->len) {
+ if ((size_t)offset > haystack->len) {
efree(needle_dup);
efree(haystack_dup);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
@@ -2074,14 +2059,14 @@ PHP_FUNCTION(strripos)
p = haystack_dup + offset;
e = haystack_dup + haystack->len - needle_len;
} else {
- if (offset < -INT_MAX || -offset > haystack->len) {
+ if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
efree(needle_dup);
efree(haystack_dup);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
p = haystack_dup;
- if (needle_len > -offset) {
+ if (needle_len > (size_t)(-offset)) {
e = haystack_dup + haystack->len - needle_len;
} else {
e = haystack_dup + haystack->len + offset;
@@ -2092,7 +2077,7 @@ PHP_FUNCTION(strripos)
if (memcmp(e, needle_dup, needle_len) == 0) {
efree(haystack_dup);
efree(needle_dup);
- RETURN_INT(e - p + (offset > 0 ? offset : 0));
+ RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
@@ -2110,7 +2095,7 @@ PHP_FUNCTION(strrchr)
zval *needle;
zend_string *haystack;
const char *found = NULL;
- php_int_t found_offset;
+ zend_long found_offset;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &haystack, &needle) == FAILURE) {
return;
@@ -2138,12 +2123,12 @@ PHP_FUNCTION(strrchr)
/* {{{ php_chunk_split
*/
-static zend_string *php_chunk_split(char *src, php_size_t srclen, char *end, php_size_t endlen, php_size_t chunklen)
+static zend_string *php_chunk_split(char *src, size_t srclen, char *end, size_t endlen, size_t chunklen)
{
char *p, *q;
- php_size_t chunks; /* complete chunks! */
- php_size_t restlen;
- php_size_t out_len;
+ size_t chunks; /* complete chunks! */
+ size_t restlen;
+ size_t out_len;
zend_string *dest;
chunks = srclen / chunklen;
@@ -2162,7 +2147,7 @@ static zend_string *php_chunk_split(char *src, php_size_t srclen, char *end, php
}
out_len += srclen + 1;
- dest = STR_ALLOC(out_len * sizeof(char), 0);
+ dest = zend_string_alloc(out_len * sizeof(char), 0);
for (p = src, q = dest->val; p < (src + srclen - chunklen + 1); ) {
memcpy(q, p, chunklen);
@@ -2192,11 +2177,11 @@ PHP_FUNCTION(chunk_split)
{
zend_string *str;
char *end = "\r\n";
- int endlen = 2;
- php_int_t chunklen = 76;
+ size_t endlen = 2;
+ zend_long chunklen = 76;
zend_string *result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &chunklen, &end, &endlen) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &str, &chunklen, &end, &endlen) == FAILURE) {
return;
}
@@ -2205,9 +2190,9 @@ PHP_FUNCTION(chunk_split)
RETURN_FALSE;
}
- if (chunklen > str->len) {
+ if ((size_t)chunklen > str->len) {
/* to maintain BC, we must return original string + ending */
- result = STR_ALLOC(endlen + str->len, 0);
+ result = zend_string_alloc(endlen + str->len, 0);
memcpy(result->val, str->val, str->len);
memcpy(result->val + str->len, end, endlen);
result->val[result->len] = '\0';
@@ -2218,7 +2203,7 @@ PHP_FUNCTION(chunk_split)
RETURN_EMPTY_STRING();
}
- result = php_chunk_split(str->val, str->len, end, endlen, chunklen);
+ result = php_chunk_split(str->val, str->len, end, endlen, (size_t)chunklen);
if (result) {
RETURN_STR(result);
@@ -2233,39 +2218,39 @@ PHP_FUNCTION(chunk_split)
PHP_FUNCTION(substr)
{
zend_string *str;
- php_int_t l = 0, f;
+ zend_long l = 0, f;
int argc = ZEND_NUM_ARGS();
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &str, &f, &l) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &str, &f, &l) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(str)
- Z_PARAM_INT(f)
+ Z_PARAM_LONG(f)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(l)
+ Z_PARAM_LONG(l)
ZEND_PARSE_PARAMETERS_END();
#endif
if (argc > 2) {
- if ((l < 0 && -l > str->len)) {
+ if ((l < 0 && (size_t)(-l) > str->len)) {
RETURN_FALSE;
- } else if (l > (php_int_t)str->len) {
+ } else if (l > (zend_long)str->len) {
l = str->len;
}
} else {
l = str->len;
}
- if (f > (php_int_t)str->len) {
+ if (f > (zend_long)str->len) {
RETURN_FALSE;
} else if (f < 0 && -f > str->len) {
f = 0;
}
- if (l < 0 && (l + (php_int_t)str->len - f) < 0) {
+ if (l < 0 && (l + (zend_long)str->len - f) < 0) {
RETURN_FALSE;
}
@@ -2273,7 +2258,7 @@ PHP_FUNCTION(substr)
* of the string
*/
if (f < 0) {
- f = (php_int_t)str->len + f;
+ f = (zend_long)str->len + f;
if (f < 0) {
f = 0;
}
@@ -2283,17 +2268,17 @@ PHP_FUNCTION(substr)
* needed to stop that many chars from the end of the string
*/
if (l < 0) {
- l = ((php_int_t)str->len - f) + l;
+ l = ((zend_long)str->len - f) + l;
if (l < 0) {
l = 0;
}
}
- if (f >= (php_int_t)str->len) {
+ if (f >= (zend_long)str->len) {
RETURN_FALSE;
}
- if ((f + l) > (php_int_t)str->len) {
+ if ((f + l) > (zend_long)str->len) {
l = str->len - f;
}
@@ -2309,8 +2294,8 @@ PHP_FUNCTION(substr_replace)
zval *from;
zval *len = NULL;
zval *repl;
- php_int_t l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/
- php_int_t f;
+ zend_long l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/
+ zend_long f;
int argc = ZEND_NUM_ARGS();
zend_string *result;
@@ -2328,16 +2313,16 @@ PHP_FUNCTION(substr_replace)
convert_to_string_ex(repl);
}
if (Z_TYPE_P(from) != IS_ARRAY) {
- convert_to_int_ex(from);
+ convert_to_long_ex(from);
}
if (argc > 3) {
if (Z_TYPE_P(len) != IS_ARRAY) {
- l = zval_get_int(len);
+ l = zval_get_long(len);
}
} else {
if (Z_TYPE_P(str) != IS_ARRAY) {
- l = Z_STRSIZE_P(str);
+ l = Z_STRLEN_P(str);
}
}
@@ -2347,79 +2332,79 @@ PHP_FUNCTION(substr_replace)
(argc == 4 && Z_TYPE_P(from) != Z_TYPE_P(len))
) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array ");
- RETURN_STR(STR_COPY(Z_STR_P(str)));
+ RETURN_STR(zend_string_copy(Z_STR_P(str)));
}
if (argc == 4 && Z_TYPE_P(from) == IS_ARRAY) {
if (zend_hash_num_elements(Z_ARRVAL_P(from)) != zend_hash_num_elements(Z_ARRVAL_P(len))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements");
- RETURN_STR(STR_COPY(Z_STR_P(str)));
+ RETURN_STR(zend_string_copy(Z_STR_P(str)));
}
}
}
if (Z_TYPE_P(str) != IS_ARRAY) {
if (Z_TYPE_P(from) != IS_ARRAY) {
- php_size_t repl_len = 0;
+ size_t repl_len = 0;
- f = Z_IVAL_P(from);
+ f = Z_LVAL_P(from);
/* if "from" position is negative, count start position from the end
* of the string
*/
if (f < 0) {
- f = Z_STRSIZE_P(str) + f;
+ f = Z_STRLEN_P(str) + f;
if (f < 0) {
f = 0;
}
- } else if (f > Z_STRSIZE_P(str)) {
- f = Z_STRSIZE_P(str);
+ } else if (f > Z_STRLEN_P(str)) {
+ f = Z_STRLEN_P(str);
}
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
*/
if (l < 0) {
- l = (Z_STRSIZE_P(str) - f) + l;
+ l = (Z_STRLEN_P(str) - f) + l;
if (l < 0) {
l = 0;
}
}
- if (f > Z_STRSIZE_P(str) || (f < 0 && -f > Z_STRSIZE_P(str))) {
+ if (f > Z_STRLEN_P(str) || (f < 0 && -f > Z_STRLEN_P(str))) {
RETURN_FALSE;
- } else if (l > Z_STRSIZE_P(str) || (l < 0 && -l > Z_STRSIZE_P(str))) {
- l = Z_STRSIZE_P(str);
+ } else if (l > Z_STRLEN_P(str) || (l < 0 && -l > Z_STRLEN_P(str))) {
+ l = Z_STRLEN_P(str);
}
- if ((f + l) > Z_STRSIZE_P(str)) {
- l = Z_STRSIZE_P(str) - f;
+ if ((f + l) > Z_STRLEN_P(str)) {
+ l = Z_STRLEN_P(str) - f;
}
if (Z_TYPE_P(repl) == IS_ARRAY) {
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(repl), &pos_repl);
if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) {
convert_to_string_ex(tmp_repl);
- repl_len = Z_STRSIZE_P(tmp_repl);
+ repl_len = Z_STRLEN_P(tmp_repl);
}
} else {
- repl_len = Z_STRSIZE_P(repl);
+ repl_len = Z_STRLEN_P(repl);
}
- result = STR_ALLOC(Z_STRSIZE_P(str) - l + repl_len, 0);
+ result = zend_string_alloc(Z_STRLEN_P(str) - l + repl_len, 0);
memcpy(result->val, Z_STRVAL_P(str), f);
if (repl_len) {
memcpy((result->val + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len);
}
- memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRSIZE_P(str) - f - l);
+ memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l);
result->val[result->len] = '\0';
RETURN_NEW_STR(result);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented");
- RETURN_STR(STR_COPY(Z_STR_P(str)));
+ RETURN_STR(zend_string_copy(Z_STR_P(str)));
}
} else { /* str is array of strings */
zend_string *str_index = NULL;
- php_size_t result_len;
- php_uint_t num_index;
+ size_t result_len;
+ zend_ulong num_index;
array_init(return_value);
@@ -2458,57 +2443,57 @@ PHP_FUNCTION(substr_replace)
if (Z_TYPE_P(from) == IS_ARRAY) {
if (NULL != (tmp_from = zend_hash_get_current_data_ex(Z_ARRVAL_P(from), &pos_from))) {
- f = zval_get_int(tmp_from);
+ f = zval_get_long(tmp_from);
if (f < 0) {
- f = Z_STRSIZE_P(orig_str) + f;
+ f = Z_STRLEN_P(orig_str) + f;
if (f < 0) {
f = 0;
}
- } else if (f > Z_STRSIZE_P(orig_str)) {
- f = Z_STRSIZE_P(orig_str);
+ } else if (f > Z_STRLEN_P(orig_str)) {
+ f = Z_STRLEN_P(orig_str);
}
zend_hash_move_forward_ex(Z_ARRVAL_P(from), &pos_from);
} else {
f = 0;
}
} else {
- f = Z_IVAL_P(from);
+ f = Z_LVAL_P(from);
if (f < 0) {
- f = Z_STRSIZE_P(orig_str) + f;
+ f = Z_STRLEN_P(orig_str) + f;
if (f < 0) {
f = 0;
}
- } else if (f > Z_STRSIZE_P(orig_str)) {
- f = Z_STRSIZE_P(orig_str);
+ } else if (f > Z_STRLEN_P(orig_str)) {
+ f = Z_STRLEN_P(orig_str);
}
}
if (argc > 3 && Z_TYPE_P(len) == IS_ARRAY) {
if (NULL != (tmp_len = zend_hash_get_current_data_ex(Z_ARRVAL_P(len), &pos_len))) {
- l = zval_get_int(tmp_len);
+ l = zval_get_long(tmp_len);
zend_hash_move_forward_ex(Z_ARRVAL_P(len), &pos_len);
} else {
- l = Z_STRSIZE_P(orig_str);
+ l = Z_STRLEN_P(orig_str);
}
} else if (argc > 3) {
- l = Z_IVAL_P(len);
+ l = Z_LVAL_P(len);
} else {
- l = Z_STRSIZE_P(orig_str);
+ l = Z_STRLEN_P(orig_str);
}
if (l < 0) {
- l = (Z_STRSIZE_P(orig_str) - f) + l;
+ l = (Z_STRLEN_P(orig_str) - f) + l;
if (l < 0) {
l = 0;
}
}
- if ((f + l) > Z_STRSIZE_P(orig_str)) {
- l = Z_STRSIZE_P(orig_str) - f;
+ if ((f + l) > Z_STRLEN_P(orig_str)) {
+ l = Z_STRLEN_P(orig_str) - f;
}
- result_len = Z_STRSIZE_P(orig_str) - l;
+ result_len = Z_STRLEN_P(orig_str) - l;
if (Z_TYPE_P(repl) == IS_ARRAY) {
if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) {
@@ -2533,30 +2518,30 @@ PHP_FUNCTION(substr_replace)
}
*/
- result_len += Z_STRSIZE_P(repl_str);
+ result_len += Z_STRLEN_P(repl_str);
zend_hash_move_forward_ex(Z_ARRVAL_P(repl), &pos_repl);
- result = STR_ALLOC(result_len, 0);
+ result = zend_string_alloc(result_len, 0);
memcpy(result->val, Z_STRVAL_P(orig_str), f);
- memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str));
- memcpy((result->val + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l);
+ memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str));
+ memcpy((result->val + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l);
if(Z_TYPE_P(tmp_repl) != IS_STRING) {
zval_dtor(repl_str);
}
} else {
- result = STR_ALLOC(result_len, 0);
+ result = zend_string_alloc(result_len, 0);
memcpy(result->val, Z_STRVAL_P(orig_str), f);
- memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l);
+ memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l);
}
} else {
- result_len += Z_STRSIZE_P(repl);
+ result_len += Z_STRLEN_P(repl);
- result = STR_ALLOC(result_len, 0);
+ result = zend_string_alloc(result_len, 0);
memcpy(result->val, Z_STRVAL_P(orig_str), f);
- memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRSIZE_P(repl));
- memcpy((result->val + f + Z_STRSIZE_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l);
+ memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl));
+ memcpy((result->val + f + Z_STRLEN_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l);
}
result->val[result->len] = '\0';
@@ -2564,7 +2549,7 @@ PHP_FUNCTION(substr_replace)
if (str_index) {
zval tmp;
- ZVAL_STR(&tmp, result);
+ ZVAL_NEW_STR(&tmp, result);
zend_symtable_update(Z_ARRVAL_P(return_value), str_index, &tmp);
} else {
add_index_str(return_value, num_index, result);
@@ -2600,7 +2585,7 @@ PHP_FUNCTION(quotemeta)
RETURN_FALSE;
}
- str = STR_ALLOC(2 * old->len, 0);
+ str = zend_string_alloc(2 * old->len, 0);
for (p = old->val, q = str->val; p != old_end; p++) {
c = *p;
@@ -2625,7 +2610,7 @@ PHP_FUNCTION(quotemeta)
*q = '\0';
- RETURN_NEW_STR(STR_REALLOC(str, q - str->val, 0));
+ RETURN_NEW_STR(zend_string_realloc(str, q - str->val, 0));
}
/* }}} */
@@ -2633,8 +2618,8 @@ PHP_FUNCTION(quotemeta)
Returns ASCII value of character */
PHP_FUNCTION(ord)
{
- char *str;
- int str_len;
+ char *str;
+ size_t str_len;
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
@@ -2646,7 +2631,7 @@ PHP_FUNCTION(ord)
ZEND_PARSE_PARAMETERS_END();
#endif
- RETURN_INT((unsigned char) str[0]);
+ RETURN_LONG((unsigned char) str[0]);
}
/* }}} */
@@ -2654,14 +2639,14 @@ PHP_FUNCTION(ord)
Converts ASCII code to a character */
PHP_FUNCTION(chr)
{
- php_int_t c;
+ zend_long c;
char temp[2];
if (ZEND_NUM_ARGS() != 1) {
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i", &c) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) {
c = 0;
}
@@ -2743,7 +2728,7 @@ PHP_FUNCTION(ucwords)
zend_string *str;
char *delims = " \t\r\n\f\v";
register char *r, *r_end;
- int delims_len = 6;
+ size_t delims_len = 6;
char mask[256];
#ifndef FAST_ZPP
@@ -2768,7 +2753,7 @@ PHP_FUNCTION(ucwords)
r = Z_STRVAL_P(return_value);
*r = toupper((unsigned char) *r);
- for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) {
+ for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) {
if (mask[(unsigned char)*r++]) {
*r = toupper((unsigned char) *r);
}
@@ -2778,9 +2763,9 @@ PHP_FUNCTION(ucwords)
/* {{{ php_strtr
*/
-PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen)
+PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen)
{
- php_size_t i;
+ size_t i;
unsigned char xlat[256];
if ((trlen < 1) || (len < 1)) {
@@ -2811,14 +2796,14 @@ static int php_strtr_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{
/* }}} */
/* {{{ php_strtr_array */
-static void php_strtr_array(zval *return_value, char *str, php_size_t slen, HashTable *pats TSRMLS_DC)
+static void php_strtr_array(zval *return_value, char *str, size_t slen, HashTable *pats TSRMLS_DC)
{
- php_uint_t num_key;
+ zend_ulong num_key;
zend_string *str_key;
- php_size_t len, pos, found;
+ size_t len, pos, found;
int num_keys = 0;
- php_size_t minlen = 128*1024;
- php_size_t maxlen = 0;
+ size_t minlen = 128*1024;
+ size_t maxlen = 0;
HashTable str_hash, num_hash;
zval *entry, tmp, dummy;
char *key;
@@ -2856,7 +2841,7 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash
zend_hash_init(&str_hash, zend_hash_num_elements(pats), NULL, NULL, 0);
ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) {
if (UNEXPECTED(!str_key)) {
- ZVAL_INT(&tmp, num_key);
+ ZVAL_LONG(&tmp, num_key);
convert_to_string(&tmp);
str_key = Z_STR(tmp);
len = str_key->len;
@@ -2912,10 +2897,10 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash
entry = zend_hash_str_find(pats, key, len);
if (entry != NULL) {
zend_string *str = zval_get_string(entry);
- smart_str_appendl(&result, str->val, str->len);
+ smart_str_append(&result, str);
pos += len;
found = 1;
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
} ZEND_HASH_FOREACH_END();
@@ -2937,10 +2922,10 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash
entry = zend_hash_str_find(pats, key, len);
if (entry != NULL) {
zend_string *str = zval_get_string(entry);
- smart_str_appendl(&result, str->val, str->len);
+ smart_str_append(&result, str);
pos += len;
found = 1;
- STR_RELEASE(str);
+ zend_string_release(str);
break;
}
}
@@ -2966,7 +2951,7 @@ PHP_FUNCTION(strtr)
{
zval *from;
char *str, *to = NULL;
- int str_len, to_len = 0;
+ size_t str_len, to_len = 0;
int ac = ZEND_NUM_ARGS();
#ifndef FAST_ZPP
@@ -3000,10 +2985,10 @@ PHP_FUNCTION(strtr)
ZVAL_STRINGL(return_value, str, str_len);
php_strtr(Z_STRVAL_P(return_value),
- Z_STRSIZE_P(return_value),
+ Z_STRLEN_P(return_value),
Z_STRVAL_P(from),
to,
- MIN(Z_STRSIZE_P(from),
+ MIN(Z_STRLEN_P(from),
to_len));
}
}
@@ -3021,7 +3006,7 @@ PHP_FUNCTION(strrev)
return;
}
- n = STR_ALLOC(str->len, 0);
+ n = zend_string_alloc(str->len, 0);
p = n->val;
e = str->val + str->len;
@@ -3038,12 +3023,12 @@ PHP_FUNCTION(strrev)
/* {{{ php_similar_str
*/
-static void php_similar_str(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2, php_size_t *pos1, php_size_t *pos2, php_size_t *max)
+static void php_similar_str(const char *txt1, size_t len1, const char *txt2, size_t len2, size_t *pos1, size_t *pos2, size_t *max)
{
char *p, *q;
char *end1 = (char *) txt1 + len1;
char *end2 = (char *) txt2 + len2;
- php_size_t l;
+ size_t l;
*max = 0;
for (p = (char *) txt1; p < end1; p++) {
@@ -3061,10 +3046,10 @@ static void php_similar_str(const char *txt1, php_size_t len1, const char *txt2,
/* {{{ php_similar_char
*/
-static php_size_t php_similar_char(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2)
+static size_t php_similar_char(const char *txt1, size_t len1, const char *txt2, size_t len2)
{
- php_size_t sum;
- php_size_t pos1 = 0, pos2 = 0, max;
+ size_t sum;
+ size_t pos1 = 0, pos2 = 0, max;
php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
if ((sum = max)) {
@@ -3089,7 +3074,7 @@ PHP_FUNCTION(similar_text)
zend_string *t1, *t2;
zval *percent = NULL;
int ac = ZEND_NUM_ARGS();
- php_size_t sim;
+ size_t sim;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/", &t1, &t2, &percent) == FAILURE) {
return;
@@ -3104,7 +3089,7 @@ PHP_FUNCTION(similar_text)
Z_DVAL_P(percent) = 0;
}
- RETURN_INT(0);
+ RETURN_LONG(0);
}
sim = php_similar_char(t1->val, t1->len, t2->val, t2->len);
@@ -3113,17 +3098,17 @@ PHP_FUNCTION(similar_text)
Z_DVAL_P(percent) = sim * 200.0 / (t1->len + t2->len);
}
- RETURN_INT(sim);
+ RETURN_LONG(sim);
}
/* }}} */
/* {{{ php_stripslashes
*
* be careful, this edits the string in-place */
-PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC)
+PHPAPI void php_stripslashes(char *str, size_t *len TSRMLS_DC)
{
char *s, *t;
- php_size_t l;
+ size_t l;
if (len != NULL) {
l = *len;
@@ -3217,7 +3202,7 @@ PHP_FUNCTION(stripcslashes)
}
ZVAL_STRINGL(return_value, str->val, str->len);
- php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value));
+ php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value));
}
/* }}} */
@@ -3232,7 +3217,7 @@ PHP_FUNCTION(stripslashes)
}
ZVAL_STRINGL(return_value, str->val, str->len);
- php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC);
+ php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC);
}
/* }}} */
@@ -3257,10 +3242,10 @@ char *php_strerror(int errnum)
/* {{{ php_stripcslashes
*/
-PHPAPI void php_stripcslashes(char *str, php_size_t *len)
+PHPAPI void php_stripcslashes(char *str, size_t *len)
{
char *source, *target, *end;
- php_size_t nlen = *len, i;
+ size_t nlen = *len, i;
char numtmp[4];
for (source=str, end=str+nlen, target=str; source < end; source++) {
@@ -3320,14 +3305,14 @@ PHPAPI void php_stripcslashes(char *str, php_size_t *len)
/* {{{ php_addcslashes
*/
-PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int should_free, char *what, php_size_t wlength TSRMLS_DC)
+PHPAPI zend_string *php_addcslashes(const char *str, size_t length, int should_free, char *what, size_t wlength TSRMLS_DC)
{
char flags[256];
char *source, *target;
char *end;
char c;
- php_size_t newlen;
- zend_string *new_str = STR_ALLOC(4 * (length? length : (length = strlen(str))), 0);
+ size_t newlen;
+ zend_string *new_str = zend_string_alloc(4 * (length? length : (length = strlen(str))), 0);
if (!wlength) {
wlength = strlen(what);
@@ -3359,7 +3344,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int shou
*target = 0;
newlen = target - new_str->val;
if (newlen < length * 4) {
- new_str = STR_REALLOC(new_str, newlen, 0);
+ new_str = zend_string_realloc(new_str, newlen, 0);
}
if (should_free) {
efree((char*)str);
@@ -3370,7 +3355,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int shou
/* {{{ php_addslashes
*/
-PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC)
+PHPAPI zend_string *php_addslashes(char *str, size_t length, int should_free TSRMLS_DC)
{
/* maximum string length, worst case situation */
char *source, *target;
@@ -3381,7 +3366,7 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free
return STR_EMPTY_ALLOC();
}
- new_str = STR_ALLOC(2 * (length ? length : (length = strlen(str))), 0);
+ new_str = zend_string_alloc(2 * (length ? length : (length = strlen(str))), 0);
source = str;
end = source + length;
target = new_str->val;
@@ -3409,7 +3394,7 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free
if (should_free) {
efree(str);
}
- new_str = STR_REALLOC(new_str, target - new_str->val, 0);
+ new_str = zend_string_realloc(new_str, target - new_str->val, 0);
return new_str;
}
@@ -3423,10 +3408,10 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free
/* {{{ php_char_to_str_ex
*/
-PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count)
+PHPAPI size_t php_char_to_str_ex(char *str, size_t len, char from, char *to, size_t to_len, zval *result, int case_sensitivity, size_t *replace_count)
{
- php_size_t char_count = 0;
- php_size_t replaced = 0;
+ size_t char_count = 0;
+ size_t replaced = 0;
char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL;
if (case_sensitivity) {
@@ -3449,9 +3434,9 @@ PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char
}
if (to_len > 0) {
- ZVAL_NEW_STR(result, STR_SAFE_ALLOC(char_count, to_len - 1, len, 0));
+ ZVAL_NEW_STR(result, zend_string_safe_alloc(char_count, to_len - 1, len, 0));
} else {
- ZVAL_NEW_STR(result, STR_ALLOC(len - char_count, 0));
+ ZVAL_NEW_STR(result, zend_string_alloc(len - char_count, 0));
}
target = Z_STRVAL_P(result);
@@ -3496,7 +3481,7 @@ PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char
/* {{{ php_char_to_str
*/
-PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result)
+PHPAPI size_t php_char_to_str(char *str, size_t len, char from, char *to, size_t to_len, zval *result)
{
return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL);
}
@@ -3504,8 +3489,8 @@ PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to
/* {{{ php_str_to_str_ex
*/
-PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length,
- char *needle, php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count)
+PHPAPI zend_string *php_str_to_str_ex(char *haystack, size_t length,
+ char *needle, size_t needle_len, char *str, size_t str_len, int case_sensitivity, size_t *replace_count)
{
zend_string *new_str;
@@ -3514,7 +3499,7 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length,
char *e, *s, *p, *r;
if (needle_len == str_len) {
- new_str = STR_INIT(haystack, length, 0);
+ new_str = zend_string_init(haystack, length, 0);
if (case_sensitivity) {
end = new_str->val + length;
@@ -3549,9 +3534,9 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length,
}
if (str_len < needle_len) {
- new_str = STR_ALLOC(length, 0);
+ new_str = zend_string_alloc(length, 0);
} else {
- php_size_t count = 0;
+ size_t count = 0;
char *o, *n, *endp;
if (case_sensitivity) {
@@ -3575,10 +3560,10 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length,
if (needle_dup) {
efree(needle_dup);
}
- new_str = STR_INIT(haystack, length, 0);
+ new_str = zend_string_init(haystack, length, 0);
return new_str;
} else {
- new_str = STR_ALLOC(count * (str_len - needle_len) + length, 0);
+ new_str = zend_string_alloc(count * (str_len - needle_len) + length, 0);
}
}
@@ -3628,12 +3613,12 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length,
*e = '\0';
- new_str = STR_REALLOC(new_str, e - s, 0);
+ new_str = zend_string_realloc(new_str, e - s, 0);
return new_str;
}
} else if (needle_len > length) {
nothing_todo:
- new_str = STR_INIT(haystack, length, 0);
+ new_str = zend_string_init(haystack, length, 0);
return new_str;
} else {
if (case_sensitivity && memcmp(haystack, needle, length)) {
@@ -3656,7 +3641,7 @@ nothing_todo:
efree(l_needle);
}
- new_str = STR_INIT(str, str_len, 0);
+ new_str = zend_string_init(str, str_len, 0);
if (replace_count) {
(*replace_count)++;
@@ -3669,7 +3654,7 @@ nothing_todo:
/* {{{ php_str_to_str
*/
-PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle, php_size_t needle_len, char *str, php_size_t str_len)
+PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle, size_t needle_len, char *str, size_t str_len)
{
return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, 1, NULL);
}
@@ -3677,14 +3662,14 @@ PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *need
/* {{{ php_str_replace_in_subject
*/
-static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, php_size_t *replace_count TSRMLS_DC)
+static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, size_t *replace_count TSRMLS_DC)
{
zval *search_entry,
*replace_entry = NULL,
temp_result,
tmp_subject;
char *replace_value = NULL;
- php_size_t replace_len = 0;
+ size_t replace_len = 0;
HashPosition pos;
/* Make sure we're dealing with strings. */
@@ -3697,7 +3682,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
convert_to_string_ex(&tmp_subject);
subject = &tmp_subject;
}
- if (Z_STRSIZE_P(subject) == 0) {
+ if (Z_STRLEN_P(subject) == 0) {
zval_ptr_dtor(&tmp_subject);
ZVAL_EMPTY_STRING(result);
return;
@@ -3714,7 +3699,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
} else {
/* Set replacement value to the passed one */
replace_value = Z_STRVAL_P(replace);
- replace_len = Z_STRSIZE_P(replace);
+ replace_len = Z_STRLEN_P(replace);
}
/* For each entry in the search array, get the entry */
@@ -3722,7 +3707,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
/* Make sure we're dealing with strings. */
SEPARATE_ZVAL(search_entry);
convert_to_string(search_entry);
- if (Z_STRSIZE_P(search_entry) == 0) {
+ if (Z_STRLEN_P(search_entry) == 0) {
if (Z_TYPE_P(replace) == IS_ARRAY) {
zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos);
}
@@ -3738,7 +3723,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
/* Set replacement value to the one we got from array */
replace_value = Z_STRVAL_P(replace_entry);
- replace_len = Z_STRSIZE_P(replace_entry);
+ replace_len = Z_STRLEN_P(replace_entry);
zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos);
} else {
@@ -3748,44 +3733,44 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec
}
}
- if (Z_STRSIZE_P(search_entry) == 1) {
+ if (Z_STRLEN_P(search_entry) == 1) {
php_char_to_str_ex(Z_STRVAL_P(result),
- Z_STRSIZE_P(result),
+ Z_STRLEN_P(result),
Z_STRVAL_P(search_entry)[0],
replace_value,
replace_len,
&temp_result,
case_sensitivity,
replace_count);
- } else if (Z_STRSIZE_P(search_entry) > 1) {
- ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result),
- Z_STRVAL_P(search_entry), Z_STRSIZE_P(search_entry),
+ } else if (Z_STRLEN_P(search_entry) > 1) {
+ ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result),
+ Z_STRVAL_P(search_entry), Z_STRLEN_P(search_entry),
replace_value, replace_len, case_sensitivity, replace_count));
}
- STR_FREE(Z_STR_P(result));
+ zend_string_free(Z_STR_P(result));
Z_STR_P(result) = Z_STR(temp_result);
Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result);
- if (Z_STRSIZE_P(result) == 0) {
+ if (Z_STRLEN_P(result) == 0) {
zval_ptr_dtor(&tmp_subject);
return;
}
} ZEND_HASH_FOREACH_END();
} else {
- if (Z_STRSIZE_P(search) == 1) {
+ if (Z_STRLEN_P(search) == 1) {
php_char_to_str_ex(Z_STRVAL_P(subject),
- Z_STRSIZE_P(subject),
+ Z_STRLEN_P(subject),
Z_STRVAL_P(search)[0],
Z_STRVAL_P(replace),
- Z_STRSIZE_P(replace),
+ Z_STRLEN_P(replace),
result,
case_sensitivity,
replace_count);
- } else if (Z_STRSIZE_P(search) > 1) {
- ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRSIZE_P(subject),
- Z_STRVAL_P(search), Z_STRSIZE_P(search),
- Z_STRVAL_P(replace), Z_STRSIZE_P(replace), case_sensitivity, replace_count));
+ } else if (Z_STRLEN_P(search) > 1) {
+ ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRLEN_P(subject),
+ Z_STRVAL_P(search), Z_STRLEN_P(search),
+ Z_STRVAL_P(replace), Z_STRLEN_P(replace), case_sensitivity, replace_count));
} else {
ZVAL_DUP(result, subject);
}
@@ -3801,8 +3786,8 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
zval *subject, *search, *replace, *subject_entry, *zcount = NULL;
zval result;
zend_string *string_key;
- php_uint_t num_key;
- php_int_t count = 0;
+ zend_ulong num_key;
+ size_t count = 0;
int argc = ZEND_NUM_ARGS();
#ifndef FAST_ZPP
@@ -3856,7 +3841,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
}
if (argc > 3) {
zval_dtor(zcount);
- ZVAL_INT(zcount, count);
+ ZVAL_LONG(zcount, count);
}
}
/* }}} */
@@ -3886,13 +3871,13 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
{
char *str;
char *heb_str, *tmp, *target;
- int block_start, block_end, block_type, block_length, i;
- php_int_t max_chars=0;
- int begin, end, char_count, orig_begin;
- int str_len;
+ size_t block_start, block_end, block_type, block_length, i;
+ zend_long max_chars=0;
+ size_t begin, end, char_count, orig_begin;
+ size_t str_len;
zend_string *broken_str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &max_chars) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) {
return;
}
@@ -3923,8 +3908,8 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
block_end++;
block_length++;
}
- for (i = block_start; i<= block_end; i++) {
- *target = str[i];
+ for (i = block_start+1; i<= block_end+1; i++) {
+ *target = str[i-1];
switch (*target) {
case '(':
*target = ')';
@@ -3972,8 +3957,8 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
tmp--;
block_end--;
}
- for (i = block_end; i >= block_start; i--) {
- *target = str[i];
+ for (i = block_end+1; i >= block_start+1; i--) {
+ *target = str[i-1];
target--;
}
block_type = _HEB_BLOCK_TYPE_HEB;
@@ -3982,13 +3967,13 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
} while (block_end < str_len-1);
- broken_str = STR_ALLOC(str_len, 0);
+ broken_str = zend_string_alloc(str_len, 0);
begin = end = str_len-1;
target = broken_str->val;
while (1) {
char_count=0;
- while ((!max_chars || char_count < max_chars) && begin > 0) {
+ while ((!max_chars || (max_chars > 0 && char_count < max_chars)) && begin > 0) {
char_count++;
begin--;
if (begin <= 0 || _isnewline(heb_str[begin])) {
@@ -3999,8 +3984,8 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
break;
}
}
- if (char_count == max_chars) { /* try to avoid breaking words */
- int new_char_count=char_count, new_begin=begin;
+ if (max_chars >= 0 && char_count == max_chars) { /* try to avoid breaking words */
+ size_t new_char_count=char_count, new_begin=begin;
while (new_char_count > 0) {
if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) {
@@ -4042,7 +4027,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
if (convert_newlines) {
php_char_to_str(broken_str->val, broken_str->len,'\n', "<br />\n", 7, return_value);
- STR_FREE(broken_str);
+ zend_string_free(broken_str);
} else {
RETURN_NEW_STR(broken_str);
}
@@ -4073,7 +4058,7 @@ PHP_FUNCTION(nl2br)
char *tmp;
zend_string *str;
char *end, *target;
- php_size_t repl_cnt = 0;
+ size_t repl_cnt = 0;
zend_bool is_xhtml = 1;
zend_string *result;
@@ -4109,7 +4094,7 @@ PHP_FUNCTION(nl2br)
{
size_t repl_len = is_xhtml ? (sizeof("<br />") - 1) : (sizeof("<br>") - 1);
- result = STR_ALLOC(repl_cnt * repl_len + str->len, 0);
+ result = zend_string_alloc(repl_cnt * repl_len + str->len, 0);
target = result->val;
}
@@ -4154,7 +4139,7 @@ PHP_FUNCTION(strip_tags)
zend_string *str;
zval *allow=NULL;
char *allowed_tags=NULL;
- int allowed_tags_len=0;
+ size_t allowed_tags_len=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &str, &allow) == FAILURE) {
return;
@@ -4164,20 +4149,20 @@ PHP_FUNCTION(strip_tags)
if (allow != NULL) {
convert_to_string_ex(allow);
// TODO: reimplement to avoid reallocation ???
- if (IS_INTERNED(Z_STR_P(allow))) {
- allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRSIZE_P(allow));
- allowed_tags_len = Z_STRSIZE_P(allow);
+ if (!Z_REFCOUNTED_P(allow)) {
+ allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow));
+ allowed_tags_len = Z_STRLEN_P(allow);
} else {
allowed_tags = Z_STRVAL_P(allow);
- allowed_tags_len = Z_STRSIZE_P(allow);
+ allowed_tags_len = Z_STRLEN_P(allow);
}
}
- buf = STR_INIT(str->val, str->len, 0);
+ buf = zend_string_init(str->val, str->len, 0);
buf->len = php_strip_tags_ex(buf->val, str->len, NULL, allowed_tags, allowed_tags_len, 0);
// TODO: reimplement to avoid reallocation ???
- if (allow && IS_INTERNED(Z_STR_P(allow))) {
+ if (allow && !Z_REFCOUNTED_P(allow)) {
efree(allowed_tags);
}
RETURN_STR(buf);
@@ -4199,8 +4184,8 @@ PHP_FUNCTION(setlocale)
}
#ifdef HAVE_SETLOCALE
- if (Z_TYPE_P(pcategory) == IS_INT) {
- cat = Z_IVAL_P(pcategory);
+ if (Z_TYPE_P(pcategory) == IS_LONG) {
+ cat = Z_LVAL_P(pcategory);
} else {
/* FIXME: The following behaviour should be removed. */
char *category;
@@ -4261,7 +4246,7 @@ PHP_FUNCTION(setlocale)
loc = NULL;
} else {
loc = Z_STRVAL(tmp);
- if (Z_STRSIZE(tmp) >= 255) {
+ if (Z_STRLEN(tmp) >= 255) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long");
zval_dtor(&tmp);
break;
@@ -4273,7 +4258,7 @@ PHP_FUNCTION(setlocale)
if (retval) {
/* Remember if locale was changed */
if (loc) {
-//??? STR_FREE(BG(locale_string));
+//??? zend_string_free(BG(locale_string));
if (BG(locale_string)) {
efree(BG(locale_string));
}
@@ -4304,7 +4289,7 @@ PHP_FUNCTION(parse_str)
char *arg;
zval *arrayArg = NULL;
char *res = NULL;
- int arglen;
+ size_t arglen;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &arg, &arglen, &arrayArg) == FAILURE) {
return;
@@ -4341,7 +4326,7 @@ PHP_FUNCTION(parse_str)
* 0 start tag
* 1 first non-whitespace char seen
*/
-int php_tag_find(char *tag, php_size_t len, char *set) {
+int php_tag_find(char *tag, size_t len, char *set) {
char c, *n, *t;
int state=0, done=0;
char *norm;
@@ -4396,7 +4381,7 @@ int php_tag_find(char *tag, php_size_t len, char *set) {
}
/* }}} */
-PHPAPI php_size_t php_strip_tags(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len) /* {{{ */
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len) /* {{{ */
{
return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0);
}
@@ -4422,11 +4407,12 @@ PHPAPI php_size_t php_strip_tags(char *rbuf, php_size_t len, int *stateptr, char
swm: Added ability to strip <?xml tags without assuming it PHP
code.
*/
-PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces)
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len, zend_bool allow_tag_spaces)
{
char *tbuf, *buf, *p, *tp, *rp, c, lc;
- int br, i=0, depth=0, in_q = 0;
- int state = 0, pos;
+ int br, depth=0, in_q = 0;
+ int state = 0;
+ size_t pos, i = 0;
char *allow_free = NULL;
if (stateptr)
@@ -4703,7 +4689,7 @@ PHP_FUNCTION(str_getcsv)
zend_string *str;
char delim = ',', enc = '"', esc = '\\';
char *delim_str = NULL, *enc_str = NULL, *esc_str = NULL;
- int delim_len = 0, enc_len = 0, esc_len = 0;
+ size_t delim_len = 0, enc_len = 0, esc_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|sss", &str, &delim_str, &delim_len,
&enc_str, &enc_len, &esc_str, &esc_len) == FAILURE) {
@@ -4723,11 +4709,11 @@ PHP_FUNCTION(str_getcsv)
PHP_FUNCTION(str_repeat)
{
zend_string *input_str; /* Input string */
- php_int_t mult; /* Multiplier */
+ zend_long mult; /* Multiplier */
zend_string *result; /* Resulting string */
size_t result_len; /* Length of the resulting string */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si", &input_str, &mult) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl", &input_str, &mult) == FAILURE) {
return;
}
@@ -4742,7 +4728,7 @@ PHP_FUNCTION(str_repeat)
RETURN_EMPTY_STRING();
/* Initialize the result string */
- result = STR_SAFE_ALLOC(input_str->len, mult, 0, 0);
+ result = zend_string_safe_alloc(input_str->len, mult, 0, 0);
result_len = input_str->len * mult;
/* Heavy optimization for situations where input string is 1 byte long */
@@ -4775,14 +4761,14 @@ PHP_FUNCTION(count_chars)
{
zend_string *input;
int chars[256];
- php_int_t mymode=0;
+ zend_long mymode=0;
unsigned char *buf;
int inx;
char retstr[256];
- php_size_t retlen=0;
- php_size_t tmp = 0;
+ size_t retlen=0;
+ size_t tmp = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &input, &mymode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &input, &mymode) == FAILURE) {
return;
}
@@ -4807,16 +4793,16 @@ PHP_FUNCTION(count_chars)
for (inx = 0; inx < 256; inx++) {
switch (mymode) {
case 0:
- add_index_int(return_value, inx, chars[inx]);
+ add_index_long(return_value, inx, chars[inx]);
break;
case 1:
if (chars[inx] != 0) {
- add_index_int(return_value, inx, chars[inx]);
+ add_index_long(return_value, inx, chars[inx]);
}
break;
case 2:
if (chars[inx] == 0) {
- add_index_int(return_value, inx, chars[inx]);
+ add_index_long(return_value, inx, chars[inx]);
}
break;
case 3:
@@ -4848,7 +4834,7 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
return;
}
- RETURN_INT(strnatcmp_ex(s1->val, s1->len,
+ RETURN_LONG(strnatcmp_ex(s1->val, s1->len,
s2->val, s2->len,
fold_case));
}
@@ -4859,10 +4845,10 @@ PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2
zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2);
- ZVAL_INT(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive));
+ ZVAL_LONG(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive));
- STR_RELEASE(str1);
- STR_RELEASE(str2);
+ zend_string_release(str1);
+ zend_string_release(str2);
return SUCCESS;
}
/* }}} */
@@ -4913,14 +4899,14 @@ PHP_FUNCTION(localeconv)
len = strlen(currlocdata.grouping);
for (i = 0; i < len; i++) {
- add_index_int(&grouping, i, currlocdata.grouping[i]);
+ add_index_long(&grouping, i, currlocdata.grouping[i]);
}
/* Grab the monetary grouping data out of the array */
len = strlen(currlocdata.mon_grouping);
for (i = 0; i < len; i++) {
- add_index_int(&mon_grouping, i, currlocdata.mon_grouping[i]);
+ add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]);
}
add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point);
@@ -4931,21 +4917,21 @@ PHP_FUNCTION(localeconv)
add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep);
add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign);
add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign);
- add_assoc_int( return_value, "int_frac_digits", currlocdata.int_frac_digits);
- add_assoc_int( return_value, "frac_digits", currlocdata.frac_digits);
- add_assoc_int( return_value, "p_cs_precedes", currlocdata.p_cs_precedes);
- add_assoc_int( return_value, "p_sep_by_space", currlocdata.p_sep_by_space);
- add_assoc_int( return_value, "n_cs_precedes", currlocdata.n_cs_precedes);
- add_assoc_int( return_value, "n_sep_by_space", currlocdata.n_sep_by_space);
- add_assoc_int( return_value, "p_sign_posn", currlocdata.p_sign_posn);
- add_assoc_int( return_value, "n_sign_posn", currlocdata.n_sign_posn);
+ add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits);
+ add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits);
+ add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes);
+ add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space);
+ add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes);
+ add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space);
+ add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn);
+ add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn);
}
#else
/* Ok, it doesn't look like we have locale info floating around, so I guess it
wouldn't hurt to just go ahead and return the POSIX locale information? */
- add_index_int(&grouping, 0, -1);
- add_index_int(&mon_grouping, 0, -1);
+ add_index_long(&grouping, 0, -1);
+ add_index_long(&mon_grouping, 0, -1);
add_assoc_string(return_value, "decimal_point", "\x2E");
add_assoc_string(return_value, "thousands_sep", "");
@@ -4955,14 +4941,14 @@ PHP_FUNCTION(localeconv)
add_assoc_string(return_value, "mon_thousands_sep", "");
add_assoc_string(return_value, "positive_sign", "");
add_assoc_string(return_value, "negative_sign", "");
- add_assoc_int( return_value, "int_frac_digits", CHAR_MAX);
- add_assoc_int( return_value, "frac_digits", CHAR_MAX);
- add_assoc_int( return_value, "p_cs_precedes", CHAR_MAX);
- add_assoc_int( return_value, "p_sep_by_space", CHAR_MAX);
- add_assoc_int( return_value, "n_cs_precedes", CHAR_MAX);
- add_assoc_int( return_value, "n_sep_by_space", CHAR_MAX);
- add_assoc_int( return_value, "p_sign_posn", CHAR_MAX);
- add_assoc_int( return_value, "n_sign_posn", CHAR_MAX);
+ add_assoc_long( return_value, "int_frac_digits", CHAR_MAX);
+ add_assoc_long( return_value, "frac_digits", CHAR_MAX);
+ add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX);
+ add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX);
+ add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX);
+ add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX);
+ add_assoc_long( return_value, "p_sign_posn", CHAR_MAX);
+ add_assoc_long( return_value, "n_sign_posn", CHAR_MAX);
#endif
zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping);
@@ -4983,13 +4969,13 @@ PHP_FUNCTION(strnatcasecmp)
PHP_FUNCTION(substr_count)
{
char *haystack, *needle;
- php_int_t offset = 0, length = 0;
+ zend_long offset = 0, length = 0;
int ac = ZEND_NUM_ARGS();
int count = 0;
- int haystack_len, needle_len;
+ size_t haystack_len, needle_len;
char *p, *endp, cmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ii", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) {
return;
}
@@ -5006,8 +4992,8 @@ PHP_FUNCTION(substr_count)
RETURN_FALSE;
}
- if (offset > haystack_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value " ZEND_INT_FMT " exceeds string length", offset);
+ if ((size_t)offset > haystack_len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value " ZEND_LONG_FMT " exceeds string length", offset);
RETURN_FALSE;
}
p += offset;
@@ -5019,7 +5005,7 @@ PHP_FUNCTION(substr_count)
RETURN_FALSE;
}
if (length > (haystack_len - offset)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value " ZEND_INT_FMT " exceeds string length", length);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value " ZEND_LONG_FMT " exceeds string length", length);
RETURN_FALSE;
}
endp = p + length;
@@ -5039,7 +5025,7 @@ PHP_FUNCTION(substr_count)
}
}
- RETURN_INT(count);
+ RETURN_LONG(count);
}
/* }}} */
@@ -5049,36 +5035,27 @@ PHP_FUNCTION(str_pad)
{
/* Input arguments */
zend_string *input; /* Input string */
- php_int_t pad_length; /* Length to pad to */
+ zend_long pad_length; /* Length to pad to */
/* Helper variables */
size_t num_pad_chars; /* Number of padding characters (total - input size) */
- zend_string *pad_str, *pad_str_save; /* Pointer to padding string */
- php_int_t pad_type_val = STR_PAD_RIGHT; /* The padding type value */
- int i, left_pad=0, right_pad=0;
+ char *pad_str = " "; /* Pointer to padding string */
+ size_t pad_str_len = 1;
+ zend_long pad_type_val = STR_PAD_RIGHT; /* The padding type value */
+ size_t i, left_pad=0, right_pad=0;
zend_string *result = NULL; /* Resulting string */
- pad_str = pad_str_save = STR_INIT(" ", 1, 1);
- if (!pad_str) {
- return;
- }
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|Si", &input, &pad_length, &pad_str, &pad_type_val) == FAILURE) {
- STR_FREE(pad_str);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|sl", &input, &pad_length, &pad_str, &pad_str_len, &pad_type_val) == FAILURE) {
return;
}
- if (pad_str != pad_str_save) {
- STR_FREE(pad_str_save);
- }
-
/* If resulting string turns out to be shorter than input string,
we simply copy the input and return. */
- if (pad_length < 0 || pad_length <= input->len) {
+ if (pad_length < 0 || (size_t)pad_length <= input->len) {
RETURN_STRINGL(input->val, input->len);
}
- if (pad_str->len == 0) {
+ if (pad_str_len == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty");
return;
}
@@ -5094,7 +5071,7 @@ PHP_FUNCTION(str_pad)
return;
}
- result = STR_ALLOC(input->len + num_pad_chars, 0);
+ result = zend_string_alloc(input->len + num_pad_chars, 0);
result->len = 0;
/* We need to figure out the left/right padding lengths. */
@@ -5117,7 +5094,7 @@ PHP_FUNCTION(str_pad)
/* First we pad on the left. */
for (i = 0; i < left_pad; i++)
- result->val[result->len++] = pad_str->val[i % pad_str->len];
+ result->val[result->len++] = pad_str[i % pad_str_len];
/* Then we copy the input string. */
memcpy(result->val + result->len, input->val, input->len);
@@ -5125,7 +5102,7 @@ PHP_FUNCTION(str_pad)
/* Finally, we pad on the right. */
for (i = 0; i < right_pad; i++)
- result->val[result->len++] = pad_str->val[i % pad_str->len];
+ result->val[result->len++] = pad_str[i % pad_str_len];
result->val[result->len] = '\0';
@@ -5139,7 +5116,8 @@ PHP_FUNCTION(sscanf)
{
zval *args = NULL;
char *str, *format;
- int str_len, format_len, result, num_args = 0;
+ size_t str_len, format_len;
+ int result, num_args = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss*", &str, &str_len, &format, &format_len,
&args, &num_args) == FAILURE) {
@@ -5169,13 +5147,13 @@ PHP_FUNCTION(str_rot13)
RETVAL_STRINGL(arg->val, arg->len);
- php_strtr(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), rot13_from, rot13_to, 52);
+ php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52);
}
/* }}} */
-static void php_string_shuffle(char *str, php_int_t len TSRMLS_DC) /* {{{ */
+static void php_string_shuffle(char *str, zend_long len TSRMLS_DC) /* {{{ */
{
- php_int_t n_elems, rnd_idx, n_left;
+ zend_long n_elems, rnd_idx, n_left;
char temp;
/* The implementation is stolen from array_data_shuffle */
/* Thus the characteristics of the randomization are the same */
@@ -5210,8 +5188,8 @@ PHP_FUNCTION(str_shuffle)
}
RETVAL_STRINGL(arg->val, arg->len);
- if (Z_STRSIZE_P(return_value) > 1) {
- php_string_shuffle(Z_STRVAL_P(return_value), (php_int_t) Z_STRSIZE_P(return_value) TSRMLS_CC);
+ if (Z_STRLEN_P(return_value) > 1) {
+ php_string_shuffle(Z_STRVAL_P(return_value), (zend_long) Z_STRLEN_P(return_value) TSRMLS_CC);
}
}
/* }}} */
@@ -5231,10 +5209,10 @@ PHP_FUNCTION(str_word_count)
{
zend_string *str;
char *char_list = NULL, *p, *e, *s, ch[256];
- int char_list_len = 0, word_count = 0;
- php_int_t type = 0;
+ size_t char_list_len = 0, word_count = 0;
+ zend_long type = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &type, &char_list, &char_list_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &str, &type, &char_list, &char_list_len) == FAILURE) {
return;
}
@@ -5248,12 +5226,12 @@ PHP_FUNCTION(str_word_count)
break;
case 0:
if (!str->len) {
- RETURN_INT(0);
+ RETURN_LONG(0);
}
/* nothing to be done */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value " ZEND_INT_FMT, type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value " ZEND_LONG_FMT, type);
RETURN_FALSE;
}
@@ -5296,7 +5274,7 @@ PHP_FUNCTION(str_word_count)
}
if (!type) {
- RETURN_INT(word_count);
+ RETURN_LONG(word_count);
}
}
@@ -5307,7 +5285,7 @@ PHP_FUNCTION(str_word_count)
Convert monetary value(s) to string */
PHP_FUNCTION(money_format)
{
- int format_len = 0;
+ size_t format_len = 0;
char *format, *p, *e;
double value;
zend_bool check = 0;
@@ -5331,14 +5309,14 @@ PHP_FUNCTION(money_format)
}
}
- str = STR_ALLOC(format_len + 1024, 0);
+ str = zend_string_alloc(format_len + 1024, 0);
if ((str->len = strfmon(str->val, str->len, format, value)) < 0) {
- STR_FREE(str);
+ zend_string_free(str);
RETURN_FALSE;
}
str->val[str->len] = '\0';
- RETURN_NEW_STR(STR_REALLOC(str, str->len, 0));
+ RETURN_NEW_STR(zend_string_realloc(str, str->len, 0));
}
/* }}} */
#endif
@@ -5348,11 +5326,11 @@ PHP_FUNCTION(money_format)
PHP_FUNCTION(str_split)
{
zend_string *str;
- php_int_t split_length = 1;
+ zend_long split_length = 1;
char *p;
- php_size_t n_reg_segments;
+ size_t n_reg_segments;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &split_length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &split_length) == FAILURE) {
return;
}
@@ -5362,7 +5340,7 @@ PHP_FUNCTION(str_split)
}
- if (0 == str->len || split_length >= str->len) {
+ if (0 == str->len || (size_t)split_length >= str->len) {
array_init_size(return_value, 1);
add_next_index_stringl(return_value, str->val, str->len);
return;
@@ -5417,17 +5395,17 @@ PHP_FUNCTION(strpbrk)
PHP_FUNCTION(substr_compare)
{
zend_string *s1, *s2;
- php_int_t offset, len=0;
+ zend_long offset, len=0;
zend_bool cs=0;
- php_size_t cmp_len;
+ size_t cmp_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi|ib", &s1, &s2, &offset, &len, &cs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl|lb", &s1, &s2, &offset, &len, &cs) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() >= 4 && len <= 0) {
if (len == 0) {
- RETURN_INT(0L);
+ RETURN_LONG(0L);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero");
RETURN_FALSE;
@@ -5439,17 +5417,17 @@ PHP_FUNCTION(substr_compare)
offset = (offset < 0) ? 0 : offset;
}
- if (offset >= s1->len) {
+ if ((size_t)offset >= s1->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length");
RETURN_FALSE;
}
- cmp_len = (php_size_t) (len ? len : MAX(s2->len, (s1->len - offset)));
+ cmp_len = (size_t) (len ? len : MAX(s2->len, (s1->len - offset)));
if (!cs) {
- RETURN_INT(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
+ RETURN_LONG(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
} else {
- RETURN_INT(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
+ RETURN_LONG(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
}
}
/* }}} */
diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c
index face191a6e..de6f727343 100644
--- a/ext/standard/strnatcmp.c
+++ b/ext/standard/strnatcmp.c
@@ -108,8 +108,9 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
int fractional, result;
short leading = 1;
- if (a_len == 0 || b_len == 0)
- return a_len - b_len;
+ if (a_len == 0 || b_len == 0) {
+ return (a_len == b_len ? 0 : (a_len > b_len ? 1 : -1));
+ }
ap = a;
bp = b;
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 65dda069d5..036c189e75 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,59 +41,59 @@
PHP_MINIT_FUNCTION(syslog)
{
/* error levels */
- REGISTER_INT_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
- REGISTER_INT_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
- REGISTER_INT_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */
- REGISTER_INT_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
+ REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
+ REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */
+ REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT);
/* facility: type of program logging the message */
- REGISTER_INT_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */
- REGISTER_INT_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */
- REGISTER_INT_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */
- REGISTER_INT_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */
+ REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */
+ REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */
+ REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT);
#ifdef LOG_NEWS
/* No LOG_NEWS on HP-UX */
- REGISTER_INT_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */
+ REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */
#endif
#ifdef LOG_UUCP
/* No LOG_UUCP on HP-UX */
- REGISTER_INT_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef LOG_CRON
/* apparently some systems don't have this one */
- REGISTER_INT_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef LOG_AUTHPRIV
/* AIX doesn't have LOG_AUTHPRIV */
- REGISTER_INT_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
#endif
#ifndef PHP_WIN32
- REGISTER_INT_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT);
#endif
/* options */
- REGISTER_INT_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
#ifdef LOG_NOWAIT
- REGISTER_INT_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef LOG_PERROR
/* AIX doesn't have LOG_PERROR */
- REGISTER_INT_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
+ REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
#endif
BG(syslog_device)=NULL;
@@ -135,10 +135,10 @@ PHP_MSHUTDOWN_FUNCTION(syslog)
PHP_FUNCTION(openlog)
{
char *ident;
- php_int_t option, facility;
- int ident_len;
+ zend_long option, facility;
+ size_t ident_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii", &ident,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident,
&ident_len, &option, &facility) == FAILURE) {
return;
}
@@ -175,11 +175,11 @@ PHP_FUNCTION(closelog)
Generate a system log message */
PHP_FUNCTION(syslog)
{
- php_int_t priority;
+ zend_long priority;
char *message;
- int message_len;
+ size_t message_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &priority,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &priority,
&message, &message_len) == FAILURE) {
return;
}
diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt
index 316e91d7e6..685547f0ec 100644
--- a/ext/standard/tests/array/array_keys_error.phpt
+++ b/ext/standard/tests/array/array_keys_error.phpt
@@ -9,7 +9,7 @@ var_dump(array_keys("string"));
var_dump(array_keys(new stdclass)); // object
var_dump(array_keys()); // Zero arguments
var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
-var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset
echo "Done\n";
?>
diff --git a/ext/standard/tests/array/array_keys_on_GLOBALS.phpt b/ext/standard/tests/array/array_keys_on_GLOBALS.phpt
new file mode 100644
index 0000000000..1d14ff4d53
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_on_GLOBALS.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Using array_keys() on $GLOBALS
+--FILE--
+<?php
+
+$foo = 'bar';
+unset($foo);
+var_dump(in_array('foo', array_keys($GLOBALS)));
+
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/array/bug26458.phpt b/ext/standard/tests/array/bug26458.phpt
index acdf98b90f..455ab2b345 100644
--- a/ext/standard/tests/array/bug26458.phpt
+++ b/ext/standard/tests/array/bug26458.phpt
Binary files differ
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
index 54b91edd3d..6df2fe4e26 100644
--- a/ext/standard/tests/assert/assert_error3.phpt
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -14,7 +14,7 @@ $sa = "0 $ 0";
var_dump($r2 = assert($sa));
--EXPECTF--
-Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+Parse error: syntax error, %s in %s(3) : assert code on line 1
Catchable fatal error: assert(): Failure evaluating code:
0 $ 0 in %s on line 3
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
index 264cc8fecf..41d404b1f3 100644
--- a/ext/standard/tests/assert/assert_error4.phpt
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -14,7 +14,7 @@ $sa = "0 $ 0";
var_dump($r2 = assert($sa, "Describing what was asserted"));
--EXPECTF--
-Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+Parse error: syntax error, %s in %s(3) : assert code on line 1
Catchable fatal error: assert(): Failure evaluating code:
Describing what was asserted:"0 $ 0" in %s on line 3
diff --git a/ext/standard/tests/file/bug41655_1-win32.phpt b/ext/standard/tests/file/bug41655_1-win32.phpt
new file mode 100644
index 0000000000..631d91079b
--- /dev/null
+++ b/ext/standard/tests/file/bug41655_1-win32.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #41655 (open_basedir bypass via glob()) 1/2
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+?>
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--INI--
+open_basedir=/tmp
+--FILE--
+<?php
+$a=glob("./*.jpeg");
+var_dump($a);
+echo "Done\n";
+?>
+--EXPECT--
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/file/bug41655_1.phpt b/ext/standard/tests/file/bug41655_1.phpt
index 62d64dfb1e..e4466821f9 100644
--- a/ext/standard/tests/file/bug41655_1.phpt
+++ b/ext/standard/tests/file/bug41655_1.phpt
@@ -1,5 +1,11 @@
--TEST--
Bug #41655 (open_basedir bypass via glob()) 1/2
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for Windows');
+}
+?>
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
--INI--
@@ -12,4 +18,4 @@ echo "Done\n";
?>
--EXPECT--
bool(false)
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/file/bug65701.phpt b/ext/standard/tests/file/bug65701.phpt
index 2b1b5d491d..42d8d3e628 100644
--- a/ext/standard/tests/file/bug65701.phpt
+++ b/ext/standard/tests/file/bug65701.phpt
@@ -6,7 +6,9 @@ Boro Sitnikovski <buritomath@yahoo.com>
<?php
$file_path = dirname(__FILE__) . "/bug65701/";
-mkdir($file_path);
+if (!is_dir($file_path)) {
+ mkdir($file_path);
+}
$src = $file_path . '/srcbug65701_file.txt';
$dst = tempnam($file_path, 'dstbug65701_file.txt');
diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt
index 4ecb5213ac..baaa7a65d9 100644
--- a/ext/standard/tests/file/file_put_contents_variation5.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation5.phpt
@@ -48,4 +48,3 @@ File written in working directory
File written in working directory
File written in working directory
===DONE===
-
diff --git a/ext/standard/tests/file/pathinfo_basic1-win32.phpt b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
index 9e84b99790..f783a6b179 100644
--- a/ext/standard/tests/file/pathinfo_basic1-win32.phpt
+++ b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
@@ -99,42 +99,42 @@ array(3) {
}
-- Iteration 3 --
string(2) "c:"
-string(2) "c:"
+string(1) "c"
string(0) ""
-string(2) "c:"
+string(1) "c"
array(3) {
["dirname"]=>
string(2) "c:"
["basename"]=>
- string(2) "c:"
+ string(1) "c"
["filename"]=>
- string(2) "c:"
+ string(1) "c"
}
-- Iteration 4 --
string(3) "c:\"
-string(2) "c:"
+string(1) "c"
string(0) ""
-string(2) "c:"
+string(1) "c"
array(3) {
["dirname"]=>
string(3) "c:\"
["basename"]=>
- string(2) "c:"
+ string(1) "c"
["filename"]=>
- string(2) "c:"
+ string(1) "c"
}
-- Iteration 5 --
string(3) "c:\"
-string(2) "c:"
+string(1) "c"
string(0) ""
-string(2) "c:"
+string(1) "c"
array(3) {
["dirname"]=>
string(3) "c:\"
["basename"]=>
- string(2) "c:"
+ string(1) "c"
["filename"]=>
- string(2) "c:"
+ string(1) "c"
}
-- Iteration 6 --
string(1) "."
diff --git a/ext/standard/tests/file/pathinfo_basic2-win32.phpt b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
index c88bc25ffc..4c2fd2cacf 100644
--- a/ext/standard/tests/file/pathinfo_basic2-win32.phpt
+++ b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
@@ -168,18 +168,18 @@ array(3) {
}
-- Iteration 9 --
string(3) "c:."
-string(11) "c:afile.txt"
+string(9) "afile.txt"
string(3) "txt"
-string(7) "c:afile"
+string(5) "afile"
array(4) {
["dirname"]=>
string(3) "c:."
["basename"]=>
- string(11) "c:afile.txt"
+ string(9) "afile.txt"
["extension"]=>
string(3) "txt"
["filename"]=>
- string(7) "c:afile"
+ string(5) "afile"
}
-- Iteration 10 --
string(12) "..\.\..\test"
@@ -267,4 +267,4 @@ array(3) {
["filename"]=>
string(5) "afile"
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt
index eab2c334c9..0ffc8d58f6 100644
--- a/ext/standard/tests/general_functions/bug41037.phpt
+++ b/ext/standard/tests/general_functions/bug41037.phpt
@@ -8,10 +8,11 @@ function a() {
unregister_tick_function('a');
}
-declare (ticks=1);
-register_tick_function('a');
+declare (ticks=1) {
+ register_tick_function('a');
-echo "Done\n";
+ echo "Done\n";
+}
?>
--EXPECTF--
hello
@@ -19,5 +20,3 @@ Warning: unregister_tick_function(): Unable to delete tick function executed at
Done
hello
Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
-hello
-Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
diff --git a/ext/standard/tests/general_functions/parse_ini_string_003.phpt b/ext/standard/tests/general_functions/parse_ini_string_003.phpt
new file mode 100644
index 0000000000..570570dbfe
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_string_003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+parse_ini_string() typed scanner mode
+--FILE--
+<?php
+
+$contents = <<<EOS
+foo = 1
+bar = 1.3
+baz = null
+qux[] = false
+qux[] = off
+qux[] = something
+qux[] = "something else"
+EOS;
+
+var_dump(parse_ini_string($contents, false, INI_SCANNER_TYPED));
+
+?>
+Done
+--EXPECTF--
+array(4) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ float(1.3)
+ ["baz"]=>
+ NULL
+ ["qux"]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ string(9) "something"
+ [3]=>
+ string(14) "something else"
+ }
+}
+Done
diff --git a/ext/standard/tests/general_functions/proc_nice_variation5.phpt b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
index c22ca56ca4..650b13c60c 100644
--- a/ext/standard/tests/general_functions/proc_nice_variation5.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
@@ -8,6 +8,7 @@ Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+ if(!function_exists('posix_geteuid')) die("skip. posix_geteuid not available ");
if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
?>
--FILE--
diff --git a/ext/standard/tests/serialize/bug68044.phpt b/ext/standard/tests/serialize/bug68044.phpt
new file mode 100644
index 0000000000..031e44e149
--- /dev/null
+++ b/ext/standard/tests/serialize/bug68044.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #68044 Integer overflow in unserialize() (32-bits only)
+--FILE--
+<?php
+ echo unserialize('C:3:"XYZ":18446744075857035259:{}');
+?>
+===DONE==
+--EXPECTF--
+Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
+
+Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
+===DONE==
diff --git a/ext/standard/tests/serialize/counting_of_references.phpt b/ext/standard/tests/serialize/counting_of_references.phpt
new file mode 100644
index 0000000000..e7ead96759
--- /dev/null
+++ b/ext/standard/tests/serialize/counting_of_references.phpt
@@ -0,0 +1,14 @@
+--TEST--
+References are not counted twice
+--FILE--
+<?php
+
+$ref1 = 1;
+$ref2 = 2;
+
+$arr = [&$ref1, &$ref1, &$ref2, &$ref2];
+var_dump(serialize($arr));
+
+?>
+--EXPECT--
+string(38) "a:4:{i:0;i:1;i:1;R:2;i:2;i:2;i:3;R:3;}"
diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt
index f8cef7818e..c62ff6a91c 100644
--- a/ext/standard/tests/serialize/serialization_arrays_002.phpt
+++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt
@@ -37,16 +37,16 @@ check($a);
echo "\n\n--- 0 refs 1:\n";
$a = array();
-$a[0] = &$a[1];
$a[1] = 1;
+$a[0] = &$a[1];
$a[2] = 1;
check($a);
echo "\n\n--- 0 refs 2:\n";
$a = array();
+$a[2] = 1;
$a[0] = &$a[2];
$a[1] = 1;
-$a[2] = 1;
check($a);
echo "\n\n--- 1 refs 0:\n";
@@ -59,8 +59,8 @@ check($a);
echo "\n\n--- 1 refs 2:\n";
$a = array();
$a[0] = 1;
-$a[1] = &$a[2];
$a[2] = 1;
+$a[1] = &$a[2];
check($a);
echo "\n\n--- 2 refs 0:\n";
@@ -79,15 +79,15 @@ check($a);
echo "\n\n--- 0,1 ref 2:\n";
$a = array();
+$a[2] = 1;
$a[0] = &$a[2];
$a[1] = &$a[2];
-$a[2] = 1;
check($a);
echo "\n\n--- 0,2 ref 1:\n";
$a = array();
-$a[0] = &$a[1];
$a[1] = 1;
+$a[0] = &$a[1];
$a[2] = &$a[1];
check($a);
@@ -541,4 +541,4 @@ array(3) {
[2]=>
&string(10) "b2.changed"
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt
index 01b623cb0d..403f9de08c 100644
--- a/ext/standard/tests/serialize/serialization_objects_013.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_013.phpt
@@ -32,16 +32,16 @@ function check(&$obj) {
echo "\n\n--- a refs b:\n";
$obj = new stdClass;
-$obj->a = &$obj->b;
$obj->b = 1;
+$obj->a = &$obj->b;
$obj->c = 1;
check($obj);
echo "\n\n--- a refs c:\n";
$obj = new stdClass;
+$obj->c = 1;
$obj->a = &$obj->c;
$obj->b = 1;
-$obj->c = 1;
check($obj);
echo "\n\n--- b refs a:\n";
@@ -54,8 +54,8 @@ check($obj);
echo "\n\n--- b refs c:\n";
$obj = new stdClass;
$obj->a = 1;
-$obj->b = &$obj->c;
$obj->c = 1;
+$obj->b = &$obj->c;
check($obj);
echo "\n\n--- c refs a:\n";
@@ -74,15 +74,15 @@ check($obj);
echo "\n\n--- a,b refs c:\n";
$obj = new stdClass;
+$obj->c = 1;
$obj->a = &$obj->c;
$obj->b = &$obj->c;
-$obj->c = 1;
check($obj);
echo "\n\n--- a,c refs b:\n";
$obj = new stdClass;
-$obj->a = &$obj->b;
$obj->b = 1;
+$obj->a = &$obj->b;
$obj->c = &$obj->b;
check($obj);
@@ -491,4 +491,4 @@ object(stdClass)#%d (3) {
["c"]=>
&string(14) "obj->c.changed"
}
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/streams/proc_open_bug51800.phpt b/ext/standard/tests/streams/proc_open_bug51800.phpt
new file mode 100644
index 0000000000..53cafd8555
--- /dev/null
+++ b/ext/standard/tests/streams/proc_open_bug51800.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Bug #51800 proc_open on Windows hangs forever
+--SKIPIF--
+<?php
+ echo 'skip expected to fail or take too long';
+ if (getenv("SKIP_SLOW_TESTS")) {
+ die("skip slow test");
+ }
+?>
+--XFAIL--
+pipes have to be read/written simultaneously
+--FILE--
+<?php
+/* This is the wrong way to do it. The parent will block till it has read all the STDIN.
+The smaller the pipe buffer is, the longer it will take. It might even pass at the end,
+after taking inappropriately long. Pipes have to be read simultaneously in smaller chunks,
+so then the pipe buffer is emptied more often and the child has chance to continue its
+write. The behaviour might look some better if write/read in a separate thread, however
+this is much more resource greedy and complexer to integrate into the user script. */
+
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
+$php = PHP_BINARY;
+$cmd = "$php $callee";
+
+$status;
+$stdout = "";
+$stderr = "";
+$pipes = array();
+
+$descriptors = array(
+ 0 => array("pipe", "rb"), // stdin
+ 1 => array("pipe", "wb"), // stdout
+ 2 => array("pipe", "wb") // stderr
+ );
+
+/* create the proc file */
+$r = file_put_contents($callee, '<?php
+
+$how_much = 10000;
+
+$data0 = str_repeat("a", $how_much);
+$data1 = str_repeat("b", $how_much);
+fwrite(STDOUT, $data0);
+fwrite(STDERR, $data1);
+
+exit(0);
+');
+
+if (!$r) {
+ die("couldn't create helper script '$callee'");
+}
+
+$process = proc_open($cmd, $descriptors, $pipes);
+
+if (is_resource($process))
+{
+ fclose($pipes[0]);
+
+ while (!feof($pipes[1]))
+ $stdout .= fread($pipes[1], 1024);
+ fclose($pipes[1]);
+
+ while (!feof($pipes[2]))
+ $stderr .= fread($pipes[2], 1024);
+ fclose($pipes[2]);
+
+ $status = proc_close($process);
+}
+
+var_dump(array(
+ "status" => $status,
+ "stdout" => $stdout,
+ "stderr" => $stderr,
+), strlen($stdout), strlen($stderr));
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
+unlink($callee);
+?>
+--EXPECTF--
+array(3) {
+ ["status"]=>
+ int(0)
+ ["stdout"]=>
+ string(10000) "a%s"
+ ["stderr"]=>
+ string(10000) "b%s"
+}
+int(10000)
+int(10000)
+===DONE===
+
diff --git a/ext/standard/tests/streams/proc_open_bug51800_right.phpt b/ext/standard/tests/streams/proc_open_bug51800_right.phpt
new file mode 100644
index 0000000000..b14fed2e5d
--- /dev/null
+++ b/ext/standard/tests/streams/proc_open_bug51800_right.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Bug #51800 proc_open on Windows hangs forever, the right way to do it
+--FILE--
+<?php
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
+$php = PHP_BINARY;
+$cmd = "$php $callee";
+
+$status;
+$stdout = "";
+$stderr = "";
+$pipes = array();
+
+$descriptors = array(
+ 0 => array("pipe", "rb"), // stdin
+ 1 => array("pipe", "wb"), // stdout
+ 2 => array("pipe", "wb") // stderr
+ );
+
+/* create the proc file */
+$r = file_put_contents($callee, '<?php
+
+$how_much = 10000;
+
+$data0 = str_repeat("a", $how_much);
+$data1 = str_repeat("b", $how_much);
+fwrite(STDOUT, $data0);
+fwrite(STDERR, $data1);
+
+exit(0);
+');
+
+if (!$r) {
+ die("couldn't create helper script '$callee'");
+}
+
+$process = proc_open($cmd, $descriptors, $pipes);
+
+if (is_resource($process))
+{
+ fclose($pipes[0]);
+
+ while (!feof($pipes[1]) || !feof($pipes[2])) {
+ $stdout .= fread($pipes[1], 1024);
+ $stderr .= fread($pipes[2], 1024);
+ }
+ fclose($pipes[1]);
+ fclose($pipes[2]);
+
+ $status = proc_close($process);
+}
+
+var_dump(array(
+ "status" => $status,
+ "stdout" => $stdout,
+ "stderr" => $stderr,
+), strlen($stdout), strlen($stderr));
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
+unlink($callee);
+?>
+--EXPECTF--
+array(3) {
+ ["status"]=>
+ int(0)
+ ["stdout"]=>
+ string(10000) "a%s"
+ ["stderr"]=>
+ string(10000) "b%s"
+}
+int(10000)
+int(10000)
+===DONE===
+
diff --git a/ext/standard/tests/streams/proc_open_bug51800_right2.phpt b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt
new file mode 100644
index 0000000000..1e742745c1
--- /dev/null
+++ b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Bug #51800 proc_open on Windows hangs forever, the right way to do it with more data
+--FILE--
+<?php
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
+$php = PHP_BINARY;
+$cmd = "$php $callee";
+
+$status;
+$stdout = "";
+$stderr = "";
+$pipes = array();
+
+$descriptors = array(
+ 0 => array("pipe", "rb"), // stdin
+ 1 => array("pipe", "wb"), // stdout
+ 2 => array("pipe", "wb") // stderr
+ );
+
+/* create the proc file */
+$r = file_put_contents($callee, '<?php
+$how_much = 1000000;
+
+$data0 = str_repeat("a", $how_much);
+$data1 = str_repeat("b", $how_much);
+$i0 = $i1 = 0;
+$step = 1024;
+
+while ($i0 < strlen($data0) && $i1 < strlen($data1)) {
+ fwrite(STDOUT, substr($data0, $i0, $step));
+ fwrite(STDERR, substr($data1, $i1, $step));
+ $i0 += $step;
+ $i1 += $step;
+}
+
+exit(0);
+');
+
+if (!$r) {
+ die("couldn't create helper script '$callee'");
+}
+
+$process = proc_open($cmd, $descriptors, $pipes);
+
+if (is_resource($process))
+{
+ fclose($pipes[0]);
+
+ while (!feof($pipes[1]) || !feof($pipes[2])) {
+ $stdout .= fread($pipes[1], 1024);
+ $stderr .= fread($pipes[2], 1024);
+ }
+ fclose($pipes[1]);
+ fclose($pipes[2]);
+
+ $status = proc_close($process);
+}
+
+var_dump(array(
+ "status" => $status,
+ "stdout" => $stdout,
+ "stderr" => $stderr,
+), strlen($stdout), strlen($stderr));
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
+unlink($callee);
+?>
+--EXPECTF--
+array(3) {
+ ["status"]=>
+ int(0)
+ ["stdout"]=>
+ string(1000000) "a%s"
+ ["stderr"]=>
+ string(1000000) "b%s"
+}
+int(1000000)
+int(1000000)
+===DONE===
+
diff --git a/ext/standard/tests/streams/proc_open_bug60120.phpt b/ext/standard/tests/streams/proc_open_bug60120.phpt
new file mode 100644
index 0000000000..8768257a2e
--- /dev/null
+++ b/ext/standard/tests/streams/proc_open_bug60120.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Bug #60120 proc_open hangs with stdin/out with 2048+ bytes
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+} else {
+ $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
+}
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ var_dump($data);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+string(2049) "%s"
+string(2049) "%s"
+string(0) ""
+string(0) ""
+===DONE===
+
diff --git a/ext/standard/tests/streams/proc_open_bug64438.phpt b/ext/standard/tests/streams/proc_open_bug64438.phpt
new file mode 100644
index 0000000000..b3857d09d4
--- /dev/null
+++ b/ext/standard/tests/streams/proc_open_bug64438.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Bug #64438 proc_open hangs with stdin/out with 4097+ bytes
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+} else {
+ $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
+}
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 4097);
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ var_dump($data);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+
+?>
+===DONE===
+--EXPECTF--
+string(4097) "%s"
+string(4097) "%s"
+string(0) ""
+string(0) ""
+===DONE===
+
diff --git a/ext/standard/tests/strings/pack64.phpt b/ext/standard/tests/strings/pack64.phpt
new file mode 100644
index 0000000000..9bc24928fe
--- /dev/null
+++ b/ext/standard/tests/strings/pack64.phpt
@@ -0,0 +1,115 @@
+--TEST--
+64bit pack()/unpack() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE < 8) {
+ die("skip 64bit test only");
+}
+?>
+--FILE--
+<?php
+print_r(unpack("Q", pack("Q", 0xfffffffffffe)));
+print_r(unpack("Q", pack("Q", 0)));
+print_r(unpack("Q", pack("Q", 0x8000000000000002)));
+print_r(unpack("Q", pack("Q", -1)));
+print_r(unpack("Q", pack("Q", 0x8000000000000000)));
+
+print_r(unpack("J", pack("J", 0xfffffffffffe)));
+print_r(unpack("J", pack("J", 0)));
+print_r(unpack("J", pack("J", 0x8000000000000002)));
+print_r(unpack("J", pack("J", -1)));
+print_r(unpack("J", pack("J", 0x8000000000000000)));
+
+print_r(unpack("P", pack("P", 0xfffffffffffe)));
+print_r(unpack("P", pack("P", 0)));
+print_r(unpack("P", pack("P", 0x8000000000000002)));
+print_r(unpack("P", pack("P", -1)));
+print_r(unpack("P", pack("P", 0x8000000000000000)));
+
+print_r(unpack("q", pack("q", 0xfffffffffffe)));
+print_r(unpack("q", pack("q", 0)));
+print_r(unpack("q", pack("q", 0x8000000000000002)));
+print_r(unpack("q", pack("q", -1)));
+print_r(unpack("q", pack("q", 0x8000000000000000)));
+?>
+--EXPECTF--
+Array
+(
+ [1] => 281474976710654
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => 281474976710654
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => 281474976710654
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => 281474976710654
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -9223372036854775808
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -9223372036854775808
+)
diff --git a/ext/standard/tests/strings/pack64_32.phpt b/ext/standard/tests/strings/pack64_32.phpt
new file mode 100644
index 0000000000..f52de63ca4
--- /dev/null
+++ b/ext/standard/tests/strings/pack64_32.phpt
@@ -0,0 +1,44 @@
+--TEST--
+64bit pack()/unpack() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE > 4) {
+ die("skip 32bit test only");
+}
+?>
+--FILE--
+<?php
+var_dump(pack("Q", 0));
+var_dump(pack("J", 0));
+var_dump(pack("P", 0));
+var_dump(pack("q", 0));
+
+var_dump(unpack("Q", ''));
+var_dump(unpack("J", ''));
+var_dump(unpack("P", ''));
+var_dump(unpack("q", ''));
+?>
+--EXPECTF--
+Warning: pack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: pack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: pack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: pack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: unpack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: unpack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: unpack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
+
+Warning: unpack(): 64-bit format codes are not available for 32-bit versions of PHP in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
index 10ae22fe0c..5ebdfe8d50 100644
--- a/ext/standard/tests/strings/setlocale_variation2.phpt
+++ b/ext/standard/tests/strings/setlocale_variation2.phpt
@@ -20,9 +20,9 @@ echo "*** Testing setlocale() : usage variations ***\n";
function good_locale($locale) {
/**
- * Note: no_NO is a bogus locale and should not be used, see https://bugzilla.redhat.com/show_bug.cgi?id=532487
+ * Note: no_NO is a bogus locale and should not be used, see https://bugzilla.redhat.com/971416
**/
- return $locale !== 'tt_RU@iqtelif.UTF-8' && substr($locale, 0, 5) !== "no_NO";
+ return $locale !== 'tt_RU@iqtelif.UTF-8' && $locale !== 'no_NO.ISO-8859-1';
}
/* Prototype : array list_system_locales( void )
diff --git a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
index fb0fb79ae5..e74f6b73e9 100644
--- a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
+++ b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
@@ -48,8 +48,8 @@ str_dump($a, $b);
--EXPECT--
*** Testing strnatcasecmp() : variation ***
int(1)
-int(6)
-int(-2)
+int(1)
+int(-1)
int(-1)
int(0)
int(0)
diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt
index e0e5411036..e172061ec2 100644
--- a/ext/standard/tests/strings/url_t.phpt
+++ b/ext/standard/tests/strings/url_t.phpt
@@ -75,6 +75,7 @@ $sample_urls = array (
);
foreach ($sample_urls as $url) {
+ echo "\n--> $url: ";
var_dump(@parse_url($url));
}
@@ -84,21 +85,24 @@ $sample_urls = array (
}
?>
--EXPECT--
-array(1) {
+--> : array(1) {
["path"]=>
string(0) ""
}
-array(1) {
+
+--> 64.246.30.37: array(1) {
["path"]=>
string(12) "64.246.30.37"
}
-array(2) {
+
+--> http://64.246.30.37: array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(12) "64.246.30.37"
}
-array(3) {
+
+--> http://64.246.30.37/: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -106,11 +110,13 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(1) {
+
+--> 64.246.30.37/: array(1) {
["path"]=>
string(13) "64.246.30.37/"
}
-array(3) {
+
+--> 64.246.30.37:80/: array(3) {
["host"]=>
string(12) "64.246.30.37"
["port"]=>
@@ -118,21 +124,25 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(1) {
+
+--> php.net: array(1) {
["path"]=>
string(7) "php.net"
}
-array(1) {
+
+--> php.net/: array(1) {
["path"]=>
string(8) "php.net/"
}
-array(2) {
+
+--> http://php.net: array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(7) "php.net"
}
-array(3) {
+
+--> http://php.net/: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -140,21 +150,25 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(1) {
+
+--> www.php.net: array(1) {
["path"]=>
string(11) "www.php.net"
}
-array(1) {
+
+--> www.php.net/: array(1) {
["path"]=>
string(12) "www.php.net/"
}
-array(2) {
+
+--> http://www.php.net: array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
}
-array(3) {
+
+--> http://www.php.net/: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -162,13 +176,15 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(2) {
+
+--> www.php.net:80: array(2) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
}
-array(3) {
+
+--> http://www.php.net:80: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -176,7 +192,8 @@ array(3) {
["port"]=>
int(80)
}
-array(4) {
+
+--> http://www.php.net:80/: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -186,7 +203,8 @@ array(4) {
["path"]=>
string(1) "/"
}
-array(3) {
+
+--> http://www.php.net/index.php: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -194,11 +212,13 @@ array(3) {
["path"]=>
string(10) "/index.php"
}
-array(1) {
+
+--> www.php.net/?: array(1) {
["path"]=>
string(12) "www.php.net/"
}
-array(3) {
+
+--> www.php.net:80/?: array(3) {
["host"]=>
string(11) "www.php.net"
["port"]=>
@@ -206,7 +226,8 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(3) {
+
+--> http://www.php.net/?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -214,7 +235,8 @@ array(3) {
["path"]=>
string(1) "/"
}
-array(4) {
+
+--> http://www.php.net:80/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -224,7 +246,8 @@ array(4) {
["path"]=>
string(1) "/"
}
-array(4) {
+
+--> http://www.php.net:80/index.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -234,7 +257,8 @@ array(4) {
["path"]=>
string(10) "/index.php"
}
-array(4) {
+
+--> http://www.php.net:80/foo/bar/index.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -244,7 +268,8 @@ array(4) {
["path"]=>
string(18) "/foo/bar/index.php"
}
-array(4) {
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -254,7 +279,8 @@ array(4) {
["path"]=>
string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
}
-array(5) {
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -266,7 +292,8 @@ array(5) {
["query"]=>
string(37) "lots=1&of=2&parameters=3&too=4&here=5"
}
-array(4) {
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -276,7 +303,8 @@ array(4) {
["path"]=>
string(45) "/this/is/a/very/deep/directory/structure/and/"
}
-array(4) {
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -286,7 +314,8 @@ array(4) {
["path"]=>
string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
}
-array(4) {
+
+--> http://www.php.net:80/this/../a/../deep/directory: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -296,7 +325,8 @@ array(4) {
["path"]=>
string(28) "/this/../a/../deep/directory"
}
-array(4) {
+
+--> http://www.php.net:80/this/../a/../deep/directory/: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -306,7 +336,8 @@ array(4) {
["path"]=>
string(29) "/this/../a/../deep/directory/"
}
-array(4) {
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -316,7 +347,8 @@ array(4) {
["path"]=>
string(42) "/this/is/a/very/deep/directory/../file.php"
}
-array(4) {
+
+--> http://www.php.net:80/index.php: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -326,7 +358,8 @@ array(4) {
["path"]=>
string(10) "/index.php"
}
-array(4) {
+
+--> http://www.php.net:80/index.php?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -336,7 +369,8 @@ array(4) {
["path"]=>
string(10) "/index.php"
}
-array(5) {
+
+--> http://www.php.net:80/#foo: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -348,7 +382,8 @@ array(5) {
["fragment"]=>
string(3) "foo"
}
-array(4) {
+
+--> http://www.php.net:80/?#: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -358,7 +393,8 @@ array(4) {
["path"]=>
string(1) "/"
}
-array(5) {
+
+--> http://www.php.net:80/?test=1: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -370,7 +406,8 @@ array(5) {
["query"]=>
string(6) "test=1"
}
-array(4) {
+
+--> http://www.php.net/?test=1&: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -380,7 +417,8 @@ array(4) {
["query"]=>
string(7) "test=1&"
}
-array(5) {
+
+--> http://www.php.net:80/?&: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -392,7 +430,8 @@ array(5) {
["query"]=>
string(1) "&"
}
-array(5) {
+
+--> http://www.php.net:80/index.php?test=1&: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -404,7 +443,8 @@ array(5) {
["query"]=>
string(7) "test=1&"
}
-array(4) {
+
+--> http://www.php.net/index.php?&: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -414,7 +454,8 @@ array(4) {
["query"]=>
string(1) "&"
}
-array(5) {
+
+--> http://www.php.net:80/index.php?foo&: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -426,7 +467,8 @@ array(5) {
["query"]=>
string(4) "foo&"
}
-array(4) {
+
+--> http://www.php.net/index.php?&foo: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -436,7 +478,8 @@ array(4) {
["query"]=>
string(4) "&foo"
}
-array(5) {
+
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -448,7 +491,8 @@ array(5) {
["query"]=>
string(31) "test=1&test2=char&test3=mixesCI"
}
-array(5) {
+
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) {
["host"]=>
string(11) "www.php.net"
["port"]=>
@@ -460,7 +504,8 @@ array(5) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(7) {
+
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -476,13 +521,16 @@ array(7) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(6) {
+
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["user"]=>
string(6) "secret"
+ ["pass"]=>
+ string(0) ""
["path"]=>
string(10) "/index.php"
["query"]=>
@@ -490,13 +538,16 @@ array(6) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(7) {
+
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
+ ["user"]=>
+ string(0) ""
["pass"]=>
string(7) "hideout"
["path"]=>
@@ -506,7 +557,8 @@ array(7) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(7) {
+
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -522,7 +574,8 @@ array(7) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(7) {
+
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -538,7 +591,8 @@ array(7) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(8) {
+
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -556,13 +610,15 @@ array(8) {
["fragment"]=>
string(16) "some_page_ref123"
}
-array(2) {
+
+--> nntp://news.php.net: array(2) {
["scheme"]=>
string(4) "nntp"
["host"]=>
string(12) "news.php.net"
}
-array(3) {
+
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) {
["scheme"]=>
string(3) "ftp"
["host"]=>
@@ -570,25 +626,29 @@ array(3) {
["path"]=>
string(22) "/gnu/glic/glibc.tar.gz"
}
-array(2) {
+
+--> zlib:http://foo@bar: array(2) {
["scheme"]=>
string(4) "zlib"
["path"]=>
string(14) "http://foo@bar"
}
-array(2) {
+
+--> zlib:filename.txt: array(2) {
["scheme"]=>
string(4) "zlib"
["path"]=>
string(12) "filename.txt"
}
-array(2) {
+
+--> zlib:/path/to/my/file/file.txt: array(2) {
["scheme"]=>
string(4) "zlib"
["path"]=>
string(25) "/path/to/my/file/file.txt"
}
-array(3) {
+
+--> foo://foo@bar: array(3) {
["scheme"]=>
string(3) "foo"
["host"]=>
@@ -596,25 +656,29 @@ array(3) {
["user"]=>
string(3) "foo"
}
-array(2) {
+
+--> mailto:me@mydomain.com: array(2) {
["scheme"]=>
string(6) "mailto"
["path"]=>
string(15) "me@mydomain.com"
}
-array(2) {
+
+--> /foo.php?a=b&c=d: array(2) {
["path"]=>
string(8) "/foo.php"
["query"]=>
string(7) "a=b&c=d"
}
-array(2) {
+
+--> foo.php?a=b&c=d: array(2) {
["path"]=>
string(7) "foo.php"
["query"]=>
string(7) "a=b&c=d"
}
-array(6) {
+
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -628,13 +692,15 @@ array(6) {
["query"]=>
string(12) "bar=1&boom=0"
}
-array(2) {
+
+--> file:///path/to/file: array(2) {
["scheme"]=>
string(4) "file"
["path"]=>
string(13) "/path/to/file"
}
-array(3) {
+
+--> file://path/to/file: array(3) {
["scheme"]=>
string(4) "file"
["host"]=>
@@ -642,13 +708,15 @@ array(3) {
["path"]=>
string(8) "/to/file"
}
-array(2) {
+
+--> file:/path/to/file: array(2) {
["scheme"]=>
string(4) "file"
["path"]=>
string(13) "/path/to/file"
}
-array(4) {
+
+--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -658,7 +726,8 @@ array(4) {
["query"]=>
string(7) "a=1&b=2"
}
-array(3) {
+
+--> http://foo.com#bar: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -666,11 +735,13 @@ array(3) {
["fragment"]=>
string(3) "bar"
}
-array(1) {
+
+--> scheme:: array(1) {
["scheme"]=>
string(6) "scheme"
}
-array(4) {
+
+--> foo+bar://baz@bang/bla: array(4) {
["scheme"]=>
string(7) "foo+bar"
["host"]=>
@@ -680,13 +751,15 @@ array(4) {
["path"]=>
string(4) "/bla"
}
-array(2) {
+
+--> gg:9130731: array(2) {
["scheme"]=>
string(2) "gg"
["path"]=>
string(7) "9130731"
}
-array(7) {
+
+--> http://user:@pass@host/path?argument?value#etc: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -710,3 +783,4 @@ string(7) "hideout"
string(10) "/index.php"
string(31) "test=1&test2=char&test3=mixesCI"
string(16) "some_page_ref123"
+
diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt
index a6f4f7a252..0708691fe3 100644
--- a/ext/standard/tests/url/parse_url_basic_001.phpt
+++ b/ext/standard/tests/url/parse_url_basic_001.phpt
@@ -454,13 +454,15 @@ echo "Done";
string(16) "some_page_ref123"
}
---> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["user"]=>
string(6) "secret"
+ ["pass"]=>
+ string(0) ""
["path"]=>
string(10) "/index.php"
["query"]=>
@@ -469,13 +471,15 @@ echo "Done";
string(16) "some_page_ref123"
}
---> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
+ ["user"]=>
+ string(0) ""
["pass"]=>
string(7) "hideout"
["path"]=>
diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt
index 1fc946e5b3..5b2cb98f8b 100644
--- a/ext/standard/tests/url/parse_url_basic_005.phpt
+++ b/ext/standard/tests/url/parse_url_basic_005.phpt
@@ -66,7 +66,7 @@ echo "Done";
--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
---> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt
index 5104326198..79af6b8b62 100644
--- a/ext/standard/tests/url/parse_url_basic_006.phpt
+++ b/ext/standard/tests/url/parse_url_basic_006.phpt
@@ -65,7 +65,7 @@ echo "Done";
--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
---> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
diff --git a/ext/standard/tests/versioning/phpversion.phpt b/ext/standard/tests/versioning/phpversion.phpt
new file mode 100644
index 0000000000..ef8c354c36
--- /dev/null
+++ b/ext/standard/tests/versioning/phpversion.phpt
@@ -0,0 +1,12 @@
+--TEST--
+phpversion test
+--FILE--
+<?php
+
+print phpversion();
+print "\n";
+print phpversion('standard');
+
+--EXPECTF--
+%s
+%s
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 574744d9ba..67d5ed1e75 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +41,7 @@ PHP_FUNCTION(gettype)
RETVAL_STRING("boolean");
break;
- case IS_INT:
+ case IS_LONG:
RETVAL_STRING("integer");
break;
@@ -94,7 +94,7 @@ PHP_FUNCTION(settype)
{
zval *var;
char *type;
- int type_len = 0;
+ size_t type_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &var, &type, &type_len) == FAILURE) {
return;
@@ -103,9 +103,9 @@ PHP_FUNCTION(settype)
ZVAL_DEREF(var);
SEPARATE_ZVAL_NOREF(var);
if (!strcasecmp(type, "integer")) {
- convert_to_int(var);
+ convert_to_long(var);
} else if (!strcasecmp(type, "int")) {
- convert_to_int(var);
+ convert_to_long(var);
} else if (!strcasecmp(type, "float")) {
convert_to_double(var);
} else if (!strcasecmp(type, "double")) { /* deprecated */
@@ -138,25 +138,25 @@ PHP_FUNCTION(settype)
PHP_FUNCTION(intval)
{
zval *num;
- php_int_t base = 10;
+ zend_long base = 10;
if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 2) {
WRONG_PARAM_COUNT;
}
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &num, &base) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &num, &base) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_ZVAL(num)
Z_PARAM_OPTIONAL
- Z_PARAM_INT(base)
+ Z_PARAM_LONG(base)
ZEND_PARSE_PARAMETERS_END();
#endif
RETVAL_ZVAL(num, 1, 0);
- convert_to_int_base(return_value, base);
+ convert_to_long_base(return_value, base);
}
/* }}} */
@@ -219,12 +219,7 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
- zend_class_entry *ce;
- if (Z_OBJ_HT_P(arg)->get_class_entry == NULL) {
- /* if there's no get_class_entry it's not a PHP object, so it can't be INCOMPLETE_CLASS */
- RETURN_TRUE;
- }
- ce = Z_OBJCE_P(arg);
+ zend_class_entry *ce = Z_OBJCE_P(arg);
if (ce->name->len == sizeof(INCOMPLETE_CLASS) - 1
&& !strncmp(ce->name->val, INCOMPLETE_CLASS, ce->name->len)) {
RETURN_FALSE;
@@ -243,7 +238,8 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
/* {{{ proto bool is_null(mixed var)
- Returns true if variable is null */
+ Returns true if variable is null
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_null)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_NULL);
@@ -251,7 +247,8 @@ PHP_FUNCTION(is_null)
/* }}} */
/* {{{ proto bool is_resource(mixed var)
- Returns true if variable is a resource */
+ Returns true if variable is a resource
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_resource)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_RESOURCE);
@@ -259,7 +256,8 @@ PHP_FUNCTION(is_resource)
/* }}} */
/* {{{ proto bool is_bool(mixed var)
- Returns true if variable is a boolean */
+ Returns true if variable is a boolean
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_bool)
{
zval *arg;
@@ -274,15 +272,17 @@ PHP_FUNCTION(is_bool)
/* }}} */
/* {{{ proto bool is_long(mixed var)
- Returns true if variable is a long (integer) */
+ Returns true if variable is a long (integer)
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_long)
{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_INT);
+ php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG);
}
/* }}} */
/* {{{ proto bool is_float(mixed var)
- Returns true if variable is float point*/
+ Returns true if variable is float point
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_float)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE);
@@ -290,7 +290,8 @@ PHP_FUNCTION(is_float)
/* }}} */
/* {{{ proto bool is_string(mixed var)
- Returns true if variable is a string */
+ Returns true if variable is a string
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_string)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
@@ -298,7 +299,8 @@ PHP_FUNCTION(is_string)
/* }}} */
/* {{{ proto bool is_array(mixed var)
- Returns true if variable is an array */
+ Returns true if variable is an array
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_array)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY);
@@ -306,7 +308,8 @@ PHP_FUNCTION(is_array)
/* }}} */
/* {{{ proto bool is_object(mixed var)
- Returns true if variable is an object */
+ Returns true if variable is an object
+ Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(is_object)
{
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT);
@@ -324,13 +327,13 @@ PHP_FUNCTION(is_numeric)
}
switch (Z_TYPE_P(arg)) {
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
RETURN_TRUE;
break;
case IS_STRING:
- if (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), NULL, NULL, 0)) {
+ if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 0)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -364,7 +367,7 @@ PHP_FUNCTION(is_scalar)
case IS_FALSE:
case IS_TRUE:
case IS_DOUBLE:
- case IS_INT:
+ case IS_LONG:
case IS_STRING:
RETURN_TRUE;
break;
@@ -401,7 +404,7 @@ PHP_FUNCTION(is_callable)
//??? is it necessary to be consistent with old PHP ("\0" support)
if (UNEXPECTED(name->len) != strlen(name->val)) {
ZVAL_STRINGL(callable_name, name->val, strlen(name->val));
- STR_RELEASE(name);
+ zend_string_release(name);
} else {
ZVAL_STR(callable_name, name);
}
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index ddc87f51a8..1014f5d9ba 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -50,7 +50,8 @@ PHP_FUNCTION(uniqid)
zend_bool more_entropy = 0;
#endif
zend_string *uniqid;
- int sec, usec, prefix_len = 0;
+ int sec, usec;
+ size_t prefix_len = 0;
struct timeval tv;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &prefix, &prefix_len,
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
index 0ea57fa52a..2247e8c2ee 100644
--- a/ext/standard/uniqid.h
+++ b/ext/standard/uniqid.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/url.c b/ext/standard/url.c
index f0f199c00b..4fb2c73edb 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -186,10 +186,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
}
if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) {
- php_int_t port;
+ zend_long port;
memcpy(port_buf, p, (pp - p));
port_buf[pp - p] = '\0';
- port = ZEND_STRTOI(port_buf, NULL, 10);
+ port = ZEND_STRTOL(port_buf, NULL, 10);
if (port > 0 && port <= 65535) {
ret->port = (unsigned short) port;
} else {
@@ -240,16 +240,12 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
/* check for login and password */
if ((p = zend_memrchr(s, '@', (e-s)))) {
if ((pp = memchr(s, ':', (p-s)))) {
- if ((pp-s) > 0) {
- ret->user = estrndup(s, (pp-s));
- php_replace_controlchars_ex(ret->user, (pp - s));
- }
+ ret->user = estrndup(s, (pp-s));
+ php_replace_controlchars_ex(ret->user, (pp - s));
pp++;
- if (p-pp > 0) {
- ret->pass = estrndup(pp, (p-pp));
- php_replace_controlchars_ex(ret->pass, (p-pp));
- }
+ ret->pass = estrndup(pp, (p-pp));
+ php_replace_controlchars_ex(ret->pass, (p-pp));
} else {
ret->user = estrndup(s, (p-s));
php_replace_controlchars_ex(ret->user, (p-s));
@@ -280,10 +276,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
efree(ret);
return NULL;
} else if (e - p > 0) {
- php_int_t port;
+ zend_long port;
memcpy(port_buf, p, (e - p));
port_buf[e - p] = '\0';
- port = ZEND_STRTOI(port_buf, NULL, 10);
+ port = ZEND_STRTOL(port_buf, NULL, 10);
if (port > 0 && port <= 65535) {
ret->port = (unsigned short)port;
} else {
@@ -375,11 +371,11 @@ end:
PHP_FUNCTION(parse_url)
{
char *str;
- int str_len;
+ size_t str_len;
php_url *resource;
- php_int_t key = -1;
+ zend_long key = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &key) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) {
return;
}
@@ -398,7 +394,7 @@ PHP_FUNCTION(parse_url)
if (resource->host != NULL) RETVAL_STRING(resource->host);
break;
case PHP_URL_PORT:
- if (resource->port != 0) RETVAL_INT(resource->port);
+ if (resource->port != 0) RETVAL_LONG(resource->port);
break;
case PHP_URL_USER:
if (resource->user != NULL) RETVAL_STRING(resource->user);
@@ -416,7 +412,7 @@ PHP_FUNCTION(parse_url)
if (resource->fragment != NULL) RETVAL_STRING(resource->fragment);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier " ZEND_INT_FMT, key);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier " ZEND_LONG_FMT, key);
RETVAL_FALSE;
}
goto done;
@@ -431,7 +427,7 @@ PHP_FUNCTION(parse_url)
if (resource->host != NULL)
add_assoc_string(return_value, "host", resource->host);
if (resource->port != 0)
- add_assoc_int(return_value, "port", resource->port);
+ add_assoc_long(return_value, "port", resource->port);
if (resource->user != NULL)
add_assoc_string(return_value, "user", resource->user);
if (resource->pass != NULL)
@@ -494,7 +490,7 @@ PHPAPI zend_string *php_url_encode(char const *s, int len)
from = (unsigned char *)s;
end = (unsigned char *)s + len;
- start = STR_ALLOC(3 * len, 0);
+ start = zend_string_alloc(3 * len, 0);
to = (unsigned char*)start->val;
while (from < end) {
@@ -525,7 +521,7 @@ PHPAPI zend_string *php_url_encode(char const *s, int len)
}
*to = '\0';
- start = STR_REALLOC(start, to - (unsigned char*)start->val, 0);
+ start = zend_string_realloc(start, to - (unsigned char*)start->val, 0);
return start;
}
@@ -567,7 +563,7 @@ PHP_FUNCTION(urldecode)
ZEND_PARSE_PARAMETERS_END();
#endif
- out_str = STR_INIT(in_str->val, in_str->len, 0);
+ out_str = zend_string_init(in_str->val, in_str->len, 0);
out_str->len = php_url_decode(out_str->val, out_str->len);
RETURN_NEW_STR(out_str);
@@ -612,7 +608,7 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, int len)
register int x, y;
zend_string *str;
- str = STR_ALLOC(3 * len, 0);
+ str = zend_string_alloc(3 * len, 0);
for (x = 0, y = 0; len--; x++, y++) {
str->val[y] = (unsigned char) s[x];
#ifndef CHARSET_EBCDIC
@@ -632,7 +628,7 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, int len)
}
}
str->val[y] = '\0';
- str = STR_REALLOC(str, y, 0);
+ str = zend_string_realloc(str, y, 0);
return str;
}
@@ -674,7 +670,7 @@ PHP_FUNCTION(rawurldecode)
ZEND_PARSE_PARAMETERS_END();
#endif
- out_str = STR_INIT(in_str->val, in_str->len, 0);
+ out_str = zend_string_init(in_str->val, in_str->len, 0);
out_str->len = php_raw_url_decode(out_str->val, out_str->len);
RETURN_NEW_STR(out_str);
@@ -714,14 +710,14 @@ PHPAPI int php_raw_url_decode(char *str, int len)
PHP_FUNCTION(get_headers)
{
char *url;
- int url_len;
+ size_t url_len;
php_stream_context *context;
php_stream *stream;
zval *prev_val, *hdr = NULL, *h;
HashTable *hashT;
- php_int_t format = 0;
+ zend_long format = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &url, &url_len, &format) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) {
return;
}
context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C));
@@ -755,7 +751,7 @@ PHP_FUNCTION(get_headers)
}
if (!format) {
no_name_header:
- add_next_index_str(return_value, STR_COPY(Z_STR_P(hdr)));
+ add_next_index_str(return_value, zend_string_copy(Z_STR_P(hdr)));
} else {
char c;
char *s, *p;
@@ -769,10 +765,10 @@ no_name_header:
}
if ((prev_val = zend_hash_str_find(HASH_OF(return_value), Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr)))) == NULL) {
- add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr))));
+ add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr))));
} else { /* some headers may occur more then once, therefor we need to remake the string into an array */
convert_to_array(prev_val);
- add_next_index_stringl(prev_val, s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr))));
+ add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr))));
}
*p = c;
diff --git a/ext/standard/url.h b/ext/standard/url.h
index d23f0a1f17..4d7a1f5b56 100644
--- a/ext/standard/url.h
+++ b/ext/standard/url.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 8ed49e6efc..3d7aa985b8 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,7 +1,8 @@
/* Generated by re2c 0.13.5 */
+#line 1 "ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -41,7 +42,7 @@
#define url_scanner url_scanner_ex
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
static void tag_dtor(zval *zv)
{
@@ -57,7 +58,7 @@ static PHP_INI_MH(OnUpdateTags)
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value, new_value_length);
+ tmp = estrndup(new_value->val, new_value->len);
if (ctx->tags)
zend_hash_destroy(ctx->tags);
@@ -99,6 +100,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
PHP_INI_END()
+#line 107 "ext/standard/url_scanner_ex.re"
#define YYFILL(n) goto done
@@ -117,6 +119,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
scan:
+#line 123 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -162,13 +165,19 @@ scan:
if (yych <= '9') goto yy6;
if (yych >= ';') goto yy4;
++YYCURSOR;
- { smart_str_append(dest, url); return; }
+#line 125 "ext/standard/url_scanner_ex.re"
+ { smart_str_append_smart_str(dest, url); return; }
+#line 171 "ext/standard/url_scanner_ex.c"
yy4:
++YYCURSOR;
+#line 126 "ext/standard/url_scanner_ex.re"
{ sep = separator; goto scan; }
+#line 176 "ext/standard/url_scanner_ex.c"
yy6:
++YYCURSOR;
+#line 127 "ext/standard/url_scanner_ex.re"
{ bash = p - 1; goto done; }
+#line 181 "ext/standard/url_scanner_ex.c"
yy8:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -176,24 +185,27 @@ yy8:
if (yybm[0+yych] & 128) {
goto yy8;
}
+#line 128 "ext/standard/url_scanner_ex.re"
{ goto scan; }
+#line 191 "ext/standard/url_scanner_ex.c"
}
+#line 129 "ext/standard/url_scanner_ex.re"
done:
/* Don't modify URLs of the format "#mark" */
if (bash && bash - url->s->val == 0) {
- smart_str_append(dest, url);
+ smart_str_append_smart_str(dest, url);
return;
}
if (bash)
smart_str_appendl(dest, url->s->val, bash - url->s->val);
else
- smart_str_append(dest, url);
+ smart_str_append_smart_str(dest, url);
smart_str_appends(dest, sep);
- smart_str_append(dest, url_app);
+ smart_str_append_smart_str(dest, url_app);
if (bash)
smart_str_appendl(dest, bash, q - bash);
@@ -218,7 +230,7 @@ static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSR
if (f) {
append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
} else {
- smart_str_append(&ctx->result, &ctx->val);
+ smart_str_append_smart_str(&ctx->result, &ctx->val);
}
if (quotes)
smart_str_appendc(&ctx->result, type);
@@ -292,7 +304,7 @@ static void handle_form(STD_PARA)
}
if (doit)
- smart_str_append(&ctx->result, &ctx->form_app);
+ smart_str_append_smart_str(&ctx->result, &ctx->form_app);
}
}
@@ -362,6 +374,7 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
+#line 378 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -404,7 +417,9 @@ state_plain:
goto yy15;
}
++YYCURSOR;
+#line 313 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
+#line 423 "ext/standard/url_scanner_ex.c"
yy15:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -412,13 +427,17 @@ yy15:
if (yybm[0+yych] & 128) {
goto yy15;
}
+#line 314 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain; }
+#line 433 "ext/standard/url_scanner_ex.c"
}
+#line 315 "ext/standard/url_scanner_ex.re"
state_tag:
start = YYCURSOR;
+#line 441 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -469,10 +488,14 @@ yy20:
yych = *YYCURSOR;
goto yy25;
yy21:
+#line 320 "ext/standard/url_scanner_ex.re"
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
+#line 494 "ext/standard/url_scanner_ex.c"
yy22:
++YYCURSOR;
+#line 321 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
+#line 499 "ext/standard/url_scanner_ex.c"
yy24:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -483,6 +506,7 @@ yy25:
}
goto yy21;
}
+#line 322 "ext/standard/url_scanner_ex.re"
state_next_arg_begin:
@@ -491,6 +515,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
+#line 519 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -555,20 +580,28 @@ yy28:
++YYCURSOR;
if ((yych = *YYCURSOR) == '>') goto yy39;
yy29:
+#line 333 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
+#line 586 "ext/standard/url_scanner_ex.c"
yy30:
++YYCURSOR;
yy31:
+#line 330 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
+#line 592 "ext/standard/url_scanner_ex.c"
yy32:
++YYCURSOR;
yych = *YYCURSOR;
goto yy38;
yy33:
+#line 331 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg; }
+#line 600 "ext/standard/url_scanner_ex.c"
yy34:
++YYCURSOR;
+#line 332 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
+#line 605 "ext/standard/url_scanner_ex.c"
yy36:
yych = *++YYCURSOR;
goto yy29;
@@ -586,11 +619,13 @@ yy39:
yych = *YYCURSOR;
goto yy31;
}
+#line 334 "ext/standard/url_scanner_ex.re"
state_arg:
start = YYCURSOR;
+#line 629 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -638,10 +673,14 @@ yy42:
yych = *YYCURSOR;
goto yy47;
yy43:
+#line 339 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
+#line 679 "ext/standard/url_scanner_ex.c"
yy44:
++YYCURSOR;
+#line 340 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
+#line 684 "ext/standard/url_scanner_ex.c"
yy46:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -652,11 +691,13 @@ yy47:
}
goto yy43;
}
+#line 341 "ext/standard/url_scanner_ex.re"
state_before_val:
start = YYCURSOR;
+#line 701 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -703,13 +744,17 @@ yy50:
if (yych == ' ') goto yy57;
if (yych == '=') goto yy55;
yy51:
+#line 347 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; goto state_next_arg_begin; }
+#line 750 "ext/standard/url_scanner_ex.c"
yy52:
++YYCURSOR;
yych = *YYCURSOR;
goto yy56;
yy53:
+#line 346 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
+#line 758 "ext/standard/url_scanner_ex.c"
yy54:
yych = *++YYCURSOR;
goto yy51;
@@ -731,12 +776,14 @@ yy57:
YYCURSOR = YYMARKER;
goto yy51;
}
+#line 348 "ext/standard/url_scanner_ex.re"
state_val:
start = YYCURSOR;
+#line 787 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -797,7 +844,9 @@ state_val:
yych = *(YYMARKER = ++YYCURSOR);
if (yych != '>') goto yy76;
yy63:
+#line 357 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg_begin; }
+#line 850 "ext/standard/url_scanner_ex.c"
yy64:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == '>') goto yy63;
@@ -807,7 +856,9 @@ yy65:
yych = *YYCURSOR;
goto yy69;
yy66:
+#line 356 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
+#line 862 "ext/standard/url_scanner_ex.c"
yy67:
yych = *++YYCURSOR;
goto yy63;
@@ -834,7 +885,9 @@ yy72:
goto yy63;
yy73:
++YYCURSOR;
+#line 355 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
+#line 891 "ext/standard/url_scanner_ex.c"
yy75:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -845,8 +898,11 @@ yy76:
}
if (yych >= '>') goto yy72;
++YYCURSOR;
+#line 354 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
+#line 904 "ext/standard/url_scanner_ex.c"
}
+#line 358 "ext/standard/url_scanner_ex.re"
stop:
@@ -902,7 +958,7 @@ static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_
}
smart_str_0(&ctx->result);
if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
*newlen += ctx->buf.s->len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
@@ -951,7 +1007,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
} else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
if (ctx->buf.s && ctx->buf.s->len) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
*handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
@@ -992,16 +1048,16 @@ PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int va
smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
- smart_str_append(&BG(url_adapt_state_ex).url_app, &val);
+ smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
- smart_str_append(&BG(url_adapt_state_ex).form_app, &val);
+ smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
if (urlencode) {
- STR_FREE(encoded);
+ zend_string_free(encoded);
}
smart_str_free(&val);
diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
index 0a7925e245..3c5b68c95b 100644
--- a/ext/standard/url_scanner_ex.h
+++ b/ext/standard/url_scanner_ex.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -31,7 +31,7 @@ PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, co
PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC);
PHPAPI int php_url_scanner_reset_vars(TSRMLS_D);
-#include "php_smart_str_public.h"
+#include "zend_smart_str_public.h"
typedef struct {
/* Used by the mainloop of the scanner */
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 240e504d6d..2e74b1fb30 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -40,7 +40,7 @@
#define url_scanner url_scanner_ex
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
static void tag_dtor(zval *zv)
{
@@ -56,7 +56,7 @@ static PHP_INI_MH(OnUpdateTags)
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value, new_value_length);
+ tmp = estrndup(new_value->val, new_value->len);
if (ctx->tags)
zend_hash_destroy(ctx->tags);
@@ -122,7 +122,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
scan:
/*!re2c
- ":" { smart_str_append(dest, url); return; }
+ ":" { smart_str_append_smart_str(dest, url); return; }
"?" { sep = separator; goto scan; }
"#" { bash = p - 1; goto done; }
(any\[:?#])+ { goto scan; }
@@ -131,17 +131,17 @@ done:
/* Don't modify URLs of the format "#mark" */
if (bash && bash - url->s->val == 0) {
- smart_str_append(dest, url);
+ smart_str_append_smart_str(dest, url);
return;
}
if (bash)
smart_str_appendl(dest, url->s->val, bash - url->s->val);
else
- smart_str_append(dest, url);
+ smart_str_append_smart_str(dest, url);
smart_str_appends(dest, sep);
- smart_str_append(dest, url_app);
+ smart_str_append_smart_str(dest, url_app);
if (bash)
smart_str_appendl(dest, bash, q - bash);
@@ -166,7 +166,7 @@ static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type TSR
if (f) {
append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
} else {
- smart_str_append(&ctx->result, &ctx->val);
+ smart_str_append_smart_str(&ctx->result, &ctx->val);
}
if (quotes)
smart_str_appendc(&ctx->result, type);
@@ -240,7 +240,7 @@ static void handle_form(STD_PARA)
}
if (doit)
- smart_str_append(&ctx->result, &ctx->form_app);
+ smart_str_append_smart_str(&ctx->result, &ctx->form_app);
}
}
@@ -410,7 +410,7 @@ static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_
}
smart_str_0(&ctx->result);
if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
*newlen += ctx->buf.s->len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
@@ -459,7 +459,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
} else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
if (ctx->buf.s && ctx->buf.s->len) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
*handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
@@ -500,16 +500,16 @@ PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int va
smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
- smart_str_append(&BG(url_adapt_state_ex).url_app, &val);
+ smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
- smart_str_append(&BG(url_adapt_state_ex).form_app, &val);
+ smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val);
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
if (urlencode) {
- STR_FREE(encoded);
+ zend_string_free(encoded);
}
smart_str_free(&val);
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index f9c94186f1..19e8e454df 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -113,13 +113,13 @@ PHP_MINIT_FUNCTION(user_filters)
return FAILURE;
}
- REGISTER_INT_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
@@ -203,7 +203,7 @@ php_stream_filter_status_t userfilter_filter(
ZEND_REGISTER_RESOURCE(&args[1], buckets_out, le_bucket_brigade);
if (bytes_consumed) {
- ZVAL_INT(&args[2], *bytes_consumed);
+ ZVAL_LONG(&args[2], *bytes_consumed);
} else {
ZVAL_NULL(&args[2]);
}
@@ -220,14 +220,14 @@ php_stream_filter_status_t userfilter_filter(
zval_ptr_dtor(&func_name);
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- convert_to_int(&retval);
- ret = Z_IVAL(retval);
+ convert_to_long(&retval);
+ ret = Z_LVAL(retval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function");
}
if (bytes_consumed) {
- *bytes_consumed = Z_IVAL_P(&args[2]);
+ *bytes_consumed = Z_LVAL_P(&args[2]);
}
if (buckets_in->head) {
@@ -397,7 +397,7 @@ static php_stream_filter_factory user_filter_factory = {
static void filter_item_dtor(zval *zv)
{
struct php_user_filter_data *fdat = Z_PTR_P(zv);
- STR_RELEASE(fdat->classname);
+ zend_string_release(fdat->classname);
efree(fdat);
}
@@ -424,7 +424,7 @@ PHP_FUNCTION(stream_bucket_make_writeable)
/* add_property_zval increments the refcount which is unwanted here */
zval_ptr_dtor(&zbucket);
add_property_stringl(return_value, "data", bucket->buf, bucket->buflen);
- add_property_int(return_value, "datalen", bucket->buflen);
+ add_property_long(return_value, "datalen", bucket->buflen);
}
}
/* }}} */
@@ -453,9 +453,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
if (!bucket->own_buf) {
bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC);
}
- if ((int)bucket->buflen != Z_STRSIZE_P(pzdata)) {
- bucket->buf = perealloc(bucket->buf, Z_STRSIZE_P(pzdata), bucket->is_persistent);
- bucket->buflen = Z_STRSIZE_P(pzdata);
+ if ((int)bucket->buflen != Z_STRLEN_P(pzdata)) {
+ bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent);
+ bucket->buflen = Z_STRLEN_P(pzdata);
}
memcpy(bucket->buf, Z_STRVAL_P(pzdata), bucket->buflen);
}
@@ -498,7 +498,7 @@ PHP_FUNCTION(stream_bucket_new)
php_stream *stream;
char *buffer;
char *pbuffer;
- int buffer_len;
+ size_t buffer_len;
php_stream_bucket *bucket;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) {
@@ -525,7 +525,7 @@ PHP_FUNCTION(stream_bucket_new)
/* add_property_zval increments the refcount which is unwanted here */
zval_ptr_dtor(&zbucket);
add_property_stringl(return_value, "data", bucket->buf, bucket->buflen);
- add_property_int(return_value, "datalen", bucket->buflen);
+ add_property_long(return_value, "datalen", bucket->buflen);
}
/* }}} */
@@ -547,7 +547,7 @@ PHP_FUNCTION(stream_get_filters)
if (filters_hash) {
ZEND_HASH_FOREACH_STR_KEY(filters_hash, filter_name) {
if (filter_name) {
- add_next_index_str(return_value, STR_COPY(filter_name));
+ add_next_index_str(return_value, zend_string_copy(filter_name));
}
} ZEND_HASH_FOREACH_END();
}
@@ -584,13 +584,13 @@ PHP_FUNCTION(stream_filter_register)
}
fdat = ecalloc(1, sizeof(struct php_user_filter_data));
- fdat->classname = STR_COPY(classname);
+ fdat->classname = zend_string_copy(classname);
if (zend_hash_add_ptr(BG(user_filter_map), filtername, fdat) != NULL &&
php_stream_filter_register_factory_volatile(filtername->val, &user_filter_factory TSRMLS_CC) == SUCCESS) {
RETVAL_TRUE;
} else {
- STR_RELEASE(classname);
+ zend_string_release(classname);
efree(fdat);
}
}
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index 5e2ad73c72..6582e7de65 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -65,14 +65,14 @@
#define PHP_UU_DEC(c) (((c) - ' ') & 077)
-PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */
+PHPAPI zend_string *php_uuencode(char *src, size_t src_len) /* {{{ */
{
- php_size_t len = 45;
+ size_t len = 45;
char *p, *s, *e, *ee;
zend_string *dest;
/* encoded length is ~ 38% greater than the original */
- dest = STR_ALLOC((size_t)ceil(src_len * 1.38) + 46, 0);
+ dest = zend_string_alloc((size_t)ceil(src_len * 1.38) + 46, 0);
p = dest->val;
s = src;
e = src + src_len;
@@ -122,18 +122,18 @@ PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */
*p++ = '\n';
*p = '\0';
- dest = STR_REALLOC(dest, p - dest->val, 0);
+ dest = zend_string_realloc(dest, p - dest->val, 0);
return dest;
}
/* }}} */
-PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */
+PHPAPI zend_string *php_uudecode(char *src, size_t src_len) /* {{{ */
{
- php_size_t len, total_len=0;
+ size_t len, total_len=0;
char *s, *e, *p, *ee;
zend_string *dest;
- dest = STR_ALLOC((size_t) ceil(src_len * 0.75), 0);
+ dest = zend_string_alloc((size_t) ceil(src_len * 0.75), 0);
p = dest->val;
s = src;
e = src + src_len;
@@ -189,7 +189,7 @@ PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */
return dest;
err:
- STR_FREE(dest);
+ zend_string_free(dest);
return NULL;
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 2c94942b94..6e5bd703d3 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,7 @@
#include "php.h"
#include "php_string.h"
#include "php_var.h"
-#include "php_smart_str.h"
+#include "zend_smart_str.h"
#include "basic_functions.h"
#include "php_incomplete_class.h"
@@ -54,10 +54,10 @@ static uint zend_obj_num_elements(HashTable *ht)
return num;
}
-static void php_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */
+static void php_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */
{
if (key == NULL) { /* numeric key */
- php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index);
+ php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
php_printf("%*c[\"", level + 1, ' ');
PHPWRITE(key->val, key->len);
@@ -67,14 +67,14 @@ static void php_array_element_dump(zval *zv, php_uint_t index, zend_string *key,
}
/* }}} */
-static void php_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */
+static void php_object_property_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */
{
const char *prop_name, *class_name;
if (key == NULL) { /* numeric key */
- php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index);
+ php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
- int unmangle = zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name);
+ int unmangle = zend_unmangle_property_name(key, &class_name, &prop_name);
php_printf("%*c[", level + 1, ' ');
if (class_name && unmangle == SUCCESS) {
@@ -100,7 +100,7 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
zend_string *class_name;
int is_temp;
int is_ref = 0;
- php_uint_t num;
+ zend_ulong num;
zend_string *key;
zval *val;
@@ -119,15 +119,15 @@ again:
case IS_NULL:
php_printf("%sNULL\n", COMMON);
break;
- case IS_INT:
- php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc));
+ case IS_LONG:
+ php_printf("%sint(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc));
break;
case IS_DOUBLE:
php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
break;
case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc));
- PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc));
+ php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+ PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
PUTS("\"\n");
break;
case IS_ARRAY:
@@ -163,15 +163,12 @@ again:
return;
}
- if (Z_OBJ_HANDLER_P(struc, get_class_name)) {
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
- php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
- STR_RELEASE(class_name);
- } else {
- php_printf("%sobject(unknown class)#%d (%d) {\n", COMMON, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
- }
+ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc) TSRMLS_CC);
+ php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
+ zend_string_release(class_name);
+
if (myht) {
- php_uint_t num;
+ zend_ulong num;
zend_string *key;
zval *val;
@@ -191,7 +188,7 @@ again:
break;
case IS_RESOURCE: {
const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc) TSRMLS_CC);
- php_printf("%sresource(%ld) of type (%s)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown");
+ php_printf("%sresource(%pd) of type (%s)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown");
break;
}
case IS_REFERENCE:
@@ -227,10 +224,10 @@ PHP_FUNCTION(var_dump)
}
/* }}} */
-static void zval_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */
+static void zval_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */
{
if (key == NULL) { /* numeric key */
- php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index);
+ php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
php_printf("%*c[\"", level + 1, ' ');
PHPWRITE(key->val, key->len);
@@ -240,14 +237,14 @@ static void zval_array_element_dump(zval *zv, php_uint_t index, zend_string *key
}
/* }}} */
-static void zval_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */
+static void zval_object_property_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */
{
const char *prop_name, *class_name;
if (key == NULL) { /* numeric key */
- php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index);
+ php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
- zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name);
+ zend_unmangle_property_name(key, &class_name, &prop_name);
php_printf("%*c[", level + 1, ' ');
if (class_name) {
@@ -271,7 +268,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
zend_string *class_name;
int is_temp = 0;
int is_ref = 0;
- php_uint_t index;
+ zend_ulong index;
zend_string *key;
zval *val;
@@ -290,16 +287,16 @@ again:
case IS_NULL:
php_printf("%sNULL\n", COMMON);
break;
- case IS_INT:
- php_printf("%slong(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc));
+ case IS_LONG:
+ php_printf("%slong(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc));
break;
case IS_DOUBLE:
php_printf("%sdouble(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
break;
case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc));
- PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc));
- php_printf("\" refcount(%u)\n", IS_INTERNED(Z_STR_P(struc)) ? 1 : Z_REFCOUNT_P(struc));
+ php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+ PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
+ php_printf("\" refcount(%u)\n", Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) : 1);
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
@@ -334,9 +331,9 @@ again:
myht->u.v.nApplyCount++;
}
}
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc) TSRMLS_CC);
php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0, Z_REFCOUNT_P(struc));
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
if (myht) {
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) {
zval_object_property_dump(val, index, key, level TSRMLS_CC);
@@ -354,7 +351,7 @@ again:
break;
case IS_RESOURCE: {
const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc) TSRMLS_CC);
- php_printf("%sresource(" ZEND_INT_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
+ php_printf("%sresource(" ZEND_LONG_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
break;
}
case IS_REFERENCE:
@@ -398,11 +395,11 @@ PHP_FUNCTION(debug_zval_dump)
efree(tmp_spaces); \
} while(0);
-static void php_array_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */
+static void php_array_element_export(zval *zv, zend_ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */
{
if (key == NULL) { /* numeric key */
buffer_append_spaces(buf, level+1);
- smart_str_append_int(buf, (php_int_t) index);
+ smart_str_append_long(buf, (zend_long) index);
smart_str_appendl(buf, " => ", 4);
} else { /* string key */
@@ -413,11 +410,11 @@ static void php_array_element_export(zval *zv, php_uint_t index, zend_string *ke
buffer_append_spaces(buf, level + 1);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, tmp_str->val, tmp_str->len);
+ smart_str_append(buf, tmp_str);
smart_str_appendl(buf, "' => ", 5);
- STR_FREE(ckey);
- STR_FREE(tmp_str);
+ zend_string_free(ckey);
+ zend_string_free(tmp_str);
}
php_var_export_ex(zv, level + 2, buf TSRMLS_CC);
@@ -426,24 +423,23 @@ static void php_array_element_export(zval *zv, php_uint_t index, zend_string *ke
}
/* }}} */
-static void php_object_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */
+static void php_object_element_export(zval *zv, zend_ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */
{
buffer_append_spaces(buf, level + 2);
if (key != NULL) {
- const char *class_name; /* ignored, but must be passed to unmangle */
- const char *pname;
+ const char *class_name, *prop_name;
+ size_t prop_name_len;
zend_string *pname_esc;
- zend_unmangle_property_name(key->val, key->len,
- &class_name, &pname);
- pname_esc = php_addcslashes(pname, strlen(pname), 0, "'\\", 2 TSRMLS_CC);
+ zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len);
+ pname_esc = php_addcslashes(prop_name, prop_name_len, 0, "'\\", 2 TSRMLS_CC);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, pname_esc->val, pname_esc->len);
+ smart_str_append(buf, pname_esc);
smart_str_appendc(buf, '\'');
- STR_RELEASE(pname_esc);
+ zend_string_release(pname_esc);
} else {
- smart_str_append_int(buf, (php_int_t) index);
+ smart_str_append_long(buf, (zend_long) index);
}
smart_str_appendl(buf, " => ", 4);
php_var_export_ex(zv, level + 2, buf TSRMLS_CC);
@@ -456,10 +452,9 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC)
{
HashTable *myht;
char *tmp_str;
- php_size_t tmp_len;
- zend_string *class_name;
+ size_t tmp_len;
zend_string *ztmp, *ztmp2;
- php_uint_t index;
+ zend_ulong index;
zend_string *key;
zval *val;
@@ -474,8 +469,8 @@ again:
case IS_NULL:
smart_str_appendl(buf, "NULL", 4);
break;
- case IS_INT:
- smart_str_append_int(buf, Z_IVAL_P(struc));
+ case IS_LONG:
+ smart_str_append_long(buf, Z_LVAL_P(struc));
break;
case IS_DOUBLE:
tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_P(struc));
@@ -483,15 +478,15 @@ again:
efree(tmp_str);
break;
case IS_STRING:
- ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRSIZE_P(struc), 0, "'\\", 2 TSRMLS_CC);
+ ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRLEN_P(struc), 0, "'\\", 2 TSRMLS_CC);
ztmp2 = php_str_to_str_ex(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12, 0, NULL);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, ztmp2->val, ztmp2->len);
+ smart_str_append(buf, ztmp2);
smart_str_appendc(buf, '\'');
- STR_FREE(ztmp);
- STR_FREE(ztmp2);
+ zend_string_free(ztmp);
+ zend_string_free(ztmp2);
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
@@ -534,12 +529,10 @@ again:
smart_str_appendc(buf, '\n');
buffer_append_spaces(buf, level - 1);
}
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
- smart_str_appendl(buf, class_name->val, class_name->len);
+ smart_str_append(buf, Z_OBJCE_P(struc)->name);
smart_str_appendl(buf, "::__set_state(array(\n", 21);
- STR_RELEASE(class_name);
if (myht) {
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) {
php_object_element_export(val, index, key, level, buf TSRMLS_CC);
@@ -599,69 +592,66 @@ PHP_FUNCTION(var_export)
}
/* }}} */
-static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var_hash TSRMLS_DC);
+static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_data_t var_hash TSRMLS_DC);
-static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var_old TSRMLS_DC) /* {{{ */
+static inline uint32_t php_add_var_hash(php_serialize_data_t data, zval *var TSRMLS_DC) /* {{{ */
{
- zval var_no, *zv;
- char id[32], *p;
- register int len;
- zval *var = var_ptr;
+ zval *zv;
+ zend_ulong key;
+ zend_bool is_ref = Z_ISREF_P(var);
- if (Z_ISREF_P(var)) {
- var = Z_REFVAL_P(var);
+ data->n += 1;
+
+ if (!is_ref && Z_TYPE_P(var) != IS_OBJECT) {
+ return 0;
}
- if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) {
- p = smart_str_print_long(id + sizeof(id) - 1,
- (php_int_t) Z_OBJ_P(var));
- *(--p) = 'O';
- len = id + sizeof(id) - 1 - p;
- } else if (var_ptr != var) {
- p = smart_str_print_long(id + sizeof(id) - 1,
- (php_int_t) Z_REF_P(var_ptr));
- *(--p) = 'R';
- len = id + sizeof(id) - 1 - p;
- } else {
- p = smart_str_print_long(id + sizeof(id) - 1, (php_int_t) var);
- len = id + sizeof(id) - 1 - p;
+
+ /* References to objects are treated as if the reference didn't exist */
+ if (is_ref && Z_TYPE_P(Z_REFVAL_P(var)) == IS_OBJECT) {
+ var = Z_REFVAL_P(var);
}
- if ((zv = zend_hash_str_find(var_hash, p, len)) != NULL) {
- ZVAL_COPY_VALUE(var_old, zv);
- if (var == var_ptr) {
- /* we still need to bump up the counter, since non-refs will
- * be counted separately by unserializer */
- ZVAL_INT(&var_no, -1);
- zend_hash_next_index_insert(var_hash, &var_no);
+ /* Index for the variable is stored using the numeric value of the pointer to
+ * the zend_refcounted struct */
+ key = (zend_ulong) (zend_uintptr_t) Z_COUNTED_P(var);
+ zv = zend_hash_index_find(&data->ht, key);
+
+ if (zv) {
+ /* References are only counted once, undo the data->n increment above */
+ if (is_ref) {
+ data->n -= 1;
}
-#if 0
- fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(php_uint_t**)var_old);
-#endif
- return FAILURE;
- }
- /* +1 because otherwise hash will think we are trying to store NULL pointer */
- ZVAL_INT(&var_no, zend_hash_num_elements(var_hash) + 1);
- zend_hash_str_add(var_hash, p, len, &var_no);
-#if 0
- fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_IVAL(var_no));
-#endif
- return SUCCESS;
+ return Z_LVAL_P(zv);
+ } else {
+ zval zv_n;
+ ZVAL_LONG(&zv_n, data->n);
+ zend_hash_index_add_new(&data->ht, key, &zv_n);
+
+ /* Additionally to the index, we also store the variable, to ensure that it is
+ * not destroyed during serialization and its pointer reused. The variable is
+ * stored at the numeric value of the pointer + 1, which cannot be the location
+ * of another zend_refcounted structure. */
+ zend_hash_index_add_new(&data->ht, key + 1, var);
+ Z_ADDREF_P(var);
+
+ return 0;
+ }
}
/* }}} */
-static inline void php_var_serialize_long(smart_str *buf, php_int_t val) /* {{{ */
+static inline void php_var_serialize_long(smart_str *buf, zend_long val) /* {{{ */
{
smart_str_appendl(buf, "i:", 2);
- smart_str_append_int(buf, val);
+ smart_str_append_long(buf, val);
smart_str_appendc(buf, ';');
}
/* }}} */
-static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */
+static inline void php_var_serialize_string(smart_str *buf, char *str, size_t len) /* {{{ */
{
smart_str_appendl(buf, "s:", 2);
- smart_str_append_int(buf, len);
+ smart_str_append_unsigned(buf, len);
smart_str_appendl(buf, ":\"", 2);
smart_str_appendl(buf, str, len);
smart_str_appendl(buf, "\";", 2);
@@ -674,18 +664,18 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc
PHP_SET_CLASS_ATTRIBUTES(struc);
smart_str_appendl(buf, "O:", 2);
- smart_str_append_int(buf, (int)class_name->len);
+ smart_str_append_unsigned(buf, class_name->len);
smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, class_name->val, class_name->len);
+ smart_str_append(buf, class_name);
smart_str_appendl(buf, "\":", 2);
PHP_CLEANUP_CLASS_ATTRIBUTES();
return incomplete_class;
}
/* }}} */
-static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_ptr, HashTable *var_hash TSRMLS_DC) /* {{{ */
+static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_ptr, php_serialize_data_t var_hash TSRMLS_DC) /* {{{ */
{
- int count;
+ uint32_t count;
zend_bool incomplete_class;
incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC);
@@ -695,7 +685,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
if (incomplete_class) {
--count;
}
- smart_str_append_int(buf, count);
+ smart_str_append_unsigned(buf, count);
smart_str_appendl(buf, ":{", 2);
if (count > 0) {
@@ -728,16 +718,15 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
continue;
}
}
- php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name));
+ php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name));
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
} else {
- zend_class_entry *ce;
- ce = zend_get_class_entry(Z_OBJ_P(struc) TSRMLS_CC);
+ zend_class_entry *ce = Z_OBJ_P(struc)->ce;
if (ce) {
zend_string *prot_name, *priv_name;
do {
- priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS);
+ priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS);
if ((d = zend_hash_find(propers, priv_name)) != NULL) {
if (Z_TYPE_P(d) == IS_INDIRECT) {
d = Z_INDIRECT_P(d);
@@ -746,32 +735,32 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
}
}
php_var_serialize_string(buf, priv_name->val, priv_name->len);
- STR_FREE(priv_name);
+ zend_string_free(priv_name);
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
break;
}
- STR_FREE(priv_name);
- prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS);
+ zend_string_free(priv_name);
+ prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS);
if ((d = zend_hash_find(propers, prot_name)) != NULL) {
if (Z_TYPE_P(d) == IS_INDIRECT) {
d = Z_INDIRECT_P(d);
if (Z_TYPE_P(d) == IS_UNDEF) {
- STR_FREE(prot_name);
+ zend_string_free(prot_name);
break;
}
}
php_var_serialize_string(buf, prot_name->val, prot_name->len);
- STR_FREE(prot_name);
+ zend_string_free(prot_name);
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
break;
}
- STR_FREE(prot_name);
- php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name));
+ zend_string_free(prot_name);
+ php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name));
php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_P(name));
} while (0);
} else {
- php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name));
+ php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name));
php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC);
}
}
@@ -781,28 +770,24 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
}
/* }}} */
-static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var_hash TSRMLS_DC) /* {{{ */
+static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_data_t var_hash TSRMLS_DC) /* {{{ */
{
- int i;
- zval var_already;
+ uint32_t var_already;
HashTable *myht;
if (EG(exception)) {
return;
}
- ZVAL_UNDEF(&var_already);
-
- if (var_hash &&
- php_add_var_hash(var_hash, struc, &var_already TSRMLS_CC) == FAILURE) {
+ if (var_hash && (var_already = php_add_var_hash(var_hash, struc TSRMLS_CC))) {
if (Z_ISREF_P(struc)) {
smart_str_appendl(buf, "R:", 2);
- smart_str_append_int(buf, Z_IVAL(var_already));
+ smart_str_append_long(buf, var_already);
smart_str_appendc(buf, ';');
return;
} else if (Z_TYPE_P(struc) == IS_OBJECT) {
smart_str_appendl(buf, "r:", 2);
- smart_str_append_int(buf, Z_IVAL(var_already));
+ smart_str_append_long(buf, var_already);
smart_str_appendc(buf, ';');
return;
}
@@ -822,8 +807,8 @@ again:
smart_str_appendl(buf, "N;", 2);
return;
- case IS_INT:
- php_var_serialize_long(buf, Z_IVAL_P(struc));
+ case IS_LONG:
+ php_var_serialize_long(buf, Z_LVAL_P(struc));
return;
case IS_DOUBLE: {
@@ -839,34 +824,30 @@ again:
}
case IS_STRING:
- php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc));
+ php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc));
return;
case IS_OBJECT: {
zval retval;
zval fname;
int res;
- zend_class_entry *ce = NULL;
-
- if (Z_OBJ_HT_P(struc)->get_class_entry) {
- ce = Z_OBJCE_P(struc);
- }
+ zend_class_entry *ce = Z_OBJCE_P(struc);
- if (ce && ce->serialize != NULL) {
+ if (ce->serialize != NULL) {
/* has custom handler */
unsigned char *serialized_data = NULL;
- zend_uint serialized_length;
+ size_t serialized_length;
if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) {
smart_str_appendl(buf, "C:", 2);
- smart_str_append_int(buf, (int)Z_OBJCE_P(struc)->name->len);
+ smart_str_append_unsigned(buf, Z_OBJCE_P(struc)->name->len);
smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, Z_OBJCE_P(struc)->name->val, Z_OBJCE_P(struc)->name->len);
+ smart_str_append(buf, Z_OBJCE_P(struc)->name);
smart_str_appendl(buf, "\":", 2);
- smart_str_append_int(buf, (int)serialized_length);
+ smart_str_append_unsigned(buf, serialized_length);
smart_str_appendl(buf, ":{", 2);
- smart_str_appendl(buf, serialized_data, serialized_length);
+ smart_str_appendl(buf, (char *) serialized_data, serialized_length);
smart_str_appendc(buf, '}');
} else {
smart_str_appendl(buf, "N;", 2);
@@ -909,6 +890,7 @@ again:
/* fall-through */
}
case IS_ARRAY: {
+ uint32_t i;
zend_bool incomplete_class = 0;
if (Z_TYPE_P(struc) == IS_ARRAY) {
smart_str_appendl(buf, "a:", 2);
@@ -923,12 +905,12 @@ again:
if (i > 0 && incomplete_class) {
--i;
}
- smart_str_append_int(buf, i);
+ smart_str_append_unsigned(buf, i);
smart_str_appendl(buf, ":{", 2);
if (i > 0) {
zend_string *key;
zval *data;
- php_uint_t index;
+ zend_ulong index;
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) {
@@ -972,9 +954,9 @@ again:
}
/* }}} */
-PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *var_hash TSRMLS_DC) /* {{{ */
+PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *data TSRMLS_DC) /* {{{ */
{
- php_var_serialize_intern(buf, struc, *var_hash TSRMLS_CC);
+ php_var_serialize_intern(buf, struc, *data TSRMLS_CC);
smart_str_0(buf);
}
/* }}} */
@@ -1013,7 +995,7 @@ PHP_FUNCTION(serialize)
PHP_FUNCTION(unserialize)
{
char *buf = NULL;
- int buf_len;
+ size_t buf_len;
const unsigned char *p;
php_unserialize_data_t var_hash;
@@ -1031,7 +1013,7 @@ PHP_FUNCTION(unserialize)
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zval_dtor(return_value);
if (!EG(exception)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_INT_FMT " of %d bytes", (php_int_t)((char*)p - buf), buf_len);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len);
}
RETURN_FALSE;
}
@@ -1048,7 +1030,7 @@ PHP_FUNCTION(memory_get_usage) {
RETURN_FALSE;
}
- RETURN_INT(zend_memory_usage(real_usage TSRMLS_CC));
+ RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC));
}
/* }}} */
@@ -1061,7 +1043,7 @@ PHP_FUNCTION(memory_get_peak_usage) {
RETURN_FALSE;
}
- RETURN_INT(zend_memory_peak_usage(real_usage TSRMLS_CC));
+ RETURN_LONG(zend_memory_peak_usage(real_usage TSRMLS_CC));
}
/* }}} */
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 810f3c8f8c..9be2b0658a 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -1,7 +1,8 @@
/* Generated by re2c 0.13.5 */
+#line 1 "ext/standard/var_unserializer.re"
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,13 +30,13 @@
typedef struct {
zval *data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_entries;
typedef struct {
zval data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_dtor_entries;
@@ -118,7 +119,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval)
{
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
@@ -135,7 +136,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz
}
}
-static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
+static zval *var_access(php_unserialize_data_t *var_hashx, zend_long id)
{
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
@@ -157,7 +158,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
{
void *next;
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor;
#if VAR_ENTRIES_DBG
@@ -185,17 +186,17 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen)
{
size_t i, j;
- zend_string *str = STR_ALLOC(len, 0);
+ zend_string *str = zend_string_alloc(len, 0);
unsigned char *end = *(unsigned char **)p+maxlen;
if (end < *p) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
for (i = 0; i < len; i++) {
if (*p >= end) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
if (**p != '\\') {
@@ -212,7 +213,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t
} else if (**p >= 'A' && **p <= 'F') {
ch = (ch << 4) + (**p -'A'+10);
} else {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
}
@@ -232,14 +233,15 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t
#define YYMARKER marker
+#line 241 "ext/standard/var_unserializer.re"
-static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q)
+static inline zend_long parse_iv2(const unsigned char *p, const unsigned char **q)
{
char cursor;
- php_int_t result = 0;
+ zend_long result = 0;
int neg = 0;
switch (*p) {
@@ -264,7 +266,7 @@ static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **
return result;
}
-static inline php_int_t parse_iv(const unsigned char *p)
+static inline zend_long parse_iv(const unsigned char *p)
{
return parse_iv2(p, NULL);
}
@@ -294,7 +296,7 @@ static inline size_t parse_uiv(const unsigned char *p)
#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC
#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC
-static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops)
+static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops)
{
while (elements-- > 0) {
zval key, *data, d, *old_data;
@@ -305,7 +307,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
return 0;
}
- if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) {
+ if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
return 0;
}
@@ -315,12 +317,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
if (!objprops) {
switch (Z_TYPE(key)) {
- case IS_INT:
- if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) {
+ case IS_LONG:
+ if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) {
//??? update hash
var_push_dtor(var_hash, old_data);
}
- data = zend_hash_index_update(ht, Z_IVAL(key), &d);
+ data = zend_hash_index_update(ht, Z_LVAL(key), &d);
break;
case IS_STRING:
if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) {
@@ -378,14 +380,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER)
static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t datalen;
+ zend_long datalen;
datalen = parse_iv2((*p) + 2, p);
(*p) += 2;
- if (datalen < 0 || (*p) + datalen >= max) {
- zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (php_int_t)(max - (*p)));
+ if (datalen < 0 || (max - (*p)) <= datalen) {
+ zend_error(E_WARNING, "Insufficient data for unserializing - %pd required, %pd present", datalen, (zend_long)(max - (*p)));
return 0;
}
@@ -401,9 +403,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
+static inline zend_long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t elements;
+ zend_long elements;
elements = parse_iv2((*p) + 2, p);
@@ -424,7 +426,7 @@ static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *
#ifdef PHP_WIN32
# pragma optimize("", off)
#endif
-static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements)
+static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements)
{
zval retval;
zval fname;
@@ -479,6 +481,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
start = cursor;
+#line 485 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
@@ -538,7 +541,9 @@ yy2:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy95;
yy3:
+#line 826 "ext/standard/var_unserializer.re"
{ return 0; }
+#line 547 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy89;
@@ -581,11 +586,13 @@ yy13:
goto yy3;
yy14:
++YYCURSOR;
+#line 820 "ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */
}
+#line 596 "ext/standard/var_unserializer.c"
yy16:
yych = *++YYCURSOR;
goto yy3;
@@ -615,9 +622,10 @@ yy20:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
+#line 681 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
- php_int_t elements;
+ zend_long elements;
char *str;
zend_string *class_name;
zend_class_entry *ce;
@@ -661,7 +669,7 @@ yy20:
return 0;
}
- class_name = STR_INIT(str, len, 0);
+ class_name = zend_string_init(str, len, 0);
do {
/* Try to find class directly */
@@ -670,7 +678,7 @@ yy20:
if (ce) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
break;
@@ -678,7 +686,7 @@ yy20:
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
@@ -692,12 +700,12 @@ yy20:
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], STR_COPY(class_name));
+ ZVAL_STR_COPY(&args[0], class_name);
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -712,7 +720,7 @@ yy20:
BG(serialize_lock)--;
zval_ptr_dtor(&retval);
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -740,7 +748,7 @@ yy20:
if (ret && incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return ret;
}
@@ -749,10 +757,11 @@ yy20:
if (incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
+#line 765 "ext/standard/var_unserializer.c"
yy25:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -777,6 +786,7 @@ yy27:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
+#line 673 "ext/standard/var_unserializer.re"
{
//??? INIT_PZVAL(rval);
@@ -784,6 +794,7 @@ yy27:
return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
}
+#line 798 "ext/standard/var_unserializer.c"
yy32:
yych = *++YYCURSOR;
if (yych == '+') goto yy33;
@@ -804,8 +815,9 @@ yy34:
yych = *++YYCURSOR;
if (yych != '{') goto yy18;
++YYCURSOR;
+#line 652 "ext/standard/var_unserializer.re"
{
- php_int_t elements = parse_iv(start + 2);
+ zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
*p = YYCURSOR;
@@ -824,6 +836,7 @@ yy34:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
+#line 840 "ext/standard/var_unserializer.c"
yy39:
yych = *++YYCURSOR;
if (yych == '+') goto yy40;
@@ -844,6 +857,7 @@ yy41:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
+#line 624 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
zend_string *str;
@@ -860,7 +874,7 @@ yy41:
}
if (*(YYCURSOR) != '"') {
- STR_FREE(str);
+ zend_string_free(str);
*p = YYCURSOR;
return 0;
}
@@ -871,6 +885,7 @@ yy41:
ZVAL_STR(rval, str);
return 1;
}
+#line 889 "ext/standard/var_unserializer.c"
yy46:
yych = *++YYCURSOR;
if (yych == '+') goto yy47;
@@ -891,6 +906,7 @@ yy48:
yych = *++YYCURSOR;
if (yych != '"') goto yy18;
++YYCURSOR;
+#line 597 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -917,6 +933,7 @@ yy48:
ZVAL_STRINGL(rval, str, len);
return 1;
}
+#line 937 "ext/standard/var_unserializer.c"
yy53:
yych = *++YYCURSOR;
if (yych <= '/') {
@@ -1004,14 +1021,16 @@ yy61:
}
yy63:
++YYCURSOR;
+#line 588 "ext/standard/var_unserializer.re"
{
-#if SIZEOF_ZEND_INT == 4
+#if SIZEOF_ZEND_LONG == 4
use_double:
#endif
*p = YYCURSOR;
ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
+#line 1034 "ext/standard/var_unserializer.c"
yy65:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1070,6 +1089,7 @@ yy73:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
+#line 572 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
@@ -1085,6 +1105,7 @@ yy73:
return 1;
}
+#line 1109 "ext/standard/var_unserializer.c"
yy76:
yych = *++YYCURSOR;
if (yych == 'N') goto yy73;
@@ -1111,18 +1132,19 @@ yy79:
if (yych <= '9') goto yy79;
if (yych != ';') goto yy18;
++YYCURSOR;
+#line 546 "ext/standard/var_unserializer.re"
{
-#if SIZEOF_ZEND_INT == 4
+#if SIZEOF_ZEND_LONG == 4
int digits = YYCURSOR - start - 3;
if (start[2] == '-' || start[2] == '+') {
digits--;
}
- /* Use double for large php_int_t values that were serialized on a 64-bit system */
- if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) {
- if (digits == MAX_LENGTH_OF_ZEND_INT - 1) {
- int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1);
+ /* Use double for large zend_long values that were serialized on a 64-bit system */
+ if (digits >= MAX_LENGTH_OF_LONG - 1) {
+ if (digits == MAX_LENGTH_OF_LONG - 1) {
+ int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1);
if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) {
goto use_double;
@@ -1133,9 +1155,10 @@ yy79:
}
#endif
*p = YYCURSOR;
- ZVAL_INT(rval, parse_iv(start + 2));
+ ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
+#line 1162 "ext/standard/var_unserializer.c"
yy83:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
@@ -1143,18 +1166,22 @@ yy83:
yych = *++YYCURSOR;
if (yych != ';') goto yy18;
++YYCURSOR;
+#line 540 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_BOOL(rval, parse_iv(start + 2));
return 1;
}
+#line 1176 "ext/standard/var_unserializer.c"
yy87:
++YYCURSOR;
+#line 534 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_NULL(rval);
return 1;
}
+#line 1185 "ext/standard/var_unserializer.c"
yy89:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1177,8 +1204,9 @@ yy91:
if (yych <= '9') goto yy91;
if (yych != ';') goto yy18;
++YYCURSOR;
+#line 511 "ext/standard/var_unserializer.re"
{
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -1199,6 +1227,7 @@ yy91:
return 1;
}
+#line 1231 "ext/standard/var_unserializer.c"
yy95:
yych = *++YYCURSOR;
if (yych <= ',') {
@@ -1221,8 +1250,9 @@ yy97:
if (yych <= '9') goto yy97;
if (yych != ';') goto yy18;
++YYCURSOR;
+#line 489 "ext/standard/var_unserializer.re"
{
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -1242,7 +1272,9 @@ yy97:
return 1;
}
+#line 1276 "ext/standard/var_unserializer.c"
}
+#line 828 "ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 40876563a8..1898c7734c 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,13 +28,13 @@
typedef struct {
zval *data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_entries;
typedef struct {
zval data[VAR_ENTRIES_MAX];
- php_int_t used_slots;
+ zend_long used_slots;
void *next;
} var_dtor_entries;
@@ -117,7 +117,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval)
{
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
@@ -134,7 +134,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz
}
}
-static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
+static zval *var_access(php_unserialize_data_t *var_hashx, zend_long id)
{
var_entries *var_hash = (*var_hashx)->first;
#if VAR_ENTRIES_DBG
@@ -156,7 +156,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id)
PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
{
void *next;
- php_int_t i;
+ zend_long i;
var_entries *var_hash = (*var_hashx)->first;
var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor;
#if VAR_ENTRIES_DBG
@@ -184,17 +184,17 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen)
{
size_t i, j;
- zend_string *str = STR_ALLOC(len, 0);
+ zend_string *str = zend_string_alloc(len, 0);
unsigned char *end = *(unsigned char **)p+maxlen;
if (end < *p) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
for (i = 0; i < len; i++) {
if (*p >= end) {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
if (**p != '\\') {
@@ -211,7 +211,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t
} else if (**p >= 'A' && **p <= 'F') {
ch = (ch << 4) + (**p -'A'+10);
} else {
- STR_FREE(str);
+ zend_string_free(str);
return NULL;
}
}
@@ -242,10 +242,10 @@ object = [OC];
-static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q)
+static inline zend_long parse_iv2(const unsigned char *p, const unsigned char **q)
{
char cursor;
- php_int_t result = 0;
+ zend_long result = 0;
int neg = 0;
switch (*p) {
@@ -270,7 +270,7 @@ static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **
return result;
}
-static inline php_int_t parse_iv(const unsigned char *p)
+static inline zend_long parse_iv(const unsigned char *p)
{
return parse_iv2(p, NULL);
}
@@ -300,7 +300,7 @@ static inline size_t parse_uiv(const unsigned char *p)
#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC
#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC
-static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops)
+static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops)
{
while (elements-- > 0) {
zval key, *data, d, *old_data;
@@ -311,7 +311,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
return 0;
}
- if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) {
+ if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
return 0;
}
@@ -321,12 +321,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_
if (!objprops) {
switch (Z_TYPE(key)) {
- case IS_INT:
- if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) {
+ case IS_LONG:
+ if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) {
//??? update hash
var_push_dtor(var_hash, old_data);
}
- data = zend_hash_index_update(ht, Z_IVAL(key), &d);
+ data = zend_hash_index_update(ht, Z_LVAL(key), &d);
break;
case IS_STRING:
if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) {
@@ -384,14 +384,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER)
static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t datalen;
+ zend_long datalen;
datalen = parse_iv2((*p) + 2, p);
(*p) += 2;
- if (datalen < 0 || (*p) + datalen >= max) {
- zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (php_int_t)(max - (*p)));
+ if (datalen < 0 || (max - (*p)) <= datalen) {
+ zend_error(E_WARNING, "Insufficient data for unserializing - %pd required, %pd present", datalen, (zend_long)(max - (*p)));
return 0;
}
@@ -407,9 +407,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
+static inline zend_long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
{
- php_int_t elements;
+ zend_long elements;
elements = parse_iv2((*p) + 2, p);
@@ -430,7 +430,7 @@ static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *
#ifdef PHP_WIN32
# pragma optimize("", off)
#endif
-static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements)
+static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements)
{
zval retval;
zval fname;
@@ -487,7 +487,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
/*!re2c
"R:" iv ";" {
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -509,7 +509,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
}
"r:" iv ";" {
- php_int_t id;
+ zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -544,17 +544,17 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
}
"i:" iv ";" {
-#if SIZEOF_ZEND_INT == 4
+#if SIZEOF_ZEND_LONG == 4
int digits = YYCURSOR - start - 3;
if (start[2] == '-' || start[2] == '+') {
digits--;
}
- /* Use double for large php_int_t values that were serialized on a 64-bit system */
- if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) {
- if (digits == MAX_LENGTH_OF_ZEND_INT - 1) {
- int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1);
+ /* Use double for large zend_long values that were serialized on a 64-bit system */
+ if (digits >= MAX_LENGTH_OF_LONG - 1) {
+ if (digits == MAX_LENGTH_OF_LONG - 1) {
+ int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1);
if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) {
goto use_double;
@@ -565,7 +565,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
}
#endif
*p = YYCURSOR;
- ZVAL_INT(rval, parse_iv(start + 2));
+ ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
@@ -586,7 +586,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
}
"d:" (iv | nv | nvexp) ";" {
-#if SIZEOF_ZEND_INT == 4
+#if SIZEOF_ZEND_LONG == 4
use_double:
#endif
*p = YYCURSOR;
@@ -637,7 +637,7 @@ use_double:
}
if (*(YYCURSOR) != '"') {
- STR_FREE(str);
+ zend_string_free(str);
*p = YYCURSOR;
return 0;
}
@@ -650,7 +650,7 @@ use_double:
}
"a:" uiv ":" "{" {
- php_int_t elements = parse_iv(start + 2);
+ zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
*p = YYCURSOR;
@@ -680,7 +680,7 @@ use_double:
object ":" uiv ":" ["] {
size_t len, len2, len3, maxlen;
- php_int_t elements;
+ zend_long elements;
char *str;
zend_string *class_name;
zend_class_entry *ce;
@@ -724,7 +724,7 @@ object ":" uiv ":" ["] {
return 0;
}
- class_name = STR_INIT(str, len, 0);
+ class_name = zend_string_init(str, len, 0);
do {
/* Try to find class directly */
@@ -733,7 +733,7 @@ object ":" uiv ":" ["] {
if (ce) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
break;
@@ -741,7 +741,7 @@ object ":" uiv ":" ["] {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return 0;
}
@@ -755,12 +755,12 @@ object ":" uiv ":" ["] {
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], STR_COPY(class_name));
+ ZVAL_STR_COPY(&args[0], class_name);
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
BG(serialize_lock)--;
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -775,7 +775,7 @@ object ":" uiv ":" ["] {
BG(serialize_lock)--;
zval_ptr_dtor(&retval);
if (EG(exception)) {
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
@@ -803,7 +803,7 @@ object ":" uiv ":" ["] {
if (ret && incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return ret;
}
@@ -812,7 +812,7 @@ object ":" uiv ":" ["] {
if (incomplete_class) {
php_store_class_name(rval, class_name->val, len2);
}
- STR_RELEASE(class_name);
+ zend_string_release(class_name);
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index 85085b0b97..ffdd5abf0d 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -211,7 +211,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
PHP_FUNCTION(version_compare)
{
char *v1, *v2, *op = NULL;
- int v1_len, v2_len, op_len = 0;
+ size_t v1_len, v2_len, op_len = 0;
int compare, argc;
argc = ZEND_NUM_ARGS();
@@ -221,7 +221,7 @@ PHP_FUNCTION(version_compare)
}
compare = php_version_compare(v1, v2);
if (argc == 2) {
- RETURN_INT(compare);
+ RETURN_LONG(compare);
}
if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) {
RETURN_BOOL(compare == -1);
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index 56244ec343..c079ff383d 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -281,8 +281,8 @@ static void _free_sybase_result(sybase_result *result)
if (result->fields) {
for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
+ zend_string_free(result->fields[i].name);
+ zend_string_free(result->fields[i].column_source);
}
efree(result->fields);
}
@@ -390,7 +390,7 @@ static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONN
if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Client message: %s (severity %ld)", errmsg->msgstring, (long)CS_SEVERITY(errmsg->msgnumber));
}
- STR_FREE(SybCtG(server_message));
+ zend_string_free(SybCtG(server_message));
SybCtG(server_message) = estrdup(errmsg->msgstring);
@@ -419,19 +419,19 @@ static int _call_message_handler(zval *callback_name, CS_SERVERMSG *srvmsg TSRML
/* Build arguments */
MAKE_STD_ZVAL(msgnumber);
- ZVAL_INT(msgnumber, srvmsg->msgnumber);
+ ZVAL_LONG(msgnumber, srvmsg->msgnumber);
args[0] = &msgnumber;
MAKE_STD_ZVAL(severity);
- ZVAL_INT(severity, srvmsg->severity);
+ ZVAL_LONG(severity, srvmsg->severity);
args[1] = &severity;
MAKE_STD_ZVAL(state);
- ZVAL_INT(state, srvmsg->state);
+ ZVAL_LONG(state, srvmsg->state);
args[2] = &state;
MAKE_STD_ZVAL(line);
- ZVAL_INT(line, srvmsg->line);
+ ZVAL_LONG(line, srvmsg->line);
args[3] = &line;
MAKE_STD_ZVAL(text);
@@ -470,7 +470,7 @@ static CS_RETCODE CS_PUBLIC _server_message_handler(CS_CONTEXT *context, CS_CONN
TSRMLS_FETCH();
/* Remember the last server message in any case */
- STR_FREE(SybCtG(server_message));
+ zend_string_free(SybCtG(server_message));
SybCtG(server_message) = estrdup(srvmsg->text);
/* Retrieve sybase link */
@@ -559,7 +559,7 @@ static PHP_GINIT_FUNCTION(sybase)
* signals to implement timeouts, they are actually implemented
* by using poll() or select() on Solaris and Linux.
*/
- if (cfg_get_int("sybct.timeout", &opt)==SUCCESS) {
+ if (cfg_get_long("sybct.timeout", &opt)==SUCCESS) {
CS_INT cs_timeout = opt;
if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update the timeout");
@@ -620,7 +620,7 @@ PHP_RSHUTDOWN_FUNCTION(sybase)
zval_ptr_dtor(&SybCtG(callback_name));
SybCtG(callback_name)= NULL;
}
- STR_FREE(SybCtG(server_message));
+ zend_string_free(SybCtG(server_message));
SybCtG(server_message) = NULL;
return SUCCESS;
}
@@ -678,7 +678,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char
}
}
- if (cfg_get_int("sybct.packet_size", &packetsize) == SUCCESS) {
+ if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) {
if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize");
}
@@ -864,7 +864,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ptr = zend_list_find(link, &type); /* check if the link is still there */
if (ptr && (type==le_link || type==le_plink)) {
zend_list_addref(link);
- Z_IVAL_P(return_value) = SybCtG(default_link) = link;
+ Z_LVAL_P(return_value) = SybCtG(default_link) = link;
Z_TYPE_P(return_value) = IS_RESOURCE;
efree(hashed_details);
return;
@@ -889,7 +889,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link);
/* add it to the hash */
- new_index_ptr.ptr = (void *) Z_IVAL_P(return_value);
+ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
Z_TYPE(new_index_ptr) = le_index_ptr;
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) {
ct_close(sybase_ptr->connection, CS_UNUSED);
@@ -901,7 +901,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
SybCtG(num_links)++;
}
efree(hashed_details);
- SybCtG(default_link)=Z_IVAL_P(return_value);
+ SybCtG(default_link)=Z_LVAL_P(return_value);
zend_list_addref(SybCtG(default_link));
}
@@ -1225,7 +1225,7 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS
switch (result->numerics[j]) {
case 1: {
/* This indicates a long */
- ZVAL_INT(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10));
+ ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10));
break;
}
@@ -1238,14 +1238,14 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS
case 3: {
/* This indicates either a long or a float, which ever fits */
errno = 0;
- Z_IVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10);
+ Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10);
if (errno == ERANGE) {
/* An overflow occurred, so try to fit it into a double */
RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]);
break;
}
- Z_TYPE(result->data[i][j]) = IS_INT;
+ Z_TYPE(result->data[i][j]) = IS_LONG;
break;
}
@@ -1426,7 +1426,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
zval *sybase_link_index = NULL;
zend_bool store = 1;
char *query;
- int len, id, deadlock_count;
+ size_t len, id, deadlock_count;
sybase_link *sybase_ptr;
sybase_result *result;
CS_INT restype;
@@ -1469,7 +1469,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
/* Get the resultset and free it */
ALLOC_ZVAL(tmp);
- Z_IVAL_P(tmp)= sybase_ptr->active_result_index;
+ Z_LVAL_P(tmp)= sybase_ptr->active_result_index;
Z_TYPE_P(tmp)= IS_RESOURCE;
INIT_PZVAL(tmp);
ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result);
@@ -1701,7 +1701,7 @@ PHP_FUNCTION(sybase_free_result)
php_sybase_finish_results(result TSRMLS_CC);
}
- zend_list_delete(Z_IVAL_P(sybase_result_index));
+ zend_list_delete(Z_LVAL_P(sybase_result_index));
RETURN_TRUE;
}
@@ -1727,8 +1727,8 @@ PHP_FUNCTION(sybase_num_rows)
}
ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
- Z_IVAL_P(return_value) = result->num_rows;
- Z_TYPE_P(return_value) = IS_INT;
+ Z_LVAL_P(return_value) = result->num_rows;
+ Z_TYPE_P(return_value) = IS_LONG;
}
/* }}} */
@@ -1745,8 +1745,8 @@ PHP_FUNCTION(sybase_num_fields)
}
ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
- Z_IVAL_P(return_value) = result->num_fields;
- Z_TYPE_P(return_value) = IS_INT;
+ Z_LVAL_P(return_value) = result->num_fields;
+ Z_TYPE_P(return_value) = IS_LONG;
}
/* }}} */
@@ -1867,7 +1867,7 @@ PHP_FUNCTION(sybase_fetch_object)
zend_class_entry **pce = NULL;
convert_to_string(object);
- if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) {
+ if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Class %s has not been declared", Z_STRVAL_P(object));
/* Use default (ZEND_STANDARD_CLASS_DEF_PTR) */
} else {
@@ -2002,9 +2002,9 @@ PHP_FUNCTION(sybase_fetch_field)
object_init(return_value);
add_property_string(return_value, "name", result->fields[field_offset].name);
- add_property_int(return_value, "max_length", result->fields[field_offset].max_length);
+ add_property_long(return_value, "max_length", result->fields[field_offset].max_length);
add_property_string(return_value, "column_source", result->fields[field_offset].column_source);
- add_property_int(return_value, "numeric", result->fields[field_offset].numeric);
+ add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset])));
}
/* }}} */
@@ -2076,8 +2076,8 @@ PHP_FUNCTION(sybase_result)
break;
}
default:
- convert_to_int(field);
- field_offset = Z_IVAL_P(field);
+ convert_to_long(field);
+ field_offset = Z_LVAL_P(field);
if (field_offset < 0 || field_offset >= result->num_fields) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset specified");
RETURN_FALSE;
@@ -2110,8 +2110,8 @@ PHP_FUNCTION(sybase_affected_rows)
ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink);
- Z_IVAL_P(return_value) = sybase_ptr->affected_rows;
- Z_TYPE_P(return_value) = IS_INT;
+ Z_LVAL_P(return_value) = sybase_ptr->affected_rows;
+ Z_TYPE_P(return_value) = IS_LONG;
}
/* }}} */
diff --git a/ext/sybase_ct/php_sybase_ct.h b/ext/sybase_ct/php_sybase_ct.h
index 8e4993e0ed..476e620588 100644
--- a/ext/sybase_ct/php_sybase_ct.h
+++ b/ext/sybase_ct/php_sybase_ct.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/sybase_ct/sybase_ct.dsp b/ext/sybase_ct/sybase_ct.dsp
deleted file mode 100644
index be2f890bab..0000000000
--- a/ext/sybase_ct/sybase_ct.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sybase_ct" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sybase_ct - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak" CFG="sybase_ct - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sybase_ct - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sybase_ct - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sybase_ct - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D HAVE_SYBASE_CT=1 /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libct.lib libcs.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sybase_ct.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "sybase_ct - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SYBASE_CT=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_sybase_ct.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sybase_ct - Win32 Release_TS"
-# Name "sybase_ct - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h
index 033a89cfb6..139d37fe38 100644
--- a/ext/sysvmsg/php_sysvmsg.h
+++ b/ext/sysvmsg/php_sysvmsg.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -52,11 +52,11 @@ PHP_FUNCTION(msg_queue_exists);
typedef struct {
key_t key;
- php_int_t id;
+ zend_long id;
} sysvmsg_queue_t;
struct php_msgbuf {
- php_int_t mtype;
+ zend_long mtype;
char mtext[1];
};
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index afeffcc092..d158366ea5 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "ext/standard/info.h"
#include "php_sysvmsg.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
/* In order to detect MSG_EXCEPT use at run time; we have no way
* of knowing what the bit definitions are, so we can't just define
@@ -130,11 +130,11 @@ static void sysvmsg_release(zend_resource *rsrc TSRMLS_DC)
PHP_MINIT_FUNCTION(sysvmsg)
{
le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg queue", module_number);
- REGISTER_INT_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS);
- REGISTER_INT_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS);
return SUCCESS;
}
/* }}} */
@@ -171,20 +171,20 @@ PHP_FUNCTION(msg_set_queue)
/* now pull out members of data and set them in the stat buffer */
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid") - 1)) != NULL) {
- convert_to_int_ex(item);
- stat.msg_perm.uid = Z_IVAL_P(item);
+ convert_to_long_ex(item);
+ stat.msg_perm.uid = Z_LVAL_P(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid") - 1)) != NULL) {
- convert_to_int_ex(item);
- stat.msg_perm.gid = Z_IVAL_P(item);
+ convert_to_long_ex(item);
+ stat.msg_perm.gid = Z_LVAL_P(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode") - 1)) != NULL) {
- convert_to_int_ex(item);
- stat.msg_perm.mode = Z_IVAL_P(item);
+ convert_to_long_ex(item);
+ stat.msg_perm.mode = Z_LVAL_P(item);
}
if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes") - 1)) != NULL) {
- convert_to_int_ex(item);
- stat.msg_qbytes = Z_IVAL_P(item);
+ convert_to_long_ex(item);
+ stat.msg_qbytes = Z_LVAL_P(item);
}
if (msgctl(mq->id, IPC_SET, &stat) == 0) {
RETVAL_TRUE;
@@ -212,16 +212,16 @@ PHP_FUNCTION(msg_stat_queue)
if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
array_init(return_value);
- add_assoc_int(return_value, "msg_perm.uid", stat.msg_perm.uid);
- add_assoc_int(return_value, "msg_perm.gid", stat.msg_perm.gid);
- add_assoc_int(return_value, "msg_perm.mode", stat.msg_perm.mode);
- add_assoc_int(return_value, "msg_stime", stat.msg_stime);
- add_assoc_int(return_value, "msg_rtime", stat.msg_rtime);
- add_assoc_int(return_value, "msg_ctime", stat.msg_ctime);
- add_assoc_int(return_value, "msg_qnum", stat.msg_qnum);
- add_assoc_int(return_value, "msg_qbytes", stat.msg_qbytes);
- add_assoc_int(return_value, "msg_lspid", stat.msg_lspid);
- add_assoc_int(return_value, "msg_lrpid", stat.msg_lrpid);
+ add_assoc_long(return_value, "msg_perm.uid", stat.msg_perm.uid);
+ add_assoc_long(return_value, "msg_perm.gid", stat.msg_perm.gid);
+ add_assoc_long(return_value, "msg_perm.mode", stat.msg_perm.mode);
+ add_assoc_long(return_value, "msg_stime", stat.msg_stime);
+ add_assoc_long(return_value, "msg_rtime", stat.msg_rtime);
+ add_assoc_long(return_value, "msg_ctime", stat.msg_ctime);
+ add_assoc_long(return_value, "msg_qnum", stat.msg_qnum);
+ add_assoc_long(return_value, "msg_qbytes", stat.msg_qbytes);
+ add_assoc_long(return_value, "msg_lspid", stat.msg_lspid);
+ add_assoc_long(return_value, "msg_lrpid", stat.msg_lrpid);
}
}
/* }}} */
@@ -230,9 +230,9 @@ PHP_FUNCTION(msg_stat_queue)
Check whether a message queue exists */
PHP_FUNCTION(msg_queue_exists)
{
- php_int_t key;
+ zend_long key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &key) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &key) == FAILURE) {
return;
}
@@ -248,11 +248,11 @@ PHP_FUNCTION(msg_queue_exists)
Attach to a message queue */
PHP_FUNCTION(msg_get_queue)
{
- php_int_t key;
- php_int_t perms = 0666;
+ zend_long key;
+ zend_long perms = 0666;
sysvmsg_queue_t *mq;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &key, &perms) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &key, &perms) == FAILURE) {
return;
}
@@ -299,8 +299,8 @@ PHP_FUNCTION(msg_remove_queue)
PHP_FUNCTION(msg_receive)
{
zval *out_message, *queue, *out_msgtype, *zerrcode = NULL;
- php_int_t desiredmsgtype, maxsize, flags = 0;
- php_int_t realflags = 0;
+ zend_long desiredmsgtype, maxsize, flags = 0;
+ zend_long realflags = 0;
zend_bool do_unserialize = 1;
sysvmsg_queue_t *mq = NULL;
struct php_msgbuf *messagebuffer = NULL; /* buffer to transmit */
@@ -308,7 +308,7 @@ PHP_FUNCTION(msg_receive)
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/iz/|biz/",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/lz/|blz/",
&queue, &desiredmsgtype, &out_msgtype, &maxsize,
&out_message, &do_unserialize, &flags, &zerrcode) == FAILURE) {
return;
@@ -344,18 +344,18 @@ PHP_FUNCTION(msg_receive)
zval_dtor(out_msgtype);
zval_dtor(out_message);
- ZVAL_INT(out_msgtype, 0);
+ ZVAL_LONG(out_msgtype, 0);
ZVAL_FALSE(out_message);
if (zerrcode) {
ZVAL_DEREF(zerrcode);
zval_dtor(zerrcode);
- ZVAL_INT(zerrcode, 0);
+ ZVAL_LONG(zerrcode, 0);
}
if (result >= 0) {
/* got it! */
- ZVAL_INT(out_msgtype, messagebuffer->mtype);
+ ZVAL_LONG(out_msgtype, messagebuffer->mtype);
RETVAL_TRUE;
if (do_unserialize) {
@@ -375,7 +375,7 @@ PHP_FUNCTION(msg_receive)
ZVAL_STRINGL(out_message, messagebuffer->mtext, result);
}
} else if (zerrcode) {
- ZVAL_INT(zerrcode, errno);
+ ZVAL_LONG(zerrcode, errno);
}
efree(messagebuffer);
}
@@ -386,7 +386,7 @@ PHP_FUNCTION(msg_receive)
PHP_FUNCTION(msg_send)
{
zval *message, *queue, *zerror=NULL;
- php_int_t msgtype;
+ zend_long msgtype;
zend_bool do_serialize = 1, blocking = 1;
sysvmsg_queue_t * mq = NULL;
struct php_msgbuf * messagebuffer = NULL; /* buffer to transmit */
@@ -395,7 +395,7 @@ PHP_FUNCTION(msg_send)
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz|bbz/",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz|bbz/",
&queue, &msgtype, &message, &do_serialize, &blocking, &zerror) == FAILURE) {
return;
}
@@ -421,11 +421,11 @@ PHP_FUNCTION(msg_send)
switch (Z_TYPE_P(message)) {
case IS_STRING:
p = Z_STRVAL_P(message);
- message_len = Z_STRSIZE_P(message);
+ message_len = Z_STRLEN_P(message);
break;
- case IS_INT:
- message_len = spprintf(&p, 0, "%pd", Z_IVAL_P(message));
+ case IS_LONG:
+ message_len = spprintf(&p, 0, "%pd", Z_LVAL_P(message));
break;
case IS_FALSE:
message_len = spprintf(&p, 0, "0");
@@ -459,7 +459,7 @@ PHP_FUNCTION(msg_send)
if (result == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "msgsnd failed: %s", strerror(errno));
if (zerror) {
- ZVAL_INT(zerror, errno);
+ ZVAL_LONG(zerror, errno);
}
} else {
RETVAL_TRUE;
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
index 964c3d3de4..8c2c2e5d3b 100644
--- a/ext/sysvsem/php_sysvsem.h
+++ b/ext/sysvsem/php_sysvsem.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index cdf596acc0..299c725c6b 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -66,6 +66,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_acquire, 0, 0, 1)
ZEND_ARG_INFO(0, sem_identifier)
+ ZEND_ARG_INFO(0, nowait)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_release, 0, 0, 1)
@@ -187,13 +188,13 @@ PHP_MINIT_FUNCTION(sysvsem)
Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
PHP_FUNCTION(sem_get)
{
- php_int_t key, max_acquire = 1, perm = 0666, auto_release = 1;
+ zend_long key, max_acquire = 1, perm = 0666, auto_release = 1;
int semid;
struct sembuf sop[3];
int count;
sysvsem_sem *sem_ptr;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|iii", &key, &max_acquire, &perm, &auto_release)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) {
RETURN_FALSE;
}
@@ -299,27 +300,36 @@ PHP_FUNCTION(sem_get)
static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
{
zval *arg_id;
+ zend_bool nowait = 0;
sysvsem_sem *sem_ptr;
struct sembuf sop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_id) == FAILURE) {
- return;
+ if (acquire) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|b", &arg_id, &nowait) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_id) == FAILURE) {
+ return;
+ }
}
ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semaphore", php_sysvsem_module.le_sem);
if (!acquire && sem_ptr->count == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_IVAL_P(arg_id), sem_ptr->key);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key);
RETURN_FALSE;
}
sop.sem_num = SYSVSEM_SEM;
sop.sem_op = acquire ? -1 : 1;
- sop.sem_flg = SEM_UNDO;
+ sop.sem_flg = SEM_UNDO | (nowait ? IPC_NOWAIT : 0);
while (semop(sem_ptr->semid, &sop, 1) == -1) {
if (errno != EINTR) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
+ if (errno != EAGAIN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
+ }
RETURN_FALSE;
}
}
@@ -374,7 +384,7 @@ PHP_FUNCTION(sem_remove)
#else
if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) {
#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_IVAL_P(arg_id));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_LVAL_P(arg_id));
RETURN_FALSE;
}
@@ -383,7 +393,7 @@ PHP_FUNCTION(sem_remove)
#else
if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
#endif
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_IVAL_P(arg_id), strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_LVAL_P(arg_id), strerror(errno));
RETURN_FALSE;
}
diff --git a/ext/sysvsem/tests/nowait.phpt b/ext/sysvsem/tests/nowait.phpt
new file mode 100644
index 0000000000..0a6fdf4a50
--- /dev/null
+++ b/ext/sysvsem/tests/nowait.phpt
@@ -0,0 +1,103 @@
+--TEST--
+sem_acquire with nowait
+--SKIPIF--
+<?php // vim600: ts=4 sw=4 syn=php fdm=marker
+if(!extension_loaded('sysvsem') || !extension_loaded('pcntl')) {
+ die("skip sysvsem and pcntl required");
+}
+?>
+--FILE--
+<?php
+$SEMKEY = ftok(__FILE__, 'P'); // Semaphore key
+
+$pid = pcntl_fork();
+
+if ($pid) {
+ echo "Parent.\n";
+
+ pcntl_signal(SIGCHLD, SIG_IGN);
+
+ // Get semaphore
+ $sem_id = sem_get($SEMKEY, 1);
+ if ($sem_id === FALSE) {
+ echo "P: fail to get semaphore";
+ exit;
+ }
+ echo "P: got semaphore $sem_id.\n";
+
+ register_shutdown_function(function () use ($sem_id) {
+ echo "P: cleanup.\n";
+ sem_remove($sem_id);
+ });
+
+ // Acquire semaphore
+ if (! sem_acquire($sem_id)) {
+ echo "P: fail to acquire semaphore $sem_id.\n";
+ sem_remove($sem_id);
+ exit;
+ }
+ echo "P: success acquire semaphore $sem_id.\n";
+
+ usleep(20000);
+
+ echo "P: releases.\n";
+ sem_release($sem_id);
+
+ usleep(5000);
+
+ // Acquire semaphore
+ if (! sem_acquire($sem_id)) {
+ echo "P: fail to acquire semaphore $sem_id.\n";
+ sem_remove($sem_id);
+ exit;
+ }
+ echo "P: success acquire semaphore $sem_id.\n";
+
+ $status = null;
+ pcntl_waitpid($pid, $status);
+
+} else {
+ usleep(10000);
+ echo "Child.\n";
+
+ // Get semaphore
+ $sem_id = sem_get($SEMKEY, 1);
+ if ($sem_id === FALSE) {
+ echo "C: fail to get semaphore";
+ exit;
+ }
+ echo "C: got semaphore $sem_id.\n";
+
+ // Acquire semaphore
+ if (! sem_acquire($sem_id)) {
+ echo "C: fail to acquire semaphore $sem_id.\n";
+ exit;
+ }
+ echo "C: success acquire semaphore $sem_id.\n";
+
+ echo "C: releases.\n";
+ sem_release($sem_id);
+
+ usleep(10000);
+
+ // Acquire semaphore
+ if (! sem_acquire($sem_id, true)) {
+ echo "C: fail to acquire semaphore $sem_id.\n";
+ exit;
+ }
+ echo "C: success acquire semaphore $sem_id.\n";
+}
+
+?>
+--EXPECTF--
+Parent.
+P: got semaphore Resource id #%i.
+P: success acquire semaphore Resource id #%i.
+Child.
+C: got semaphore Resource id #%i.
+P: releases.
+C: success acquire semaphore Resource id #%i.
+C: releases.
+P: success acquire semaphore Resource id #%i.
+C: fail to acquire semaphore Resource id #%i.
+P: cleanup.
diff --git a/ext/sysvsem/tests/sysv.phpt b/ext/sysvsem/tests/sysv.phpt
index 6f52f3bd7e..ccfcf03d32 100644
--- a/ext/sysvsem/tests/sysv.phpt
+++ b/ext/sysvsem/tests/sysv.phpt
@@ -9,8 +9,8 @@ if(!extension_loaded('sysvsem') || !extension_loaded('sysvshm')) {
--FILE--
<?php
$MEMSIZE = 512; // size of shared memory to allocate
-$SEMKEY = 1; // Semaphore key
-$SHMKEY = 2; // Shared memory key
+$SEMKEY = ftok(__FILE__, 'P'); // Semaphore key
+$SHMKEY = ftok(__FILE__, 'Q'); // Shared memory key
echo "Start.\n";
// Get semaphore
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
index 359c9f7ae2..9dd9272dfe 100644
--- a/ext/sysvshm/php_sysvshm.h
+++ b/ext/sysvshm/php_sysvshm.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -34,27 +34,27 @@ extern zend_module_entry sysvshm_module_entry;
typedef struct {
int le_shm;
- php_int_t init_mem;
+ zend_long init_mem;
} sysvshm_module;
typedef struct {
- php_int_t key;
- php_int_t length;
- php_int_t next;
+ zend_long key;
+ zend_long length;
+ zend_long next;
char mem;
} sysvshm_chunk;
typedef struct {
char magic[8];
- php_int_t start;
- php_int_t end;
- php_int_t free;
- php_int_t total;
+ zend_long start;
+ zend_long end;
+ zend_long free;
+ zend_long total;
} sysvshm_chunk_head;
typedef struct {
key_t key; /* key set by user */
- php_int_t id; /* returned by shmget */
+ zend_long id; /* returned by shmget */
sysvshm_chunk_head *ptr; /* memory address of shared memory */
} sysvshm_shm;
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index 97fa4df8d7..c87be09e4f 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -36,7 +36,7 @@
#include "php_sysvshm.h"
#include "ext/standard/php_var.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_ini.h"
/* {{{ arginfo */
@@ -116,9 +116,9 @@ ZEND_GET_MODULE(sysvshm)
THREAD_LS sysvshm_module php_sysvshm;
-static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len);
-static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key);
-static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos);
+static int php_put_shm_data(sysvshm_chunk_head *ptr, zend_long key, const char *data, zend_long len);
+static zend_long php_check_shm_data(sysvshm_chunk_head *ptr, zend_long key);
+static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos);
/* {{{ php_release_sysvshm
*/
@@ -136,7 +136,7 @@ PHP_MINIT_FUNCTION(sysvshm)
{
php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, PHP_SHM_RSRC_NAME, module_number);
- if (cfg_get_int("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) {
+ if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) {
php_sysvshm.init_mem=10000;
}
return SUCCESS;
@@ -150,9 +150,9 @@ PHP_FUNCTION(shm_attach)
sysvshm_shm *shm_list_ptr;
char *shm_ptr;
sysvshm_chunk_head *chunk_ptr;
- php_int_t shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666;
+ zend_long shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &shm_key, &shm_size, &shm_flag)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &shm_key, &shm_size, &shm_flag)) {
return;
}
@@ -229,7 +229,7 @@ PHP_FUNCTION(shm_remove)
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_IVAL_P(shm_id), strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno));
RETURN_FALSE;
}
@@ -243,12 +243,12 @@ PHP_FUNCTION(shm_put_var)
{
zval *shm_id, *arg_var;
int ret;
- php_int_t shm_key;
+ zend_long shm_key;
sysvshm_shm *shm_list_ptr;
smart_str shm_var = {0};
php_serialize_data_t var_hash;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &shm_id, &shm_key, &arg_var)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &shm_id, &shm_key, &arg_var)) {
return;
}
@@ -282,14 +282,14 @@ PHP_FUNCTION(shm_put_var)
PHP_FUNCTION(shm_get_var)
{
zval *shm_id;
- php_int_t shm_key;
+ zend_long shm_key;
sysvshm_shm *shm_list_ptr;
char *shm_data;
- php_int_t shm_varpos;
+ zend_long shm_varpos;
sysvshm_chunk *shm_var;
php_unserialize_data_t var_hash;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) {
return;
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
@@ -319,10 +319,10 @@ PHP_FUNCTION(shm_get_var)
PHP_FUNCTION(shm_has_var)
{
zval *shm_id;
- php_int_t shm_key;
+ zend_long shm_key;
sysvshm_shm *shm_list_ptr;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) {
return;
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
@@ -335,10 +335,10 @@ PHP_FUNCTION(shm_has_var)
PHP_FUNCTION(shm_remove_var)
{
zval *shm_id;
- php_int_t shm_key, shm_varpos;
+ zend_long shm_key, shm_varpos;
sysvshm_shm *shm_list_ptr;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) {
return;
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
@@ -356,13 +356,13 @@ PHP_FUNCTION(shm_remove_var)
/* {{{ php_put_shm_data
* inserts an ascii-string into shared memory */
-static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len)
+static int php_put_shm_data(sysvshm_chunk_head *ptr, zend_long key, const char *data, zend_long len)
{
sysvshm_chunk *shm_var;
- php_int_t total_size;
- php_int_t shm_varpos;
+ zend_long total_size;
+ zend_long shm_varpos;
- total_size = ((php_int_t) (len + sizeof(sysvshm_chunk) - 1) / sizeof(php_int_t)) * sizeof(php_int_t) + sizeof(php_int_t); /* php_int_t alligment */
+ total_size = ((zend_long) (len + sizeof(sysvshm_chunk) - 1) / sizeof(zend_long)) * sizeof(zend_long) + sizeof(zend_long); /* zend_long alligment */
if ((shm_varpos = php_check_shm_data(ptr, key)) > 0) {
php_remove_shm_data(ptr, shm_varpos);
@@ -385,9 +385,9 @@ static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *
/* {{{ php_check_shm_data
*/
-static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key)
+static zend_long php_check_shm_data(sysvshm_chunk_head *ptr, zend_long key)
{
- php_int_t pos;
+ zend_long pos;
sysvshm_chunk *shm_var;
pos = ptr->start;
@@ -412,10 +412,10 @@ static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key)
/* {{{ php_remove_shm_data
*/
-static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos)
+static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos)
{
sysvshm_chunk *chunk_ptr, *next_chunk_ptr;
- php_int_t memcpy_len;
+ zend_long memcpy_len;
chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos);
next_chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos + chunk_ptr->next);
diff --git a/ext/tidy/examples/cleanhtml.php b/ext/tidy/examples/cleanhtml.php
index 2644210cbf..b47384b810 100644
--- a/ext/tidy/examples/cleanhtml.php
+++ b/ext/tidy/examples/cleanhtml.php
@@ -34,7 +34,3 @@
echo tidy_get_output();
?>
-
-
-
- \ No newline at end of file
diff --git a/ext/tidy/examples/cleanhtml5.php b/ext/tidy/examples/cleanhtml5.php
index 2ce683acad..c5a1fcd338 100644
--- a/ext/tidy/examples/cleanhtml5.php
+++ b/ext/tidy/examples/cleanhtml5.php
@@ -33,7 +33,3 @@
echo $tidy;
?>
-
-
-
-
diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h
index efeba3baa9..cd78f37a17 100644
--- a/ext/tidy/php_tidy.h
+++ b/ext/tidy/php_tidy.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 84425950a8..63ccf52370 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -98,8 +98,8 @@
tidy_object_handlers_ ## name.clone_obj = NULL; \
}
-#define TIDY_TAG_CONST(tag) REGISTER_INT_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT)
-#define TIDY_NODE_CONST(name, type) REGISTER_INT_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT)
+#define TIDY_TAG_CONST(tag) REGISTER_LONG_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT)
+#define TIDY_NODE_CONST(name, type) REGISTER_LONG_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT)
#ifndef TRUE
#define TRUE 1
@@ -134,7 +134,7 @@
#define ADD_PROPERTY_LONG(_table, _key, _long) \
{ \
zval tmp; \
- ZVAL_INT(&tmp, _long); \
+ ZVAL_LONG(&tmp, _long); \
zend_hash_str_update(_table, #_key, sizeof(#_key) - 1, &tmp); \
}
@@ -524,21 +524,21 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS
break;
case TidyInteger:
- if (Z_TYPE(conv) != IS_INT) {
+ if (Z_TYPE(conv) != IS_LONG) {
zval_copy_ctor(&conv);
- convert_to_int(&conv);
+ convert_to_long(&conv);
}
- if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_IVAL(conv))) {
+ if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) {
return SUCCESS;
}
break;
case TidyBoolean:
- if (Z_TYPE(conv) != IS_INT) {
+ if (Z_TYPE(conv) != IS_LONG) {
zval_copy_ctor(&conv);
- convert_to_int(&conv);
+ convert_to_long(&conv);
}
- if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_IVAL(conv))) {
+ if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_LVAL(conv))) {
return SUCCESS;
}
break;
@@ -554,7 +554,7 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS
static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_file)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
@@ -627,7 +627,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
}
if (is_file) {
- STR_RELEASE(data);
+ zend_string_release(data);
}
tidyBufFree(errbuf);
@@ -734,8 +734,8 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
PHPTidyObj *obj;
switch (type) {
- case IS_INT:
- ZVAL_INT(out, 0);
+ case IS_LONG:
+ ZVAL_LONG(out, 0);
break;
case IS_DOUBLE:
@@ -767,8 +767,8 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
PHPTidyObj *obj;
switch(type) {
- case IS_INT:
- ZVAL_INT(out, 0);
+ case IS_LONG:
+ ZVAL_LONG(out, 0);
break;
case IS_DOUBLE:
@@ -1080,14 +1080,14 @@ static PHP_INI_MH(php_tidy_set_clean_output)
int status;
zend_bool value;
- if (new_value_length==2 && strcasecmp("on", new_value)==0) {
+ if (new_value->len==2 && strcasecmp("on", new_value->val)==0) {
value = (zend_bool) 1;
- } else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
+ } else if (new_value->len==3 && strcasecmp("yes", new_value->val)==0) {
value = (zend_bool) 1;
- } else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
+ } else if (new_value->len==4 && strcasecmp("true", new_value->val)==0) {
value = (zend_bool) 1;
} else {
- value = (zend_bool) atoi(new_value);
+ value = (zend_bool) atoi(new_value->val);
}
if (stage == PHP_INI_STAGE_RUNTIME) {
@@ -1103,7 +1103,7 @@ static PHP_INI_MH(php_tidy_set_clean_output)
}
}
- status = OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ status = OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
if (stage == PHP_INI_STAGE_RUNTIME && value) {
if (!php_output_handler_started(ZEND_STRL("ob_tidyhandler") TSRMLS_CC)) {
@@ -1182,7 +1182,7 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
static PHP_FUNCTION(tidy_parse_string)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zend_string *input;
zval *options = NULL;
PHPTidyObj *obj;
@@ -1237,7 +1237,7 @@ static PHP_FUNCTION(tidy_get_output)
static PHP_FUNCTION(tidy_parse_file)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zend_bool use_include_path = 0;
zend_string *inputfile, *contents;
zval *options = NULL;
@@ -1264,7 +1264,7 @@ static PHP_FUNCTION(tidy_parse_file)
RETVAL_FALSE;
}
- STR_RELEASE(contents);
+ zend_string_release(contents);
}
/* }}} */
@@ -1334,7 +1334,7 @@ static PHP_FUNCTION(tidy_get_opt_doc)
{
PHPTidyObj *obj;
char *optval, *optname;
- int optname_len;
+ size_t optname_len;
TidyOption opt;
TIDY_SET_CONTEXT;
@@ -1396,11 +1396,11 @@ static PHP_FUNCTION(tidy_get_config)
break;
case TidyInteger:
- add_assoc_int(return_value, opt_name, (long)opt_value);
+ add_assoc_long(return_value, opt_name, (zend_long)opt_value);
break;
case TidyBoolean:
- add_assoc_bool(return_value, opt_name, (long)opt_value);
+ add_assoc_bool(return_value, opt_name, (zend_long)opt_value);
break;
}
}
@@ -1415,7 +1415,7 @@ static PHP_FUNCTION(tidy_get_status)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyStatus(obj->ptdoc->doc));
+ RETURN_LONG(tidyStatus(obj->ptdoc->doc));
}
/* }}} */
@@ -1425,7 +1425,7 @@ static PHP_FUNCTION(tidy_get_html_ver)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyDetectedHtmlVersion(obj->ptdoc->doc));
+ RETURN_LONG(tidyDetectedHtmlVersion(obj->ptdoc->doc));
}
/* }}} */
@@ -1455,7 +1455,7 @@ static PHP_FUNCTION(tidy_error_count)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyErrorCount(obj->ptdoc->doc));
+ RETURN_LONG(tidyErrorCount(obj->ptdoc->doc));
}
/* }}} */
@@ -1465,7 +1465,7 @@ static PHP_FUNCTION(tidy_warning_count)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyWarningCount(obj->ptdoc->doc));
+ RETURN_LONG(tidyWarningCount(obj->ptdoc->doc));
}
/* }}} */
@@ -1475,7 +1475,7 @@ static PHP_FUNCTION(tidy_access_count)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyAccessWarningCount(obj->ptdoc->doc));
+ RETURN_LONG(tidyAccessWarningCount(obj->ptdoc->doc));
}
/* }}} */
@@ -1485,7 +1485,7 @@ static PHP_FUNCTION(tidy_config_count)
{
TIDY_FETCH_OBJECT;
- RETURN_INT(tidyConfigErrorCount(obj->ptdoc->doc));
+ RETURN_LONG(tidyConfigErrorCount(obj->ptdoc->doc));
}
/* }}} */
@@ -1496,7 +1496,7 @@ static PHP_FUNCTION(tidy_getopt)
PHPTidyObj *obj;
char *optname;
void *optval;
- int optname_len;
+ size_t optname_len;
TidyOption opt;
TidyOptionType optt;
@@ -1529,7 +1529,7 @@ static PHP_FUNCTION(tidy_getopt)
return;
case TidyInteger:
- RETURN_INT((long)optval);
+ RETURN_LONG((zend_long)optval);
break;
case TidyBoolean:
@@ -1552,7 +1552,7 @@ static PHP_FUNCTION(tidy_getopt)
static TIDY_DOC_METHOD(__construct)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zend_bool use_include_path = 0;
zval *options = NULL;
zend_string *contents, *inputfile = NULL;
@@ -1577,14 +1577,14 @@ static TIDY_DOC_METHOD(__construct)
php_tidy_parse_string(obj, contents->val, contents->len, enc TSRMLS_CC);
- STR_RELEASE(contents);
+ zend_string_release(contents);
}
}
static TIDY_DOC_METHOD(parseFile)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zend_bool use_include_path = 0;
zval *options = NULL;
zend_string *inputfile, *contents;
@@ -1612,13 +1612,13 @@ static TIDY_DOC_METHOD(parseFile)
RETVAL_TRUE;
}
- STR_RELEASE(contents);
+ zend_string_release(contents);
}
static TIDY_DOC_METHOD(parseString)
{
char *enc = NULL;
- int enc_len = 0;
+ size_t enc_len = 0;
zval *options = NULL;
PHPTidyObj *obj;
zend_string *input;
diff --git a/ext/tidy/tidy.dsp b/ext/tidy/tidy.dsp
deleted file mode 100755
index fe44fa7a51..0000000000
--- a/ext/tidy/tidy.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tidy" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=tidy - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tidy.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tidy.mak" CFG="tidy - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tidy - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "tidy - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tidy - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TIDY_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\libtidy" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_TIDY" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_TIDY_EXPORTS" /D "HAVE_ZLIB" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib libtidy.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_tidy.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
-
-!ELSEIF "$(CFG)" == "tidy - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TIDY_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\include" /I "..\..\..\php_build\include\libtidy" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_TIDY" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "PHP_TIDY_EXPORTS" /D "HAVE_ZLIB" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib libtidy.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_tidy.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "tidy - Win32 Release_TS"
-# Name "tidy - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\tidy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_tidy.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index 1b5490d257..c6946c7078 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/tokenizer/tests/bug60097.phpt b/ext/tokenizer/tests/bug60097.phpt
index c3f417a7d5..e628dee1ef 100644
--- a/ext/tokenizer/tests/bug60097.phpt
+++ b/ext/tokenizer/tests/bug60097.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug 60097: token_get_all fails to lex nested heredoc
+--SKIPIF--
+<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--FILE--
<?php
@@ -12,12 +14,12 @@ DOC1;
'));
?>
---EXPECT--
+--EXPECTF--
array(14) {
[0]=>
array(3) {
[0]=>
- int(376)
+ int(%d)
[1]=>
string(6) "<?php
"
@@ -27,7 +29,7 @@ array(14) {
[1]=>
array(3) {
[0]=>
- int(380)
+ int(%d)
[1]=>
string(8) "<<<DOC1
"
@@ -37,7 +39,7 @@ array(14) {
[2]=>
array(3) {
[0]=>
- int(383)
+ int(%d)
[1]=>
string(1) "{"
[2]=>
@@ -46,7 +48,7 @@ array(14) {
[3]=>
array(3) {
[0]=>
- int(312)
+ int(%d)
[1]=>
string(2) "$s"
[2]=>
@@ -57,7 +59,7 @@ array(14) {
[5]=>
array(3) {
[0]=>
- int(380)
+ int(%d)
[1]=>
string(8) "<<<DOC2
"
@@ -67,7 +69,7 @@ array(14) {
[6]=>
array(3) {
[0]=>
- int(381)
+ int(%d)
[1]=>
string(4) "DOC2"
[2]=>
@@ -76,7 +78,7 @@ array(14) {
[7]=>
array(3) {
[0]=>
- int(379)
+ int(%d)
[1]=>
string(1) "
"
@@ -90,7 +92,7 @@ array(14) {
[10]=>
array(3) {
[0]=>
- int(317)
+ int(%d)
[1]=>
string(1) "
"
@@ -100,7 +102,7 @@ array(14) {
[11]=>
array(3) {
[0]=>
- int(381)
+ int(%d)
[1]=>
string(4) "DOC1"
[2]=>
@@ -111,7 +113,7 @@ array(14) {
[13]=>
array(3) {
[0]=>
- int(379)
+ int(%d)
[1]=>
string(1) "
"
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index be0b6a302a..26e05c2be3 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -131,7 +131,7 @@ static void tokenize(zval *return_value TSRMLS_DC)
if (token_type >= 256) {
array_init(&keyword);
- add_next_index_int(&keyword, token_type);
+ add_next_index_long(&keyword, token_type);
if (token_type == T_END_HEREDOC) {
if (CG(increment_lineno)) {
token_line = ++CG(zend_lineno);
@@ -139,7 +139,7 @@ static void tokenize(zval *return_value TSRMLS_DC)
}
}
add_next_index_stringl(&keyword, (char *)zendtext, zendleng);
- add_next_index_int(&keyword, token_line);
+ add_next_index_long(&keyword, token_line);
add_next_index_zval(return_value, &keyword);
} else {
add_next_index_stringl(return_value, (char *)zendtext, zendleng);
@@ -158,9 +158,9 @@ static void tokenize(zval *return_value TSRMLS_DC)
// fetch the rest into a T_INLINE_HTML
if (zendcursor != zendlimit) {
array_init(&keyword);
- add_next_index_int(&keyword, T_INLINE_HTML);
+ add_next_index_long(&keyword, T_INLINE_HTML);
add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor);
- add_next_index_int(&keyword, token_line);
+ add_next_index_long(&keyword, token_line);
add_next_index_zval(return_value, &keyword);
}
break;
@@ -185,7 +185,7 @@ PHP_FUNCTION(token_get_all)
return;
}
- ZVAL_STR(&source_zval, STR_COPY(source));
+ ZVAL_STR_COPY(&source_zval, source);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (zend_prepare_string_for_scanning(&source_zval, "" TSRMLS_CC) == FAILURE) {
@@ -206,9 +206,9 @@ PHP_FUNCTION(token_get_all)
*/
PHP_FUNCTION(token_name)
{
- php_int_t type;
+ zend_long type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) {
return;
}
diff --git a/ext/tokenizer/tokenizer.dsp b/ext/tokenizer/tokenizer.dsp
deleted file mode 100644
index 9844574a8a..0000000000
--- a/ext/tokenizer/tokenizer.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tokenizer" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=tokenizer - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tokenizer.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tokenizer.mak" CFG="tokenizer - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tokenizer - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "tokenizer - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tokenizer - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TOKENIZER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_TOKENIZER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_TOKENIZER=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_tokenizer.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "tokenizer - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TOKENIZER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_TOKENIZER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_TOKENIZER=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_tokenizer.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "tokenizer - Win32 Release_TS"
-# Name "tokenizer - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\tokenizer.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_tokenizer.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index b797518ed7..209e3ba495 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,139 +29,140 @@
void tokenizer_register_constants(INIT_FUNC_ARGS) {
- REGISTER_INT_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_COALESCE", T_COALESCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);
}
char *get_token_type_name(int token_type)
@@ -190,6 +191,7 @@ char *get_token_type_name(int token_type)
case T_MUL_EQUAL: return "T_MUL_EQUAL";
case T_MINUS_EQUAL: return "T_MINUS_EQUAL";
case T_PLUS_EQUAL: return "T_PLUS_EQUAL";
+ case T_COALESCE: return "T_COALESCE";
case T_BOOLEAN_OR: return "T_BOOLEAN_OR";
case T_BOOLEAN_AND: return "T_BOOLEAN_AND";
case T_IS_NOT_IDENTICAL: return "T_IS_NOT_IDENTICAL";
@@ -213,22 +215,29 @@ char *get_token_type_name(int token_type)
case T_POW: return "T_POW";
case T_CLONE: return "T_CLONE";
case T_NEW: return "T_NEW";
- case T_EXIT: return "T_EXIT";
- case T_IF: return "T_IF";
case T_ELSEIF: return "T_ELSEIF";
case T_ELSE: return "T_ELSE";
case T_ENDIF: return "T_ENDIF";
+ case T_PUBLIC: return "T_PUBLIC";
+ case T_PROTECTED: return "T_PROTECTED";
+ case T_PRIVATE: return "T_PRIVATE";
+ case T_FINAL: return "T_FINAL";
+ case T_ABSTRACT: return "T_ABSTRACT";
+ case T_STATIC: return "T_STATIC";
+ case T_DOUBLE_ARROW: return "T_DOUBLE_ARROW";
case T_LNUMBER: return "T_LNUMBER";
case T_DNUMBER: return "T_DNUMBER";
case T_STRING: return "T_STRING";
- case T_STRING_VARNAME: return "T_STRING_VARNAME";
case T_VARIABLE: return "T_VARIABLE";
- case T_NUM_STRING: return "T_NUM_STRING";
case T_INLINE_HTML: return "T_INLINE_HTML";
- case T_CHARACTER: return "T_CHARACTER";
- case T_BAD_CHARACTER: return "T_BAD_CHARACTER";
case T_ENCAPSED_AND_WHITESPACE: return "T_ENCAPSED_AND_WHITESPACE";
case T_CONSTANT_ENCAPSED_STRING: return "T_CONSTANT_ENCAPSED_STRING";
+ case T_STRING_VARNAME: return "T_STRING_VARNAME";
+ case T_NUM_STRING: return "T_NUM_STRING";
+ case T_EXIT: return "T_EXIT";
+ case T_IF: return "T_IF";
+ case T_CHARACTER: return "T_CHARACTER";
+ case T_BAD_CHARACTER: return "T_BAD_CHARACTER";
case T_ECHO: return "T_ECHO";
case T_DO: return "T_DO";
case T_WHILE: return "T_WHILE";
@@ -257,12 +266,6 @@ char *get_token_type_name(int token_type)
case T_USE: return "T_USE";
case T_INSTEADOF: return "T_INSTEADOF";
case T_GLOBAL: return "T_GLOBAL";
- case T_PUBLIC: return "T_PUBLIC";
- case T_PROTECTED: return "T_PROTECTED";
- case T_PRIVATE: return "T_PRIVATE";
- case T_FINAL: return "T_FINAL";
- case T_ABSTRACT: return "T_ABSTRACT";
- case T_STATIC: return "T_STATIC";
case T_VAR: return "T_VAR";
case T_UNSET: return "T_UNSET";
case T_ISSET: return "T_ISSET";
@@ -274,16 +277,16 @@ char *get_token_type_name(int token_type)
case T_EXTENDS: return "T_EXTENDS";
case T_IMPLEMENTS: return "T_IMPLEMENTS";
case T_OBJECT_OPERATOR: return "T_OBJECT_OPERATOR";
- case T_DOUBLE_ARROW: return "T_DOUBLE_ARROW";
case T_LIST: return "T_LIST";
case T_ARRAY: return "T_ARRAY";
case T_CALLABLE: return "T_CALLABLE";
+ case T_LINE: return "T_LINE";
+ case T_FILE: return "T_FILE";
+ case T_DIR: return "T_DIR";
case T_CLASS_C: return "T_CLASS_C";
case T_TRAIT_C: return "T_TRAIT_C";
case T_METHOD_C: return "T_METHOD_C";
case T_FUNC_C: return "T_FUNC_C";
- case T_LINE: return "T_LINE";
- case T_FILE: return "T_FILE";
case T_COMMENT: return "T_COMMENT";
case T_DOC_COMMENT: return "T_DOC_COMMENT";
case T_OPEN_TAG: return "T_OPEN_TAG";
@@ -297,7 +300,6 @@ char *get_token_type_name(int token_type)
case T_PAAMAYIM_NEKUDOTAYIM: return "T_DOUBLE_COLON";
case T_NAMESPACE: return "T_NAMESPACE";
case T_NS_C: return "T_NS_C";
- case T_DIR: return "T_DIR";
case T_NS_SEPARATOR: return "T_NS_SEPARATOR";
case T_ELLIPSIS: return "T_ELLIPSIS";
diff --git a/ext/tokenizer/tokenizer_data_gen.sh b/ext/tokenizer/tokenizer_data_gen.sh
index 1ed76e3617..0966367020 100755
--- a/ext/tokenizer/tokenizer_data_gen.sh
+++ b/ext/tokenizer/tokenizer_data_gen.sh
@@ -14,7 +14,7 @@ fi
echo '/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -45,8 +45,8 @@ echo '/*
echo 'void tokenizer_register_constants(INIT_FUNC_ARGS) {' >> $OUTFILE
-$AWK '/^#define T_/ { print " REGISTER_INT_CONSTANT(\"" $2 "\", " $2 ", CONST_CS | CONST_PERSISTENT);" }' < $INFILE >> $OUTFILE
-echo ' REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);' >> $OUTFILE
+$AWK '/^#define T_/ { print " REGISTER_LONG_CONSTANT(\"" $2 "\", " $2 ", CONST_CS | CONST_PERSISTENT);" }' < $INFILE >> $OUTFILE
+echo ' REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);' >> $OUTFILE
echo '}' >> $OUTFILE
diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h
index 7e823f7c8f..3809c0a3e1 100644
--- a/ext/wddx/php_wddx.h
+++ b/ext/wddx/php_wddx.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h
index 72edcf33b6..5c47109ee3 100644
--- a/ext/wddx/php_wddx_api.h
+++ b/ext/wddx/php_wddx_api.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -21,7 +21,7 @@
#ifndef PHP_WDDX_API_H
#define PHP_WDDX_API_H
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str_public.h"
#define WDDX_ARRAY_S "<array length='%d'>"
#define WDDX_ARRAY_E "</array>"
@@ -57,7 +57,7 @@ typedef smart_str wddx_packet;
wddx_packet* php_wddx_constructor(void);
void php_wddx_destructor(wddx_packet *packet);
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len);
+void php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_len);
void php_wddx_packet_end(wddx_packet *packet);
void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TSRMLS_DC);
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index e0cde68cc1..705babd885 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -35,7 +35,7 @@
#include "ext/standard/php_incomplete_class.h"
#include "ext/standard/base64.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/html.h"
#include "ext/standard/php_string.h"
#include "ext/date/php_date.h"
@@ -275,7 +275,7 @@ PS_SERIALIZER_ENCODE_FUNC(wddx)
php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
php_wddx_packet_end(packet);
smart_str_0(packet);
- str = STR_COPY(packet->s);
+ str = zend_string_copy(packet->s);
php_wddx_destructor(packet);
return str;
@@ -289,7 +289,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
zval retval;
zval *ent;
zend_string *key;
- ulong idx;
+ zend_ulong idx;
int ret;
if (vallen == 0) {
@@ -300,15 +300,15 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) {
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) {
if (key == NULL) {
- key = zend_int_to_str(idx);
+ key = zend_long_to_str(idx);
} else {
- STR_ADDREF(key);
+ zend_string_addref(key);
}
if (php_set_session_var(key, ent, NULL TSRMLS_CC)) {
if (Z_REFCOUNTED_P(ent)) Z_ADDREF_P(ent);
}
PS_ADD_VAR(key);
- STR_RELEASE(key);
+ zend_string_release(key);
} ZEND_HASH_FOREACH_END();
}
@@ -352,7 +352,7 @@ PHP_MINFO_FUNCTION(wddx)
/* {{{ php_wddx_packet_start
*/
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len)
+void php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_len)
{
php_wddx_add_chunk_static(packet, WDDX_PACKET_S);
if (comment) {
@@ -389,14 +389,14 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC)
{
php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- if (Z_STRSIZE_P(var) > 0) {
+ if (Z_STRLEN_P(var) > 0) {
zend_string *buf;
- buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC);
+ buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC);
php_wddx_add_chunk_ex(packet, buf->val, buf->len);
- STR_RELEASE(buf);
+ zend_string_release(buf);
}
php_wddx_add_chunk_static(packet, WDDX_STRING_E);
}
@@ -442,7 +442,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
zval *ent, fname, *varname;
zval retval;
zend_string *key;
- ulong idx;
+ zend_ulong idx;
char tmp_buf[WDDX_BUF_LEN];
HashTable *objhash, *sleephash;
TSRMLS_FETCH();
@@ -505,16 +505,17 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
}
if (key) {
const char *class_name, *prop_name;
+ size_t prop_name_len;
zend_string *tmp;
- zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name);
- tmp = STR_INIT(prop_name, strlen(prop_name), 0);
+ zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len);
+ tmp = zend_string_init(prop_name, prop_name_len, 0);
php_wddx_serialize_var(packet, ent, tmp TSRMLS_CC);
- STR_RELEASE(tmp);
+ zend_string_release(tmp);
} else {
- key = zend_int_to_str(idx);
+ key = zend_long_to_str(idx);
php_wddx_serialize_var(packet, ent, key TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
}
} ZEND_HASH_FOREACH_END();
php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
@@ -532,10 +533,10 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
zval *ent;
zend_string *key;
int is_struct = 0;
- ulong idx;
+ zend_ulong idx;
HashTable *target_hash;
char tmp_buf[WDDX_BUF_LEN];
- ulong ind = 0;
+ zend_ulong ind = 0;
TSRMLS_FETCH();
target_hash = HASH_OF(arr);
@@ -568,9 +569,9 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
if (key) {
php_wddx_serialize_var(packet, ent, key TSRMLS_CC);
} else {
- key = zend_int_to_str(idx);
+ key = zend_long_to_str(idx);
php_wddx_serialize_var(packet, ent, key TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
}
} else {
php_wddx_serialize_var(packet, ent, NULL TSRMLS_CC);
@@ -600,7 +601,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS
snprintf(tmp_buf, name_esc->len + sizeof(WDDX_VAR_S), WDDX_VAR_S, name_esc->val);
php_wddx_add_chunk(packet, tmp_buf);
efree(tmp_buf);
- STR_RELEASE(name_esc);
+ zend_string_release(name_esc);
}
if (Z_TYPE_P(var) == IS_INDIRECT) {
@@ -612,7 +613,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS
php_wddx_serialize_string(packet, var TSRMLS_CC);
break;
- case IS_INT:
+ case IS_LONG:
case IS_DOUBLE:
php_wddx_serialize_number(packet, var);
break;
@@ -750,7 +751,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X
ent.type = ST_NUMBER;
SET_STACK_VARNAME;
- ZVAL_INT(&ent.data, 0);
+ ZVAL_LONG(&ent.data, 0);
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
} else if (!strcmp((char *)name, EL_BOOLEAN)) {
int i;
@@ -854,7 +855,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X
ent.type = ST_DATETIME;
SET_STACK_VARNAME;
- ZVAL_INT(&ent.data, 0);
+ ZVAL_LONG(&ent.data, 0);
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
}
}
@@ -886,7 +887,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
if (!strcmp((char *)name, EL_BINARY)) {
zend_string *new_str;
- new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data));
+ new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));
zval_ptr_dtor(&ent1->data);
ZVAL_STR(&ent1->data, new_str);
}
@@ -919,11 +920,11 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
if (ent1->varname) {
if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&
- Z_TYPE(ent1->data) == IS_STRING && Z_STRSIZE(ent1->data)) {
+ Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data)) {
zend_bool incomplete_class = 0;
- zend_str_tolower(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data));
- STR_FORGET_HASH_VAL(Z_STR(ent1->data));
+ zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));
+ zend_string_forget_hash_val(Z_STR(ent1->data));
if ((pce = zend_hash_find_ptr(EG(class_table), Z_STR(ent1->data))) == NULL) {
incomplete_class = 1;
pce = PHP_IC_ENTRY;
@@ -938,7 +939,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
zval_add_ref, 0);
if (incomplete_class) {
- php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data));
+ php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));
}
/* Clean up old array entry */
@@ -992,13 +993,13 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
switch (ent->type) {
case ST_BINARY:
case ST_STRING:
- if (Z_STRSIZE(ent->data) == 0) {
+ if (Z_STRLEN(ent->data) == 0) {
zval_ptr_dtor(&ent->data);
ZVAL_STRINGL(&ent->data, (char *)s, len);
} else {
- Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRSIZE(ent->data) + len, 0);
- memcpy(Z_STRVAL(ent->data) + Z_STRSIZE(ent->data) - len, (char *)s, len);
- Z_STRVAL(ent->data)[Z_STRSIZE(ent->data)] = '\0';
+ Z_STR(ent->data) = zend_string_realloc(Z_STR(ent->data), Z_STRLEN(ent->data) + len, 0);
+ memcpy(Z_STRVAL(ent->data) + Z_STRLEN(ent->data) - len, (char *)s, len);
+ Z_STRVAL(ent->data)[Z_STRLEN(ent->data)] = '\0';
}
break;
case ST_NUMBER:
@@ -1008,9 +1009,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
case ST_BOOLEAN:
if (!strcmp((char *)s, "true")) {
- Z_IVAL(ent->data) = 1;
+ Z_LVAL(ent->data) = 1;
} else if (!strcmp((char *)s, "false")) {
- Z_IVAL(ent->data) = 0;
+ Z_LVAL(ent->data) = 0;
} else {
stack->top--;
zval_ptr_dtor(&ent->data);
@@ -1027,9 +1028,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
memcpy(tmp, (char *)s, len);
tmp[len] = '\0';
- Z_IVAL(ent->data) = php_parse_date(tmp, NULL);
+ Z_LVAL(ent->data) = php_parse_date(tmp, NULL);
/* date out of range < 1969 or > 2038 */
- if (Z_IVAL(ent->data) == -1) {
+ if (Z_LVAL(ent->data) == -1) {
ZVAL_STRINGL(&ent->data, (char *)s, len);
}
efree(tmp);
@@ -1083,7 +1084,7 @@ PHP_FUNCTION(wddx_serialize_value)
{
zval *var;
char *comment = NULL;
- int comment_len = 0;
+ size_t comment_len = 0;
wddx_packet *packet;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &var, &comment, &comment_len) == FAILURE) {
@@ -1097,7 +1098,7 @@ PHP_FUNCTION(wddx_serialize_value)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(STR_COPY(packet->s));
+ RETVAL_STR(zend_string_copy(packet->s));
php_wddx_destructor(packet);
}
/* }}} */
@@ -1136,7 +1137,7 @@ PHP_FUNCTION(wddx_serialize_vars)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(STR_COPY(packet->s));
+ RETVAL_STR(zend_string_copy(packet->s));
php_wddx_destructor(packet);
}
/* }}} */
@@ -1167,7 +1168,7 @@ void php_wddx_destructor(wddx_packet *packet)
PHP_FUNCTION(wddx_packet_start)
{
char *comment = NULL;
- int comment_len = 0;
+ size_t comment_len = 0;
wddx_packet *packet;
comment = NULL;
@@ -1203,7 +1204,7 @@ PHP_FUNCTION(wddx_packet_end)
php_wddx_packet_end(packet);
smart_str_0(packet);
- RETVAL_STR(STR_COPY(packet->s));
+ RETVAL_STR(zend_string_copy(packet->s));
zend_list_close(Z_RES_P(packet_id));
}
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index 41f5d42012..c046e150da 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -198,15 +198,6 @@ _start_element_handler_ns(void *user, const xmlChar *name, const xmlChar *prefix
}
static void
-_namespace_handler(XML_Parser parser, xmlNsPtr nsptr)
-{
- if (nsptr != NULL) {
- _namespace_handler(parser, nsptr->next);
- parser->h_end_ns(parser->user, nsptr->prefix);
- }
-}
-
-static void
_end_element_handler(void *user, const xmlChar *name)
{
xmlChar *qualified_name;
@@ -368,7 +359,7 @@ _external_entity_ref_handler(void *user, const xmlChar *names, int type, const x
return;
}
- parser->h_external_entity_ref(parser, names, "", sys_id, pub_id);
+ parser->h_external_entity_ref(parser, names, (XML_Char *) "", sys_id, pub_id);
}
static xmlEntityPtr
@@ -602,7 +593,7 @@ has been defined and none can be detected */
}
#endif
- error = xmlParseChunk(parser->parser, data, data_len, is_final);
+ error = xmlParseChunk(parser->parser, (char *) data, data_len, is_final);
if (!error) {
return 1;
} else if (parser->parser->lastError.level > XML_ERR_WARNING ){
@@ -728,7 +719,7 @@ PHPAPI const XML_Char *
XML_ErrorString(int code)
{
if (code < 0 || code >= (int)(sizeof(error_mapping) / sizeof(error_mapping[0]))) {
- return "Unknown";
+ return (const XML_Char *) "Unknown";
}
return error_mapping[code];
}
@@ -763,7 +754,7 @@ XML_GetCurrentByteCount(XML_Parser parser)
PHPAPI const XML_Char *XML_ExpatVersion(void)
{
- return "1.0";
+ return (const XML_Char *) "1.0";
}
PHPAPI void
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index dab9812122..54673f9ad0 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index 0195bb5836..cdb08f812e 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -134,8 +134,8 @@ PHP_FUNCTION(utf8_decode);
PHP_FUNCTION(xml_parse_into_struct);
PHPAPI char *_xml_zval_strdup(zval *);
-PHPAPI zend_string *xml_utf8_decode(const XML_Char *, int, const XML_Char *);
-PHPAPI zend_string *xml_utf8_encode(const char *, int, const XML_Char *);
+PHPAPI zend_string *xml_utf8_decode(const XML_Char *, size_t, const XML_Char *);
+PHPAPI zend_string *xml_utf8_encode(const char *, size_t, const XML_Char *);
#endif /* HAVE_LIBEXPAT */
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 1ae1f02889..f1a3442b6d 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -314,33 +314,33 @@ PHP_MINIT_FUNCTION(xml)
{
le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
- REGISTER_INT_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_INT_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT);
+
+ REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
/* this object should not be pre-initialised at compile time,
as the order of members may vary */
@@ -456,7 +456,7 @@ static void xml_set_handler(zval *handler, zval *data)
/* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */
if (Z_TYPE_P(data) != IS_ARRAY && Z_TYPE_P(data) != IS_OBJECT) {
convert_to_string_ex(data);
- if (Z_STRSIZE_P(data) == 0) {
+ if (Z_STRLEN_P(data) == 0) {
ZVAL_UNDEF(handler);
return;
}
@@ -554,9 +554,9 @@ static xml_encoding *xml_get_encoding(const XML_Char *name)
/* }}} */
/* {{{ xml_utf8_encode() */
-PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *encoding)
+PHPAPI zend_string *xml_utf8_encode(const char *s, size_t len, const XML_Char *encoding)
{
- int pos = len;
+ size_t pos = len;
zend_string *str;
unsigned int c;
unsigned short (*encoder)(unsigned char) = NULL;
@@ -571,12 +571,12 @@ PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *enco
if (encoder == NULL) {
/* If no encoder function was specified, return the data as-is.
*/
- str = STR_INIT(s, len, 0);
+ str = zend_string_init(s, len, 0);
return str;
}
/* This is the theoretical max (will never get beyond len * 2 as long
* as we are converting from single-byte characters, though) */
- str = STR_ALLOC(len * 4, 0);
+ str = zend_string_alloc(len * 4, 0);
str->len = 0;
while (pos > 0) {
c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s);
@@ -599,13 +599,13 @@ PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *enco
s++;
}
str->val[str->len] = '\0';
- str = STR_REALLOC(str, str->len, 0);
+ str = zend_string_realloc(str, str->len, 0);
return str;
}
/* }}} */
/* {{{ xml_utf8_decode() */
-PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char *encoding)
+PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XML_Char *encoding)
{
size_t pos = 0;
unsigned int c;
@@ -621,13 +621,13 @@ PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char *
/* If the target encoding was unknown, or no decoder function
* was specified, return the UTF-8-encoded data as-is.
*/
- str = STR_INIT((char *)s, len, 0);
+ str = zend_string_init((char *)s, len, 0);
return str;
}
- str = STR_ALLOC(len, 0);
+ str = zend_string_alloc(len, 0);
str->len = 0;
- while (pos < (size_t)len) {
+ while (pos < len) {
int status = FAILURE;
c = php_next_utf8_char((const unsigned char*)s, (size_t) len, &pos, &status);
@@ -639,7 +639,7 @@ PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char *
}
str->val[str->len] = '\0';
if (str->len < len) {
- str = STR_REALLOC(str, str->len, 0);
+ str = zend_string_realloc(str, str->len, 0);
}
return str;
@@ -663,9 +663,9 @@ static int _xml_xmlcharlen(const XML_Char *s)
PHPAPI char *_xml_zval_strdup(zval *val)
{
if (Z_TYPE_P(val) == IS_STRING) {
- char *buf = emalloc(Z_STRSIZE_P(val) + 1);
- memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val));
- buf[Z_STRSIZE_P(val)] = '\0';
+ char *buf = emalloc(Z_STRLEN_P(val) + 1);
+ memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val));
+ buf[Z_STRLEN_P(val)] = '\0';
return buf;
}
return NULL;
@@ -687,7 +687,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name)
element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values);
}
- add_next_index_int(element, parser->curtag);
+ add_next_index_long(element, parser->curtag);
parser->curtag++;
}
@@ -737,7 +737,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
attributes += 2;
- STR_RELEASE(att);
+ zend_string_release(att);
}
xml_call_handler(parser, &parser->startElementHandler, parser->startElementPtr, 3, args, &retval);
@@ -756,7 +756,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */
add_assoc_string(&tag, "type", "open");
- add_assoc_int(&tag, "level", parser->level);
+ add_assoc_long(&tag, "level", parser->level);
parser->ltags[parser->level-1] = estrdup(tag_name->val);
parser->lastwasopen = 1;
@@ -775,7 +775,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
atcnt++;
attributes += 2;
- STR_RELEASE(att);
+ zend_string_release(att);
}
if (atcnt) {
@@ -791,7 +791,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
}
}
- STR_RELEASE(tag_name);
+ zend_string_release(tag_name);
}
}
/* }}} */
@@ -827,7 +827,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */
add_assoc_string(&tag, "type", "close");
- add_assoc_int(&tag, "level", parser->level);
+ add_assoc_long(&tag, "level", parser->level);
zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag);
}
@@ -835,7 +835,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
parser->lastwasopen = 0;
}
- STR_RELEASE(tag_name);
+ zend_string_release(tag_name);
if ((parser->ltags) && (parser->level <= XML_MAXLEVEL)) {
efree(parser->ltags[parser->level-1]);
@@ -887,11 +887,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
/* check if the current tag already has a value - if yes append to that! */
if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) {
- int newlen = Z_STRSIZE_P(myval) + decoded_value->len;
- Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0);
- strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len,
+ int newlen = Z_STRLEN_P(myval) + decoded_value->len;
+ Z_STR_P(myval) = zend_string_realloc(Z_STR_P(myval), newlen, 0);
+ strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len,
decoded_value->val, decoded_value->len + 1);
- STR_RELEASE(decoded_value);
+ zend_string_release(decoded_value);
} else {
add_assoc_str(parser->ctag, "value", decoded_value);
}
@@ -904,11 +904,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) {
if (!strcmp(Z_STRVAL_P(mytype), "cdata")) {
if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) {
- int newlen = Z_STRSIZE_P(myval) + decoded_value->len;
- Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0);
- strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len,
+ int newlen = Z_STRLEN_P(myval) + decoded_value->len;
+ Z_STR_P(myval) = zend_string_realloc(Z_STR_P(myval), newlen, 0);
+ strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len,
decoded_value->val, decoded_value->len + 1);
- STR_RELEASE(decoded_value);
+ zend_string_release(decoded_value);
return;
}
}
@@ -924,7 +924,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
add_assoc_string(&tag, "tag", parser->ltags[parser->level-1] + parser->toffset);
add_assoc_str(&tag, "value", decoded_value);
add_assoc_string(&tag, "type", "cdata");
- add_assoc_int(&tag, "level", parser->level);
+ add_assoc_long(&tag, "level", parser->level);
zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag);
} else if (parser->level == (XML_MAXLEVEL + 1)) {
@@ -933,7 +933,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
}
}
} else {
- STR_RELEASE(decoded_value);
+ zend_string_release(decoded_value);
}
}
}
@@ -1041,8 +1041,8 @@ int _xml_externalEntityRefHandler(XML_Parser parserPtr,
_xml_xmlchar_zval(publicId, 0, parser->target_encoding, &args[4]);
xml_call_handler(parser, &parser->externalEntityRefHandler, parser->externalEntityRefPtr, 5, args, &retval);
if (!Z_ISUNDEF(retval)) {
- convert_to_int(&retval);
- ret = Z_IVAL(retval);
+ convert_to_long(&retval);
+ ret = Z_LVAL(retval);
} else {
ret = 0;
}
@@ -1092,10 +1092,10 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
int auto_detect = 0;
char *encoding_param = NULL;
- int encoding_param_len = 0;
+ size_t encoding_param_len = 0;
char *ns_param = NULL;
- int ns_param_len = 0;
+ size_t ns_param_len = 0;
XML_Char *encoding;
@@ -1365,10 +1365,11 @@ PHP_FUNCTION(xml_parse)
xml_parser *parser;
zval *pind;
char *data;
- int data_len, ret;
- php_int_t isFinal = 0;
+ size_t data_len;
+ int ret;
+ zend_long isFinal = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pind, &data, &data_len, &isFinal) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pind, &data, &data_len, &isFinal) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser);
@@ -1376,7 +1377,7 @@ PHP_FUNCTION(xml_parse)
parser->isparsing = 1;
ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal);
parser->isparsing = 0;
- RETVAL_INT(ret);
+ RETVAL_LONG(ret);
}
/* }}} */
@@ -1389,7 +1390,8 @@ PHP_FUNCTION(xml_parse_into_struct)
xml_parser *parser;
zval *pind, *xdata, *info = NULL;
char *data;
- int data_len, ret;
+ size_t data_len;
+ int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|z/", &pind, &data, &data_len, &xdata, &info) == FAILURE) {
return;
@@ -1422,7 +1424,7 @@ PHP_FUNCTION(xml_parse_into_struct)
ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, 1);
parser->isparsing = 0;
- RETVAL_INT(ret);
+ RETVAL_LONG(ret);
}
/* }}} */
@@ -1439,7 +1441,7 @@ PHP_FUNCTION(xml_get_error_code)
ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
- RETURN_INT((long)XML_GetErrorCode(parser->parser));
+ RETURN_LONG((zend_long)XML_GetErrorCode(parser->parser));
}
/* }}} */
@@ -1447,10 +1449,10 @@ PHP_FUNCTION(xml_get_error_code)
Get XML parser error string */
PHP_FUNCTION(xml_error_string)
{
- php_int_t code;
+ zend_long code;
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) {
return;
}
@@ -1474,7 +1476,7 @@ PHP_FUNCTION(xml_get_current_line_number)
ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser);
- RETVAL_INT(XML_GetCurrentLineNumber(parser->parser));
+ RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser));
}
/* }}} */
@@ -1491,7 +1493,7 @@ PHP_FUNCTION(xml_get_current_column_number)
ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser);
- RETVAL_INT(XML_GetCurrentColumnNumber(parser->parser));
+ RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser));
}
/* }}} */
@@ -1508,7 +1510,7 @@ PHP_FUNCTION(xml_get_current_byte_index)
ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser);
- RETVAL_INT(XML_GetCurrentByteIndex(parser->parser));
+ RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser));
}
/* }}} */
@@ -1544,9 +1546,9 @@ PHP_FUNCTION(xml_parser_set_option)
{
xml_parser *parser;
zval *pind, *val;
- php_int_t opt;
+ zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &pind, &opt, &val) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &pind, &opt, &val) == FAILURE) {
return;
}
@@ -1554,16 +1556,16 @@ PHP_FUNCTION(xml_parser_set_option)
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
- convert_to_int_ex(val);
- parser->case_folding = Z_IVAL_P(val);
+ convert_to_long_ex(val);
+ parser->case_folding = Z_LVAL_P(val);
break;
case PHP_XML_OPTION_SKIP_TAGSTART:
- convert_to_int_ex(val);
- parser->toffset = Z_IVAL_P(val);
+ convert_to_long_ex(val);
+ parser->toffset = Z_LVAL_P(val);
break;
case PHP_XML_OPTION_SKIP_WHITE:
- convert_to_int_ex(val);
- parser->skipwhite = Z_IVAL_P(val);
+ convert_to_long_ex(val);
+ parser->skipwhite = Z_LVAL_P(val);
break;
case PHP_XML_OPTION_TARGET_ENCODING: {
xml_encoding *enc;
@@ -1591,16 +1593,16 @@ PHP_FUNCTION(xml_parser_get_option)
{
xml_parser *parser;
zval *pind;
- php_int_t opt;
+ zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pind, &opt) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pind, &opt) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser);
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
- RETURN_INT(parser->case_folding);
+ RETURN_LONG(parser->case_folding);
break;
case PHP_XML_OPTION_TARGET_ENCODING:
RETURN_STRING((char *)parser->target_encoding);
@@ -1620,7 +1622,7 @@ PHP_FUNCTION(xml_parser_get_option)
PHP_FUNCTION(utf8_encode)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_string *encoded;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
@@ -1640,7 +1642,7 @@ PHP_FUNCTION(utf8_encode)
PHP_FUNCTION(utf8_decode)
{
char *arg;
- int arg_len;
+ size_t arg_len;
zend_string *decoded;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
diff --git a/ext/xml/xml.mak b/ext/xml/xml.mak
index ab60f28eed..b712dea1d6 100644
--- a/ext/xml/xml.mak
+++ b/ext/xml/xml.mak
@@ -4,7 +4,7 @@ PROJECT_ROOT = ..\..
# Module details
MODULE_NAME = php_xml
-MODULE_DESC = "PHP 5 - XML Extension"
+MODULE_DESC = "PHP 7 - XML Extension"
VMAJ = 3
VMIN = 0
VREV = 0
diff --git a/ext/xmlreader/README b/ext/xmlreader/README
index 0d946f62da..f85e4a2121 100644
--- a/ext/xmlreader/README
+++ b/ext/xmlreader/README
@@ -2,4 +2,4 @@ XMLReader represents a reader that provides non-cached,
forward-only access to XML data. It is based upon the
xmlTextReader api from libxml
-This extension is designed to only work under PHP 5.
+This extension is designed to only work under PHP 5+.
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 79d41065cf..43e585dd33 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -100,8 +100,8 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl
case IS_FALSE:
ZVAL_BOOL(rv, retint);
break;
- case IS_INT:
- ZVAL_INT(rv, retint);
+ case IS_LONG:
+ ZVAL_LONG(rv, retint);
break;
default:
ZVAL_NULL(rv);
@@ -270,7 +270,7 @@ char *_xmlreader_get_valid_file_path(char *source, char *resolved_path, int reso
#ifdef LIBXML_SCHEMAS_ENABLED
/* {{{ _xmlreader_get_relaxNG */
-static xmlRelaxNGPtr _xmlreader_get_relaxNG(char *source, int source_len, int type,
+static xmlRelaxNGPtr _xmlreader_get_relaxNG(char *source, size_t source_len, size_t type,
xmlRelaxNGValidityErrorFunc error_func,
xmlRelaxNGValidityWarningFunc warn_func TSRMLS_DC)
{
@@ -398,7 +398,7 @@ zend_object *xmlreader_objects_new(zend_class_entry *class_type TSRMLS_DC)
/* {{{ php_xmlreader_string_arg */
static void php_xmlreader_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_one_char_t internal_function) {
zval *id;
- int name_len = 0;
+ size_t name_len = 0;
char *retchar = NULL;
xmlreader_object *intern;
char *name;
@@ -480,7 +480,8 @@ static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_
static void php_xmlreader_set_relaxng_schema(INTERNAL_FUNCTION_PARAMETERS, int type) {
#ifdef LIBXML_SCHEMAS_ENABLED
zval *id;
- int source_len = 0, retval = -1;
+ size_t source_len = 0;
+ int retval = -1;
xmlreader_object *intern;
xmlRelaxNGPtr schema = NULL;
char *source;
@@ -561,11 +562,11 @@ Get value of an attribute at index from current element */
PHP_METHOD(xmlreader, getAttributeNo)
{
zval *id;
- php_int_t attr_pos;
+ zend_long attr_pos;
char *retchar = NULL;
xmlreader_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
return;
}
@@ -587,7 +588,7 @@ Get value of a attribute via name and namespace from current element */
PHP_METHOD(xmlreader, getAttributeNs)
{
zval *id;
- int name_len = 0, ns_uri_len = 0;
+ size_t name_len = 0, ns_uri_len = 0;
xmlreader_object *intern;
char *name, *ns_uri, *retchar = NULL;
@@ -618,11 +619,11 @@ Indicates whether given property (one of the parser option constants) is set or
PHP_METHOD(xmlreader, getParserProperty)
{
zval *id;
- php_int_t property;
+ zend_long property;
int retval = -1;
xmlreader_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &property) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) {
return;
}
@@ -664,7 +665,8 @@ Positions reader at specified attribute - Returns TRUE on success and FALSE on f
PHP_METHOD(xmlreader, moveToAttribute)
{
zval *id;
- int name_len = 0, retval;
+ size_t name_len = 0;
+ int retval;
xmlreader_object *intern;
char *name;
@@ -697,11 +699,11 @@ Returns TRUE on success and FALSE on failure */
PHP_METHOD(xmlreader, moveToAttributeNo)
{
zval *id;
- php_int_t attr_pos;
+ zend_long attr_pos;
int retval;
xmlreader_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
return;
}
@@ -725,7 +727,8 @@ Returns TRUE on success and FALSE on failure */
PHP_METHOD(xmlreader, moveToAttributeNs)
{
zval *id;
- int name_len=0, ns_uri_len=0, retval;
+ size_t name_len=0, ns_uri_len=0;
+ int retval;
xmlreader_object *intern;
char *name, *ns_uri;
@@ -805,7 +808,8 @@ Moves the position of the current instance to the next node in the stream. */
PHP_METHOD(xmlreader, next)
{
zval *id;
- int retval, name_len=0;
+ int retval;
+ size_t name_len=0;
xmlreader_object *intern;
char *name = NULL;
@@ -846,15 +850,15 @@ Sets the URI that the XMLReader will parse. */
PHP_METHOD(xmlreader, open)
{
zval *id;
- int source_len = 0, encoding_len = 0;
- php_int_t options = 0;
+ size_t source_len = 0, encoding_len = 0;
+ zend_long options = 0;
xmlreader_object *intern = NULL;
char *source, *valid_file = NULL;
char *encoding = NULL;
char resolved_path[MAXPATHLEN + 1];
xmlTextReaderPtr reader = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
return;
}
@@ -936,7 +940,8 @@ PHP_METHOD(xmlreader, setSchema)
{
#ifdef LIBXML_SCHEMAS_ENABLED
zval *id;
- int source_len = 0, retval = -1;
+ size_t source_len = 0;
+ int retval = -1;
xmlreader_object *intern;
char *source;
@@ -978,12 +983,12 @@ Properties must be set after open() or XML() and before the first read() is call
PHP_METHOD(xmlreader, setParserProperty)
{
zval *id;
- php_int_t property;
+ zend_long property;
int retval = -1;
zend_bool value;
xmlreader_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &property, &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) {
return;
}
@@ -1029,8 +1034,8 @@ Sets the string that the XMLReader will parse. */
PHP_METHOD(xmlreader, XML)
{
zval *id;
- int source_len = 0, encoding_len = 0;
- php_int_t options = 0;
+ size_t source_len = 0, encoding_len = 0;
+ zend_long options = 0;
xmlreader_object *intern = NULL;
char *source, *uri = NULL, *encoding = NULL;
int resolved_path_len, ret = 0;
@@ -1038,7 +1043,7 @@ PHP_METHOD(xmlreader, XML)
xmlParserInputBufferPtr inputbfr;
xmlTextReaderPtr reader;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
return;
}
@@ -1313,9 +1318,9 @@ PHP_MINIT_FUNCTION(xmlreader)
xmlreader_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
zend_hash_init(&xmlreader_prop_handlers, 0, NULL, php_xmlreader_free_prop_handler, 1);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_INT TSRMLS_CC);
+ xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderConstBaseUri, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_INT TSRMLS_CC);
+ xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_LONG TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasAttributes", xmlTextReaderHasAttributes, NULL, IS_FALSE TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasValue", xmlTextReaderHasValue, NULL, IS_FALSE TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isDefault", xmlTextReaderIsDefault, NULL, IS_FALSE TSRMLS_CC);
@@ -1323,43 +1328,43 @@ PHP_MINIT_FUNCTION(xmlreader)
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "localName", NULL, xmlTextReaderConstLocalName, IS_STRING TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "name", NULL, xmlTextReaderConstName, IS_STRING TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "namespaceURI", NULL, xmlTextReaderConstNamespaceUri, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_INT TSRMLS_CC);
+ xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_LONG TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "prefix", NULL, xmlTextReaderConstPrefix, IS_STRING TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "value", NULL, xmlTextReaderConstValue, IS_STRING TSRMLS_CC);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "xmlLang", NULL, xmlTextReaderConstXmlLang, IS_STRING TSRMLS_CC);
/* Constants for NodeType - cannot define common types to share with dom as there are differences in these types */
- REGISTER_XMLREADER_CLASS_CONST_INT("NONE", XML_READER_TYPE_NONE);
- REGISTER_XMLREADER_CLASS_CONST_INT("ELEMENT", XML_READER_TYPE_ELEMENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE);
- REGISTER_XMLREADER_CLASS_CONST_INT("TEXT", XML_READER_TYPE_TEXT);
- REGISTER_XMLREADER_CLASS_CONST_INT("CDATA", XML_READER_TYPE_CDATA);
- REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE);
- REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY", XML_READER_TYPE_ENTITY);
- REGISTER_XMLREADER_CLASS_CONST_INT("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION);
- REGISTER_XMLREADER_CLASS_CONST_INT("COMMENT", XML_READER_TYPE_COMMENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("DOC", XML_READER_TYPE_DOCUMENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE);
- REGISTER_XMLREADER_CLASS_CONST_INT("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("NOTATION", XML_READER_TYPE_NOTATION);
- REGISTER_XMLREADER_CLASS_CONST_INT("WHITESPACE", XML_READER_TYPE_WHITESPACE);
- REGISTER_XMLREADER_CLASS_CONST_INT("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE);
- REGISTER_XMLREADER_CLASS_CONST_INT("END_ELEMENT", XML_READER_TYPE_END_ELEMENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("END_ENTITY", XML_READER_TYPE_END_ENTITY);
- REGISTER_XMLREADER_CLASS_CONST_INT("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("NONE", XML_READER_TYPE_NONE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("ELEMENT", XML_READER_TYPE_ELEMENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("TEXT", XML_READER_TYPE_TEXT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("CDATA", XML_READER_TYPE_CDATA);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY", XML_READER_TYPE_ENTITY);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("COMMENT", XML_READER_TYPE_COMMENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("DOC", XML_READER_TYPE_DOCUMENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("NOTATION", XML_READER_TYPE_NOTATION);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("WHITESPACE", XML_READER_TYPE_WHITESPACE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("END_ELEMENT", XML_READER_TYPE_END_ELEMENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("END_ENTITY", XML_READER_TYPE_END_ENTITY);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION);
/* Constants for Parser options */
- REGISTER_XMLREADER_CLASS_CONST_INT("LOADDTD", XML_PARSER_LOADDTD);
- REGISTER_XMLREADER_CLASS_CONST_INT("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS);
- REGISTER_XMLREADER_CLASS_CONST_INT("VALIDATE", XML_PARSER_VALIDATE);
- REGISTER_XMLREADER_CLASS_CONST_INT("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("LOADDTD", XML_PARSER_LOADDTD);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDATE", XML_PARSER_VALIDATE);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES);
/* Constants for Errors when loading - not yet used until we implement custom error handling
- REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_XMLREADER_CLASS_CONST_INT("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_XMLREADER_CLASS_CONST_LONG("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT);
*/
return SUCCESS;
diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h
index 1ceb2e1e61..7a721dcc6f 100644
--- a/ext/xmlreader/php_xmlreader.h
+++ b/ext/xmlreader/php_xmlreader.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -50,8 +50,8 @@ PHP_MINIT_FUNCTION(xmlreader);
PHP_MSHUTDOWN_FUNCTION(xmlreader);
PHP_MINFO_FUNCTION(xmlreader);
-#define REGISTER_XMLREADER_CLASS_CONST_INT(const_name, value) \
- zend_declare_class_constant_int(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+#define REGISTER_XMLREADER_CLASS_CONST_LONG(const_name, value) \
+ zend_declare_class_constant_long(xmlreader_class_entry, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
#ifdef ZTS
#define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v)
diff --git a/ext/xmlreader/xmlreader.dsp b/ext/xmlreader/xmlreader.dsp
deleted file mode 100644
index 7b21518ba3..0000000000
--- a/ext/xmlreader/xmlreader.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlreader" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlreader - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlreader.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlreader.mak" CFG="xmlreader - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlreader - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlreader - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlreader - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "xmlreader___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "xmlreader___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XMLREADER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-
-!ELSEIF "$(CFG)" == "xmlreader - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "xmlreader___Win32_Release_TS0"
-# PROP BASE Intermediate_Dir "xmlreader___Win32_Release_TS0"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /YX /FD /GZ /c
-# SUBTRACT CPP /Fr
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-# ADD LINK32 php5ts.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /incremental:no /machine:I386 /out:"..\..\Release_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-# SUBTRACT LINK32 /debug
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlreader - Win32 Debug_TS"
-# Name "xmlreader - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_xmlreader.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlreader.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c
index f4cc212d7c..467dca922e 100644
--- a/ext/xmlrpc/libxmlrpc/encodings.c
+++ b/ext/xmlrpc/libxmlrpc/encodings.c
@@ -44,6 +44,7 @@
static const char rcsid[] = "#(@) $Id$";
#include <errno.h>
+#include <string.h>
#ifdef HAVE_GICONV_H
#include <giconv.h>
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c
index 0f77ae2451..fed73bbfa8 100644
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c
@@ -219,16 +219,19 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_mon = 0;
for(i = 0; i < 2; i++) {
- XMLRPC_IS_NUMBER(text[i])
+ XMLRPC_IS_NUMBER(text[i+4])
tm.tm_mon += (text[i+4]-'0')*n;
n /= 10;
}
tm.tm_mon --;
+ if(tm.tm_mon < 0 || tm.tm_mon > 11) {
+ return -1;
+ }
n = 10;
tm.tm_mday = 0;
for(i = 0; i < 2; i++) {
- XMLRPC_IS_NUMBER(text[i])
+ XMLRPC_IS_NUMBER(text[i+6])
tm.tm_mday += (text[i+6]-'0')*n;
n /= 10;
}
@@ -236,7 +239,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_hour = 0;
for(i = 0; i < 2; i++) {
- XMLRPC_IS_NUMBER(text[i])
+ XMLRPC_IS_NUMBER(text[i+9])
tm.tm_hour += (text[i+9]-'0')*n;
n /= 10;
}
@@ -244,7 +247,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_min = 0;
for(i = 0; i < 2; i++) {
- XMLRPC_IS_NUMBER(text[i])
+ XMLRPC_IS_NUMBER(text[i+12])
tm.tm_min += (text[i+12]-'0')*n;
n /= 10;
}
@@ -252,7 +255,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_sec = 0;
for(i = 0; i < 2; i++) {
- XMLRPC_IS_NUMBER(text[i])
+ XMLRPC_IS_NUMBER(text[i+15])
tm.tm_sec += (text[i+15]-'0')*n;
n /= 10;
}
diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h
index 286711b505..4e059788de 100644
--- a/ext/xmlrpc/php_xmlrpc.h
+++ b/ext/xmlrpc/php_xmlrpc.h
@@ -35,7 +35,7 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/xmlrpc/tests/bug68027.phpt b/ext/xmlrpc/tests/bug68027.phpt
new file mode 100644
index 0000000000..a5c96f1cf2
--- /dev/null
+++ b/ext/xmlrpc/tests/bug68027.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #68027 (buffer overflow in mkgmtime() function)
+--SKIPIF--
+<?php
+if (!extension_loaded("xmlrpc")) print "skip";
+?>
+--FILE--
+<?php
+
+$d = '6-01-01 20:00:00';
+xmlrpc_set_type($d, 'datetime');
+var_dump($d);
+$datetime = "2001-0-08T21:46:40-0400";
+$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
+print_r($obj);
+
+$datetime = "34770-0-08T21:46:40-0400";
+$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
+print_r($obj);
+
+echo "Done\n";
+?>
+--EXPECTF--
+object(stdClass)#1 (3) {
+ ["scalar"]=>
+ string(16) "6-01-01 20:00:00"
+ ["xmlrpc_type"]=>
+ string(8) "datetime"
+ ["timestamp"]=>
+ int(%d)
+}
+stdClass Object
+(
+ [scalar] => 2001-0-08T21:46:40-0400
+ [xmlrpc_type] => datetime
+ [timestamp] => %s
+)
+stdClass Object
+(
+ [scalar] => 34770-0-08T21:46:40-0400
+ [xmlrpc_type] => datetime
+ [timestamp] => %d
+)
+Done
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index fe0c794d1d..d43a31be11 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -35,7 +35,7 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -316,8 +316,8 @@ PHP_MINFO_FUNCTION(xmlrpc)
*/
#if 0
static int add_long(zval* list, char* id, int num) {
- if(id) return add_assoc_int(list, id, num);
- else return add_next_index_int(list, num);
+ if(id) return add_assoc_long(list, id, num);
+ else return add_next_index_long(list, num);
}
static int add_double(zval* list, char* id, double num) {
@@ -342,7 +342,7 @@ static void add_zval(zval* list, const char* id, zval* val)
if (list && val) {
if (id) {
int id_len = strlen(id);
- if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_INT) {
+ if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) {
long index = strtol(id, NULL, 0);
zend_hash_index_update(Z_ARRVAL_P(list), index, val);
} else {
@@ -472,7 +472,7 @@ static void set_output_options(php_output_options* options, zval* output_opts)
static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht)
{
int bArray = 0, bStruct = 0, bMixed = 0;
- unsigned long num_index, last_num = 0;
+ zend_ulong num_index, last_num = 0;
zend_string* my_key;
ZEND_HASH_FOREACH_KEY(ht, num_index, my_key) {
@@ -516,7 +516,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
xReturn = XMLRPC_CreateValueEmpty();
XMLRPC_SetValueID(xReturn, key, 0);
} else {
- xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRSIZE(val));
+ xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val));
}
break;
case xmlrpc_datetime:
@@ -528,8 +528,8 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
xReturn = XMLRPC_CreateValueBoolean(key, Z_TYPE(val) == IS_TRUE);
break;
case xmlrpc_int:
- convert_to_int(&val);
- xReturn = XMLRPC_CreateValueInt(key, Z_IVAL(val));
+ convert_to_long(&val);
+ xReturn = XMLRPC_CreateValueInt(key, Z_LVAL(val));
break;
case xmlrpc_double:
convert_to_double(&val);
@@ -537,11 +537,11 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
break;
case xmlrpc_string:
convert_to_string(&val);
- xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRSIZE(val));
+ xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val));
break;
case xmlrpc_vector:
{
- unsigned long num_index;
+ zend_ulong num_index;
zval* pIter;
zend_string* my_key;
HashTable *ht = NULL;
@@ -618,7 +618,7 @@ static void XMLRPC_to_PHP(XMLRPC_VALUE el, zval *elem)
}
break;
case xmlrpc_int:
- ZVAL_INT(elem, XMLRPC_GetValueInt(el));
+ ZVAL_LONG(elem, XMLRPC_GetValueInt(el));
break;
case xmlrpc_boolean:
ZVAL_BOOL(elem, XMLRPC_GetValueBoolean(el));
@@ -666,7 +666,7 @@ PHP_FUNCTION(xmlrpc_encode_request)
char *outBuf;
zval *vals, *out_opts = NULL;
char *method = NULL;
- int method_len;
+ size_t method_len;
php_output_options out;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) {
@@ -775,7 +775,7 @@ PHP_FUNCTION(xmlrpc_decode_request)
{
char *xml, *encoding = NULL;
zval *method;
- int xml_len, encoding_len = 0;
+ size_t xml_len, encoding_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) {
return;
@@ -792,7 +792,7 @@ PHP_FUNCTION(xmlrpc_decode_request)
PHP_FUNCTION(xmlrpc_decode)
{
char *arg1, *arg2 = NULL;
- int arg1_len, arg2_len = 0;
+ size_t arg1_len, arg2_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &arg1, &arg1_len, &arg2, &arg2_len) == FAILURE) {
return;
@@ -945,7 +945,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid callback '%s' passed", php_function_name->val);
}
- STR_RELEASE(php_function_name);
+ zend_string_release(php_function_name);
} ZEND_HASH_FOREACH_END();
/* so we don't call the same callbacks ever again */
@@ -958,7 +958,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
PHP_FUNCTION(xmlrpc_server_register_method)
{
char *method_key;
- int method_key_len;
+ size_t method_key_len;
zval *handle, *method_name;
xmlrpc_server_data* server;
@@ -1020,7 +1020,7 @@ PHP_FUNCTION(xmlrpc_server_call_method)
xmlrpc_server_data* server;
zval *caller_params, *handle, *output_opts = NULL;
char *rawxml;
- int rawxml_len;
+ size_t rawxml_len;
php_output_options out;
int argc = ZEND_NUM_ARGS();
@@ -1130,9 +1130,9 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
if (xDesc) {
int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc);
XMLRPC_CleanupValue(xDesc);
- RETURN_INT(retval);
+ RETURN_LONG(retval);
}
- RETURN_INT(0);
+ RETURN_LONG(0);
}
/* }}} */
@@ -1141,7 +1141,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
PHP_FUNCTION(xmlrpc_parse_method_descriptions)
{
char *arg1;
- int arg1_len;
+ size_t arg1_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg1, &arg1_len) == FAILURE) {
return;
@@ -1276,7 +1276,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */
if (timestamp != -1) {
zval ztimestamp;
- ZVAL_INT(&ztimestamp, timestamp);
+ ZVAL_LONG(&ztimestamp, timestamp);
convert_to_object(value);
if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) {
@@ -1321,7 +1321,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */
#else
case IS_BOOL:
#endif
- case IS_INT:
+ case IS_LONG:
case IS_RESOURCE:
type = xmlrpc_int;
break;
@@ -1375,7 +1375,7 @@ PHP_FUNCTION(xmlrpc_set_type)
{
zval *arg;
char *type;
- int type_len;
+ size_t type_len;
XMLRPC_VALUE_TYPE vtype;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/s", &arg, &type, &type_len) == FAILURE) {
diff --git a/ext/xmlrpc/xmlrpc.dsp b/ext/xmlrpc/xmlrpc.dsp
deleted file mode 100644
index 8c455d3fcd..0000000000
--- a/ext/xmlrpc/xmlrpc.dsp
+++ /dev/null
@@ -1,211 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlrpc - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlrpc - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "_DEBUG"
-# ADD RSC /l 0x1009 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib expat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xmlrpc.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "xmlrpc - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "NDEBUG"
-# ADD RSC /l 0x1009 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib expat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xmlrpc.dll" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc - Win32 Debug_TS"
-# Name "xmlrpc - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\xmlrpc-epi-php.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlrpc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libxmlrpc"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_private.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/xmlwriter/TODO b/ext/xmlwriter/TODO
index bfc895d769..858ad6be27 100644
--- a/ext/xmlwriter/TODO
+++ b/ext/xmlwriter/TODO
@@ -1,4 +1,4 @@
-- Fix up config file for PHP 5 to use libxml extension configuration
+- Fix up config file for PHP 7 to use libxml extension configuration
- Add tests for Namespace functions/methods
- Sync with xmlwriter (new dtd func?)
- Write documentations in docbook
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index a3d9b59f6e..6e3475e8d0 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -635,7 +635,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
dir_len = php_dirname(file_dirname, strlen(source));
if (dir_len > 0) {
- php_stat_t buf;
+ zend_stat_t buf;
if (php_sys_stat(file_dirname, &buf) != 0) {
xmlFreeURI(uri);
return NULL;
@@ -695,7 +695,7 @@ static void php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_rea
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
- int name_len, retval;
+ size_t name_len, retval;
zval *self = getThis();
@@ -833,7 +833,8 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
- int name_len, prefix_len, uri_len, retval;
+ size_t name_len, prefix_len, uri_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -874,7 +875,8 @@ static PHP_FUNCTION(xmlwriter_write_attribute)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -915,7 +917,8 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content;
- int name_len, prefix_len, uri_len, content_len, retval;
+ size_t name_len, prefix_len, uri_len, content_len;
+ int retval;
zval *self = getThis();
@@ -965,7 +968,8 @@ static PHP_FUNCTION(xmlwriter_start_element_ns)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
- int name_len, prefix_len, uri_len, retval;
+ size_t name_len, prefix_len, uri_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1022,7 +1026,8 @@ static PHP_FUNCTION(xmlwriter_write_element)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content = NULL;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1073,7 +1078,8 @@ static PHP_FUNCTION(xmlwriter_write_element_ns)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content = NULL;
- int name_len, prefix_len, uri_len, content_len, retval;
+ size_t name_len, prefix_len, uri_len, content_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1140,7 +1146,8 @@ static PHP_FUNCTION(xmlwriter_write_pi)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
zval *self = getThis();
@@ -1296,7 +1303,8 @@ static PHP_FUNCTION(xmlwriter_start_document)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *version = NULL, *enc = NULL, *alone = NULL;
- int version_len, enc_len, alone_len, retval;
+ size_t version_len, enc_len, alone_len;
+ int retval;
zval *self = getThis();
@@ -1341,7 +1349,8 @@ static PHP_FUNCTION(xmlwriter_start_dtd)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL;
- int name_len, pubid_len, sysid_len, retval;
+ size_t name_len, pubid_len, sysid_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1386,7 +1395,8 @@ static PHP_FUNCTION(xmlwriter_write_dtd)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL, *subset = NULL;
- int name_len, pubid_len, sysid_len, subset_len, retval;
+ size_t name_len, pubid_len, sysid_len, subset_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1440,7 +1450,8 @@ static PHP_FUNCTION(xmlwriter_write_dtd_element)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1496,7 +1507,8 @@ static PHP_FUNCTION(xmlwriter_write_dtd_attlist)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
zval *self = getThis();
if (self) {
@@ -1536,7 +1548,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_entity)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
- int name_len, retval;
+ size_t name_len, retval;
zend_bool isparm;
zval *self = getThis();
@@ -1583,11 +1595,12 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
- int name_len, content_len, retval;
+ size_t name_len, content_len;
+ int retval;
/* Optional parameters */
char *pubid = NULL, *sysid = NULL, *ndataid = NULL;
zend_bool pe = 0;
- int pubid_len, sysid_len, ndataid_len;
+ size_t pubid_len, sysid_len, ndataid_len;
zval *self = getThis();
if (self) {
@@ -1631,7 +1644,7 @@ static PHP_FUNCTION(xmlwriter_open_uri)
xmlTextWriterPtr ptr;
char *source;
char resolved_path[MAXPATHLEN + 1];
- int source_len;
+ size_t source_len;
zval *self = getThis();
ze_xmlwriter_object *ze_obj = NULL;
@@ -1756,7 +1769,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string)
xmlBufferEmpty(buffer);
}
} else {
- RETVAL_INT(output_bytes);
+ RETVAL_LONG(output_bytes);
}
return;
}
diff --git a/ext/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
index a4f43baaf5..fc00a9d578 100644
--- a/ext/xmlwriter/php_xmlwriter.h
+++ b/ext/xmlwriter/php_xmlwriter.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/xmlwriter/xmlwriter.dsp b/ext/xmlwriter/xmlwriter.dsp
deleted file mode 100644
index e5eca77be5..0000000000
--- a/ext/xmlwriter/xmlwriter.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlwriter" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlwriter - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwriter.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwriter.mak" CFG="xmlwriter - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlwriter - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlwriter - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlwriter - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLWRITER_EXPORTS" /D "COMPILE_DL_XMLWRITER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLWRITER_EXPORTS" /D "COMPILE_DL_XMLWRITER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XMLWRITER=1 /D "LIBXML_STATIC" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlwriter.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-# ADD LINK32 wsock32.lib php4ts.lib libxml2_a.lib iconv.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xmlwriter.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release"
-# SUBTRACT LINK32 /debug
-
-!ELSEIF "$(CFG)" == "xmlwriter - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "xmlwriter___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "xmlwriter___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLWRITER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLWRITER_EXPORTS" /D "COMPILE_DL_XMLWRITER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_STATIC" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 wsock32.lib php4ts_debug.lib libxml2_a.lib iconv.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlwriter.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlwriter - Win32 Release_TS"
-# Name "xmlwriter - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_xmlwriter.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlwriter.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 2b08a8a49b..2763d83326 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -161,23 +161,23 @@ PHP_MINIT_FUNCTION(xsl)
xsl_ext_function_object_php);
xsltSetGenericErrorFunc(NULL, php_libxml_error_handler);
- REGISTER_INT_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("LIBXSLT_DOTTED_VERSION", LIBXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT);
#if HAVE_XSL_EXSLT
- REGISTER_INT_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("LIBEXSLT_DOTTED_VERSION", LIBEXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT);
#endif
diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index e1702ebaa8..b6603321a3 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -64,7 +64,7 @@ typedef struct _xsl_object {
HashTable *node_list;
php_libxml_node_object *doc;
char *profiling;
- php_int_t securityPrefs;
+ zend_long securityPrefs;
int securityPrefsSet;
zend_object std;
} xsl_object;
diff --git a/ext/xsl/xsl.dsp b/ext/xsl/xsl.dsp
deleted file mode 100644
index ff7257d161..0000000000
--- a/ext/xsl/xsl.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xsl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xsl - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xsl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xsl.mak" CFG="xsl - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xsl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xsl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xsl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" /D "LIBXML_THREAD_ENABLED" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 wsock32.lib php5ts.lib libxslt_a.lib libexslt_a.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xsl.dll" /implib:".Release_TS/php_xsl.lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "xsl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSL_EXPORTS" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib libxslt_a.lib libexslt_a.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xsl.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release" /libpath:"..\..\..\php_build\lib\libxslt"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xsl - Win32 Release_TS"
-# Name "xsl - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_xsl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xsltprocessor.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xsl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\xsl_fe.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index 89726da724..e987554a4d 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 2bf3269b3f..20af855aa4 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -138,7 +138,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
zval *value;
char *xpath_expr;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
char **params = NULL;
int i = 0;
@@ -160,7 +160,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
if (!xpath_params) {
xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_P(value) TSRMLS_CC);
} else {
- xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value));
+ xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value));
}
if (xpath_expr) {
params[i++] = estrndup(string_key->val, string_key->len);
@@ -351,7 +351,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
nodep = dom_object_get_node(obj);
valuePush(ctxt, xmlXPathNewNodeSet(nodep));
} else if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) {
- valuePush(ctxt, xmlXPathNewBoolean(Z_IVAL(retval)));
+ valuePush(ctxt, xmlXPathNewBoolean(Z_LVAL(retval)));
} else if (Z_TYPE(retval) == IS_OBJECT) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string");
valuePush(ctxt, xmlXPathNewString(""));
@@ -362,7 +362,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
zval_ptr_dtor(&retval);
}
}
- STR_RELEASE(callable);
+ zend_string_release(callable);
zval_ptr_dtor(&handler);
if (fci.param_count > 0) {
for (i = 0; i < nargs - 1; i++) {
@@ -437,8 +437,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
ZVAL_STRING(&member, "cloneDocument");
cloneDocu = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC);
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
- convert_to_int(cloneDocu);
- clone_docu = Z_IVAL_P(cloneDocu);
+ convert_to_long(cloneDocu);
+ clone_docu = Z_LVAL_P(cloneDocu);
}
zval_ptr_dtor(&member);
if (clone_docu == 0) {
@@ -536,8 +536,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
ZVAL_STRING(&member, "doXInclude");
doXInclude = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC);
if (Z_TYPE_P(doXInclude) != IS_NULL) {
- convert_to_int(doXInclude);
- ctxt->xinclude = Z_IVAL_P(doXInclude);
+ convert_to_long(doXInclude);
+ ctxt->xinclude = Z_LVAL_P(doXInclude);
}
zval_ptr_dtor(&member);
@@ -695,7 +695,8 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
zval *id, *docp = NULL;
xmlDoc *newdocp;
xsltStylesheetPtr sheetp;
- int ret, uri_len;
+ int ret;
+ size_t uri_len;
char *uri;
xsl_object *intern;
@@ -715,7 +716,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
xmlFreeDoc(newdocp);
}
- RETVAL_INT(ret);
+ RETVAL_LONG(ret);
}
/* }}} end xsl_xsltprocessor_transform_to_uri */
@@ -765,9 +766,9 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
zval *id;
zval *array_value, *entry, new_string;
xsl_object *intern;
- php_uint_t idx;
+ zend_ulong idx;
char *namespace;
- int namespace_len;
+ size_t namespace_len;
zend_string *string_key, *name, *value;
DOM_GET_THIS(id);
@@ -790,7 +791,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
intern = Z_XSL_P(id);
- ZVAL_STR(&new_string, STR_COPY(value));
+ ZVAL_STR_COPY(&new_string, value);
zend_hash_update(intern->parameter, name, &new_string);
RETURN_TRUE;
@@ -807,7 +808,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
{
zval *id;
char *namespace;
- int namespace_len = 0;
+ size_t namespace_len = 0;
zval *value;
zend_string *name;
xsl_object *intern;
@@ -820,7 +821,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
intern = Z_XSL_P(id);
if ((value = zend_hash_find(intern->parameter, name)) != NULL) {
convert_to_string_ex(value);
- RETURN_STR(STR_COPY(Z_STR_P(value)));
+ RETURN_STR(zend_string_copy(Z_STR_P(value)));
} else {
RETURN_FALSE;
}
@@ -832,7 +833,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
{
zval *id;
- int namespace_len = 0;
+ size_t namespace_len = 0;
char *namespace;
zend_string *name;
xsl_object *intern;
@@ -868,7 +869,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) {
SEPARATE_ZVAL(entry);
convert_to_string_ex(entry);
- ZVAL_INT(&new_string ,1);
+ ZVAL_LONG(&new_string ,1);
zend_hash_update(intern->registered_phpfunctions, Z_STR_P(entry), &new_string);
} ZEND_HASH_FOREACH_END();
@@ -876,7 +877,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) {
intern = Z_XSL_P(id);
- ZVAL_INT(&new_string,1);
+ ZVAL_LONG(&new_string,1);
zend_hash_update(intern->registered_phpfunctions, name, &new_string);
intern->registerPhpFunctions = 2;
@@ -894,7 +895,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
zval *id;
xsl_object *intern;
char *filename = NULL;
- int filename_len;
+ size_t filename_len;
DOM_GET_THIS(id);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p!", &filename, &filename_len) == SUCCESS) {
@@ -919,10 +920,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
{
zval *id;
xsl_object *intern;
- php_int_t securityPrefs, oldSecurityPrefs;
+ zend_long securityPrefs, oldSecurityPrefs;
DOM_GET_THIS(id);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &securityPrefs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) {
return;
}
intern = Z_XSL_P(id);
@@ -930,7 +931,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
intern->securityPrefs = securityPrefs;
/* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */
intern->securityPrefsSet = 1;
- RETURN_INT(oldSecurityPrefs);
+ RETURN_LONG(oldSecurityPrefs);
}
/* }}} end xsl_xsltprocessor_set_security_prefs */
@@ -943,7 +944,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs)
DOM_GET_THIS(id);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "") == SUCCESS) {
intern = Z_XSL_P(id);
- RETURN_INT(intern->securityPrefs);
+ RETURN_LONG(intern->securityPrefs);
} else {
WRONG_PARAM_COUNT;
}
diff --git a/ext/zip/lib/config.h b/ext/zip/lib/config.h
index 8c11baa5e2..3d524f3923 100644
--- a/ext/zip/lib/config.h
+++ b/ext/zip/lib/config.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c
index 02fa1272d6..4793c54534 100644
--- a/ext/zip/lib/zip_set_name.c
+++ b/ext/zip/lib/zip_set_name.c
@@ -58,7 +58,7 @@ _zip_set_name(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t fl
return -1;
}
- if (name && strlen(name) > 0) {
+ if (name && name[0] != '\0') {
/* TODO: check for string too long */
if ((str=_zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
return -1;
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 9fd3e8ce4a..4accc22e30 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -90,10 +90,10 @@ static int le_zip_entry;
/* }}} */
# define add_ascii_assoc_string add_assoc_string
-# define add_ascii_assoc_long add_assoc_int
+# define add_ascii_assoc_long add_assoc_long
/* Flatten a path by making a relative path (to .)*/
-static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */
+static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
{
char *path_begin = path;
size_t i;
@@ -187,7 +187,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) {
efree(file_dirname_fullpath);
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
CWD_STATE_FREE(new_state.cwd);
return 0;
}
@@ -199,7 +199,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
if (!ret) {
efree(file_dirname_fullpath);
if (!is_dir_only) {
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
CWD_STATE_FREE(new_state.cwd);
}
return 0;
@@ -216,13 +216,13 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
len = spprintf(&fullpath, 0, "%s/%s", file_dirname_fullpath, file_basename->val);
if (!len) {
efree(file_dirname_fullpath);
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
CWD_STATE_FREE(new_state.cwd);
return 0;
} else if (len > MAXPATHLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN);
efree(file_dirname_fullpath);
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
CWD_STATE_FREE(new_state.cwd);
return 0;
}
@@ -234,7 +234,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
if (ZIP_OPENBASEDIR_CHECKPATH(fullpath)) {
efree(fullpath);
efree(file_dirname_fullpath);
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
CWD_STATE_FREE(new_state.cwd);
return 0;
}
@@ -264,7 +264,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
done:
efree(fullpath);
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
efree(file_dirname_fullpath);
CWD_STATE_FREE(new_state.cwd);
@@ -311,18 +311,18 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam
}
/* }}} */
-static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */
+static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char **remove_path, size_t *remove_path_len, char **add_path, size_t *add_path_len TSRMLS_DC) /* {{{ */
{
zval *option;
if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {
- php_int_t opt;
- if (Z_TYPE_P(option) != IS_INT) {
+ zend_long opt;
+ if (Z_TYPE_P(option) != IS_LONG) {
zval tmp;
ZVAL_DUP(&tmp, option);
- convert_to_int(&tmp);
- opt = Z_IVAL(tmp);
+ convert_to_long(&tmp);
+ opt = Z_LVAL(tmp);
} else {
- opt = Z_IVAL_P(option);
+ opt = Z_LVAL_P(option);
}
*remove_all_path = opt;
}
@@ -334,17 +334,17 @@ static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char
return -1;
}
- if (Z_STRSIZE_P(option) < 1) {
+ if (Z_STRLEN_P(option) < 1) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as remove_path option");
return -1;
}
- if (Z_STRSIZE_P(option) >= MAXPATHLEN) {
+ if (Z_STRLEN_P(option) >= MAXPATHLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "remove_path string is too long (max: %i, %i given)",
- MAXPATHLEN - 1, Z_STRSIZE_P(option));
+ MAXPATHLEN - 1, Z_STRLEN_P(option));
return -1;
}
- *remove_path_len = Z_STRSIZE_P(option);
+ *remove_path_len = Z_STRLEN_P(option);
*remove_path = Z_STRVAL_P(option);
}
@@ -354,26 +354,26 @@ static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char
return -1;
}
- if (Z_STRSIZE_P(option) < 1) {
+ if (Z_STRLEN_P(option) < 1) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as the add_path option");
return -1;
}
- if (Z_STRSIZE_P(option) >= MAXPATHLEN) {
+ if (Z_STRLEN_P(option) >= MAXPATHLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)",
- MAXPATHLEN - 1, Z_STRSIZE_P(option));
+ MAXPATHLEN - 1, Z_STRLEN_P(option));
return -1;
}
- *add_path_len = Z_STRSIZE_P(option);
+ *add_path_len = Z_STRLEN_P(option);
*add_path = Z_STRVAL_P(option);
}
return 1;
}
/* }}} */
-/* {{{ REGISTER_ZIP_CLASS_CONST_INT */
-#define REGISTER_ZIP_CLASS_CONST_INT(const_name, value) \
- zend_declare_class_constant_int(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+/* {{{ REGISTER_ZIP_CLASS_CONST_LONG */
+#define REGISTER_ZIP_CLASS_CONST_LONG(const_name, value) \
+ zend_declare_class_constant_long(zip_class_entry, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
/* }}} */
/* {{{ ZIP_FROM_OBJECT */
@@ -393,12 +393,12 @@ static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char
{ \
array_init(return_value); \
add_ascii_assoc_string(return_value, "name", (char *)(sb)->name); \
- add_ascii_assoc_long(return_value, "index", (long) (sb)->index); \
- add_ascii_assoc_long(return_value, "crc", (long) (sb)->crc); \
- add_ascii_assoc_long(return_value, "size", (long) (sb)->size); \
- add_ascii_assoc_long(return_value, "mtime", (long) (sb)->mtime); \
- add_ascii_assoc_long(return_value, "comp_size", (long) (sb)->comp_size); \
- add_ascii_assoc_long(return_value, "comp_method", (long) (sb)->comp_method); \
+ add_ascii_assoc_long(return_value, "index", (zend_long) (sb)->index); \
+ add_ascii_assoc_long(return_value, "crc", (zend_long) (sb)->crc); \
+ add_ascii_assoc_long(return_value, "size", (zend_long) (sb)->size); \
+ add_ascii_assoc_long(return_value, "mtime", (zend_long) (sb)->mtime); \
+ add_ascii_assoc_long(return_value, "comp_size", (zend_long) (sb)->comp_size); \
+ add_ascii_assoc_long(return_value, "comp_method", (zend_long) (sb)->comp_method); \
}
/* }}} */
@@ -481,7 +481,7 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len TSRMLS_DC) /*
#endif /* }}} */
-int php_zip_glob(char *pattern, int pattern_len, php_int_t flags, zval *return_value TSRMLS_DC) /* {{{ */
+int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_GLOB
char cwd[MAXPATHLEN];
@@ -645,14 +645,14 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
if ((namelist_len == 1 && namelist[i]->val[0] == '.') ||
(namelist_len == 2 && namelist[i]->val[0] == '.' && namelist[i]->val[1] == '.')) {
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
continue;
}
if ((path_len + namelist_len + 1) >= MAXPATHLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)",
MAXPATHLEN - 1, (path_len + namelist_len + 1));
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
break;
}
@@ -660,24 +660,24 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
if (0 != VCWD_STAT(fullpath, &s)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot read <%s>", fullpath);
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
continue;
}
if (S_IFDIR == (s.st_mode & S_IFMT)) {
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
continue;
}
matches = pcre_exec(re, NULL, namelist[i]->val, namelist[i]->len, 0, 0, ovector, 3);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (matches < 0) {
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
continue;
}
add_next_index_string(return_value, fullpath);
- STR_RELEASE(namelist[i]);
+ zend_string_release(namelist[i]);
}
efree(namelist);
}
@@ -818,8 +818,8 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd,
case IS_FALSE:
ZVAL_BOOL(rv, (long)retint);
break;
- case IS_INT:
- ZVAL_INT(rv, (long)retint);
+ case IS_LONG:
+ ZVAL_LONG(rv, (long)retint);
break;
default:
ZVAL_NULL(rv);
@@ -956,7 +956,7 @@ static HashTable *php_zip_get_properties(zval *object TSRMLS_DC)/* {{{ */
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
- ulong num_key;
+ zend_ulong num_key;
obj = Z_ZIP_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -1124,7 +1124,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open)
rsrc_int->za = zip_open(resolved_path, 0, &err);
if (rsrc_int->za == NULL) {
efree(rsrc_int);
- RETURN_INT((long)err);
+ RETURN_LONG((zend_long)err);
}
rsrc_int->index_current = 0;
@@ -1203,7 +1203,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open)
zval * zip;
zval * zip_entry;
char *mode = NULL;
- int mode_len = 0;
+ size_t mode_len = 0;
zip_read_rsrc * zr_rsrc;
zip_rsrc *z_rsrc;
@@ -1244,12 +1244,12 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close)
static PHP_NAMED_FUNCTION(zif_zip_entry_read)
{
zval * zip_entry;
- php_int_t len = 0;
+ zend_long len = 0;
zip_read_rsrc * zr_rsrc;
zend_string *buffer;
int n = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zip_entry, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zip_entry, &len) == FAILURE) {
return;
}
@@ -1260,14 +1260,14 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = STR_ALLOC(len, 0);
+ buffer = zend_string_alloc(len, 0);
n = zip_fread(zr_rsrc->zf, buffer->val, buffer->len);
if (n > 0) {
buffer->val[n] = '\0';
buffer->len = n;
RETURN_STR(buffer);
} else {
- STR_FREE(buffer);
+ zend_string_free(buffer);
RETURN_EMPTY_STRING()
}
} else {
@@ -1296,10 +1296,10 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{
RETURN_STRING((char *)zr_rsrc->sb.name);
break;
case 1:
- RETURN_INT((php_int_t) (zr_rsrc->sb.comp_size));
+ RETURN_LONG((zend_long) (zr_rsrc->sb.comp_size));
break;
case 2:
- RETURN_INT((php_int_t) (zr_rsrc->sb.size));
+ RETURN_LONG((zend_long) (zr_rsrc->sb.size));
break;
case 3:
switch (zr_rsrc->sb.comp_method) {
@@ -1333,7 +1333,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{
default:
RETURN_FALSE;
}
- RETURN_INT((php_int_t) (zr_rsrc->sb.comp_method));
+ RETURN_LONG((zend_long) (zr_rsrc->sb.comp_method));
break;
}
@@ -1378,13 +1378,13 @@ static ZIPARCHIVE_METHOD(open)
{
struct zip *intern;
int err = 0;
- php_int_t flags = 0;
+ zend_long flags = 0;
char *resolved_path;
zend_string *filename;
zval *self = getThis();
ze_zip_object *ze_obj = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &filename, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &filename, &flags) == FAILURE) {
return;
}
@@ -1423,7 +1423,7 @@ static ZIPARCHIVE_METHOD(open)
intern = zip_open(resolved_path, flags, &err);
if (!intern || err) {
efree(resolved_path);
- RETURN_INT((php_int_t)err);
+ RETURN_LONG((zend_long)err);
}
ze_obj->filename = resolved_path;
ze_obj->filename_len = strlen(resolved_path);
@@ -1439,7 +1439,7 @@ static ZIPARCHIVE_METHOD(setPassword)
struct zip *intern;
zval *self = getThis();
char *password;
- int password_len;
+ size_t password_len;
if (!self) {
RETURN_FALSE;
@@ -1522,7 +1522,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
struct zip *intern;
zval *self = getThis();
char *dirname;
- int dirname_len;
+ size_t dirname_len;
int idx;
struct zip_stat sb;
char *s;
@@ -1575,9 +1575,9 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
char *path = NULL;
char *remove_path = NULL;
char *add_path = NULL;
- int add_path_len, remove_path_len = 0, path_len = 0;
- php_int_t remove_all_path = 0;
- php_int_t flags = 0;
+ size_t add_path_len, remove_path_len = 0, path_len = 0;
+ zend_long remove_all_path = 0;
+ zend_long flags = 0;
zval *options = NULL;
int found;
zend_string *pattern;
@@ -1589,7 +1589,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
ZIP_FROM_OBJECT(intern, self);
/* 1 == glob, 2 == pcre */
if (type == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ia",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|la",
&pattern, &flags, &options) == FAILURE) {
return;
}
@@ -1609,9 +1609,11 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
RETURN_FALSE;
}
- if (remove_path && remove_path_len > 1 && (remove_path[strlen(remove_path) - 1] == '/' ||
- remove_path[strlen(remove_path) - 1] == '\\')) {
- remove_path[strlen(remove_path) - 1] = '\0';
+ if (remove_path && remove_path_len > 1) {
+ size_t real_len = strlen(remove_path);
+ if (real_len > 1 && remove_path[real_len - 1] == '/' || remove_path[real_len - 1] == '\\') {
+ remove_path[real_len - 1] = '\0';
+ }
}
if (type == 1) {
@@ -1632,15 +1634,15 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(return_value), i)) != NULL) {
if (remove_all_path) {
- basename = php_basename(Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), NULL, 0 TSRMLS_CC);
+ basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0 TSRMLS_CC);
file_stripped = basename->val;
file_stripped_len = basename->len;
} else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) {
file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1;
- file_stripped_len = Z_STRSIZE_P(zval_file) - remove_path_len - 1;
+ file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1;
} else {
file_stripped = Z_STRVAL_P(zval_file);
- file_stripped_len = Z_STRSIZE_P(zval_file);
+ file_stripped_len = Z_STRLEN_P(zval_file);
}
if (add_path) {
@@ -1656,13 +1658,13 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
entry_name_len = strlen(entry_name);
} else {
entry_name = Z_STRVAL_P(zval_file);
- entry_name_len = Z_STRSIZE_P(zval_file);
+ entry_name_len = Z_STRLEN_P(zval_file);
}
if (basename) {
- STR_RELEASE(basename);
+ zend_string_release(basename);
basename = NULL;
}
- if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file),
+ if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file),
entry_name, entry_name_len, 0, 0 TSRMLS_CC) < 0) {
zval_dtor(return_value);
RETURN_FALSE;
@@ -1696,8 +1698,8 @@ static ZIPARCHIVE_METHOD(addFile)
struct zip *intern;
zval *self = getThis();
char *entry_name = NULL;
- int entry_name_len = 0;
- php_int_t offset_start = 0, offset_len = 0;
+ size_t entry_name_len = 0;
+ zend_long offset_start = 0, offset_len = 0;
zend_string *filename;
if (!self) {
@@ -1706,7 +1708,7 @@ static ZIPARCHIVE_METHOD(addFile)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sii",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sll",
&filename, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) {
return;
}
@@ -1737,7 +1739,7 @@ static ZIPARCHIVE_METHOD(addFromString)
zval *self = getThis();
zend_string *buffer;
char *name;
- int name_len;
+ size_t name_len;
ze_zip_object *ze_obj;
struct zip_source *zs;
int pos = 0;
@@ -1797,7 +1799,7 @@ static ZIPARCHIVE_METHOD(statName)
{
struct zip *intern;
zval *self = getThis();
- php_int_t flags = 0;
+ zend_long flags = 0;
struct zip_stat sb;
zend_string *name;
@@ -1807,7 +1809,7 @@ static ZIPARCHIVE_METHOD(statName)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) {
return;
}
@@ -1823,7 +1825,7 @@ static ZIPARCHIVE_METHOD(statIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index, flags = 0;
+ zend_long index, flags = 0;
struct zip_stat sb;
@@ -1833,7 +1835,7 @@ static ZIPARCHIVE_METHOD(statIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
&index, &flags) == FAILURE) {
return;
}
@@ -1851,8 +1853,8 @@ static ZIPARCHIVE_METHOD(locateName)
{
struct zip *intern;
zval *self = getThis();
- php_int_t flags = 0;
- php_int_t idx = -1;
+ zend_long flags = 0;
+ zend_long idx = -1;
zend_string *name;
if (!self) {
@@ -1861,7 +1863,7 @@ static ZIPARCHIVE_METHOD(locateName)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) {
return;
}
@@ -1869,10 +1871,10 @@ static ZIPARCHIVE_METHOD(locateName)
RETURN_FALSE;
}
- idx = (php_int_t)zip_name_locate(intern, (const char *)name->val, flags);
+ idx = (zend_long)zip_name_locate(intern, (const char *)name->val, flags);
if (idx >= 0) {
- RETURN_INT(idx);
+ RETURN_LONG(idx);
} else {
RETURN_FALSE;
}
@@ -1886,7 +1888,7 @@ static ZIPARCHIVE_METHOD(getNameIndex)
struct zip *intern;
zval *self = getThis();
const char *name;
- php_int_t flags = 0, index = 0;
+ zend_long flags = 0, index = 0;
if (!self) {
RETURN_FALSE;
@@ -1894,7 +1896,7 @@ static ZIPARCHIVE_METHOD(getNameIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
&index, &flags) == FAILURE) {
return;
}
@@ -1915,7 +1917,7 @@ static ZIPARCHIVE_METHOD(setArchiveComment)
{
struct zip *intern;
zval *self = getThis();
- int comment_len;
+ size_t comment_len;
char * comment;
if (!self) {
@@ -1941,7 +1943,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment)
{
struct zip *intern;
zval *self = getThis();
- php_int_t flags = 0;
+ zend_long flags = 0;
const char * comment;
int comment_len = 0;
@@ -1951,7 +1953,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
return;
}
@@ -1959,7 +1961,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment)
if(comment==NULL) {
RETURN_FALSE;
}
- RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
+ RETURN_STRINGL((char *)comment, (zend_long)comment_len);
}
/* }}} */
@@ -1969,7 +1971,7 @@ static ZIPARCHIVE_METHOD(setCommentName)
{
struct zip *intern;
zval *self = getThis();
- int comment_len, name_len;
+ size_t comment_len, name_len;
char * comment, *name;
int idx;
@@ -2002,8 +2004,8 @@ static ZIPARCHIVE_METHOD(setCommentIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index;
- int comment_len;
+ zend_long index;
+ size_t comment_len;
char * comment;
struct zip_stat sb;
@@ -2013,7 +2015,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls",
&index, &comment, &comment_len) == FAILURE) {
return;
}
@@ -2032,9 +2034,9 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName)
{
struct zip *intern;
zval *self = getThis();
- int name_len;
+ size_t name_len;
char *name;
- php_int_t flags=0, opsys, attr;
+ zend_long flags=0, opsys, attr;
zip_int64_t idx;
if (!self) {
@@ -2043,7 +2045,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|l",
&name, &name_len, &opsys, &attr, &flags) == FAILURE) {
return;
}
@@ -2070,7 +2072,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index, flags=0, opsys, attr;
+ zend_long index, flags=0, opsys, attr;
struct zip_stat sb;
if (!self) {
@@ -2079,7 +2081,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l",
&index, &opsys, &attr, &flags) == FAILURE) {
return;
}
@@ -2099,9 +2101,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
- int name_len;
+ size_t name_len;
char *name;
- php_int_t flags=0;
+ zend_long flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
zip_int64_t idx;
@@ -2112,7 +2114,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|l",
&name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
@@ -2130,9 +2132,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
RETURN_FALSE;
}
zval_ptr_dtor(z_opsys);
- ZVAL_INT(z_opsys, opsys);
+ ZVAL_LONG(z_opsys, opsys);
zval_ptr_dtor(z_attr);
- ZVAL_INT(z_attr, attr);
+ ZVAL_LONG(z_attr, attr);
RETURN_TRUE;
}
/* }}} */
@@ -2143,7 +2145,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
- php_int_t index, flags=0;
+ zend_long index, flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
struct zip_stat sb;
@@ -2154,7 +2156,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/z/|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/z/|l",
&index, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
@@ -2165,9 +2167,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
RETURN_FALSE;
}
zval_dtor(z_opsys);
- ZVAL_INT(z_opsys, opsys);
+ ZVAL_LONG(z_opsys, opsys);
zval_dtor(z_attr);
- ZVAL_INT(z_attr, attr);
+ ZVAL_LONG(z_attr, attr);
RETURN_TRUE;
}
/* }}} */
@@ -2179,8 +2181,9 @@ static ZIPARCHIVE_METHOD(getCommentName)
{
struct zip *intern;
zval *self = getThis();
- int name_len, idx;
- php_int_t flags = 0;
+ size_t name_len;
+ int idx;
+ zend_long flags = 0;
int comment_len = 0;
const char * comment;
char *name;
@@ -2191,7 +2194,7 @@ static ZIPARCHIVE_METHOD(getCommentName)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
&name, &name_len, &flags) == FAILURE) {
return;
}
@@ -2206,7 +2209,7 @@ static ZIPARCHIVE_METHOD(getCommentName)
}
comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags);
- RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
+ RETURN_STRINGL((char *)comment, (zend_long)comment_len);
}
/* }}} */
@@ -2216,7 +2219,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index, flags = 0;
+ zend_long index, flags = 0;
const char * comment;
int comment_len = 0;
struct zip_stat sb;
@@ -2227,14 +2230,14 @@ static ZIPARCHIVE_METHOD(getCommentIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
&index, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
comment = zip_get_file_comment(intern, index, &comment_len, (int)flags);
- RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
+ RETURN_STRINGL((char *)comment, (zend_long)comment_len);
}
/* }}} */
@@ -2244,7 +2247,7 @@ static ZIPARCHIVE_METHOD(deleteIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index;
+ zend_long index;
if (!self) {
RETURN_FALSE;
@@ -2252,7 +2255,7 @@ static ZIPARCHIVE_METHOD(deleteIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
return;
}
@@ -2274,7 +2277,7 @@ static ZIPARCHIVE_METHOD(deleteName)
{
struct zip *intern;
zval *self = getThis();
- int name_len;
+ size_t name_len;
char *name;
struct zip_stat sb;
@@ -2307,8 +2310,8 @@ static ZIPARCHIVE_METHOD(renameIndex)
zval *self = getThis();
char *new_name;
- int new_name_len;
- php_int_t index;
+ size_t new_name_len;
+ zend_long index;
if (!self) {
RETURN_FALSE;
@@ -2316,7 +2319,7 @@ static ZIPARCHIVE_METHOD(renameIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &index, &new_name, &new_name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &index, &new_name, &new_name_len) == FAILURE) {
return;
}
@@ -2343,7 +2346,7 @@ static ZIPARCHIVE_METHOD(renameName)
zval *self = getThis();
struct zip_stat sb;
char *name, *new_name;
- int name_len, new_name_len;
+ size_t name_len, new_name_len;
if (!self) {
RETURN_FALSE;
@@ -2375,7 +2378,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex)
{
struct zip *intern;
zval *self = getThis();
- php_int_t index;
+ zend_long index;
if (!self) {
RETURN_FALSE;
@@ -2383,7 +2386,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex)
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
return;
}
@@ -2407,7 +2410,7 @@ static ZIPARCHIVE_METHOD(unchangeName)
zval *self = getThis();
struct zip_stat sb;
char *name;
- int name_len;
+ size_t name_len;
if (!self) {
RETURN_FALSE;
@@ -2491,7 +2494,7 @@ static ZIPARCHIVE_METHOD(extractTo)
zval *zval_file = NULL;
php_stream_statbuf ssb;
char *pathto;
- int pathto_len;
+ size_t pathto_len;
int ret, i;
int nelems;
@@ -2519,7 +2522,7 @@ static ZIPARCHIVE_METHOD(extractTo)
if (zval_files && (Z_TYPE_P(zval_files) != IS_NULL)) {
switch (Z_TYPE_P(zval_files)) {
case IS_STRING:
- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRSIZE_P(zval_files) TSRMLS_CC)) {
+ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) {
RETURN_FALSE;
}
break;
@@ -2531,10 +2534,10 @@ static ZIPARCHIVE_METHOD(extractTo)
for (i = 0; i < nelems; i++) {
if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) {
switch (Z_TYPE_P(zval_file)) {
- case IS_INT:
+ case IS_LONG:
break;
case IS_STRING:
- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file) TSRMLS_CC)) {
+ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file) TSRMLS_CC)) {
RETURN_FALSE;
}
break;
@@ -2542,7 +2545,7 @@ static ZIPARCHIVE_METHOD(extractTo)
}
}
break;
- case IS_INT:
+ case IS_LONG:
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings");
break;
@@ -2575,9 +2578,9 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
struct zip_stat sb;
struct zip_file *zf;
- php_int_t index = -1;
- php_int_t flags = 0;
- php_int_t len = 0;
+ zend_long index = -1;
+ zend_long flags = 0;
+ zend_long len = 0;
zend_string *filename;
zend_string *buffer;
@@ -2591,12 +2594,12 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
ZIP_FROM_OBJECT(intern, self);
if (type == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ii", &filename, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ll", &filename, &len, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_PATH(intern, filename->val, filename->len, flags, sb);
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &index, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &index, &len, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
@@ -2619,10 +2622,10 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
RETURN_FALSE;
}
- buffer = STR_ALLOC(len, 0);
+ buffer = zend_string_alloc(len, 0);
n = zip_fread(zf, buffer->val, buffer->len);
if (n < 1) {
- STR_FREE(buffer);
+ zend_string_free(buffer);
RETURN_EMPTY_STRING();
}
@@ -2898,88 +2901,88 @@ static PHP_MINIT_FUNCTION(zip)
zip_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1);
- php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_INT TSRMLS_CC);
- php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_INT TSRMLS_CC);
- php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_INT TSRMLS_CC);
+ php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC);
+ php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC);
+ php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC);
php_zip_register_prop_handler(&zip_prop_handlers, "filename", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC);
php_zip_register_prop_handler(&zip_prop_handlers, "comment", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC);
- REGISTER_ZIP_CLASS_CONST_INT("CREATE", ZIP_CREATE);
- REGISTER_ZIP_CLASS_CONST_INT("EXCL", ZIP_EXCL);
- REGISTER_ZIP_CLASS_CONST_INT("CHECKCONS", ZIP_CHECKCONS);
- REGISTER_ZIP_CLASS_CONST_INT("OVERWRITE", ZIP_OVERWRITE);
-
- REGISTER_ZIP_CLASS_CONST_INT("FL_NOCASE", ZIP_FL_NOCASE);
- REGISTER_ZIP_CLASS_CONST_INT("FL_NODIR", ZIP_FL_NODIR);
- REGISTER_ZIP_CLASS_CONST_INT("FL_COMPRESSED", ZIP_FL_COMPRESSED);
- REGISTER_ZIP_CLASS_CONST_INT("FL_UNCHANGED", ZIP_FL_UNCHANGED);
- REGISTER_ZIP_CLASS_CONST_INT("CM_DEFAULT", ZIP_CM_DEFAULT);
- REGISTER_ZIP_CLASS_CONST_INT("CM_STORE", ZIP_CM_STORE);
- REGISTER_ZIP_CLASS_CONST_INT("CM_SHRINK", ZIP_CM_SHRINK);
- REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_1", ZIP_CM_REDUCE_1);
- REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_2", ZIP_CM_REDUCE_2);
- REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_3", ZIP_CM_REDUCE_3);
- REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_4", ZIP_CM_REDUCE_4);
- REGISTER_ZIP_CLASS_CONST_INT("CM_IMPLODE", ZIP_CM_IMPLODE);
- REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE", ZIP_CM_DEFLATE);
- REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE64", ZIP_CM_DEFLATE64);
- REGISTER_ZIP_CLASS_CONST_INT("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE);
- REGISTER_ZIP_CLASS_CONST_INT("CM_BZIP2", ZIP_CM_BZIP2);
- REGISTER_ZIP_CLASS_CONST_INT("CM_LZMA", ZIP_CM_LZMA);
- REGISTER_ZIP_CLASS_CONST_INT("CM_TERSE", ZIP_CM_TERSE);
- REGISTER_ZIP_CLASS_CONST_INT("CM_LZ77", ZIP_CM_LZ77);
- REGISTER_ZIP_CLASS_CONST_INT("CM_WAVPACK", ZIP_CM_WAVPACK);
- REGISTER_ZIP_CLASS_CONST_INT("CM_PPMD", ZIP_CM_PPMD);
+ REGISTER_ZIP_CLASS_CONST_LONG("CREATE", ZIP_CREATE);
+ REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL);
+ REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE);
+
+ REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE);
+ REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR);
+ REGISTER_ZIP_CLASS_CONST_LONG("FL_COMPRESSED", ZIP_FL_COMPRESSED);
+ REGISTER_ZIP_CLASS_CONST_LONG("FL_UNCHANGED", ZIP_FL_UNCHANGED);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFAULT", ZIP_CM_DEFAULT);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_STORE", ZIP_CM_STORE);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_SHRINK", ZIP_CM_SHRINK);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_1", ZIP_CM_REDUCE_1);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_2", ZIP_CM_REDUCE_2);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_3", ZIP_CM_REDUCE_3);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_4", ZIP_CM_REDUCE_4);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_IMPLODE", ZIP_CM_IMPLODE);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE", ZIP_CM_DEFLATE);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE64", ZIP_CM_DEFLATE64);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_BZIP2", ZIP_CM_BZIP2);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_LZMA", ZIP_CM_LZMA);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_TERSE", ZIP_CM_TERSE);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_LZ77", ZIP_CM_LZ77);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_WAVPACK", ZIP_CM_WAVPACK);
+ REGISTER_ZIP_CLASS_CONST_LONG("CM_PPMD", ZIP_CM_PPMD);
/* Error code */
- REGISTER_ZIP_CLASS_CONST_INT("ER_OK", ZIP_ER_OK); /* N No error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */
- REGISTER_ZIP_CLASS_CONST_INT("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */
- REGISTER_ZIP_CLASS_CONST_INT("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */
- REGISTER_ZIP_CLASS_CONST_INT("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_READ", ZIP_ER_READ); /* S Read error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_WRITE", ZIP_ER_WRITE); /* S Write error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_CRC", ZIP_ER_CRC); /* N CRC error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */
- REGISTER_ZIP_CLASS_CONST_INT("ER_NOENT", ZIP_ER_NOENT); /* N No such file */
- REGISTER_ZIP_CLASS_CONST_INT("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */
- REGISTER_ZIP_CLASS_CONST_INT("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */
- REGISTER_ZIP_CLASS_CONST_INT("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */
- REGISTER_ZIP_CLASS_CONST_INT("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */
- REGISTER_ZIP_CLASS_CONST_INT("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */
- REGISTER_ZIP_CLASS_CONST_INT("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */
- REGISTER_ZIP_CLASS_CONST_INT("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */
- REGISTER_ZIP_CLASS_CONST_INT("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */
- REGISTER_ZIP_CLASS_CONST_INT("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */
- REGISTER_ZIP_CLASS_CONST_INT("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */
- REGISTER_ZIP_CLASS_CONST_INT("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */
- REGISTER_ZIP_CLASS_CONST_INT("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */
- REGISTER_ZIP_CLASS_CONST_INT("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_OK", ZIP_ER_OK); /* N No error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_READ", ZIP_ER_READ); /* S Read error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_WRITE", ZIP_ER_WRITE); /* S Write error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_CRC", ZIP_ER_CRC); /* N CRC error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_NOENT", ZIP_ER_NOENT); /* N No such file */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */
+ REGISTER_ZIP_CLASS_CONST_LONG("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */
#ifdef ZIP_OPSYS_DEFAULT
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DOS", ZIP_OPSYS_DOS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_AMIGA", ZIP_OPSYS_AMIGA);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_UNIX", ZIP_OPSYS_UNIX);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_2", ZIP_OPSYS_OS_2);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_CPM", ZIP_OPSYS_CPM);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MVS", ZIP_OPSYS_MVS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VSE", ZIP_OPSYS_VSE);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VFAT", ZIP_OPSYS_VFAT);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_BEOS", ZIP_OPSYS_BEOS);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_TANDEM", ZIP_OPSYS_TANDEM);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_400", ZIP_OPSYS_OS_400);
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_X", ZIP_OPSYS_OS_X);
-
- REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DOS", ZIP_OPSYS_DOS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_AMIGA", ZIP_OPSYS_AMIGA);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_UNIX", ZIP_OPSYS_UNIX);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_2", ZIP_OPSYS_OS_2);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_CPM", ZIP_OPSYS_CPM);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MVS", ZIP_OPSYS_MVS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VSE", ZIP_OPSYS_VSE);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VFAT", ZIP_OPSYS_VFAT);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_BEOS", ZIP_OPSYS_BEOS);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_TANDEM", ZIP_OPSYS_TANDEM);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_400", ZIP_OPSYS_OS_400);
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_X", ZIP_OPSYS_OS_X);
+
+ REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT);
#endif /* ifdef ZIP_OPSYS_DEFAULT */
php_register_url_stream_wrapper("zip", &php_stream_zip_wrapper TSRMLS_CC);
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
index f4ad99f293..7fab823297 100644
--- a/ext/zip/php_zip.h
+++ b/ext/zip/php_zip.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -70,17 +70,17 @@ typedef struct _ze_zip_read_rsrc {
struct zip_stat sb;
} zip_read_rsrc;
-#define ZIPARCHIVE_ME(name, arg_info, flags) {#name, c_ziparchive_ ##name, arg_info,(zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
+#define ZIPARCHIVE_ME(name, arg_info, flags) {#name, c_ziparchive_ ##name, arg_info,(uint32_t) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
#define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_ ##name)
/* Extends zend object */
typedef struct _ze_zip_object {
struct zip *za;
- int buffers_cnt;
char **buffers;
HashTable *prop_handler;
char *filename;
int filename_len;
+ int buffers_cnt;
zend_object zo;
} ze_zip_object;
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index 29ec3d022a..c542340170 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -152,7 +152,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
fragment++;
if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) {
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
return -1;
}
@@ -160,7 +160,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
if (za) {
memset(ssb, 0, sizeof(php_stream_statbuf));
if (zip_stat(za, fragment, ZIP_FL_NOCASE, &sb) != 0) {
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
return -1;
}
zip_close(za);
@@ -184,7 +184,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
#endif
ssb->sb.st_ino = -1;
}
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
return 0;
}
/* }}} */
@@ -296,7 +296,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
fragment++;
if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) {
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
return NULL;
}
@@ -320,7 +320,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
}
}
- STR_RELEASE(file_basename);
+ zend_string_release(file_basename);
if (!stream) {
return NULL;
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 5a2985c11b..ba829b5888 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -49,13 +49,13 @@ typedef struct _php_zlib_context {
ZEND_BEGIN_MODULE_GLOBALS(zlib)
/* variables for transparent gzip encoding */
- int compression_coding;
- php_int_t output_compression;
- php_int_t output_compression_level;
+ zend_long output_compression;
+ zend_long output_compression_level;
char *output_handler;
php_zlib_context *ob_gzhandler;
- php_int_t output_compression_default;
+ zend_long output_compression_default;
zend_bool handler_registered;
+ int compression_coding;
ZEND_END_MODULE_GLOBALS(zlib);
php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 67f575ec9a..000b96ad8e 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -70,9 +70,9 @@ static int php_zlib_output_encoding(TSRMLS_D)
zval *enc;
if (!ZLIBG(compression_coding)) {
- zend_string *name = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0);
+ zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(name TSRMLS_CC);
- STR_RELEASE(name);
+ zend_string_release(name);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
(enc = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING") - 1))) {
convert_to_string(enc);
@@ -315,7 +315,7 @@ static zend_string *php_zlib_encode(const char *in_buf, size_t in_len, int encod
Z.zfree = php_zlib_free;
if (Z_OK == (status = deflateInit2(&Z, level, Z_DEFLATED, encoding, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))) {
- out = STR_ALLOC(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0);
+ out = zend_string_alloc(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0);
Z.next_in = (Bytef *) in_buf;
Z.next_out = (Bytef *) out->val;
@@ -327,11 +327,11 @@ static zend_string *php_zlib_encode(const char *in_buf, size_t in_len, int encod
if (Z_STREAM_END == status) {
/* size buffer down to actual length */
- out = STR_REALLOC(out, Z.total_out, 0);
+ out = zend_string_realloc(out, Z.total_out, 0);
out->val[out->len] = '\0';
return out;
} else {
- STR_FREE(out);
+ zend_string_free(out);
}
}
@@ -447,8 +447,8 @@ static void php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_D)
static PHP_FUNCTION(ob_gzhandler)
{
char *in_str;
- int in_len;
- php_int_t flags = 0;
+ size_t in_len;
+ zend_long flags = 0;
php_output_context ctx = {0};
int encoding, rv;
@@ -460,7 +460,7 @@ static PHP_FUNCTION(ob_gzhandler)
* - OG(running) is not set or set to any other output handler
* - we have to mess around with php_output_context */
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &in_str, &in_len, &flags)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &in_str, &in_len, &flags)) {
RETURN_FALSE;
}
@@ -533,14 +533,14 @@ static PHP_FUNCTION(zlib_get_coding_type)
static PHP_FUNCTION(gzfile)
{
char *filename;
- int filename_len;
+ size_t filename_len;
int flags = REPORT_ERRORS;
char buf[8192] = {0};
register int i = 0;
- php_int_t use_include_path = 0;
+ zend_long use_include_path = 0;
php_stream *stream;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &use_include_path)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) {
return;
}
@@ -575,12 +575,12 @@ static PHP_FUNCTION(gzopen)
{
char *filename;
char *mode;
- int filename_len, mode_len;
+ size_t filename_len, mode_len;
int flags = REPORT_ERRORS;
php_stream *stream;
- php_int_t use_include_path = 0;
+ zend_long use_include_path = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
return;
}
@@ -602,13 +602,13 @@ static PHP_FUNCTION(gzopen)
static PHP_FUNCTION(readgzfile)
{
char *filename;
- int filename_len;
+ size_t filename_len;
int flags = REPORT_ERRORS;
php_stream *stream;
- int size;
- php_int_t use_include_path = 0;
+ size_t size;
+ zend_long use_include_path = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &filename, &filename_len, &use_include_path) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) {
return;
}
@@ -623,7 +623,7 @@ static PHP_FUNCTION(readgzfile)
}
size = php_stream_passthru(stream);
php_stream_close(stream);
- RETURN_INT(size);
+ RETURN_LONG(size);
}
/* }}} */
@@ -631,14 +631,14 @@ static PHP_FUNCTION(readgzfile)
static PHP_FUNCTION(name) \
{ \
zend_string *in, *out; \
- php_int_t level = -1; \
- php_int_t encoding = default_encoding; \
+ zend_long level = -1; \
+ zend_long encoding = default_encoding; \
if (default_encoding) { \
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &in, &level, &encoding)) { \
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &in, &level, &encoding)) { \
return; \
} \
} else { \
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &in, &encoding, &level)) { \
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &in, &encoding, &level)) { \
return; \
} \
} \
@@ -665,10 +665,10 @@ static PHP_FUNCTION(name) \
static PHP_FUNCTION(name) \
{ \
char *in_buf, *out_buf; \
- int in_len; \
+ size_t in_len; \
size_t out_len; \
- php_int_t max_len = 0; \
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &in_buf, &in_len, &max_len)) { \
+ zend_long max_len = 0; \
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &in_buf, &in_len, &max_len)) { \
return; \
} \
if (max_len < 0) { \
@@ -863,22 +863,28 @@ static const zend_function_entry php_zlib_functions[] = {
/* {{{ OnUpdate_zlib_output_compression */
static PHP_INI_MH(OnUpdate_zlib_output_compression)
{
- int status, int_value;
+ int int_value;
char *ini_value;
+ zend_long *p;
+#ifndef ZTS
+ char *base = (char *) mh_arg2;
+#else
+ char *base;
+
+ base = (char *) ts_resource(*((int *) mh_arg2));
+#endif
if (new_value == NULL) {
return FAILURE;
}
- if (!strncasecmp(new_value, "off", sizeof("off"))) {
- new_value = "0";
- new_value_length = sizeof("0");
- } else if (!strncasecmp(new_value, "on", sizeof("on"))) {
- new_value = "1";
- new_value_length = sizeof("1");
+ if (!strncasecmp(new_value->val, "off", sizeof("off"))) {
+ int_value = 0;
+ } else if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
+ int_value = 1;
+ } else {
+ int_value = zend_atoi(new_value->val, new_value->len);
}
-
- int_value = zend_atoi(new_value, new_value_length);
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
if (ini_value && *ini_value && int_value) {
@@ -886,14 +892,15 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
return FAILURE;
}
if (stage == PHP_INI_STAGE_RUNTIME) {
- status = php_output_get_status(TSRMLS_C);
+ int status = php_output_get_status(TSRMLS_C);
if (status & PHP_OUTPUT_SENT) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent");
return FAILURE;
}
}
- status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ p = (zend_long *) (base+(size_t) mh_arg1);
+ *p = int_value;
ZLIBG(output_compression) = ZLIBG(output_compression_default);
if (stage == PHP_INI_STAGE_RUNTIME && int_value) {
@@ -902,7 +909,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
}
}
- return status;
+ return SUCCESS;
}
/* }}} */
@@ -914,7 +921,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler)
return FAILURE;
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
/* }}} */
@@ -937,12 +944,12 @@ static PHP_MINIT_FUNCTION(zlib)
php_output_handler_conflict_register(ZEND_STRL("ob_gzhandler"), php_zlib_output_conflict_check TSRMLS_CC);
php_output_handler_conflict_register(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), php_zlib_output_conflict_check TSRMLS_CC);
- REGISTER_INT_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT);
REGISTER_INI_ENTRIES();
return SUCCESS;
}
@@ -999,7 +1006,7 @@ static PHP_MINFO_FUNCTION(zlib)
/* }}} */
/* {{{ ZEND_MODULE_GLOBALS_CTOR */
-static ZEND_MODULE_GLOBALS_CTOR_D(zlib)
+static PHP_GINIT_FUNCTION(zlib)
{
zlib_globals->ob_gzhandler = NULL;
zlib_globals->handler_registered = 0;
@@ -1018,7 +1025,7 @@ zend_module_entry php_zlib_module_entry = {
PHP_MINFO(zlib),
"2.0",
PHP_MODULE_GLOBALS(zlib),
- ZEND_MODULE_GLOBALS_CTOR_N(zlib),
+ PHP_GINIT(zlib),
NULL,
NULL,
STANDARD_MODULE_PROPERTIES_EX
diff --git a/ext/zlib/zlib.dsp b/ext/zlib/zlib.dsp
deleted file mode 100644
index 8986bc6f05..0000000000
--- a/ext/zlib/zlib.dsp
+++ /dev/null
@@ -1,121 +0,0 @@
-# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=zlib - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "zlib - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_zlib.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\zlib\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_zlib.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\zlib\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zlib - Win32 Release_TS"
-# Name "zlib - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zlib_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zlib_filter.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_zlib.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 72a67740be..45ef2a8f7d 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,12 +25,12 @@
/* Passed as opaque in malloc callbacks */
typedef struct _php_zlib_filter_data {
- int persistent;
z_stream strm;
char *inbuf;
size_t inbuf_len;
char *outbuf;
size_t outbuf_len;
+ int persistent;
zend_bool finished;
} php_zlib_filter_data;
@@ -76,8 +76,6 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
while (buckets_in->head) {
size_t bin = 0, desired;
- bucket = buckets_in->head;
-
bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
while (bin < (unsigned int) bucket->buflen) {
@@ -332,11 +330,11 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* log-2 base of history window (9 - 15) */
ZVAL_DUP(&tmp, tmpzval);
- convert_to_int(&tmp);
- if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 32) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp));
+ convert_to_long(&tmp);
+ if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 32) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_LVAL(tmp));
} else {
- windowBits = Z_IVAL(tmp);
+ windowBits = Z_LVAL(tmp);
}
}
}
@@ -363,25 +361,25 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
case IS_OBJECT:
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "memory", sizeof("memory") -1))) {
ZVAL_DUP(&tmp, tmpzval);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
/* Memory Level (1 - 9) */
- if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > MAX_MEM_LEVEL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_IVAL(tmp));
+ if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > MAX_MEM_LEVEL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%pd)", Z_LVAL(tmp));
} else {
- memLevel = Z_IVAL(tmp);
+ memLevel = Z_LVAL(tmp);
}
}
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "window", sizeof("window") - 1))) {
ZVAL_DUP(&tmp, tmpzval);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
/* log-2 base of history window (9 - 15) */
- if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 16) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp));
+ if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 16) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_LVAL(tmp));
} else {
- windowBits = Z_IVAL(tmp);
+ windowBits = Z_LVAL(tmp);
}
}
@@ -394,17 +392,17 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
break;
case IS_STRING:
case IS_DOUBLE:
- case IS_INT:
+ case IS_LONG:
ZVAL_COPY_VALUE(&tmp, filterparams);
factory_setlevel:
zval_copy_ctor(&tmp);
- convert_to_int(&tmp);
+ convert_to_long(&tmp);
/* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
- if (Z_IVAL(tmp) < -1 || Z_IVAL(tmp) > 9) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_IVAL(tmp));
+ if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%pd)", Z_LVAL(tmp));
} else {
- level = Z_IVAL(tmp);
+ level = Z_LVAL(tmp);
}
break;
default:
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 713a6ecfb2..796b8a54e0 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,13 +37,14 @@ static size_t php_gziop_read(php_stream *stream, char *buf, size_t count TSRMLS_
struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
int read;
+ /* XXX this needs to be looped for the case count > UINT_MAX */
read = gzread(self->gz_file, buf, count);
if (gzeof(self->gz_file)) {
stream->eof = 1;
}
- return (read < 0) ? 0 : read;
+ return (size_t)((read < 0) ? 0 : read);
}
static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
@@ -51,9 +52,10 @@ static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count
struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
int wrote;
+ /* XXX this needs to be looped for the case count > UINT_MAX */
wrote = gzwrite(self->gz_file, (char *) buf, count);
- return (wrote < 0) ? 0 : wrote;
+ return (size_t)((wrote < 0) ? 0 : wrote);
}
static int php_gziop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt
index a4e01a4845..0c46a88831 100644
--- a/ext/zlib/zlib_win32_howto.txt
+++ b/ext/zlib/zlib_win32_howto.txt
@@ -7,7 +7,7 @@ php_build\zlib\include\zlib.h
php_build\zlib\include\zconf.h
php_build\zlib\lib\zlibstat.lib
-php_build is a directory at the same level as php5.
+php_build is a directory at the same level as php7.
Start Visual Studio, load php_modules.dsw, select the ZLIB projects, and build
it.
diff --git a/header b/header
index fcbcaea9e3..1d22bbb0b1 100644
--- a/header
+++ b/header
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/SAPI.c b/main/SAPI.c
index 9d8a19dc6d..50ea8c0a16 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -269,7 +269,7 @@ SAPI_API int sapi_read_post_block(char *buffer, size_t buflen TSRMLS_DC)
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
{
if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %pd bytes exceeds the limit of %pd bytes",
SG(request_info).content_length, SG(post_max_size));
return;
}
@@ -290,7 +290,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
}
if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_INT_FMT " bytes", SG(post_max_size));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_LONG_FMT " bytes", SG(post_max_size));
break;
}
@@ -739,7 +739,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
return SUCCESS;
} else {
/* new line/NUL character safety check */
- int i;
+ uint i;
for (i = 0; i < header_line_len; i++) {
/* RFC 2616 allows new lines if followed by SP or HT */
int illegal_break =
@@ -789,9 +789,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
/* Disable possible output compression for images */
if (!strncmp(ptr, "image/", sizeof("image/")-1)) {
- zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
- zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(key);
+ zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
+ zend_alter_ini_entry_chars(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(key);
}
mimetype = estrdup(ptr);
@@ -817,10 +817,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
* do disable compression altogether. This contributes to making scripts
* portable between setups that have and don't have zlib compression
* enabled globally. See req #44164 */
- zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
- zend_alter_ini_entry(key,
+ zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
+ zend_alter_ini_entry_chars(key,
"0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- STR_RELEASE(key);
+ zend_string_release(key);
} else if (!STRCASECMP(header_line, "Location")) {
if ((SG(sapi_headers).http_response_code < 300 ||
SG(sapi_headers).http_response_code > 399) &&
@@ -984,7 +984,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva
return SUCCESS;
}
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC)
+SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC)
{
if (SG(sapi_started) && EG(current_execute_data)) {
return FAILURE;
diff --git a/main/SAPI.h b/main/SAPI.h
index 4e67a481c5..79661371d9 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -82,7 +82,7 @@ typedef struct {
const char *request_method;
char *query_string;
char *cookie_data;
- zend_int_t content_length;
+ zend_long content_length;
char *path_translated;
char *request_uri;
@@ -129,7 +129,7 @@ typedef struct _sapi_globals_struct {
char *default_mimetype;
char *default_charset;
HashTable *rfc1867_uploaded_files;
- zend_int_t post_max_size;
+ zend_long post_max_size;
int options;
zend_bool sapi_started;
double global_request_time;
@@ -170,7 +170,7 @@ END_EXTERN_C()
typedef struct {
char *line; /* If you allocated this, you need to free it yourself */
uint line_len;
- zend_int_t response_code; /* long due to zend_parse_parameters compatibility */
+ zend_long response_code; /* long due to zend_parse_parameters compatibility */
} sapi_header_line;
typedef enum { /* Parameter: */
@@ -198,7 +198,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC);
SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC);
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC);
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC);
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC);
+SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC);
SAPI_API int sapi_flush(TSRMLS_D);
SAPI_API zend_stat_t *sapi_get_stat(TSRMLS_D);
@@ -228,7 +228,7 @@ struct _sapi_module_struct {
int (*activate)(TSRMLS_D);
int (*deactivate)(TSRMLS_D);
- php_size_t (*ub_write)(const char *str, php_size_t str_length TSRMLS_DC);
+ size_t (*ub_write)(const char *str, size_t str_length TSRMLS_DC);
void (*flush)(void *server_context TSRMLS_DC);
zend_stat_t *(*get_stat)(TSRMLS_D);
char *(*getenv)(char *name, size_t name_len TSRMLS_DC);
@@ -239,7 +239,7 @@ struct _sapi_module_struct {
int (*send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC);
void (*send_header)(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC);
- php_size_t (*read_post)(char *buffer, php_size_t count_bytes TSRMLS_DC);
+ size_t (*read_post)(char *buffer, size_t count_bytes TSRMLS_DC);
char *(*read_cookies)(TSRMLS_D);
void (*register_server_variables)(zval *track_vars_array TSRMLS_DC);
@@ -266,7 +266,7 @@ struct _sapi_module_struct {
int (*get_target_uid)(uid_t * TSRMLS_DC);
int (*get_target_gid)(gid_t * TSRMLS_DC);
- unsigned int (*input_filter)(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC);
+ unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC);
void (*ini_defaults)(HashTable *configuration_hash);
int phpinfo_as_text;
@@ -300,7 +300,7 @@ struct _sapi_post_entry {
#define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC)
#define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC)
-#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC)
+#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC)
BEGIN_EXTERN_C()
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
diff --git a/main/build-defs.h.in b/main/build-defs.h.in
index aa1fbf0321..6821b631f5 100644
--- a/main/build-defs.h.in
+++ b/main/build-defs.h.in
@@ -1,6 +1,6 @@
/* -*- C -*-
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 981c5c5a15..8d6bf3d0bc 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -94,24 +94,24 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) {
/* We're in a PHP_INI_SYSTEM context, no restrictions */
- *p = new_value;
+ *p = new_value ? new_value->val : NULL;
return SUCCESS;
}
/* Otherwise we're in runtime */
if (!*p || !**p) {
/* open_basedir not set yet, go ahead and give it a value */
- *p = new_value;
+ *p = new_value->val;
return SUCCESS;
}
/* Shortcut: When we have a open_basedir and someone tries to unset, we know it'll fail */
- if (!new_value || !*new_value) {
+ if (!new_value || !*new_value->val) {
return FAILURE;
}
/* Is the proposed open_basedir at least as restrictive as the current setting? */
- ptr = pathbuf = estrdup(new_value);
+ ptr = pathbuf = estrdup(new_value->val);
while (ptr && *ptr) {
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
if (end != NULL) {
@@ -128,7 +128,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
efree(pathbuf);
/* Everything checks out, set it */
- *p = new_value;
+ *p = new_value->val;
return SUCCESS;
}
@@ -226,12 +226,13 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
/* Resolve open_basedir to resolved_basedir */
if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL) {
+ int basedir_len = (int)strlen(basedir);
/* Handler for basedirs that end with a / */
- resolved_basedir_len = strlen(resolved_basedir);
+ resolved_basedir_len = (int)strlen(resolved_basedir);
#if defined(PHP_WIN32) || defined(NETWARE)
- if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR || basedir[strlen(basedir) - 1] == '/') {
+ if (basedir[basedir_len - 1] == PHP_DIR_SEPARATOR || basedir[basedir_len - 1] == '/') {
#else
- if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
+ if (basedir[basedir_len - 1] == PHP_DIR_SEPARATOR) {
#endif
if (resolved_basedir[resolved_basedir_len - 1] != PHP_DIR_SEPARATOR) {
resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR;
@@ -758,10 +759,15 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co
cwd_state new_state;
char cwd[MAXPATHLEN];
int copy_len;
+ int path_len;
if (!filepath[0]) {
return NULL;
- } else if (IS_ABSOLUTE_PATH(filepath, strlen(filepath))) {
+ }
+
+ path_len = (int)strlen(filepath);
+
+ if (IS_ABSOLUTE_PATH(filepath, path_len)) {
cwd[0] = '\0';
} else {
const char *iam = SG(request_info).path_translated;
@@ -784,7 +790,7 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co
/* return a relative file path if for any reason
* we cannot cannot getcwd() and the requested,
* relatively referenced file is accessible */
- copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath);
+ copy_len = path_len > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : path_len;
if (real_path) {
memcpy(real_path, filepath, copy_len);
real_path[copy_len] = '\0';
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 4dde0e35eb..b58f54dce8 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/getopt.c b/main/getopt.c
index 315467a095..8126d577b4 100644
--- a/main/getopt.c
+++ b/main/getopt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in
index f1e66b160a..3f02921ddf 100644
--- a/main/internal_functions.c.in
+++ b/main/internal_functions.c.in
@@ -1,6 +1,6 @@
/* -*- C -*-
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/internal_functions_nw.c b/main/internal_functions_nw.c
index 86ba57d486..dcb84c346c 100644
--- a/main/internal_functions_nw.c
+++ b/main/internal_functions_nw.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
index 8b5518ca90..355013f501 100644
--- a/main/internal_functions_win32.c
+++ b/main/internal_functions_win32.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/main.c b/main/main.c
index 8f954706cf..d7d7c44f80 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -53,6 +53,7 @@
#include <locale.h>
#endif
#include "zend.h"
+#include "zend_types.h"
#include "zend_extensions.h"
#include "php_ini.h"
#include "php_globals.h"
@@ -160,9 +161,9 @@ static php_win32_disable_functions(TSRMLS_D)
*/
static PHP_INI_MH(OnSetPrecision)
{
- php_int_t i;
+ zend_long i;
- ZEND_ATOI(i, new_value);
+ ZEND_ATOL(i, new_value->val);
if (i >= 0) {
EG(precision) = i;
return SUCCESS;
@@ -177,7 +178,7 @@ static PHP_INI_MH(OnSetPrecision)
static PHP_INI_MH(OnChangeMemoryLimit)
{
if (new_value) {
- PG(memory_limit) = zend_atol(new_value, new_value_length);
+ PG(memory_limit) = zend_atol(new_value->val, new_value->len);
} else {
PG(memory_limit) = 1<<30; /* effectively, no limit */
}
@@ -281,7 +282,7 @@ static void php_binary_init(TSRMLS_D)
if ((envpath = getenv("PATH")) != NULL) {
char *search_dir, search_path[MAXPATHLEN];
char *last = NULL;
- php_stat_t s;
+ zend_stat_t s;
path = estrdup(envpath);
search_dir = php_strtok_r(path, ":", &last);
@@ -318,11 +319,11 @@ static PHP_INI_MH(OnUpdateTimeout)
{
if (stage==PHP_INI_STAGE_STARTUP) {
/* Don't set a timeout on startup, only per-request */
- ZEND_ATOI(EG(timeout_seconds), new_value);
+ ZEND_ATOL(EG(timeout_seconds), new_value->val);
return SUCCESS;
}
zend_unset_timeout(TSRMLS_C);
- ZEND_ATOI(EG(timeout_seconds), new_value);
+ ZEND_ATOL(EG(timeout_seconds), new_value->val);
zend_set_timeout(EG(timeout_seconds), 0);
return SUCCESS;
}
@@ -349,7 +350,7 @@ static int php_get_display_errors_mode(char *value, int value_length)
} else if (value_length == 6 && !strcasecmp(value, "stdout")) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
} else {
- ZEND_ATOI(mode, value);
+ ZEND_ATOL(mode, value);
if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
}
@@ -363,7 +364,7 @@ static int php_get_display_errors_mode(char *value, int value_length)
*/
static PHP_INI_MH(OnUpdateDisplayErrors)
{
- PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);
+ PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value->val, new_value->len);
return SUCCESS;
}
@@ -378,11 +379,11 @@ static PHP_INI_DISP(display_errors_mode)
TSRMLS_FETCH();
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );
- tmp_value_length = ini_entry->orig_value_length;
+ tmp_value = (ini_entry->orig_value ? ini_entry->orig_value->val : NULL );
+ tmp_value_length = ini_entry->orig_value->len;
} else if (ini_entry->value) {
- tmp_value = ini_entry->value;
- tmp_value_length = ini_entry->value_length;
+ tmp_value = ini_entry->value->val;
+ tmp_value_length = ini_entry->value->len;
} else {
tmp_value = NULL;
tmp_value_length = 0;
@@ -422,9 +423,9 @@ static PHP_INI_DISP(display_errors_mode)
static PHP_INI_MH(OnUpdateInternalEncoding)
{
if (new_value) {
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
- OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ PG(internal_encoding) = SG(default_charset);
}
return SUCCESS;
}
@@ -435,9 +436,9 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
static PHP_INI_MH(OnUpdateInputEncoding)
{
if (new_value) {
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
- OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ PG(input_encoding) = SG(default_charset);
}
return SUCCESS;
}
@@ -448,9 +449,9 @@ static PHP_INI_MH(OnUpdateInputEncoding)
static PHP_INI_MH(OnUpdateOutputEncoding)
{
if (new_value) {
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
- OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ PG(output_encoding) = SG(default_charset);
}
return SUCCESS;
}
@@ -461,12 +462,12 @@ static PHP_INI_MH(OnUpdateOutputEncoding)
static PHP_INI_MH(OnUpdateErrorLog)
{
/* Only do the safemode/open_basedir check at runtime */
- if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value, "syslog")) {
- if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {
+ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value->val, "syslog")) {
+ if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) {
return FAILURE;
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
@@ -477,11 +478,11 @@ static PHP_INI_MH(OnUpdateMailLog)
{
/* Only do the safemode/open_basedir check at runtime */
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) {
- if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {
+ if (PG(open_basedir) && php_check_open_basedir(new_value->val TSRMLS_CC)) {
return FAILURE;
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
@@ -528,7 +529,6 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals)
STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode)
STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
@@ -691,7 +691,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
#endif
php_ignore_value(write(fd, tmp, len));
efree(tmp);
- STR_FREE(error_time_str);
+ zend_string_free(error_time_str);
close(fd);
PG(in_error_log) = 0;
return;
@@ -709,7 +709,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
/* {{{ php_write
wrapper for modules to use PHPWRITE */
-PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC)
+PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC)
{
return PHPWRITE(buf, size);
}
@@ -717,12 +717,12 @@ PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC)
/* {{{ php_printf
*/
-PHPAPI php_size_t php_printf(const char *format, ...)
+PHPAPI size_t php_printf(const char *format, ...)
{
va_list args;
- php_size_t ret;
+ size_t ret;
char *buffer;
- php_size_t size;
+ size_t size;
TSRMLS_FETCH();
va_start(args, format);
@@ -893,7 +893,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
spprintf(&message, 0, "%s: %s", origin, buffer);
}
if (replace_origin) {
- STR_FREE(replace_origin);
+ zend_string_free(replace_origin);
} else {
efree(origin);
}
@@ -914,7 +914,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
}
}
if (replace_buffer) {
- STR_FREE(replace_buffer);
+ zend_string_free(replace_buffer);
} else {
efree(buffer);
}
@@ -1129,7 +1129,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
if (PG(display_errors) && ((module_initialized && !PG(during_request_startup)) || (PG(display_startup_errors)))) {
if (PG(xmlrpc_errors)) {
- php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%ld</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno);
+ php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%pd</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno);
} else {
char *prepend_string = INI_STR("error_prepend_string");
char *append_string = INI_STR("error_append_string");
@@ -1138,7 +1138,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
if (type == E_ERROR || type == E_PARSE) {
zend_string *buf = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL TSRMLS_CC);
php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf->val, error_filename, error_lineno, STR_PRINT(append_string));
- STR_FREE(buf);
+ zend_string_free(buf);
} else {
php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string));
}
@@ -1148,10 +1148,10 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR
) {
#ifdef PHP_WIN32
- fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno);
+ fprintf(stderr, "%s: %s in %s on line %u\n", error_type_str, buffer, error_filename, error_lineno);
fflush(stderr);
#else
- fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno);
+ fprintf(stderr, "%s: %s in %s on line %u\n", error_type_str, buffer, error_filename, error_lineno);
#endif
} else {
php_printf("%s\n%s: %s in %s on line %d\n%s", STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string));
@@ -1265,7 +1265,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
*/
PHPAPI char *php_get_current_user(TSRMLS_D)
{
- php_stat_t *pstat;
+ zend_stat_t *pstat;
if (SG(request_info).current_user) {
return SG(request_info).current_user;
@@ -1328,24 +1328,24 @@ PHPAPI char *php_get_current_user(TSRMLS_D)
Sets the maximum time a script can run */
PHP_FUNCTION(set_time_limit)
{
- php_int_t new_timeout;
+ zend_long new_timeout;
char *new_timeout_str;
int new_timeout_strlen;
zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_timeout) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) {
return;
}
- new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_INT_FMT, new_timeout);
+ new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout);
- key = STR_INIT("max_execution_time", sizeof("max_execution_time")-1, 0);
- if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
+ key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0);
+ if (zend_alter_ini_entry_chars_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
- STR_RELEASE(key);
+ zend_string_release(key);
efree(new_timeout_str);
}
/* }}} */
@@ -1438,22 +1438,15 @@ static char *php_resolve_path_for_zend(const char *filename, int filename_len TS
/* {{{ php_get_configuration_directive_for_zend
*/
-static int php_get_configuration_directive_for_zend(const char *name, uint name_length, zval *contents)
+static zval *php_get_configuration_directive_for_zend(zend_string *name)
{
- zval *retval = cfg_get_entry(name, name_length);
-
- if (retval) {
- *contents = *retval;
- return SUCCESS;
- } else {
- return FAILURE;
- }
+ return cfg_get_entry_ex(name);
}
/* }}} */
/* {{{ php_message_handler_for_zend
*/
-static void php_message_handler_for_zend(long message, const void *data TSRMLS_DC)
+static void php_message_handler_for_zend(zend_long message, const void *data TSRMLS_DC)
{
switch (message) {
case ZMSG_FAILED_INCLUDE_FOPEN:
@@ -1499,7 +1492,7 @@ static void php_message_handler_for_zend(long message, const void *data TSRMLS_D
if (EG(error_reporting) & E_WARNING) {
char memory_leak_buf[512];
- snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===\n", *((zend_uint *) data));
+ snprintf(memory_leak_buf, 512, "=== Total %d memory leaks detected ===\n", *((uint32_t *) data));
# if defined(PHP_WIN32)
OutputDebugString(memory_leak_buf);
# else
@@ -1923,7 +1916,7 @@ PHPAPI void php_com_initialize(TSRMLS_D)
/* {{{ php_output_wrapper
*/
-static php_size_t php_output_wrapper(const char *str, php_size_t str_length)
+static size_t php_output_wrapper(const char *str, size_t str_length)
{
TSRMLS_FETCH();
return php_output_write(str, str_length TSRMLS_CC);
@@ -2029,7 +2022,7 @@ void dummy_invalid_parameter_handler(
called = 1;
if (function) {
if (file) {
- len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%d)", function, file, line);
+ len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws' (%ws:%u)", function, file, line);
} else {
len = _snprintf(buf, sizeof(buf)-1, "Invalid parameter detected in CRT function '%ws'", function);
}
@@ -2180,17 +2173,17 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
/* Register constants */
REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTRA_VERSION", PHP_EXTRA_VERSION, sizeof(PHP_EXTRA_VERSION) - 1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS);
#ifdef ZTS
- REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS);
#else
- REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS);
#endif
- REGISTER_MAIN_INT_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_module.name, strlen(sapi_module.name), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);
@@ -2210,23 +2203,23 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", ZEND_LONG_MAX, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MIN", ZEND_LONG_MIN, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_LONG, CONST_PERSISTENT | CONST_CS);
#ifdef PHP_WIN32
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS);
#endif
php_binary_init(TSRMLS_C);
@@ -2333,7 +2326,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
struct {
const long error_level;
const char *phrase;
- const char *directives[16]; /* Remember to change this if the number of directives change */
+ const char *directives[17]; /* Remember to change this if the number of directives change */
} directives[2] = {
{
E_DEPRECATED,
@@ -2347,6 +2340,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
"Directive '%s' is no longer available in PHP",
{
"allow_call_time_pass_reference",
+ "asp_tags",
"define_syslog_variables",
"highlight.bg",
"magic_quotes_gpc",
@@ -2374,9 +2368,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
const char **p = directives[i].directives;
while(*p) {
- php_int_t value;
+ zend_long value;
- if (cfg_get_int((char*)*p, &value) == SUCCESS && value) {
+ if (cfg_get_long((char*)*p, &value) == SUCCESS && value) {
zend_error(directives[i].error_level, directives[i].phrase, *p);
}
@@ -2653,7 +2647,7 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC)
SG(request_info).auth_password = estrdup(pass);
ret = 0;
}
- STR_FREE(user);
+ zend_string_free(user);
}
}
diff --git a/main/network.c b/main/network.c
index 5edc74c830..9fd1285493 100644
--- a/main/network.c
+++ b/main/network.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -507,7 +507,7 @@ bound:
}
/* }}} */
-PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC)
+PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC)
{
char *colon;
char *tmp;
@@ -563,7 +563,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int
if (n == 0) {
if (errstr) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val);
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
goto out;
}
@@ -645,10 +645,10 @@ PHPAPI void php_network_populate_name_from_sockaddr(
if (ua->sun_path[0] == '\0') {
/* abstract name */
int len = strlen(ua->sun_path + 1) + 1;
- *textaddr = STR_INIT((char*)ua->sun_path, len, 0);
+ *textaddr = zend_string_init((char*)ua->sun_path, len, 0);
} else {
int len = strlen(ua->sun_path);
- *textaddr = STR_INIT((char*)ua->sun_path, len, 0);
+ *textaddr = zend_string_init((char*)ua->sun_path, len, 0);
}
}
break;
@@ -880,7 +880,7 @@ skip_bind:
}
/* free error string received during previous iteration (if any) */
if (error_string && *error_string) {
- STR_RELEASE(*error_string);
+ zend_string_release(*error_string);
*error_string = NULL;
}
@@ -1050,7 +1050,7 @@ PHPAPI zend_string *php_socket_error_str(long err)
char *errstr;
errstr = strerror(err);
- return STR_INIT(errstr, strlen(errstr), 0);
+ return zend_string_init(errstr, strlen(errstr), 0);
#else
zend_string *ret;
char *sysbuf;
@@ -1070,7 +1070,7 @@ PHPAPI zend_string *php_socket_error_str(long err)
sysbuf = "Unknown Error";
}
- ret = STR_INIT(sysbuf, strlen(sysbuf), 0);
+ ret = zend_string_init(sysbuf, strlen(sysbuf), 0);
if (free_it) {
LocalFree(sysbuf);
@@ -1110,7 +1110,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p
int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC)
{
char *res;
- php_int_t reslen;
+ zend_long reslen;
php_stream *stream;
reslen = spprintf(&res, 0, "tcp://%s:%d", host, port);
@@ -1123,7 +1123,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p
return stream;
}
-PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC)
+PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block TSRMLS_DC)
{
int ret = SUCCESS;
int flags;
diff --git a/main/output.c b/main/output.c
index 4acdd234f2..f44ae178b4 100644
--- a/main/output.c
+++ b/main/output.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -199,20 +199,20 @@ PHPAPI void php_output_deactivate(TSRMLS_D)
/* {{{ void php_output_register_constants() */
PHPAPI void php_output_register_constants(TSRMLS_D)
{
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT);
}
/* }}} */
@@ -404,7 +404,7 @@ PHPAPI int php_output_get_contents(zval *p TSRMLS_DC)
PHPAPI int php_output_get_length(zval *p TSRMLS_DC)
{
if (OG(active)) {
- ZVAL_INT(p, OG(active)->buffer.used);
+ ZVAL_LONG(p, OG(active)->buffer.used);
return SUCCESS;
} else {
ZVAL_NULL(p);
@@ -501,8 +501,8 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC);
break;
case IS_STRING:
- if (Z_STRSIZE_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler) TSRMLS_CC))) {
- handler = alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler), chunk_size, flags TSRMLS_CC);
+ if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) {
+ handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC);
break;
}
default:
@@ -519,7 +519,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
efree(error);
}
if (handler_name) {
- STR_RELEASE(handler_name);
+ zend_string_release(handler_name);
}
}
@@ -532,11 +532,11 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC)
{
php_output_handler *handler;
- zend_string *str = STR_INIT(name, name_len, 1);
+ zend_string *str = zend_string_init(name, name_len, 1);
handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL TSRMLS_CC);
handler->func.internal = output_handler;
- STR_RELEASE(str);
+ zend_string_release(str);
return handler;
}
@@ -718,7 +718,7 @@ PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSR
PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
{
if (handler->name) {
- STR_RELEASE(handler->name);
+ zend_string_release(handler->name);
}
if (handler->buffer.data) {
efree(handler->buffer.data);
@@ -885,7 +885,7 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz
php_output_handler *handler;
handler = ecalloc(1, sizeof(php_output_handler));
- handler->name = STR_COPY(name);
+ handler->name = zend_string_copy(name);
handler->size = chunk_size;
handler->flags = flags;
handler->buffer.size = PHP_OUTPUT_HANDLER_INITBUF_SIZE(chunk_size);
@@ -973,7 +973,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
zval retval, ob_data, ob_mode;
ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used);
- ZVAL_INT(&ob_mode, (long) context->op);
+ ZVAL_LONG(&ob_mode, (zend_long) context->op);
zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode);
#define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_FALSE))
@@ -982,9 +982,9 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
status = PHP_OUTPUT_HANDLER_NO_DATA;
if (Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) {
convert_to_string_ex(&retval);
- if (Z_STRSIZE(retval)) {
- context->out.data = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval));
- context->out.used = Z_STRSIZE(retval);
+ if (Z_STRLEN(retval)) {
+ context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ context->out.used = Z_STRLEN(retval);
context->out.free = 1;
status = PHP_OUTPUT_HANDLER_SUCCESS;
}
@@ -1172,7 +1172,7 @@ static int php_output_stack_apply_list(void *h, void *z)
php_output_handler *handler = *(php_output_handler **) h;
zval *array = (zval *) z;
- add_next_index_str(array, STR_COPY(handler->name));
+ add_next_index_str(array, zend_string_copy(handler->name));
return 0;
}
/* }}} */
@@ -1196,13 +1196,13 @@ static inline zval *php_output_handler_status(php_output_handler *handler, zval
ZEND_ASSERT(entry != NULL);
array_init(entry);
- add_assoc_str(entry, "name", STR_COPY(handler->name));
- add_assoc_int(entry, "type", (php_int_t) (handler->flags & 0xf));
- add_assoc_int(entry, "flags", (php_int_t) handler->flags);
- add_assoc_int(entry, "level", (php_int_t) handler->level);
- add_assoc_int(entry, "chunk_size", (php_int_t) handler->size);
- add_assoc_int(entry, "buffer_size", (php_int_t) handler->buffer.size);
- add_assoc_int(entry, "buffer_used", (php_int_t) handler->buffer.used);
+ add_assoc_str(entry, "name", zend_string_copy(handler->name));
+ add_assoc_long(entry, "type", (zend_long) (handler->flags & 0xf));
+ add_assoc_long(entry, "flags", (zend_long) handler->flags);
+ add_assoc_long(entry, "level", (zend_long) handler->level);
+ add_assoc_long(entry, "chunk_size", (zend_long) handler->size);
+ add_assoc_long(entry, "buffer_size", (zend_long) handler->buffer.size);
+ add_assoc_long(entry, "buffer_used", (zend_long) handler->buffer.used);
return entry;
}
@@ -1316,10 +1316,10 @@ static int php_output_handler_devnull_func(void **handler_context, php_output_co
PHP_FUNCTION(ob_start)
{
zval *output_handler = NULL;
- php_int_t chunk_size = 0;
- php_int_t flags = PHP_OUTPUT_HANDLER_STDFLAGS;
+ zend_long chunk_size = 0;
+ zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ii", &output_handler, &chunk_size, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ll", &output_handler, &chunk_size, &flags) == FAILURE) {
return;
}
@@ -1475,7 +1475,7 @@ PHP_FUNCTION(ob_get_level)
return;
}
- RETURN_INT(php_output_get_level(TSRMLS_C));
+ RETURN_LONG(php_output_get_level(TSRMLS_C));
}
/* }}} */
@@ -1539,7 +1539,7 @@ PHP_FUNCTION(ob_get_status)
Turn implicit flush on/off and is equivalent to calling flush() after every output call */
PHP_FUNCTION(ob_implicit_flush)
{
- php_int_t flag = 1;
+ zend_long flag = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
return;
@@ -1566,7 +1566,7 @@ PHP_FUNCTION(output_reset_rewrite_vars)
PHP_FUNCTION(output_add_rewrite_var)
{
char *name, *value;
- int name_len, value_len;
+ size_t name_len, value_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) {
return;
diff --git a/main/php.h b/main/php.h
index a271f0d5fc..2a683e1924 100644
--- a/main/php.h
+++ b/main/php.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -66,15 +66,6 @@
# define PHP_EOL "\n"
#endif
-#define php_size_t zend_size_t
-#define php_int_t zend_int_t
-#define php_uint_t zend_uint_t
-#define php_off_t zend_off_t
-#define PHP_INT_MAX ZEND_INT_MAX
-#define PHP_INT_MIN ZEND_INT_MIN
-#define PHP_UINT_MAX ZEND_UINT_MAX
-#define PHP_SIZE_MAX ZEND_SIZE_MAX
-
#ifdef NETWARE
/* For php_get_uname() function */
#define PHP_UNAME "NetWare"
@@ -289,8 +280,8 @@ ssize_t pread(int, void *, size_t, off64_t);
BEGIN_EXTERN_C()
void phperror(char *error);
-PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC);
-PHPAPI php_size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1,
+PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC);
+PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1,
2);
PHPAPI int php_get_module_initialized(void);
PHPAPI void php_log_err(char *log_message TSRMLS_DC);
@@ -443,7 +434,7 @@ END_EXTERN_C()
#else /* ! (CRAY || __arm) */
#define XtOffset(p_type, field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+ ((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
#endif /* !CRAY */
#endif /* ! XtOffset */
diff --git a/main/php_compat.h b/main/php_compat.h
index 20951ba427..5e6af03c59 100644
--- a/main/php_compat.h
+++ b/main/php_compat.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_content_types.c b/main/php_content_types.c
index c8db921421..8765a507bc 100644
--- a/main/php_content_types.c
+++ b/main/php_content_types.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_content_types.h b/main/php_content_types.h
index ed5346c843..0a49d1e2cd 100644
--- a/main/php_content_types.h
+++ b/main/php_content_types.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_getopt.h b/main/php_getopt.h
index f536ac8a96..8f70181786 100644
--- a/main/php_getopt.h
+++ b/main/php_getopt.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_globals.h b/main/php_globals.h
index defb220c76..a60efe69de 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -56,7 +56,7 @@ typedef struct _arg_separators {
struct _php_core_globals {
zend_bool implicit_flush;
- zend_int_t output_buffering;
+ zend_long output_buffering;
zend_bool sql_safe_mode;
zend_bool enable_dl;
@@ -64,16 +64,16 @@ struct _php_core_globals {
char *output_handler;
char *unserialize_callback_func;
- zend_int_t serialize_precision;
+ zend_long serialize_precision;
- zend_int_t memory_limit;
- zend_int_t max_input_time;
+ zend_long memory_limit;
+ zend_long max_input_time;
zend_bool track_errors;
zend_bool display_errors;
zend_bool display_startup_errors;
zend_bool log_errors;
- zend_int_t log_errors_max_len;
+ zend_long log_errors_max_len;
zend_bool ignore_repeated_errors;
zend_bool ignore_repeated_source;
zend_bool report_memleaks;
@@ -88,7 +88,7 @@ struct _php_core_globals {
char *sys_temp_dir;
char *upload_tmp_dir;
- zend_int_t upload_max_filesize;
+ zend_long upload_max_filesize;
char *error_append_string;
char *error_prepend_string;
@@ -126,7 +126,7 @@ struct _php_core_globals {
zend_bool html_errors;
zend_bool xmlrpc_errors;
- zend_int_t xmlrpc_error_number;
+ zend_long xmlrpc_error_number;
zend_bool activated_auto_globals[8];
@@ -149,12 +149,12 @@ struct _php_core_globals {
#ifdef PHP_WIN32
zend_bool com_initialized;
#endif
- zend_int_t max_input_nesting_level;
- zend_int_t max_input_vars;
+ zend_long max_input_nesting_level;
+ zend_long max_input_vars;
zend_bool in_user_include;
char *user_ini_filename;
- zend_int_t user_ini_cache_ttl;
+ zend_long user_ini_cache_ttl;
char *request_order;
diff --git a/main/php_ini.c b/main/php_ini.c
index 54944483d2..c90dc9f29f 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -83,9 +83,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC)
uint display_string_length, esc_html=0;
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value && ini_entry->orig_value[0]) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
+ if (ini_entry->orig_value && ini_entry->orig_value->val[0]) {
+ display_string = ini_entry->orig_value->val;
+ display_string_length = ini_entry->orig_value->len;
esc_html = !sapi_module.phpinfo_as_text;
} else {
if (!sapi_module.phpinfo_as_text) {
@@ -96,9 +96,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC)
display_string_length = sizeof("no value") - 1;
}
}
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
+ } else if (ini_entry->value && ini_entry->value->val[0]) {
+ display_string = ini_entry->value->val;
+ display_string_length = ini_entry->value->len;
esc_html = !sapi_module.phpinfo_as_text;
} else {
if (!sapi_module.phpinfo_as_text) {
@@ -132,14 +132,14 @@ static int php_ini_displayer(zval *el, void *arg TSRMLS_DC)
if (!sapi_module.phpinfo_as_text) {
PUTS("<tr>");
PUTS("<td class=\"e\">");
- PHPWRITE(ini_entry->name, ini_entry->name_length);
+ PHPWRITE(ini_entry->name->val, ini_entry->name->len);
PUTS("</td><td class=\"v\">");
php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC);
PUTS("</td><td class=\"v\">");
php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG TSRMLS_CC);
PUTS("</td></tr>\n");
} else {
- PHPWRITE(ini_entry->name, ini_entry->name_length);
+ PHPWRITE(ini_entry->name->val, ini_entry->name->len);
PUTS(" => ");
php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE TSRMLS_CC);
PUTS(" => ");
@@ -200,7 +200,7 @@ PHPAPI void config_zval_dtor(zval *zvalue)
zend_hash_destroy(Z_ARRVAL_P(zvalue));
free(Z_ARR_P(zvalue));
} else if (Z_TYPE_P(zvalue) == IS_STRING) {
- STR_RELEASE(Z_STR_P(zvalue));
+ zend_string_release(Z_STR_P(zvalue));
}
}
/* Reset / free active_ini_sectin global */
@@ -233,17 +233,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
/* PHP and Zend extensions are not added into configuration hash! */
if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */
- extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2));
+ extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
zend_llist_add_element(&extension_lists.functions, &extension_name);
} else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
- extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2));
+ extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
zend_llist_add_element(&extension_lists.engine, &extension_name);
/* All other entries are added into either configuration_hash or active ini section array */
} else {
/* Store in active hash */
entry = zend_hash_update(active_hash, Z_STR_P(arg1), arg2);
- Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1);
+ Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1);
}
}
break;
@@ -267,12 +267,12 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
}
/* arg3 is possible option offset name */
- if (arg3 && Z_STRSIZE_P(arg3) > 0) {
+ if (arg3 && Z_STRLEN_P(arg3) > 0) {
entry = zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STR_P(arg3), arg2);
} else {
entry = zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2);
}
- Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1);
+ Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1);
}
break;
@@ -287,7 +287,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) {
key = Z_STRVAL_P(arg1);
key = key + sizeof("PATH") - 1;
- key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1;
+ key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1;
is_special_section = 1;
has_per_dir_config = 1;
@@ -298,7 +298,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
} else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) {
key = Z_STRVAL_P(arg1);
key = key + sizeof("HOST") - 1;
- key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1;
+ key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1;
is_special_section = 1;
has_per_host_config = 1;
zend_str_tolower(key, key_len); /* host names are case-insensitive. */
@@ -545,7 +545,7 @@ int php_init_config(TSRMLS_D)
/* Check if php_ini_file_name is a file and can be opened */
if (php_ini_file_name && php_ini_file_name[0]) {
- php_stat_t statbuf;
+ zend_stat_t statbuf;
if (!VCWD_STAT(php_ini_file_name, &statbuf)) {
if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
@@ -593,12 +593,12 @@ int php_init_config(TSRMLS_D)
{
zval tmp;
- ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1));
+ ZVAL_NEW_STR(&tmp, zend_string_init(fh.filename, strlen(fh.filename), 1));
zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp);
if (php_ini_opened_path) {
efree(php_ini_opened_path);
}
- php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp));
+ php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
}
}
@@ -614,7 +614,7 @@ int php_init_config(TSRMLS_D)
if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
struct dirent **namelist;
int ndir, i;
- php_stat_t sb;
+ zend_stat_t sb;
char ini_file[MAXPATHLEN];
char *p;
zend_file_handle fh2;
@@ -744,7 +744,7 @@ void php_ini_register_extensions(TSRMLS_D)
*/
PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC)
{
- php_stat_t sb;
+ zend_stat_t sb;
char ini_file[MAXPATHLEN];
zend_file_handle fh;
@@ -778,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int
{
zend_string *str;
zval *data;
- zend_uint_t num_index;
+ zend_ulong num_index;
/* Walk through config hash and alter matching ini entries using the values found in the hash */
for (zend_hash_internal_pointer_reset(source_hash);
@@ -786,7 +786,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int
zend_hash_move_forward(source_hash)
) {
data = zend_hash_get_current_data(source_hash);
- zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0 TSRMLS_CC);
}
}
/* }}} */
@@ -867,15 +867,23 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR
/* {{{ cfg_get_entry
*/
+PHPAPI zval *cfg_get_entry_ex(zend_string *name)
+{
+ return zend_hash_find(&configuration_hash, name);
+}
+/* }}} */
+
+/* {{{ cfg_get_entry
+ */
PHPAPI zval *cfg_get_entry(const char *name, uint name_length)
{
return zend_hash_str_find(&configuration_hash, name, name_length);
}
/* }}} */
-/* {{{ cfg_get_int
+/* {{{ cfg_get_long
*/
-PHPAPI int cfg_get_int(const char *varname, zend_int_t *result)
+PHPAPI int cfg_get_long(const char *varname, zend_long *result)
{
zval *tmp, var;
@@ -884,8 +892,8 @@ PHPAPI int cfg_get_int(const char *varname, zend_int_t *result)
return FAILURE;
}
ZVAL_DUP(&var, tmp);
- convert_to_int(&var);
- *result = Z_IVAL(var);
+ convert_to_long(&var);
+ *result = Z_LVAL(var);
return SUCCESS;
}
/* }}} */
diff --git a/main/php_ini.h b/main/php_ini.h
index 491ad1cbd8..99f6a07a07 100644
--- a/main/php_ini.h
+++ b/main/php_ini.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,8 +28,9 @@ PHPAPI void config_zval_dtor(zval *zvalue);
int php_init_config(TSRMLS_D);
int php_shutdown_config(void);
void php_ini_register_extensions(TSRMLS_D);
+PHPAPI zval *cfg_get_entry_ex(zend_string *name);
PHPAPI zval *cfg_get_entry(const char *name, uint name_length);
-PHPAPI int cfg_get_int(const char *varname, zend_int_t *result);
+PHPAPI int cfg_get_long(const char *varname, zend_long *result);
PHPAPI int cfg_get_double(const char *varname, double *result);
PHPAPI int cfg_get_string(const char *varname, char **result);
PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC);
@@ -83,7 +84,7 @@ END_EXTERN_C()
#define php_alter_ini_entry zend_alter_ini_entry
-#define php_ini_long zend_ini_int
+#define php_ini_long zend_ini_long
#define php_ini_double zend_ini_double
#define php_ini_string zend_ini_string
diff --git a/main/php_main.h b/main/php_main.h
index 92dafde4d8..07d7dc2280 100644
--- a/main/php_main.h
+++ b/main/php_main.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h
index 229ed1902e..a7823817bc 100644
--- a/main/php_memory_streams.h
+++ b/main/php_memory_streams.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_network.h b/main/php_network.h
index cc6e1c54e7..b0b1787ea5 100644
--- a/main/php_network.h
+++ b/main/php_network.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -306,7 +306,7 @@ PHPAPI void php_network_populate_name_from_sockaddr(
TSRMLS_DC);
PHPAPI int php_network_parse_network_address_with_port(const char *addr,
- php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC);
+ zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC);
END_EXTERN_C()
#define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC)
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index ebe5350ef2..a52619ed47 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h
index 873bffcb0a..a11cb79014 100644
--- a/main/php_open_temporary_file.h
+++ b/main/php_open_temporary_file.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_output.h b/main/php_output.h
index f8b961c7c3..02b2b85d13 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -143,12 +143,12 @@ typedef struct _php_output_handler {
} php_output_handler;
ZEND_BEGIN_MODULE_GLOBALS(output)
- int flags;
zend_stack handlers;
php_output_handler *active;
php_output_handler *running;
const char *output_start_filename;
int output_start_lineno;
+ int flags;
ZEND_END_MODULE_GLOBALS(output)
/* there should not be a need to use OG() from outside of output.c */
diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h
index 2f2e99c0b4..5aac0262a8 100644
--- a/main/php_reentrancy.h
+++ b/main/php_reentrancy.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_scandir.c b/main/php_scandir.c
index 36c0c648e1..7dfec7bff7 100644
--- a/main/php_scandir.c
+++ b/main/php_scandir.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_scandir.h b/main/php_scandir.h
index 90708c6872..848f525732 100644
--- a/main/php_scandir.h
+++ b/main/php_scandir.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_sprintf.c b/main/php_sprintf.c
index e9f956f8dd..f93c16e9aa 100644
--- a/main/php_sprintf.c
+++ b/main/php_sprintf.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_stdint.h b/main/php_stdint.h
index 14b32d7ca4..4d0d723af6 100644
--- a/main/php_stdint.h
+++ b/main/php_stdint.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,6 +28,7 @@
# if !defined(_STDINT)
# define _STDINT
# include "win32/php_stdint.h"
+# include "win32/php_inttypes.h"
# endif
# define HAVE_INT8_T 1
# define HAVE_UINT8_T 1
diff --git a/main/php_streams.h b/main/php_streams.h
index 229f8f49e0..77a2234d92 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,6 +26,8 @@
#endif
#include <sys/types.h>
#include <sys/stat.h>
+#include "zend.h"
+#include "zend_stream.h"
BEGIN_EXTERN_C()
PHPAPI int php_file_le_stream(void);
@@ -103,16 +105,6 @@ typedef struct _php_stream_filter php_stream_filter;
#include "streams/php_stream_context.h"
#include "streams/php_stream_filter_api.h"
-#ifdef _WIN64
-# define php_fstat _fstat64
-# define php_stat_fn _stat64
-typedef struct __stat64 php_stat_t;
-#else
-# define php_fstat fstat
-# define php_stat_fn stat
-typedef struct stat php_stat_t;
-#endif
-
typedef struct _php_stream_statbuf {
zend_stat_t sb; /* regular info */
/* extended info to go here some day: content-type etc. etc. */
diff --git a/main/php_syslog.h b/main/php_syslog.h
index f8280a8a50..d39fc9b5b2 100644
--- a/main/php_syslog.h
+++ b/main/php_syslog.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_ticks.c b/main/php_ticks.c
index 248b5a9e04..daa6cde6ff 100644
--- a/main/php_ticks.c
+++ b/main/php_ticks.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_ticks.h b/main/php_ticks.h
index b511949d80..0f8277cc7f 100644
--- a/main/php_ticks.h
+++ b/main/php_ticks.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/php_variables.c b/main/php_variables.c
index 949bd6c6b0..a0acb38264 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,7 @@
#include "php.h"
#include "ext/standard/php_standard.h"
#include "ext/standard/credits.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "php_variables.h"
#include "php_globals.h"
#include "php_content_types.h"
@@ -43,13 +43,13 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra
}
/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *strval, php_size_t str_len, zval *track_vars_array TSRMLS_DC)
+PHPAPI void php_register_variable_safe(char *var, char *strval, size_t str_len, zval *track_vars_array TSRMLS_DC)
{
zval new_entry;
assert(strval != NULL);
/* Prepare value */
- ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0));
+ ZVAL_NEW_STR(&new_entry, zend_string_init(strval, str_len, 0));
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
}
@@ -141,7 +141,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
/* do not output the error message to the screen,
this helps us to to avoid "information disclosure" */
if (!PG(display_errors)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded " ZEND_INT_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level));
}
free_alloca(var_orig, use_heap);
return;
@@ -243,10 +243,10 @@ typedef struct post_var_data {
static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSRMLS_DC)
{
- char *ksep, *vsep;
+ char *ksep, *vsep, *val;
size_t klen, vlen;
/* FIXME: string-size_t */
- php_size_t new_vlen;
+ size_t new_vlen;
if (var->ptr >= var->end) {
return 0;
@@ -274,15 +274,17 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSR
vlen = 0;
}
-
php_url_decode(var->ptr, klen);
+
+ val = estrndup(ksep, vlen);
if (vlen) {
- vlen = php_url_decode(ksep, vlen);
+ vlen = php_url_decode(val, vlen);
}
- if (sapi_module.input_filter(PARSE_POST, var->ptr, &ksep, vlen, &new_vlen TSRMLS_CC)) {
- php_register_variable_safe(var->ptr, ksep, new_vlen, arr TSRMLS_CC);
+ if (sapi_module.input_filter(PARSE_POST, var->ptr, &val, vlen, &new_vlen TSRMLS_CC)) {
+ php_register_variable_safe(var->ptr, val, new_vlen, arr TSRMLS_CC);
}
+ efree(val);
var->ptr = vsep + (vsep != var->end);
return 1;
@@ -358,7 +360,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
zval array;
int free_buffer = 0;
char *strtok_buf = NULL;
- php_int_t count = 0;
+ zend_long count = 0;
ZVAL_UNDEF(&array);
switch (arg) {
@@ -442,13 +444,13 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
}
if (++count > PG(max_input_vars)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_INT_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
break;
}
if (val) { /* have a value */
- php_size_t val_len;
- php_size_t new_val_len;
+ size_t val_len;
+ size_t new_val_len;
*val++ = '\0';
php_url_decode(var, strlen(var));
@@ -459,8 +461,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
}
efree(val);
} else {
- php_size_t val_len;
- php_size_t new_val_len;
+ size_t val_len;
+ size_t new_val_len;
php_url_decode(var, strlen(var));
val_len = 0;
@@ -535,7 +537,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
for (i = 0; i < SG(request_info).argc; i++) {
ZVAL_STRING(&tmp, SG(request_info).argv[i]);
if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) {
- STR_FREE(Z_STR(tmp));
+ zend_string_free(Z_STR(tmp));
}
}
} else if (s && *s) {
@@ -549,7 +551,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
ZVAL_STRING(&tmp, ss);
count++;
if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) {
- STR_FREE(Z_STR(tmp));
+ zend_string_free(Z_STR(tmp));
}
if (space) {
*space = '+';
@@ -562,9 +564,9 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
/* prepare argc */
if (SG(request_info).argc) {
- ZVAL_INT(&argc, SG(request_info).argc);
+ ZVAL_LONG(&argc, SG(request_info).argc);
} else {
- ZVAL_INT(&argc, count);
+ ZVAL_LONG(&argc, count);
}
if (SG(request_info).argc) {
@@ -608,7 +610,7 @@ static inline void php_register_server_variables(TSRMLS_D)
zval request_time_float, request_time_long;
ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C));
php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
- ZVAL_INT(&request_time_long, zend_dval_to_ival(Z_DVAL(request_time_float)));
+ ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float)));
php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
@@ -621,7 +623,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
{
zval *src_entry, *dest_entry;
zend_string *string_key;
- php_uint_t num_key;
+ zend_ulong num_key;
int globals_check = (dest == (&EG(symbol_table).ht));
ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {
@@ -816,13 +818,13 @@ static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC)
void php_startup_auto_globals(TSRMLS_D)
{
- zend_register_auto_global(STR_INIT("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC);
- zend_register_auto_global(STR_INIT("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC);
+ zend_register_auto_global(zend_string_init("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC);
}
/*
diff --git a/main/php_variables.h b/main/php_variables.h
index c33308b5a2..08abeb5267 100644
--- a/main/php_variables.h
+++ b/main/php_variables.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,7 +38,7 @@ void php_startup_auto_globals(TSRMLS_D);
extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC);
/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *val, php_size_t val_len, zval *track_vars_array TSRMLS_DC);
+PHPAPI void php_register_variable_safe(char *var, char *val, size_t val_len, zval *track_vars_array TSRMLS_DC);
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC);
PHPAPI int php_hash_environment(TSRMLS_D);
diff --git a/main/reentrancy.c b/main/reentrancy.c
index dd411f478b..4aca23eb1a 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 2d76d6c975..0eacf896c3 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -58,7 +58,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL;
PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL;
-static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC);
+static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC);
/* The longest property name we use in an uploaded file array */
#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
@@ -78,14 +78,14 @@ static void safe_php_register_variable(char *var, char *strval, php_size_t val_l
void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */
{
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT);
}
/* }}} */
@@ -161,7 +161,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */
+static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */
{
if (override_protection || !is_protected_variable(var TSRMLS_CC)) {
php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC);
@@ -611,9 +611,9 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne
}
/* read until a boundary condition */
-static int multipart_buffer_read(multipart_buffer *self, char *buf, php_size_t bytes, int *end TSRMLS_DC)
+static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end TSRMLS_DC)
{
- php_size_t len, max;
+ size_t len, max;
char *bound;
/* fill buffer if needed */
@@ -657,7 +657,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, php_size_t b
XXX: this is horrible memory-usage-wise, but we only expect
to do this on small pieces of form data.
*/
-static char *multipart_buffer_read_body(multipart_buffer *self, php_size_t *len TSRMLS_DC)
+static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len TSRMLS_DC)
{
char buf[FILLUNIT], *out=NULL;
int total_bytes=0, read_bytes=0;
@@ -701,7 +701,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
php_rfc1867_getword_t getword;
php_rfc1867_getword_conf_t getword_conf;
php_rfc1867_basename_t _basename;
- php_int_t count = 0;
+ zend_long count = 0;
if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) {
getword = php_rfc1867_getword;
@@ -714,7 +714,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
if (SG(post_max_size) > 0 && SG(request_info).content_length > SG(post_max_size)) {
- sapi_module.sapi_error(E_WARNING, "POST Content-Length of " ZEND_INT_FMT " bytes exceeds the limit of " ZEND_INT_FMT " bytes", SG(request_info).content_length, SG(post_max_size));
+ sapi_module.sapi_error(E_WARNING, "POST Content-Length of " ZEND_LONG_FMT " bytes exceeds the limit of " ZEND_LONG_FMT " bytes", SG(request_info).content_length, SG(post_max_size));
return;
}
@@ -850,9 +850,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
/* Normal form variable, safe to read all data into memory */
if (!filename && param) {
- php_size_t value_len;
+ size_t value_len;
char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC);
- php_size_t new_val_len; /* Dummy variable */
+ size_t new_val_len; /* Dummy variable */
if (!value) {
value = estrdup("");
@@ -889,7 +889,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
safe_php_register_variable(param, value, new_val_len, array_ptr, 0 TSRMLS_CC);
} else {
if (count == PG(max_input_vars) + 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_INT_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
}
if (php_rfc1867_callback != NULL) {
@@ -1034,14 +1034,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
}
- if (PG(upload_max_filesize) > 0 && (php_int_t)(total_bytes+blen) > PG(upload_max_filesize)) {
+ if (PG(upload_max_filesize) > 0 && (zend_long)(total_bytes+blen) > PG(upload_max_filesize)) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
+ sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_LONG_FMT " bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
#endif
cancel_upload = UPLOAD_ERROR_A;
- } else if (max_file_size && ((php_int_t)(total_bytes+blen) > max_file_size)) {
+ } else if (max_file_size && ((zend_long)(total_bytes+blen) > max_file_size)) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
+ sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_LONG_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
#endif
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
@@ -1224,13 +1224,13 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
int size_overflow = 0;
char file_size_buf[65];
- ZVAL_INT(&error_type, cancel_upload);
+ ZVAL_LONG(&error_type, cancel_upload);
/* Add $foo[error] */
if (cancel_upload) {
- ZVAL_INT(&file_size, 0);
+ ZVAL_LONG(&file_size, 0);
} else {
- if (total_bytes > ZEND_INT_MAX) {
+ if (total_bytes > ZEND_LONG_MAX) {
#ifdef PHP_WIN32
if (_i64toa_s(total_bytes, file_size_buf, 65, 10)) {
file_size_buf[0] = '0';
@@ -1245,7 +1245,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
size_overflow = 1;
} else {
- ZVAL_INT(&file_size, total_bytes);
+ ZVAL_LONG(&file_size, total_bytes);
}
}
diff --git a/main/rfc1867.h b/main/rfc1867.h
index b76e3598f5..ab5f50f8d6 100644
--- a/main/rfc1867.h
+++ b/main/rfc1867.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/snprintf.c b/main/snprintf.c
index 7a55034341..062ccc4eee 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
*/
/* char * ap_php_conv_10() {{{ */
char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register php_size_t *len)
+ register bool_int * is_negative, char *buf_end, register size_t *len)
{
register char *p = buf_end;
register u_wide_int magnitude;
@@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
*/
/* PHPAPI char * php_conv_fp() {{{ */
PHPAPI char * php_conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, php_size_t *len)
+ boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len)
{
register char *s = buf;
register char *p, *p_orig;
@@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num,
if (format != 'F') {
char temp[EXPONENT_LENGTH]; /* for exponent conversion */
- php_size_t t_len;
+ size_t t_len;
bool_int exponent_is_negative;
*s++ = format; /* either e or E */
@@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num,
* which is a pointer to the END of the buffer + 1 (i.e. if the buffer
* is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
*/
-char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register php_size_t *len) /* {{{ */
+char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register size_t *len) /* {{{ */
{
register int mask = (1 << nbits) - 1;
register char *p = buf_end;
@@ -584,10 +584,10 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
char *sp;
char *bep;
int cc = 0;
- php_size_t i;
+ size_t i;
char *s = NULL;
- php_size_t s_len;
+ size_t s_len;
int free_zcopy;
zval *zvp, zcopy;
@@ -793,7 +793,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
if (free_zcopy) {
zvp = &zcopy;
}
- s_len = Z_STRSIZE_P(zvp);
+ s_len = Z_STRLEN_P(zvp);
s = Z_STRVAL_P(zvp);
if (adjust_precision && precision < s_len) {
s_len = precision;
@@ -829,7 +829,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
break;
#endif
case LM_PHP_INT_T:
- i_num = (wide_int) va_arg(ap, php_uint_t);
+ i_num = (wide_int) va_arg(ap, zend_ulong);
break;
}
/*
@@ -874,7 +874,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
break;
#endif
case LM_PHP_INT_T:
- i_num = (wide_int) va_arg(ap, php_int_t);
+ i_num = (wide_int) va_arg(ap, zend_long);
break;
}
}
@@ -923,7 +923,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
break;
#endif
case LM_PHP_INT_T:
- ui_num = (u_wide_int) va_arg(ap, php_uint_t);
+ ui_num = (u_wide_int) va_arg(ap, zend_ulong);
break;
}
s = ap_php_conv_p2(ui_num, 3, *fmt, &num_buf[NUM_BUF_SIZE], &s_len);
@@ -965,7 +965,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
break;
#endif
case LM_PHP_INT_T:
- ui_num = (u_wide_int) va_arg(ap, php_uint_t);
+ ui_num = (u_wide_int) va_arg(ap, zend_ulong);
break;
}
s = ap_php_conv_p2(ui_num, 4, *fmt, &num_buf[NUM_BUF_SIZE], &s_len);
diff --git a/main/snprintf.h b/main/snprintf.h
index ae179cf6f5..d133ad7aaa 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -87,7 +87,7 @@ PHPAPI int ap_php_asprintf(char **buf, const char *format, ...);
PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf);
PHPAPI char * php_conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, php_size_t *len);
+ boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len);
END_EXTERN_C()
@@ -154,10 +154,10 @@ typedef WIDE_INT wide_int;
typedef unsigned WIDE_INT u_wide_int;
extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register php_size_t *len);
+ register bool_int * is_negative, char *buf_end, register size_t *len);
extern char * ap_php_conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register php_size_t *len);
+ char format, char *buf_end, register size_t *len);
/* The maximum precision that's allowed for float conversion. Does not include
* decimal separator, exponent, sign, terminator. Currently does not affect
diff --git a/main/spprintf.c b/main/spprintf.c
index 5c0310fd9d..cf730dd964 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -111,7 +111,7 @@
#define FLOAT_DIGITS 6
#define EXPONENT_LENGTH 10
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/php_smart_string.h"
/* {{{ macros */
@@ -198,7 +198,7 @@ static size_t strnlen(const char *s, size_t maxlen) {
static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt, va_list ap) /* {{{ */
{
char *s = NULL;
- php_size_t s_len;
+ size_t s_len;
int free_zcopy;
zval *zvp, zcopy;
@@ -407,7 +407,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
if (free_zcopy) {
zvp = &zcopy;
}
- s_len = Z_STRSIZE_P(zvp);
+ s_len = Z_STRLEN_P(zvp);
s = Z_STRVAL_P(zvp);
if (adjust_precision && precision < s_len) {
s_len = precision;
@@ -443,7 +443,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
break;
#endif
case LM_PHP_INT_T:
- i_num = (wide_int) va_arg(ap, php_uint_t);
+ i_num = (wide_int) va_arg(ap, zend_ulong);
break;
}
/*
@@ -488,7 +488,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
break;
#endif
case LM_PHP_INT_T:
- i_num = (wide_int) va_arg(ap, php_int_t);
+ i_num = (wide_int) va_arg(ap, zend_long);
break;
}
}
@@ -536,7 +536,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
break;
#endif
case LM_PHP_INT_T:
- ui_num = (u_wide_int) va_arg(ap, php_uint_t);
+ ui_num = (u_wide_int) va_arg(ap, zend_ulong);
break;
}
s = ap_php_conv_p2(ui_num, 3, *fmt,
@@ -579,7 +579,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
break;
#endif
case LM_PHP_INT_T:
- ui_num = (u_wide_int) va_arg(ap, php_uint_t);
+ ui_num = (u_wide_int) va_arg(ap, zend_ulong);
break;
}
s = ap_php_conv_p2(ui_num, 4, *fmt,
@@ -819,10 +819,10 @@ skip_output:
/*
* This is the general purpose conversion function.
*/
-PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */
+PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */
{
smart_string buf = {0};
- php_size_t result;
+ size_t result;
xbuf_format_converter(&buf, 1, format, ap);
@@ -844,9 +844,9 @@ PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_
}
/* }}} */
-PHPAPI php_size_t spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */
+PHPAPI size_t spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */
{
- php_size_t cc;
+ size_t cc;
va_list ap;
va_start(ap, format);
diff --git a/main/spprintf.h b/main/spprintf.h
index 612bcbf5db..1e7c034cfa 100644
--- a/main/spprintf.h
+++ b/main/spprintf.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -37,9 +37,9 @@ There is also snprintf: See difference explained in snprintf.h
#include "snprintf.h"
BEGIN_EXTERN_C()
-PHPAPI php_size_t spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+PHPAPI size_t spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
-PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);
+PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);
PHPAPI zend_string *vstrpprintf(size_t max_len, const char *format, va_list ap);
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 4780d46eea..3291a9ca8f 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -334,7 +334,7 @@ exit_success:
* will be accessing the stream. Emit a warning so that the end-user will
* know that they should try something else */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (php_int_t)(stream->writepos - stream->readpos));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_LONG_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos));
}
if (castas == PHP_STREAM_AS_STDIO && ret) {
diff --git a/main/streams/filter.c b/main/streams/filter.c
index a74802eb14..36585fa9bf 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c
index ceb60d5b07..e62fbfb662 100644
--- a/main/streams/glob_wrapper.c
+++ b/main/streams/glob_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -47,7 +47,7 @@ typedef struct {
size_t pattern_len;
} glob_s_t;
-PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
+PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC) /* {{{ */
{
glob_s_t *pglob = (glob_s_t *)stream->abstract;
@@ -69,7 +69,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen S
}
/* }}} */
-PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */
+PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC) /* {{{ */
{
glob_s_t *pglob = (glob_s_t *)stream->abstract;
diff --git a/main/streams/memory.c b/main/streams/memory.c
index 71e9005fa7..9788954988 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -741,7 +741,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
ZVAL_COPY_VALUE(&ts->meta, &meta);
}
if (base64_comma) {
- STR_FREE(base64_comma);
+ zend_string_free(base64_comma);
} else {
efree(comma);
}
diff --git a/main/streams/mmap.c b/main/streams/mmap.c
index a99c8994aa..8746959bbe 100644
--- a/main/streams/mmap.c
+++ b/main/streams/mmap.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index c0b70934c6..ac90a0ba3c 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index 31e73ff6e4..dfa4ae2937 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h
index d0322f7190..69b67d4c85 100644
--- a/main/streams/php_stream_glob_wrapper.h
+++ b/main/streams/php_stream_glob_wrapper.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,10 +23,10 @@ PHPAPI extern php_stream_ops php_glob_stream_ops;
BEGIN_EXTERN_C()
-PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC);
+PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC);
#define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC TSRMLS_CC)
-PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC);
+PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC TSRMLS_DC);
#define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC)
PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC);
diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
index 5d200d729a..a25c4ac6b9 100644
--- a/main/streams/php_stream_mmap.h
+++ b/main/streams/php_stream_mmap.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
index 4370867995..7d5278c620 100644
--- a/main/streams/php_stream_plain_wrapper.h
+++ b/main/streams/php_stream_plain_wrapper.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index a6797ed898..9674314c49 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -142,21 +142,21 @@ typedef struct _php_stream_xport_param {
struct {
char *name;
size_t namelen;
- int backlog;
struct timeval *timeout;
struct sockaddr *addr;
- socklen_t addrlen;
char *buf;
size_t buflen;
- long flags;
+ zend_long flags;
+ socklen_t addrlen;
+ int backlog;
} inputs;
struct {
php_stream *client;
- int returncode;
struct sockaddr *addr;
socklen_t addrlen;
zend_string *textaddr;
zend_string *error_text;
+ int returncode;
int error_code;
} outputs;
} php_stream_xport_param;
@@ -191,18 +191,18 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML
END_EXTERN_C()
typedef struct _php_stream_xport_crypto_param {
- enum {
- STREAM_XPORT_CRYPTO_OP_SETUP,
- STREAM_XPORT_CRYPTO_OP_ENABLE
- } op;
struct {
+ php_stream *session;
int activate;
php_stream_xport_crypt_method_t method;
- php_stream *session;
} inputs;
struct {
int returncode;
} outputs;
+ enum {
+ STREAM_XPORT_CRYPTO_OP_SETUP,
+ STREAM_XPORT_CRYPTO_OP_ENABLE
+ } op;
} php_stream_xport_crypto_param;
BEGIN_EXTERN_C()
diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
index 28985a5e1e..7a03690a8f 100644
--- a/main/streams/php_stream_userspace.h
+++ b/main/streams/php_stream_userspace.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index 489e18b26f..d8799fcefb 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index d9f058e3cc..28328c3cd5 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -138,7 +138,7 @@ typedef struct {
HANDLE file_mapping;
#endif
- php_stat_t sb;
+ zend_stat_t sb;
} php_stdio_stream_data;
#define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
@@ -149,7 +149,7 @@ static int do_fstat(php_stdio_stream_data *d, int force)
int r;
PHP_STDIOP_GET_FD(fd, d);
- r = php_fstat(fd, &d->sb);
+ r = zend_fstat(fd, &d->sb);
d->cached_fstat = r == 0;
return r;
@@ -348,6 +348,34 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
assert(data != NULL);
if (data->fd >= 0) {
+#ifdef PHP_WIN32
+ php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
+
+ if (self->is_pipe || self->is_process_pipe) {
+ HANDLE ph = (HANDLE)_get_osfhandle(data->fd);
+ int retry = 0;
+ DWORD avail_read = 0;
+
+ do {
+ /* Look ahead to get the available data amount to read. Do the same
+ as read() does, however not blocking forever. In case it failed,
+ no data will be read (better than block). */
+ if (!PeekNamedPipe(ph, NULL, 0, NULL, &avail_read, NULL)) {
+ break;
+ }
+ /* If there's nothing to read, wait in 100ms periods. */
+ if (0 == avail_read) {
+ usleep(100000);
+ }
+ } while (0 == avail_read && retry++ < 320);
+
+ /* Reduce the required data amount to what is available, otherwise read()
+ will block.*/
+ if (avail_read < count) {
+ count = avail_read;
+ }
+ }
+#endif
ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count));
if (ret == (size_t)-1 && errno == EINTR) {
@@ -1102,7 +1130,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
#ifndef PHP_WIN32
# ifdef EXDEV
if (errno == EXDEV) {
- php_stat_t sb;
+ zend_stat_t sb;
if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) {
if (VCWD_STAT(url_from, &sb) == 0) {
# if !defined(TSRM_WIN32) && !defined(NETWARE)
@@ -1165,7 +1193,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
} else {
/* we look for directory separator from the end of string, thus hopefuly reducing our work load */
char *e;
- php_stat_t sb;
+ zend_stat_t sb;
int dir_len = strlen(dir);
int offset = 0;
char buf[MAXPATHLEN];
@@ -1336,7 +1364,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
break;
#endif
case PHP_STREAM_META_ACCESS:
- mode = (mode_t)*(long *)value;
+ mode = (mode_t)*(zend_long *)value;
ret = VCWD_CHMOD(url, mode);
break;
default:
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 1a6c4d24a0..6be2b91dc7 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1101,7 +1101,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con
}
}
- ret_buf = STR_ALLOC(tent_ret_len, 0);
+ ret_buf = zend_string_alloc(tent_ret_len, 0);
/* php_stream_read will not call ops->read here because the necessary
* data is guaranteedly buffered */
ret_buf->len = php_stream_read(stream, ret_buf->val, tent_ret_len);
@@ -1445,7 +1445,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int
}
if (maxlen > 0) {
- result = STR_ALLOC(maxlen, persistent);
+ result = zend_string_alloc(maxlen, persistent);
ptr = result->val;
while ((len < maxlen) && !php_stream_eof(src)) {
ret = php_stream_read(src, ptr, maxlen - len);
@@ -1459,7 +1459,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int
*ptr = '\0';
result->len = len;
} else {
- STR_FREE(result);
+ zend_string_free(result);
result = NULL;
}
return result;
@@ -1477,13 +1477,13 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int
max_len = step;
}
- result = STR_ALLOC(max_len, persistent);
+ result = zend_string_alloc(max_len, persistent);
ptr = result->val;
while ((ret = php_stream_read(src, ptr, max_len - len))) {
len += ret;
if (len + min_room >= max_len) {
- result = STR_REALLOC(result, max_len + step, persistent);
+ result = zend_string_realloc(result, max_len + step, persistent);
max_len += step;
ptr = result->val + len;
} else {
@@ -1491,10 +1491,10 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int
}
}
if (len) {
- result = STR_REALLOC(result, len, persistent);
+ result = zend_string_realloc(result, len, persistent);
result->val[len] = '\0';
} else {
- STR_FREE(result);
+ zend_string_free(result);
result = NULL;
}
@@ -2310,7 +2310,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in
vector = (zend_string **) safe_erealloc(vector, vector_size, sizeof(char *), 0);
}
- vector[nfiles] = STR_INIT(sdp.d_name, strlen(sdp.d_name), 0);
+ vector[nfiles] = zend_string_init(sdp.d_name, strlen(sdp.d_name), 0);
nfiles++;
if(vector_size < 10 || nfiles == 0) {
diff --git a/main/streams/transports.c b/main/streams/transports.c
index 7f1d13faaa..a75f77c5bd 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC)
#define ERR_RETURN(out_err, local_err, fmt) \
if (out_err) { *out_err = local_err; } \
else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \
- if (local_err) { STR_RELEASE(local_err); local_err = NULL; } \
+ if (local_err) { zend_string_release(local_err); local_err = NULL; } \
}
PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options,
@@ -163,8 +163,8 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
if (PHP_STREAM_CONTEXT(stream) && (zbacklog = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "backlog")) != NULL) {
zval *ztmp = zbacklog;
- convert_to_int_ex(ztmp);
- backlog = Z_IVAL_P(ztmp);
+ convert_to_long_ex(ztmp);
+ backlog = Z_LVAL_P(ztmp);
if (ztmp != zbacklog) {
zval_ptr_dtor(ztmp);
}
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 82ff445c4f..1ff80cdfa6 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -86,35 +86,35 @@ PHP_MINIT_FUNCTION(user_streams)
if (le_protocols == FAILURE)
return FAILURE;
- REGISTER_INT_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT);
return SUCCESS;
}
@@ -367,7 +367,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
/* call it's stream_open method - set up params first */
ZVAL_STRING(&args[0], filename);
ZVAL_STRING(&args[1], mode);
- ZVAL_INT(&args[2], options);
+ ZVAL_LONG(&args[2], options);
ZVAL_NEW_REF(&args[3], &EG(uninitialized_zval));
ZVAL_STRING(&zfuncname, USERSTREAM_OPEN);
@@ -385,7 +385,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
/* if the opened path is set, copy it out */
if (Z_ISREF(args[3]) && Z_TYPE_P(Z_REFVAL(args[3])) == IS_STRING && opened_path) {
- *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRSIZE_P(Z_REFVAL(args[3])));
+ *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRLEN_P(Z_REFVAL(args[3])));
}
/* set wrapper data to be a reference to our object */
@@ -443,7 +443,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char
/* call it's dir_open method - set up params first */
ZVAL_STRING(&args[0], filename);
- ZVAL_INT(&args[1], options);
+ ZVAL_LONG(&args[1], options);
ZVAL_STRING(&zfuncname, USERSTREAM_DIR_OPEN);
@@ -490,7 +490,7 @@ PHP_FUNCTION(stream_wrapper_register)
zend_string *protocol, *classname;
struct php_user_stream_wrapper * uwrap;
zend_resource *rsrc;
- php_int_t flags = 0;
+ zend_long flags = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &classname, &flags) == FAILURE) {
RETURN_FALSE;
@@ -531,7 +531,7 @@ PHP_FUNCTION(stream_wrapper_register)
PHP_FUNCTION(stream_wrapper_unregister)
{
char *protocol;
- int protocol_len;
+ size_t protocol_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) {
RETURN_FALSE;
@@ -608,8 +608,8 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
didwrite = 0;
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- convert_to_int(&retval);
- didwrite = Z_IVAL(retval);
+ convert_to_long(&retval);
+ didwrite = Z_LVAL(retval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!",
us->wrapper->classname);
@@ -617,9 +617,9 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
/* don't allow strange buffer overruns due to bogus return */
if (didwrite > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " written, " ZEND_INT_FMT " max)",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " written, " ZEND_LONG_FMT " max)",
us->wrapper->classname,
- (php_int_t)(didwrite - count), (php_int_t)didwrite, (php_int_t)count);
+ (zend_long)(didwrite - count), (zend_long)didwrite, (zend_long)count);
didwrite = count;
}
@@ -641,7 +641,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1);
- ZVAL_INT(&args[0], count);
+ ZVAL_LONG(&args[0], count);
call_result = call_user_function_ex(NULL,
Z_ISUNDEF(us->object)? NULL : &us->object,
@@ -652,10 +652,10 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
convert_to_string(&retval);
- didread = Z_STRSIZE(retval);
+ didread = Z_STRLEN(retval);
if (didread > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " read, " ZEND_INT_FMT " max) - excess data will be lost",
- us->wrapper->classname, (php_int_t)(didread - count), (php_int_t)didread, (php_int_t)count);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " read, " ZEND_LONG_FMT " max) - excess data will be lost",
+ us->wrapper->classname, (zend_long)(didread - count), (zend_long)didread, (zend_long)count);
didread = count;
}
if (didread > 0)
@@ -751,7 +751,7 @@ static int php_userstreamop_flush(php_stream *stream TSRMLS_DC)
return call_result;
}
-static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
+static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
{
zval func_name;
zval retval;
@@ -763,8 +763,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o
ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1);
- ZVAL_INT(&args[0], offset);
- ZVAL_INT(&args[1], whence);
+ ZVAL_LONG(&args[0], offset);
+ ZVAL_LONG(&args[1], whence);
call_result = call_user_function_ex(NULL,
Z_ISUNDEF(us->object)? NULL : &us->object,
@@ -807,8 +807,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && Z_TYPE(retval) == IS_INT) {
- *newoffs = Z_IVAL(retval);
+ if (call_result == SUCCESS && Z_TYPE(retval) == IS_LONG) {
+ *newoffs = Z_LVAL(retval);
ret = 0;
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname);
@@ -831,8 +831,8 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC)
#define STAT_PROP_ENTRY_EX(name, name2) \
if (NULL != (elem = zend_hash_str_find(Z_ARRVAL_P(array), #name, sizeof(#name)-1))) { \
SEPARATE_ZVAL(elem); \
- convert_to_int(elem); \
- ssb->sb.st_##name2 = Z_IVAL_P(elem); \
+ convert_to_long(elem); \
+ ssb->sb.st_##name2 = Z_LVAL_P(elem); \
}
#define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name)
@@ -927,20 +927,20 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
break;
case PHP_STREAM_OPTION_LOCKING:
- ZVAL_INT(&args[0], 0);
+ ZVAL_LONG(&args[0], 0);
if (value & LOCK_NB) {
- Z_IVAL_P(&args[0]) |= PHP_LOCK_NB;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_NB;
}
switch(value & ~LOCK_NB) {
case LOCK_SH:
- Z_IVAL_P(&args[0]) |= PHP_LOCK_SH;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_SH;
break;
case LOCK_EX:
- Z_IVAL_P(&args[0]) |= PHP_LOCK_EX;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_EX;
break;
case LOCK_UN:
- Z_IVAL_P(&args[0]) |= PHP_LOCK_UN;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_UN;
break;
}
@@ -987,7 +987,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
case PHP_STREAM_TRUNCATE_SET_SIZE: {
ptrdiff_t new_size = *(ptrdiff_t*) ptrparam;
if (new_size >= 0 && new_size <= (ptrdiff_t)LONG_MAX) {
- ZVAL_INT(&args[0], (long)new_size);
+ ZVAL_LONG(&args[0], (zend_long)new_size);
call_result = call_user_function_ex(NULL,
Z_ISUNDEF(us->object)? NULL : &us->object,
&func_name,
@@ -1025,28 +1025,28 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1);
- ZVAL_INT(&args[0], option);
+ ZVAL_LONG(&args[0], option);
ZVAL_NULL(&args[1]);
ZVAL_NULL(&args[2]);
switch(option) {
case PHP_STREAM_OPTION_READ_BUFFER:
case PHP_STREAM_OPTION_WRITE_BUFFER:
- ZVAL_INT(&args[1], value);
+ ZVAL_LONG(&args[1], value);
if (ptrparam) {
- ZVAL_INT(&args[2], *(long *)ptrparam);
+ ZVAL_LONG(&args[2], *(long *)ptrparam);
} else {
- ZVAL_INT(&args[2], BUFSIZ);
+ ZVAL_LONG(&args[2], BUFSIZ);
}
break;
case PHP_STREAM_OPTION_READ_TIMEOUT: {
struct timeval tv = *(struct timeval*)ptrparam;
- ZVAL_INT(&args[1], tv.tv_sec);
- ZVAL_INT(&args[2], tv.tv_usec);
+ ZVAL_LONG(&args[1], tv.tv_sec);
+ ZVAL_LONG(&args[2], tv.tv_usec);
break;
}
case PHP_STREAM_OPTION_BLOCKING:
- ZVAL_INT(&args[1], value);
+ ZVAL_LONG(&args[1], value);
break;
default:
break;
@@ -1189,8 +1189,8 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int
/* call the mkdir method */
ZVAL_STRING(&args[0], url);
- ZVAL_INT(&args[1], mode);
- ZVAL_INT(&args[2], options);
+ ZVAL_LONG(&args[1], mode);
+ ZVAL_LONG(&args[2], options);
ZVAL_STRING(&zfuncname, USERSTREAM_MKDIR);
@@ -1237,7 +1237,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url,
/* call the rmdir method */
ZVAL_STRING(&args[0], url);
- ZVAL_INT(&args[1], options);
+ ZVAL_LONG(&args[1], options);
ZVAL_STRING(&zfuncname, USERSTREAM_RMDIR);
@@ -1280,14 +1280,14 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
array_init(&args[2]);
if(value) {
struct utimbuf *newtime = (struct utimbuf *)value;
- add_index_int(&args[2], 0, newtime->modtime);
- add_index_int(&args[2], 1, newtime->actime);
+ add_index_long(&args[2], 0, newtime->modtime);
+ add_index_long(&args[2], 1, newtime->actime);
}
break;
case PHP_STREAM_META_GROUP:
case PHP_STREAM_META_OWNER:
case PHP_STREAM_META_ACCESS:
- ZVAL_INT(&args[2], *(long *)value);
+ ZVAL_LONG(&args[2], *(long *)value);
break;
case PHP_STREAM_META_GROUP_NAME:
case PHP_STREAM_META_OWNER_NAME:
@@ -1308,7 +1308,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
/* call the mkdir method */
ZVAL_STRING(&args[0], url);
- ZVAL_INT(&args[1], option);
+ ZVAL_LONG(&args[1], option);
ZVAL_STRING(&zfuncname, USERSTREAM_METADATA);
@@ -1356,7 +1356,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i
/* call it's stat_url method - set up params first */
ZVAL_STRING(&args[0], url);
- ZVAL_INT(&args[1], flags);
+ ZVAL_LONG(&args[1], flags);
ZVAL_STRING(&zfuncname, USERSTREAM_STATURL);
@@ -1414,7 +1414,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou
if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) {
convert_to_string(&retval);
- PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRSIZE(retval));
+ PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval));
didread = sizeof(php_stream_dirent);
} else if (call_result == FAILURE) {
@@ -1454,7 +1454,7 @@ static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS
return 0;
}
-static int php_userstreamop_rewinddir(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
+static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
{
zval func_name;
zval retval;
@@ -1489,10 +1489,10 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T
switch(castas) {
case PHP_STREAM_AS_FD_FOR_SELECT:
- ZVAL_INT(&args[0], PHP_STREAM_AS_FD_FOR_SELECT);
+ ZVAL_LONG(&args[0], PHP_STREAM_AS_FD_FOR_SELECT);
break;
default:
- ZVAL_INT(&args[0], PHP_STREAM_AS_STDIO);
+ ZVAL_LONG(&args[0], PHP_STREAM_AS_STDIO);
break;
}
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index d2aaef0bc3..bce6a09fb0 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -102,8 +102,8 @@ retry:
} while (err == EINTR);
}
estr = php_socket_strerror(err, NULL, 0);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_INT_FMT " bytes failed with errno=%ld %s",
- (php_int_t)count, err, estr);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%ld %s",
+ (zend_long)count, err, estr);
efree(estr);
}
@@ -237,7 +237,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC
#if ZEND_WIN32
return 0;
#else
- return php_fstat(sock->socket, &ssb->sb);
+ return zend_fstat(sock->socket, &ssb->sb);
#endif
}
@@ -702,7 +702,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_
efree(host);
return -1;
}
- bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
+ bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
}
#ifdef SO_BROADCAST
diff --git a/main/strlcat.c b/main/strlcat.c
index b7aa06e8a2..65811e90c2 100644
--- a/main/strlcat.c
+++ b/main/strlcat.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/strlcpy.c b/main/strlcpy.c
index 7738238bd5..737036c4a1 100644
--- a/main/strlcpy.c
+++ b/main/strlcpy.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/win32_internal_function_disabled.h b/main/win32_internal_function_disabled.h
index 7365262772..a412305ea3 100644
--- a/main/win32_internal_function_disabled.h
+++ b/main/win32_internal_function_disabled.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/main/win95nt.h b/main/win95nt.h
index ce2b002f38..76bec05ea5 100644
--- a/main/win95nt.h
+++ b/main/win95nt.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/makerpm b/makerpm
index 07bd372df4..4a33758a0a 100644
--- a/makerpm
+++ b/makerpm
@@ -37,8 +37,8 @@ sed -e "s/PVERSION/$VERSION/g" \
-e "s/TARDIR/$TARDIR/g" \
-e "s/PREQUIRES/$PREQUIRES/g" \
> $SPEC <<'EOF'
-Summary: PHP 5 - A powerful scripting language
-Name: php5
+Summary: PHP 7 - A powerful scripting language
+Name: php7
Version: PVERSION
Release: PRELEASE
Group: Networking/Daemons
@@ -48,7 +48,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Requires: PREQUIRES
%description
-PHP 5 is a powerful apache module that adds scripting and database connection
+PHP 7 is a powerful apache module that adds scripting and database connection
capabilities to the apache server. This version includes the "php_cgi" binary
for suExec and stand alone php scripts too.
@@ -103,7 +103,7 @@ mv php.keepme sapi/cgi/php
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_libdir}/apache
-install -m 0755 .libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/apache
+install -m 0755 .libs/libphp7.so $RPM_BUILD_ROOT%{_libdir}/apache
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 0755 sapi/cli/php $RPM_BUILD_ROOT%{_bindir}
install -m 0755 sapi/cgi/php $RPM_BUILD_ROOT%{_bindir}/php_cgi
@@ -168,7 +168,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
-%{_libdir}/apache/libphp5.so
+%{_libdir}/apache/libphp7.so
%{_bindir}/php
%{_bindir}/php_cgi
%{_mandir}/man1/php.1*
diff --git a/netware/start.c b/netware/start.c
index e0569b1b89..d2445bbda0 100644
--- a/netware/start.c
+++ b/netware/start.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/php.ini-development b/php.ini-development
index 562816fc44..61519f05aa 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -201,10 +201,6 @@ engine = On
; http://php.net/short-open-tag
short_open_tag = Off
-; Allow ASP-style <% %> tags.
-; http://php.net/asp-tags
-asp_tags = Off
-
; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
precision = 14
@@ -867,8 +863,8 @@ default_socket_timeout = 60
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
-; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
-; extension folders as well as the separate PECL DLL download (PHP 5).
+; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5+)
+; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
@@ -1758,7 +1754,7 @@ mssql.secure_connection = Off
;mbstring.encoding_translation = Off
; automatic encoding detection order.
-; "auto" detect order is changed accoding to mbstring.language
+; "auto" detect order is changed according to mbstring.language
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto
diff --git a/php.ini-production b/php.ini-production
index 34f91fe293..a455b825b5 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -201,10 +201,6 @@ engine = On
; http://php.net/short-open-tag
short_open_tag = Off
-; Allow ASP-style <% %> tags.
-; http://php.net/asp-tags
-asp_tags = Off
-
; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
precision = 14
@@ -865,8 +861,8 @@ default_socket_timeout = 60
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
-; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
-; extension folders as well as the separate PECL DLL download (PHP 5).
+; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5+)
+; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
@@ -1756,7 +1752,7 @@ mssql.secure_connection = Off
;mbstring.encoding_translation = Off
; automatic encoding detection order.
-; "auto" detect order is changed accoding to mbstring.language
+; "auto" detect order is changed according to mbstring.language
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto
diff --git a/php5.spec.in b/php7.spec.in
index 97a84b5fb2..97a84b5fb2 100644
--- a/php5.spec.in
+++ b/php7.spec.in
diff --git a/run-tests.php b/run-tests.php
index 1b5bcec253..4f29345d9f 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2,7 +2,7 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
@@ -594,6 +594,9 @@ if (isset($argc) && $argc > 1) {
}
$pass_option_n = true;
break;
+ case 'e':
+ $pass_options .= ' -e';
+ break;
case '--no-clean':
$no_clean = true;
break;
@@ -1189,6 +1192,7 @@ function run_test($php, $file, $env)
global $no_clean;
global $valgrind_version;
global $JUNIT;
+ global $SHOW_ONLY_GROUPS;
$temp_filenames = null;
$org_file = $file;
@@ -1363,7 +1367,9 @@ TEST $file
}
}
- show_test($test_idx, $shortname);
+ if (!$SHOW_ONLY_GROUPS) {
+ show_test($test_idx, $shortname);
+ }
if (is_array($IN_REDIRECT)) {
$temp_dir = $test_dir = $IN_REDIRECT['dir'];
@@ -2569,7 +2575,7 @@ function show_result($result, $tested, $tested_file, $extra = '', $temp_filename
if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
echo "$result $tested [$tested_file] $extra\n";
- } else {
+ } else if (!$SHOW_ONLY_GROUPS) {
// Write over the last line to avoid random trailing chars on next echo
echo str_repeat(" ", $line_length), "\r";
}
diff --git a/sapi/aolserver/README b/sapi/aolserver/README
index 80c186ea5d..86af6a54b3 100644
--- a/sapi/aolserver/README
+++ b/sapi/aolserver/README
@@ -60,7 +60,7 @@ Then enable the PHP module:
ns_section "ns/server/${servername}/modules"
...
-ns_param php ${bindir}/libphp5.so
+ns_param php ${bindir}/libphp7.so
=============================================================================
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
index 13091b908a..2796dd23a5 100644
--- a/sapi/aolserver/aolserver.c
+++ b/sapi/aolserver/aolserver.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/aolserver/php5aolserver.dsp b/sapi/aolserver/php5aolserver.dsp
deleted file mode 100644
index dd6ad71c53..0000000000
--- a/sapi/aolserver/php5aolserver.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5aolserver" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5aolserver - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5aolserver.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5aolserver.mak" CFG="php5aolserver - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5aolserver - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5aolserver - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5aolserver - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5aolserver - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "PHP5AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS/php5aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5aolserver - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "PHPAOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS_inline/php5aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5aolserver - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5AOLSERVER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP5AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 nsd.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php5aolserver.so" /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5aolserver - Win32 Release_TS"
-# Name "php5aolserver - Win32 Release_TS_inline"
-# Name "php5aolserver - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\aolserver.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/apMakefile.tmpl b/sapi/apache/apMakefile.tmpl
index 5f77d9c9c9..c8b174775e 100644
--- a/sapi/apache/apMakefile.tmpl
+++ b/sapi/apache/apMakefile.tmpl
@@ -1,38 +1,38 @@
##
-## Apache 1.3 Makefile template for PHP 5.0 Module
-## [src/modules/php5/Makefile.tmpl]
+## Apache 1.3 Makefile template for PHP 7.0 Module
+## [src/modules/php7/Makefile.tmpl]
##
# the parametrized target
-LIB=libphp5.$(LIBEXT)
+LIB=libphp7.$(LIBEXT)
# objects for building the static library
-OBJS=mod_php5.o
-OBJS_LIB=libmodphp5.a
+OBJS=mod_php7.o
+OBJS_LIB=libmodphp7.a
# objects for building the shared object library
-SHLIB_OBJS=mod_php5.so-o
-SHLIB_OBJS_LIB=libmodphp5.a
+SHLIB_OBJS=mod_php7.so-o
+SHLIB_OBJS_LIB=libmodphp7.a
# the general targets
all: lib
lib: $(LIB)
# build the static library by merging the object files
-libphp5.a: $(OBJS) $(OBJS_LIB)
+libphp7.a: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp5.: $(OBJS) $(OBJS_LIB)
+libphp7.: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
- cp libphp5. libphp5.a
+ cp libphp7. libphp7.a
# build the shared object library by linking the object files
-libphp5.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
+libphp7.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
rm -f $@
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
@@ -69,9 +69,9 @@ depend:
$(OBJS): Makefile
# DO NOT REMOVE
-mod_php5.o: mod_php5.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
+mod_php7.o: mod_php7.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
$(INCDIR)/buff.h \
$(INCDIR)/http_config.h \
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php5.h
+ $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php7.h
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index 7b0ee562eb..f5bfde4d68 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -78,7 +78,7 @@ if test "$PHP_APXS" != "no"; then
*darwin*)
MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
PHP_SUBST(MH_BUNDLE_FLAGS)
- SAPI_SHARED=libs/libphp5.so
+ SAPI_SHARED=libs/libphp7.so
build_type=bundle
;;
*)
@@ -86,26 +86,26 @@ if test "$PHP_APXS" != "no"; then
;;
esac
- PHP_SELECT_SAPI(apache, $build_type, sapi_apache.c mod_php5.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
+ PHP_SELECT_SAPI(apache, $build_type, sapi_apache.c mod_php7.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
# Test whether apxs support -S option
$APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
if test "$?" != "0"; then
- APACHE_INSTALL="$APXS -i -a -n php5 $SAPI_SHARED" # Old apxs does not have -S option
+ APACHE_INSTALL="$APXS -i -a -n php7 $SAPI_SHARED" # Old apxs does not have -S option
else
APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
if test -z `$APXS -q SYSCONFDIR`; then
APACHE_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5 $SAPI_SHARED"
+ -i -n php7 $SAPI_SHARED"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
APACHE_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5 $SAPI_SHARED"
+ -i -a -n php7 $SAPI_SHARED"
fi
fi
@@ -135,7 +135,7 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
PHP_APACHE=/usr/local/apache
fi
- APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php5.* sapi/apache/libphp5.module"
+ APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php7.* sapi/apache/libphp7.module"
AC_DEFINE(HAVE_APACHE,1,[ ])
APACHE_MODULE=yes
@@ -144,7 +144,7 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
if test -f $PHP_APACHE/src/httpd.h; then
APACHE_INCLUDE=-I$PHP_APACHE/src
APACHE_TARGET=$PHP_APACHE/src
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
PHP_LIBS="-L. -lphp3"
AC_MSG_RESULT([yes - Apache 1.2.x])
@@ -159,13 +159,13 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
elif test -f $PHP_APACHE/src/main/httpd.h; then
APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$PHP_APACHE/src/main -I$PHP_APACHE/src/os/unix -I$PHP_APACHE/src/ap"
- APACHE_TARGET=$PHP_APACHE/src/modules/php5
+ APACHE_TARGET=$PHP_APACHE/src/modules/php7
if test ! -d $APACHE_TARGET; then
mkdir $APACHE_TARGET
fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
AC_MSG_RESULT([yes - Apache 1.3.x])
STRONGHOLD=
if test -f $PHP_APACHE/src/include/ap_config.h; then
@@ -183,13 +183,13 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
elif test -f $PHP_APACHE/src/include/httpd.h; then
APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$PHP_APACHE/src/include -I$PHP_APACHE/src/os/unix"
- APACHE_TARGET=$PHP_APACHE/src/modules/php5
+ APACHE_TARGET=$PHP_APACHE/src/modules/php7
if test ! -d $APACHE_TARGET; then
mkdir $APACHE_TARGET
fi
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
AC_MSG_RESULT([yes - Apache 1.3.x])
STRONGHOLD=
if test -f $PHP_APACHE/src/include/ap_config.h; then
@@ -207,9 +207,9 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_APACHE" != "no"; then
elif test -f $PHP_APACHE/apache/httpd.h; then
APACHE_INCLUDE="-I$PHP_APACHE/apache -I$PHP_APACHE/ssl/include"
APACHE_TARGET=$PHP_APACHE/apache
- PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
+ PHP_SELECT_SAPI(apache, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
+ APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
STRONGHOLD=-DSTRONGHOLD=1
AC_MSG_RESULT([yes - StrongHold])
if test -f $PHP_APACHE/apache/ap_config.h; then
@@ -247,13 +247,13 @@ dnl Build as static module
if test "$APACHE_MODULE" = "yes"; then
PHP_TARGET_RDYNAMIC
$php_shtool mkdir -p sapi/apache
- PHP_OUTPUT(sapi/apache/libphp5.module)
+ PHP_OUTPUT(sapi/apache/libphp7.module)
fi
dnl General
if test -n "$APACHE_INSTALL"; then
if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP=-bE:sapi/apache/mod_php5.exp
+ APXS_EXP=-bE:sapi/apache/mod_php7.exp
fi
PHP_APACHE_FD_CHECK
diff --git a/sapi/apache/config.w32 b/sapi/apache/config.w32
index e876d7500e..e5b72f1bcf 100644
--- a/sapi/apache/config.w32
+++ b/sapi/apache/config.w32
@@ -15,9 +15,9 @@ if (PHP_APACHE != "no") {
";" + PHP_PHP_BUILD + "\\apache\\src\\corer")) {
// We need to play tricks to get our readdir.h used by apache
// headers
- SAPI('apache', 'mod_php5.c sapi_apache.c php_apache.c',
+ SAPI('apache', 'mod_php7.c sapi_apache.c php_apache.c',
'php' + PHP_VERSION + 'apache.dll',
- '/D APACHEPHP5_EXPORTS /D APACHE_READDIR_H /I win32');
+ '/D APACHEPHP7_EXPORTS /D APACHE_READDIR_H /I win32');
} else {
WARNING("Could not find apache libraries/headers");
}
diff --git a/sapi/apache/libphp5.module.in b/sapi/apache/libphp7.module.in
index 00d9c49f40..892df4d5cc 100644
--- a/sapi/apache/libphp5.module.in
+++ b/sapi/apache/libphp7.module.in
@@ -1,4 +1,4 @@
-Name: php5_module
+Name: php7_module
ConfigStart
RULE_WANTHSREGEX=no
RULE_HIDE=yes
diff --git a/sapi/apache/libpre.c b/sapi/apache/libpre.c
index ca10e34cdd..f7ab68b62c 100644
--- a/sapi/apache/libpre.c
+++ b/sapi/apache/libpre.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/apache/mod_php5.exp b/sapi/apache/mod_php5.exp
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache/mod_php5.exp
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php7.c
index a78b8dc913..687586952f 100644
--- a/sapi/apache/mod_php5.c
+++ b/sapi/apache/mod_php7.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -60,12 +60,12 @@ static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *con
static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-/* ### these should be defined in mod_php5.h or somewhere else */
+/* ### these should be defined in mod_php7.h or somewhere else */
#define USE_PATH 1
#define IGNORE_URL 2
#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST POSSIBLE STATUS DESCRIPTION")
-module MODULE_VAR_EXPORT php5_module;
+module MODULE_VAR_EXPORT php7_module;
int saved_umask;
static unsigned char apache_php_initialized;
@@ -567,7 +567,7 @@ static void init_request_info(TSRMLS_D)
static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC)
{
zend_string *key = STR_INIT(per_dir_entry->key, per_dir_entry->key_length, 0);
- zend_alter_ini_entry(key, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, per_dir_entry->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE);
+ zend_alter_ini_entry_chars(key, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, per_dir_entry->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE);
STR_RELEASE(key);
return 0;
}
@@ -622,7 +622,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename)
return DECLINED;
}
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php5_module);
+ per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php7_module);
if (per_dir_conf) {
zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
}
@@ -909,7 +909,7 @@ static int php_xbithack_handler(request_rec * r)
if (!(r->finfo.st_mode & S_IXUSR)) {
return DECLINED;
}
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php5_module);
+ per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php7_module);
if (per_dir_conf) {
zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
}
@@ -1006,9 +1006,9 @@ command_rec php_commands[] =
};
/* }}} */
-/* {{{ odule MODULE_VAR_EXPORT php5_module
+/* {{{ odule MODULE_VAR_EXPORT php7_module
*/
-module MODULE_VAR_EXPORT php5_module =
+module MODULE_VAR_EXPORT php7_module =
{
STANDARD_MODULE_STUFF,
php_init_handler, /* initializer */
diff --git a/sapi/apache/mod_php7.exp b/sapi/apache/mod_php7.exp
new file mode 100644
index 0000000000..1469b0314d
--- /dev/null
+++ b/sapi/apache/mod_php7.exp
@@ -0,0 +1 @@
+php7_module
diff --git a/sapi/apache/mod_php5.h b/sapi/apache/mod_php7.h
index 3bc7857380..947d8b44d4 100644
--- a/sapi/apache/mod_php5.h
+++ b/sapi/apache/mod_php7.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -17,8 +17,8 @@
*/
/* $Id$ */
-#ifndef MOD_PHP5_H
-#define MOD_PHP5_H
+#ifndef MOD_PHP7_H
+#define MOD_PHP7_H
#if !defined(WIN32) && !defined(WINNT)
#ifndef MODULE_VAR_EXPORT
@@ -50,7 +50,7 @@ extern php_apache_info_struct php_apache_info;
# define MODULE_VAR_EXPORT PHPAPI
#endif
-#endif /* MOD_PHP5_H */
+#endif /* MOD_PHP7_H */
/*
* Local variables:
diff --git a/sapi/apache/php.sym b/sapi/apache/php.sym
index 9ad0f0a0ad..1469b0314d 100644
--- a/sapi/apache/php.sym
+++ b/sapi/apache/php.sym
@@ -1 +1 @@
-php5_module
+php7_module
diff --git a/sapi/apache/php5apache.dsp b/sapi/apache/php5apache.dsp
deleted file mode 100644
index fbdb7612b8..0000000000
--- a/sapi/apache/php5apache.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5apache" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5apache - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache.mak" CFG="php5apache - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5apache - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5apache - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ELSEIF "$(CFG)" == "php5apache - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\release" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ELSEIF "$(CFG)" == "php5apache - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" /libpath:"C:\Program Files\Apache Group\Apache\libexec"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5apache - Win32 Release_TS"
-# Name "php5apache - Win32 Debug_TS"
-# Name "php5apache - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_php5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mod_php5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache_http.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
index 3a88a1210e..f6e9e61203 100644
--- a/sapi/apache/php_apache.c
+++ b/sapi/apache/php_apache.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h
index a18e5dbac2..ed586372d7 100644
--- a/sapi/apache/php_apache_http.h
+++ b/sapi/apache/php_apache_http.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -67,4 +67,4 @@
#include "php_ini.h"
#include "ext/standard/php_standard.h"
-#include "mod_php5.h"
+#include "mod_php7.h"
diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c
index f19586da1f..466cf6b8ff 100644
--- a/sapi/apache/sapi_apache.c
+++ b/sapi/apache/sapi_apache.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
index 6de4b3ab36..f87a04bbd1 100644
--- a/sapi/apache2filter/apache_config.c
+++ b/sapi/apache2filter/apache_config.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4
index b6524fd874..11cc051015 100644
--- a/sapi/apache2filter/config.m4
+++ b/sapi/apache2filter/config.m4
@@ -71,14 +71,14 @@ if test "$PHP_APXS2FILTER" != "no"; then
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5"
+ -i -n php7"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5"
+ -i -a -n php7"
fi
case $host_alias in
@@ -101,7 +101,7 @@ if test "$PHP_APXS2FILTER" != "no"; then
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp5.so
+ SAPI_SHARED=libs/libphp7.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
*beos*)
diff --git a/sapi/apache2filter/php.sym b/sapi/apache2filter/php.sym
index 9ad0f0a0ad..1469b0314d 100644
--- a/sapi/apache2filter/php.sym
+++ b/sapi/apache2filter/php.sym
@@ -1 +1 @@
-php5_module
+php7_module
diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h
index 8410414dc0..7918cf6de8 100644
--- a/sapi/apache2filter/php_apache.h
+++ b/sapi/apache2filter/php_apache.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,7 +26,7 @@
#include "http_core.h"
/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php5_module;
+extern module AP_MODULE_DECLARE_DATA php7_module;
/* A way to specify the location of the php.ini dir in an apache directive */
extern char *apache2_php_ini_path_override;
diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c
index 3a0b3ee0b9..ea137384f2 100644
--- a/sapi/apache2filter/php_functions.c
+++ b/sapi/apache2filter/php_functions.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -22,7 +22,7 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/info.h"
#include "SAPI.h"
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
index 4fd45041ba..389686124d 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,7 +30,7 @@
#include "php_variables.h"
#include "SAPI.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#ifndef NETWARE
#include "ext/standard/php_standard.h"
#else
@@ -456,7 +456,7 @@ static void php_apache_request_dtor(ap_filter_t *f TSRMLS_DC)
static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
{
php_struct *ctx;
- void *conf = ap_get_module_config(f->r->per_dir_config, &php5_module);
+ void *conf = ap_get_module_config(f->r->per_dir_config, &php7_module);
char *p = get_php_config(conf, "engine", sizeof("engine"));
zend_file_handle zfd;
php_apr_bucket_brigade *pbb;
@@ -740,7 +740,7 @@ static size_t php_apache_fsizer_stream(void *handle TSRMLS_DC)
return 0;
}
-AP_MODULE_DECLARE_DATA module php5_module = {
+AP_MODULE_DECLARE_DATA module php7_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
merge_php_config, /* merge per-directory config structures */
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index 5302afcf18..9eed8dba0f 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -192,7 +192,7 @@ void apply_config(void *dummy)
ZEND_HASH_FOREACH_STR_KEY_PTR(&d->config, str, data) {
phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) {
+ if (zend_alter_ini_entry_chars(str, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) {
phpapdebug((stderr, "..FAILED\n"));
}
} ZEND_HASH_FOREACH_END();
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 02f8a0b3ad..59e17393dd 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -70,20 +70,20 @@ if test "$PHP_APXS2" != "no"; then
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5"
+ -i -n php7"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5"
+ -i -a -n php7"
fi
case $host_alias in
*aix*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*darwin*)
@@ -99,19 +99,19 @@ if test "$PHP_APXS2" != "no"; then
fi
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2handler, bundle, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp5.so
+ PHP_SELECT_SAPI(apache2handler, bundle, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ SAPI_SHARED=libs/libphp7.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
*beos*)
if test -f _APP_; then `rm _APP_`; fi
`ln -s $APXS_BINDIR/httpd _APP_`
EXTRA_LIBS="$EXTRA_LIBS _APP_"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*)
- PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
esac
diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32
index a7547514d8..d15dcfaf03 100644
--- a/sapi/apache2handler/config.w32
+++ b/sapi/apache2handler/config.w32
@@ -11,7 +11,7 @@ if (PHP_APACHE2HANDLER != "no") {
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
) {
- SAPI('apache2handler', 'mod_php5.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2.dll',
'/D PHP_APACHE2_EXPORTS /I win32');
} else {
@@ -29,7 +29,7 @@ if (PHP_APACHE2_2HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
) {
- SAPI('apache2_2handler', 'mod_php5.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_2.dll',
'/D PHP_APACHE2_EXPORTS /I win32',
'sapi\\apache2_2handler');
@@ -47,7 +47,7 @@ if (PHP_APACHE2_4HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
) {
- SAPI('apache2_4handler', 'mod_php5.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_4handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_4.dll',
'/D PHP_APACHE2_EXPORTS /I win32',
'sapi\\apache2handler');
diff --git a/sapi/apache2handler/mod_php5.c b/sapi/apache2handler/mod_php7.c
index 4a01ebfd5f..ddc98e153c 100644
--- a/sapi/apache2handler/mod_php5.c
+++ b/sapi/apache2handler/mod_php7.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -25,7 +25,7 @@
#include "php.h"
#include "php_apache.h"
-AP_MODULE_DECLARE_DATA module php5_module = {
+AP_MODULE_DECLARE_DATA module php7_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
merge_php_config, /* merge per-directory config structures */
diff --git a/sapi/apache2handler/php.sym b/sapi/apache2handler/php.sym
index 9ad0f0a0ad..1469b0314d 100644
--- a/sapi/apache2handler/php.sym
+++ b/sapi/apache2handler/php.sym
@@ -1 +1 @@
-php5_module
+php7_module
diff --git a/sapi/apache2handler/php5apache2.dsp b/sapi/apache2handler/php5apache2.dsp
deleted file mode 100644
index 40cd58cb92..0000000000
--- a/sapi/apache2handler/php5apache2.dsp
+++ /dev/null
@@ -1,146 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5apache2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5apache2 - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache2.mak" CFG="php5apache2 - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5apache2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache2 - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5apache2 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5apache2 - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS_inline/php5apache2.dll" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5apache2 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_APACHE2_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib libhttpd.lib libapr.lib libaprutil.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5apache2 - Win32 Release_TS"
-# Name "php5apache2 - Win32 Release_TS_inline"
-# Name "php5apache2 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\apache_config.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mod_php5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache2.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_apache.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 10b4186306..f6f4f7a7c9 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -29,7 +29,7 @@
#include "main/php_streams.h"
/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php5_module;
+extern module AP_MODULE_DECLARE_DATA php7_module;
/* A way to specify the location of the php.ini dir in an apache directive */
extern char *apache2_php_ini_path_override;
@@ -43,7 +43,7 @@ typedef struct php_struct {
#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
struct stat_libc finfo;
#else
- php_stat_t finfo;
+ zend_stat_t finfo;
#endif
/* Whether or not we've processed PHP in the output filters yet. */
int request_processed;
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 675bb78371..d9ae4d97ea 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -21,7 +21,7 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include "php.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/info.h"
#include "ext/standard/head.h"
#include "php_ini.h"
@@ -72,7 +72,7 @@ static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC)
PHP_FUNCTION(virtual)
{
char *filename;
- int filename_len;
+ size_t filename_len;
request_rec *rr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
@@ -109,9 +109,9 @@ PHP_FUNCTION(virtual)
/* }}} */
#define ADD_LONG(name) \
- add_property_int(return_value, #name, rr->name)
+ add_property_long(return_value, #name, rr->name)
#define ADD_TIME(name) \
- add_property_int(return_value, #name, apr_time_sec(rr->name));
+ add_property_long(return_value, #name, apr_time_sec(rr->name));
#define ADD_STRING(name) \
if (rr->name) add_property_string(return_value, #name, (char *) rr->name)
@@ -119,7 +119,7 @@ PHP_FUNCTION(apache_lookup_uri)
{
request_rec *rr;
char *filename;
- int filename_len;
+ size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
return;
@@ -222,7 +222,7 @@ PHP_FUNCTION(apache_note)
{
php_struct *ctx;
char *note_name, *note_val = NULL;
- int note_name_len, note_val_len;
+ size_t note_name_len, note_val_len;
char *old_note_val=NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &note_name, &note_name_len, &note_val, &note_val_len) == FAILURE) {
@@ -254,7 +254,7 @@ PHP_FUNCTION(apache_setenv)
{
php_struct *ctx;
char *variable=NULL, *string_val=NULL;
- int variable_len, string_val_len;
+ size_t variable_len, string_val_len;
zend_bool walk_to_top = 0;
int arg_count = ZEND_NUM_ARGS();
request_rec *r;
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 669f25f786..fe200304fd 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,7 +30,7 @@
#include <fcntl.h>
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#ifndef NETWARE
#include "ext/standard/php_standard.h"
#else
@@ -67,13 +67,13 @@
#define PHP_MAGIC_TYPE "application/x-httpd-php"
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
-#define PHP_SCRIPT "php5-script"
+#define PHP_SCRIPT "php7-script"
/* A way to specify the location of the php.ini dir in an apache directive */
char *apache2_php_ini_path_override = NULL;
-static php_size_t
-php_apache_sapi_ub_write(const char *str, php_size_t str_length TSRMLS_DC)
+static size_t
+php_apache_sapi_ub_write(const char *str, size_t str_length TSRMLS_DC)
{
request_rec *r;
php_struct *ctx;
@@ -181,7 +181,7 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
}
static apr_size_t
-php_apache_sapi_read_post(char *buf, php_size_t count_bytes TSRMLS_DC)
+php_apache_sapi_read_post(char *buf, size_t count_bytes TSRMLS_DC)
{
apr_size_t len, tlen=0;
php_struct *ctx = SG(server_context);
@@ -212,7 +212,7 @@ php_apache_sapi_read_post(char *buf, php_size_t count_bytes TSRMLS_DC)
return tlen;
}
-static php_stat_t*
+static zend_stat_t*
php_apache_sapi_get_stat(TSRMLS_D)
{
php_struct *ctx = SG(server_context);
@@ -270,18 +270,18 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
php_struct *ctx = SG(server_context);
const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env);
char *key, *val;
- php_size_t new_val_len;
+ size_t new_val_len;
APR_ARRAY_FOREACH_OPEN(arr, key, val)
if (!val) {
val = "";
}
- if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (php_size_t *)&new_val_len TSRMLS_CC)) {
+ if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (size_t *)&new_val_len TSRMLS_CC)) {
php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC);
}
APR_ARRAY_FOREACH_CLOSE()
- if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (php_size_t *)&new_val_len TSRMLS_CC)) {
+ if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (size_t *)&new_val_len TSRMLS_CC)) {
php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC);
}
}
@@ -482,7 +482,11 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC)
r->no_local_copy = 1;
content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
- SG(request_info).content_length = (content_length ? atol(content_length) : 0);
+ if (content_length) {
+ ZEND_ATOL(SG(request_info).content_length, content_length);
+ } else {
+ SG(request_info).content_length = 0;
+ }
apr_table_unset(r->headers_out, "Content-Length");
apr_table_unset(r->headers_out, "Last-Modified");
@@ -515,7 +519,7 @@ typedef struct {
HashTable config;
} php_conf_rec;
zend_string *str;
- php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module);
+ php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php7_module);
ZEND_HASH_FOREACH_STR_KEY(&c->config, str) {
zend_restore_ini_entry(str, ZEND_INI_STAGE_SHUTDOWN);
@@ -540,7 +544,7 @@ static int php_handler(request_rec *r)
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC);
- conf = ap_get_module_config(r->per_dir_config, &php5_module);
+ conf = ap_get_module_config(r->per_dir_config, &php7_module);
/* apply_config() needs r in some cases, so allocate server_context early */
ctx = SG(server_context);
diff --git a/sapi/apache_hooks/apMakefile.tmpl b/sapi/apache_hooks/apMakefile.tmpl
index 4054e8e119..1e5e465f65 100644
--- a/sapi/apache_hooks/apMakefile.tmpl
+++ b/sapi/apache_hooks/apMakefile.tmpl
@@ -1,38 +1,38 @@
##
## Apache 1.3 Makefile template for PHP 4.0 Module
-## [src/modules/php5/Makefile.tmpl]
+## [src/modules/php7/Makefile.tmpl]
##
# the parametrized target
-LIB=libphp5.$(LIBEXT)
+LIB=libphp7.$(LIBEXT)
# objects for building the static library
-OBJS=mod_php5.o
-OBJS_LIB=libmodphp5.a
+OBJS=mod_php7.o
+OBJS_LIB=libmodphp7.a
# objects for building the shared object library
-SHLIB_OBJS=mod_php5.so-o
-SHLIB_OBJS_LIB=libmodphp5.a
+SHLIB_OBJS=mod_php7.so-o
+SHLIB_OBJS_LIB=libmodphp7.a
# the general targets
all: lib
lib: $(LIB)
# build the static library by merging the object files
-libphp5.a: $(OBJS) $(OBJS_LIB)
+libphp7.a: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp5.: $(OBJS) $(OBJS_LIB)
+libphp7.: $(OBJS) $(OBJS_LIB)
cp $(OBJS_LIB) $@
ar r $@ $(OBJS)
$(RANLIB) $@
- cp libphp5. libphp5.a
+ cp libphp7. libphp7.a
# build the shared object library by linking the object files
-libphp5.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
+libphp7.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
rm -f $@
$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
@@ -69,9 +69,9 @@ depend:
$(OBJS): Makefile
# DO NOT REMOVE
-mod_php5.o: mod_php5.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
+mod_php7.o: mod_php7.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
$(INCDIR)/buff.h \
$(INCDIR)/http_config.h \
$(INCDIR)/http_core.h $(INCDIR)/http_main.h \
$(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php5.h
+ $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php7.h
diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4
index e2c71b4274..a1ee213492 100644
--- a/sapi/apache_hooks/config.m4
+++ b/sapi/apache_hooks/config.m4
@@ -79,7 +79,7 @@ if test "$PHP_APACHE_HOOKS" != "no"; then
*darwin*)
MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD"
PHP_SUBST(MH_BUNDLE_FLAGS)
- SAPI_SHARED=libs/libphp5.so
+ SAPI_SHARED=libs/libphp7.so
build_type=bundle
;;
*)
@@ -87,26 +87,26 @@ if test "$PHP_APACHE_HOOKS" != "no"; then
;;
esac
- PHP_SELECT_SAPI(apache_hooks, $build_type, sapi_apache.c mod_php5.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
+ PHP_SELECT_SAPI(apache_hooks, $build_type, sapi_apache.c mod_php7.c php_apache.c, $APACHE_CPPFLAGS -I$APXS_INCLUDEDIR)
# Test whether apxs support -S option
$APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1
if test "$?" != "0"; then
- APACHE_HOOKS_INSTALL="$APXS -i -a -n php5 $SAPI_SHARED" # Old apxs does not have -S option
+ APACHE_HOOKS_INSTALL="$APXS -i -a -n php7 $SAPI_SHARED" # Old apxs does not have -S option
else
APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
if test -z `$APXS -q SYSCONFDIR`; then
APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php5 $SAPI_SHARED"
+ -i -n php7 $SAPI_SHARED"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
APACHE_HOOKS_INSTALL="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php5 $SAPI_SHARED"
+ -i -a -n php7 $SAPI_SHARED"
fi
fi
@@ -137,7 +137,7 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$
PHP_APACHE_HOOKS_STATIC=/usr/local/apache
fi
- APACHE_HOOKS_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php5.* sapi/apache_hooks/libphp5.module"
+ APACHE_HOOKS_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php7.* sapi/apache_hooks/libphp7.module"
AC_DEFINE(HAVE_APACHE,1,[ ])
APACHE_HOOKS_MODULE=yes
@@ -146,7 +146,7 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$
if test -f $PHP_APACHE_HOOKS_STATIC/src/httpd.h; then
APACHE_INCLUDE=-I$PHP_APACHE_HOOKS_STATIC/src
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
PHP_LIBS="-L. -lphp3"
AC_MSG_RESULT([yes - Apache 1.2.x])
@@ -161,13 +161,13 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$
elif test -f $PHP_APACHE_HOOKS_STATIC/src/main/httpd.h; then
APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/main -I$PHP_APACHE_HOOKS_STATIC/src/os/unix -I$PHP_APACHE_HOOKS_STATIC/src/ap"
- APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php7
if test ! -d $APACHE_TARGET; then
mkdir $APACHE_TARGET
fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
AC_MSG_RESULT([yes - Apache 1.3.x])
STRONGHOLD=
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
@@ -185,13 +185,13 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$
elif test -f $PHP_APACHE_HOOKS_STATIC/src/include/httpd.h; then
APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/src/include -I$PHP_APACHE_HOOKS_STATIC/src/os/unix"
- APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php5
+ APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/src/modules/php7
if test ! -d $APACHE_TARGET; then
mkdir $APACHE_TARGET
fi
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
AC_MSG_RESULT([yes - Apache 1.3.x])
STRONGHOLD=
if test -f $PHP_APACHE_HOOKS_STATIC/src/include/ap_config.h; then
@@ -209,9 +209,9 @@ if test "$PHP_SAPI" != "apache" && test "$PHP_SAPI" != "apache_hooks" && test "$
elif test -f $PHP_APACHE_HOOKS_STATIC/apache/httpd.h; then
APACHE_INCLUDE="-I$PHP_APACHE_HOOKS_STATIC/apache -I$PHP_APACHE_HOOKS_STATIC/ssl/include"
APACHE_TARGET=$PHP_APACHE_HOOKS_STATIC/apache
- PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE)
- PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5"
- APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
+ PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php7.c php_apache.c, $APACHE_INCLUDE)
+ PHP_LIBS="-Lmodules/php7 -L../modules/php7 -L../../modules/php7 -lmodphp7"
+ APACHE_HOOKS_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp7.a; cp $APACHE_HOOKS_INSTALL_FILES $APACHE_TARGET"
STRONGHOLD=-DSTRONGHOLD=1
AC_MSG_RESULT([yes - StrongHold])
if test -f $PHP_APACHE_HOOKS_STATIC/apache/ap_config.h; then
@@ -249,13 +249,13 @@ dnl Build as static module
if test "$APACHE_HOOKS_MODULE" = "yes"; then
PHP_TARGET_RDYNAMIC
$php_shtool mkdir -p sapi/apache_hooks
- PHP_OUTPUT(sapi/apache_hooks/libphp5.module)
+ PHP_OUTPUT(sapi/apache_hooks/libphp7.module)
fi
dnl General
if test -n "$APACHE_HOOKS_INSTALL"; then
if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP=-bE:sapi/apache_hooks/mod_php5.exp
+ APXS_EXP=-bE:sapi/apache_hooks/mod_php7.exp
fi
PHP_APACHE_FD_CHECK
diff --git a/sapi/apache_hooks/config.w32 b/sapi/apache_hooks/config.w32
index 85dc624d60..1c9129e615 100644
--- a/sapi/apache_hooks/config.w32
+++ b/sapi/apache_hooks/config.w32
@@ -12,9 +12,9 @@ if (PHP_APACHE_HOOKS != "no") {
";" + PHP_PHP_BUILD + "\\apache\\src\\corer")) {
// We need to play tricks to get our readdir.h used by apache
// headers
- SAPI('apache_hooks', 'mod_php5.c sapi_apache.c php_apache.c',
+ SAPI('apache_hooks', 'mod_php7.c sapi_apache.c php_apache.c',
'php' + PHP_VERSION + 'apache_hooks.dll',
- '/D APACHEPHP5_EXPORTS /D APACHE_READDIR_H /I win32');
+ '/D APACHEPHP7_EXPORTS /D APACHE_READDIR_H /I win32');
} else {
WARNING("Could not find apache libraries/headers");
}
diff --git a/sapi/apache_hooks/libphp5.module.in b/sapi/apache_hooks/libphp7.module.in
index 8488181897..5bea79ef95 100644
--- a/sapi/apache_hooks/libphp5.module.in
+++ b/sapi/apache_hooks/libphp7.module.in
@@ -1,4 +1,4 @@
-Name: php5_module
+Name: php7_module
ConfigStart
RULE_WANTHSREGEX=no
RULE_HIDE=yes
diff --git a/sapi/apache_hooks/mod_php5.exp b/sapi/apache_hooks/mod_php5.exp
deleted file mode 100644
index 9ad0f0a0ad..0000000000
--- a/sapi/apache_hooks/mod_php5.exp
+++ /dev/null
@@ -1 +0,0 @@
-php5_module
diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php7.c
index 901d3b57a3..33e0931fb6 100644
--- a/sapi/apache_hooks/mod_php5.c
+++ b/sapi/apache_hooks/mod_php7.c
@@ -84,11 +84,11 @@ static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_co
static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2);
-/* ### these should be defined in mod_php5.h or somewhere else */
+/* ### these should be defined in mod_php7.h or somewhere else */
#define USE_PATH 1
#define IGNORE_URL 2
-module MODULE_VAR_EXPORT php5_module;
+module MODULE_VAR_EXPORT php7_module;
int saved_umask;
/* static int setup_env = 0; */
@@ -667,7 +667,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename)
return DECLINED;
}
- per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
if (per_dir_conf) {
zend_hash_apply((HashTable *) per_dir_conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
}
@@ -934,7 +934,7 @@ static CONST_PREFIX char *php_set_server_handler(server_rec *s, char *arg1, long
handler->type = handler_type;
handler->stage = handler_stage;
handler->name = strdup(arg1);
- conf = get_module_config(s->module_config, &php5_module);
+ conf = get_module_config(s->module_config, &php7_module);
switch(handler_stage) {
case AP_URI_TRANS:
sapi_stack_push(&conf->uri_handlers, handler);
@@ -1184,7 +1184,7 @@ static int php_xbithack_handler(request_rec * r)
r->allowed |= (1 << METHODS) - 1;
return DECLINED;
}
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
if (conf) {
zend_hash_apply((HashTable *) conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
}
@@ -1266,7 +1266,7 @@ static int php_run_hook(php_handler *handler, request_rec *r)
TSRMLS_FETCH();
if(!AP(apache_config_loaded)) {
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
if (conf)
zend_hash_apply((HashTable *)conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC);
AP(apache_config_loaded) = 1;
@@ -1298,7 +1298,7 @@ static int php_uri_translation(request_rec *r)
php_per_server_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_URI_TRANS;
- conf = (php_per_server_config *) get_module_config(r->server->module_config, &php5_module);
+ conf = (php_per_server_config *) get_module_config(r->server->module_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook, r, OK);
@@ -1309,7 +1309,7 @@ static int php_header_hook(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_HEADER_PARSE;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook, r);
@@ -1320,7 +1320,7 @@ static int php_auth_hook(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_AUTHENTICATION;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook, r, OK);
@@ -1332,7 +1332,7 @@ static int php_access_hook(request_rec *r)
int status = DECLINED;
TSRMLS_FETCH();
AP(current_hook) = AP_ACCESS_CONTROL;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
status = sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook, r);
@@ -1345,7 +1345,7 @@ static int php_type_hook(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_TYPE_CHECKING;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook,
@@ -1357,7 +1357,7 @@ static int php_fixup_hook(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_FIXUP;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook,
@@ -1369,7 +1369,7 @@ static int php_logger_hook(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_LOGGING;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook,
@@ -1382,11 +1382,11 @@ static int php_post_read_hook(request_rec *r)
php_per_server_config *svr;
TSRMLS_FETCH();
AP(current_hook) = AP_POST_READ;
- svr = get_module_config(r->server->module_config, &php5_module);
+ svr = get_module_config(r->server->module_config, &php7_module);
if(ap_is_initial_req(r)) {
sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
}
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers,
ZEND_STACK_APPLY_BOTTOMUP,
(int (*)(void *element, void *)) php_run_hook, r);
@@ -1397,7 +1397,7 @@ static int php_response_handler(request_rec *r)
php_per_dir_config *conf;
TSRMLS_FETCH();
AP(current_hook) = AP_RESPONSE;
- conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module);
+ conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php7_module);
return sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r);
}
@@ -1449,9 +1449,9 @@ command_rec php_commands[] =
};
/* }}} */
-/* {{{ module MODULE_VAR_EXPORT php5_module
+/* {{{ module MODULE_VAR_EXPORT php7_module
*/
-module MODULE_VAR_EXPORT php5_module =
+module MODULE_VAR_EXPORT php7_module =
{
STANDARD_MODULE_STUFF,
php_init_handler, /* initializer */
diff --git a/sapi/apache_hooks/mod_php7.exp b/sapi/apache_hooks/mod_php7.exp
new file mode 100644
index 0000000000..1469b0314d
--- /dev/null
+++ b/sapi/apache_hooks/mod_php7.exp
@@ -0,0 +1 @@
+php7_module
diff --git a/sapi/apache_hooks/mod_php5.h b/sapi/apache_hooks/mod_php7.h
index 3db828ec83..325ae1f721 100644
--- a/sapi/apache_hooks/mod_php5.h
+++ b/sapi/apache_hooks/mod_php7.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -17,8 +17,8 @@
*/
/* $Id$ */
-#ifndef MOD_PHP5_H
-#define MOD_PHP5_H
+#ifndef MOD_PHP7_H
+#define MOD_PHP7_H
#if !defined(WIN32) && !defined(WINNT)
#ifndef MODULE_VAR_EXPORT
@@ -78,7 +78,7 @@ extern php_apache_info_struct php_apache_info;
# define MODULE_VAR_EXPORT PHPAPI
#endif
-#endif /* MOD_PHP5_H */
+#endif /* MOD_PHP7_H */
/*
* Local variables:
diff --git a/sapi/apache_hooks/php.sym b/sapi/apache_hooks/php.sym
index 9ad0f0a0ad..1469b0314d 100644
--- a/sapi/apache_hooks/php.sym
+++ b/sapi/apache_hooks/php.sym
@@ -1 +1 @@
-php5_module
+php7_module
diff --git a/sapi/apache_hooks/php5apache_hooks.dsp b/sapi/apache_hooks/php5apache_hooks.dsp
deleted file mode 100755
index cc60f4b3b1..0000000000
--- a/sapi/apache_hooks/php5apache_hooks.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5apache_hooks" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5apache_hooks - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache_hooks.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5apache_hooks.mak" CFG="php5apache_hooks - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5apache_hooks - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache_hooks - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5apache_hooks - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5apache_hooks - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5apache_hooks - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php5apache_hooks.dll" /pdbtype:sept /libpath:"..\..\..\php_build\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5apache_hooks - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5apache_hooks - Win32 Release_TS"
-# Name "php5apache_hooks - Win32 Debug_TS"
-# Name "php5apache_hooks - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_php5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mod_php5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache_http.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c
index 8045bbce32..e5bd3f5d61 100644
--- a/sapi/apache_hooks/php_apache.c
+++ b/sapi/apache_hooks/php_apache.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/apache_hooks/php_apache_http.h b/sapi/apache_hooks/php_apache_http.h
index 23cf7fea69..e6610741c7 100644
--- a/sapi/apache_hooks/php_apache_http.h
+++ b/sapi/apache_hooks/php_apache_http.h
@@ -36,7 +36,7 @@
#include "php_ini.h"
#include "ext/standard/php_standard.h"
-#include "mod_php5.h"
+#include "mod_php7.h"
zval *php_apache_request_new(request_rec *r);
diff --git a/sapi/apache_hooks/sapi_apache.c b/sapi/apache_hooks/sapi_apache.c
index 9ed93aea6d..daaad4e39d 100644
--- a/sapi/apache_hooks/sapi_apache.c
+++ b/sapi/apache_hooks/sapi_apache.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c
index 946f7a039e..b1ffddb460 100644
--- a/sapi/caudium/caudium.c
+++ b/sapi/caudium/caudium.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -38,7 +38,7 @@
*/
#define NO_PIKE_SHORTHAND
-/* Ok, we are now using Pike level threads to handle PHP5 since
+/* Ok, we are now using Pike level threads to handle PHP7 since
* the nice th_farm threads aren't working on Linux with glibc 2.2
* (why this is I don't know).
*/
@@ -79,7 +79,7 @@
#endif
#ifndef PIKE_THREADS
-#error The PHP5 module requires that your Pike has thread support.
+#error The PHP7 module requires that your Pike has thread support.
#endif
#undef HIDE_GLOBAL_VARIABLES
@@ -625,7 +625,7 @@ static void php_caudium_module_main(php_caudium_request *ureq)
SG(request_info).headers_only = 0;
}
- /* Let PHP5 handle the deconding of the AUTH */
+ /* Let PHP7 handle the deconding of the AUTH */
php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), TSRMLS_C);
/* Swap out this thread and release the interpreter lock to allow
* Pike threads to run. We wait since the above would otherwise require
diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4
index 5ce55f3f01..13a6b2943e 100644
--- a/sapi/caudium/config.m4
+++ b/sapi/caudium/config.m4
@@ -79,12 +79,12 @@ if test "$PHP_CAUDIUM" != "no"; then
AC_MSG_RESULT(not found)
fi
else
- AC_MSG_ERROR([Caudium PHP5 requires Pike 7.0 or newer])
+ AC_MSG_ERROR([Caudium PHP7 requires Pike 7.0 or newer])
fi
PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
PHP_SELECT_SAPI(caudium, shared, caudium.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_CAUDIUM/lib/$PIKE_VERSION/PHP5.so"
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_CAUDIUM/lib/$PIKE_VERSION/PHP7.so"
RESULT=" *** Pike binary used: $PIKE
*** Pike include dir(s) used: $PIKE_INCLUDE_DIR
*** Pike version: $PIKE_VERSION"
diff --git a/sapi/cgi/CHANGES b/sapi/cgi/CHANGES
index de029474e5..b7cf41cf5e 100755
--- a/sapi/cgi/CHANGES
+++ b/sapi/cgi/CHANGES
@@ -31,4 +31,3 @@ In PHP5.3 all additional configure options (except --enable-cgi) are removed:
Now it is disabled by default, but can be enabled
with ini directive "cgi.discard_path=1".
-
diff --git a/sapi/cgi/README.FastCGI b/sapi/cgi/README.FastCGI
index 3dda295d84..f0f11e102d 100644
--- a/sapi/cgi/README.FastCGI
+++ b/sapi/cgi/README.FastCGI
@@ -69,7 +69,7 @@ a line in your config like:
Don't load mod_php, by the way. Make sure it is commented out!
- #LoadModule php5_module /usr/lib/apache/2.0/libphp5.so
+ #LoadModule php7_module /usr/lib/apache/2.0/libphp7.so
Now, we'll create a fcgi-bin directory, just like you would do with normal
CGI scripts. You'll need to create a directory somewhere to store your
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 9d30b53cfc..f06787543e 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -159,6 +159,8 @@ static const opt_struct OPTIONS[] = {
};
typedef struct _php_cgi_globals_struct {
+ HashTable user_config_cache;
+ char *redirect_status_env;
zend_bool rfc2616_headers;
zend_bool nph;
zend_bool check_shebang_line;
@@ -166,11 +168,9 @@ typedef struct _php_cgi_globals_struct {
zend_bool force_redirect;
zend_bool discard_path;
zend_bool fcgi_logging;
- char *redirect_status_env;
#ifdef PHP_WIN32
zend_bool impersonate;
#endif
- HashTable user_config_cache;
} php_cgi_globals_struct;
/* {{{ user_config_cache
@@ -287,10 +287,10 @@ static inline size_t sapi_cgi_single_write(const char *str, uint str_length TSRM
#endif
}
-static php_size_t sapi_cgi_ub_write(const char *str, php_size_t str_length TSRMLS_DC)
+static size_t sapi_cgi_ub_write(const char *str, size_t str_length TSRMLS_DC)
{
const char *ptr = str;
- php_size_t remaining = str_length;
+ size_t remaining = str_length;
size_t ret;
while (remaining > 0) {
@@ -306,14 +306,14 @@ static php_size_t sapi_cgi_ub_write(const char *str, php_size_t str_length TSRML
return str_length;
}
-static php_size_t sapi_fcgi_ub_write(const char *str, php_size_t str_length TSRMLS_DC)
+static size_t sapi_fcgi_ub_write(const char *str, size_t str_length TSRMLS_DC)
{
const char *ptr = str;
- php_size_t remaining = str_length;
+ size_t remaining = str_length;
fcgi_request *request = (fcgi_request*) SG(server_context);
while (remaining > 0) {
- php_int_t ret = fcgi_write(request, FCGI_STDOUT, ptr, remaining);
+ zend_long ret = fcgi_write(request, FCGI_STDOUT, ptr, remaining);
if (ret <= 0) {
php_handle_aborted_connection();
@@ -505,12 +505,17 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
# define STDIN_FILENO 0
#endif
-static php_size_t sapi_cgi_read_post(char *buffer, php_size_t count_bytes TSRMLS_DC)
+static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
{
- php_size_t read_bytes = 0;
+ size_t read_bytes = 0;
int tmp_read_bytes;
+ size_t remaining_bytes;
- count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes));
+ assert(SG(request_info).content_length >= SG(read_post_bytes));
+
+ remaining_bytes = (size_t)(SG(request_info).content_length - SG(read_post_bytes));
+
+ count_bytes = MIN(count_bytes, remaining_bytes);
while (read_bytes < count_bytes) {
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {
@@ -521,9 +526,9 @@ static php_size_t sapi_cgi_read_post(char *buffer, php_size_t count_bytes TSRMLS
return read_bytes;
}
-static php_size_t sapi_fcgi_read_post(char *buffer, php_size_t count_bytes TSRMLS_DC)
+static size_t sapi_fcgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
{
- php_size_t read_bytes = 0;
+ size_t read_bytes = 0;
int tmp_read_bytes;
fcgi_request *request = (fcgi_request*) SG(server_context);
size_t remaining = SG(request_info).content_length - SG(read_post_bytes);
@@ -622,7 +627,7 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns
{
zval *array_ptr = (zval*)arg;
int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER;
- php_size_t new_val_len;
+ size_t new_val_len;
if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len TSRMLS_CC)) {
php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
@@ -658,7 +663,7 @@ static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
{
- php_size_t php_self_len;
+ size_t php_self_len;
char *php_self;
/* In CGI mode, we consider the environment to be a part of the server
@@ -1184,7 +1189,7 @@ static void init_request_info(fcgi_request *request TSRMLS_DC)
#endif
if (CGIG(fix_pathinfo)) {
- php_stat_t st;
+ zend_stat_t st;
char *real_path = NULL;
char *env_redirect_url = CGI_GETENV("REDIRECT_URL");
char *env_document_root = CGI_GETENV("DOCUMENT_ROOT");
@@ -1587,7 +1592,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
char buf[128];
char **env, *p, *q, *var, *val, *t = buf;
size_t alloc_size = sizeof(buf);
- php_uint_t var_len;
+ zend_ulong var_len;
for (env = environ; env != NULL && *env != NULL; env++) {
val = strchr(*env, '=');
@@ -1751,6 +1756,7 @@ int main(int argc, char *argv[])
char *bindpath = NULL;
int fcgi_fd = 0;
fcgi_request *request = NULL;
+ int warmup_repeats = 0;
int repeats = 1;
int benchmark = 0;
#if HAVE_GETTIMEOFDAY
@@ -2094,7 +2100,15 @@ consult the installation file that came with this distribution, or visit \n\
switch (c) {
case 'T':
benchmark = 1;
- repeats = atoi(php_optarg);
+ {
+ char *comma = strchr(php_optarg, ',');
+ if (comma) {
+ warmup_repeats = atoi(php_optarg);
+ repeats = atoi(comma + 1);
+ } else {
+ repeats = atoi(php_optarg);
+ }
+ }
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&start, NULL);
#else
@@ -2130,7 +2144,6 @@ consult the installation file that came with this distribution, or visit \n\
while (!fastcgi || fcgi_accept_request(request) >= 0) {
SG(server_context) = fastcgi ? (void *) request : (void *) 1;
init_request_info(request TSRMLS_CC);
- CG(interactive) = 0;
if (!cgi && !fastcgi) {
while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) {
@@ -2138,7 +2151,6 @@ consult the installation file that came with this distribution, or visit \n\
case 'a': /* interactive mode */
printf("Interactive mode enabled\n\n");
- CG(interactive) = 1;
break;
case 'C': /* don't chdir to the script directory */
@@ -2398,8 +2410,8 @@ consult the installation file that came with this distribution, or visit \n\
/* handle situations where line is terminated by \r\n */
if (c == '\r') {
if (fgetc(file_handle.handle.fp) != '\n') {
- long pos = ftell(file_handle.handle.fp);
- fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
+ zend_long pos = zend_ftell(file_handle.handle.fp);
+ zend_fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
}
}
CG(start_lineno) = 2;
@@ -2416,7 +2428,7 @@ consult the installation file that came with this distribution, or visit \n\
/* handle situations where line is terminated by \r\n */
if (c == '\r') {
if (php_stream_getc((php_stream*)file_handle.handle.stream.handle) != '\n') {
- php_off_t pos = php_stream_tell((php_stream*)file_handle.handle.stream.handle);
+ zend_off_t pos = php_stream_tell((php_stream*)file_handle.handle.stream.handle);
php_stream_seek((php_stream*)file_handle.handle.stream.handle, pos - 1, SEEK_SET);
}
}
@@ -2514,12 +2526,24 @@ fastcgi_request_done:
if (!fastcgi) {
if (benchmark) {
- repeats--;
- if (repeats > 0) {
- script_file = NULL;
- php_optind = orig_optind;
- php_optarg = orig_optarg;
+ if (warmup_repeats) {
+ warmup_repeats--;
+ if (!warmup_repeats) {
+#ifdef HAVE_GETTIMEOFDAY
+ gettimeofday(&start, NULL);
+#else
+ time(&start);
+#endif
+ }
continue;
+ } else {
+ repeats--;
+ if (repeats > 0) {
+ script_file = NULL;
+ php_optind = orig_optind;
+ php_optarg = orig_optarg;
+ continue;
+ }
}
}
break;
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
index 45f809f5b3..0cd3096e4d 100644
--- a/sapi/cgi/fastcgi.c
+++ b/sapi/cgi/fastcgi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -73,8 +73,6 @@
# include <netdb.h>
# include <signal.h>
-# define closesocket(s) close(s)
-
# if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
# include <sys/poll.h>
# endif
@@ -643,7 +641,7 @@ int fcgi_listen(const char *path, int backlog)
if (namedPipe == INVALID_HANDLE_VALUE) {
return -1;
}
- listen_socket = _open_osfhandle((long)namedPipe, 0);
+ listen_socket = _open_osfhandle((intptr_t)namedPipe, 0);
if (!is_initialized) {
fcgi_init();
}
@@ -724,7 +722,7 @@ int fcgi_listen(const char *path, int backlog)
#ifdef _WIN32
if (tcp) {
- listen_socket = _open_osfhandle((long)listen_socket, 0);
+ listen_socket = _open_osfhandle((intptr_t)listen_socket, 0);
}
#else
fcgi_setup_signals();
@@ -993,7 +991,7 @@ static int fcgi_read_request(fcgi_request *req)
if ((value = zend_hash_str_find(&fcgi_mgmt_vars, q->var, q->var_len)) == NULL) {
continue;
}
- zlen = Z_STRSIZE_P(value);
+ zlen = Z_STRLEN_P(value);
if ((p + 4 + 4 + q->var_len + zlen) >= (buf + sizeof(buf))) {
break;
}
@@ -1113,7 +1111,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy)
shutdown(req->fd, 1);
/* read the last FCGI_STDIN header (it may be omitted) */
- recv(req->fd, (char *)&buf, sizeof(buf), 0);
+ recv(req->fd, (char *)(&buf), sizeof(buf), 0);
}
closesocket(req->fd);
}
@@ -1123,7 +1121,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy)
shutdown(req->fd, 1);
/* read the last FCGI_STDIN header (it may be omitted) */
- recv(req->fd, &buf, sizeof(buf), 0);
+ recv(req->fd, (char *)(&buf), sizeof(buf), 0);
}
close(req->fd);
#endif
@@ -1512,7 +1510,7 @@ void fcgi_impersonate(void)
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len)
{
zval zvalue;
- ZVAL_NEW_STR(&zvalue, STR_INIT(value, value_len, 1));
+ ZVAL_NEW_STR(&zvalue, zend_string_init(value, value_len, 1));
zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue);
}
diff --git a/sapi/cgi/fastcgi.h b/sapi/cgi/fastcgi.h
index d5f141cd1b..4a30a207b1 100644
--- a/sapi/cgi/fastcgi.h
+++ b/sapi/cgi/fastcgi.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h
index 8840ac01cc..e49a203821 100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -30,11 +30,11 @@
#endif
-extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length TSRMLS_DC);
+extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRMLS_DC);
typedef struct {
- php_size_t (*cli_shell_write)(const char *str, php_size_t str_length TSRMLS_DC);
- php_size_t (*cli_shell_ub_write)(const char *str, php_size_t str_length TSRMLS_DC);
+ size_t (*cli_shell_write)(const char *str, size_t str_length TSRMLS_DC);
+ size_t (*cli_shell_ub_write)(const char *str, size_t str_length TSRMLS_DC);
int (*cli_shell_run)(TSRMLS_D);
} cli_shell_callbacks_t;
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 9a1b98da46..090574a007 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -45,7 +45,7 @@ if test "$PHP_CLI" != "no"; then
BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
*netware*)
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -Lnetware -lphp5lib -o \$(SAPI_CLI_PATH)"
+ BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -Lnetware -lphp7lib -o \$(SAPI_CLI_PATH)"
;;
*)
BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
diff --git a/sapi/cli/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index 4475004985..772569a426 100644
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -30,7 +30,7 @@ array_walk($types, function ($line) use (&$extensions) {
?>
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/mime_type_map.h b/sapi/cli/mime_type_map.h
index 72c05d4149..16f9b7f3ff 100644
--- a/sapi/cli/mime_type_map.h
+++ b/sapi/cli/mime_type_map.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index bdc4629c08..ef45ef6ef9 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -244,7 +244,7 @@ static inline int sapi_cli_select(int fd TSRMLS_DC)
PHP_SAFE_FD_SET(fd, &wfd);
- tv.tv_sec = FG(default_socket_timeout);
+ tv.tv_sec = (long)FG(default_socket_timeout);
tv.tv_usec = 0;
ret = php_select(fd+1, &dfd, &wfd, &dfd, &tv);
@@ -252,16 +252,16 @@ static inline int sapi_cli_select(int fd TSRMLS_DC)
return ret != -1;
}
-PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */
+PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */
{
#ifdef PHP_WRITE_STDOUT
- php_int_t ret;
+ zend_long ret;
#else
- php_size_t ret;
+ size_t ret;
#endif
if (cli_shell_callbacks.cli_shell_write) {
- php_size_t shell_wrote;
+ size_t shell_wrote;
shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length TSRMLS_CC);
if (shell_wrote > -1) {
return shell_wrote;
@@ -285,10 +285,10 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length
}
/* }}} */
-static php_size_t sapi_cli_ub_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */
+static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */
{
const char *ptr = str;
- php_size_t remaining = str_length;
+ size_t remaining = str_length;
size_t ret;
if (!str_length) {
@@ -296,7 +296,7 @@ static php_size_t sapi_cli_ub_write(const char *str, php_size_t str_length TSRML
}
if (cli_shell_callbacks.cli_shell_ub_write) {
- php_size_t ub_wrote;
+ size_t ub_wrote;
ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length TSRMLS_CC);
if (ub_wrote > -1) {
return ub_wrote;
@@ -338,7 +338,7 @@ static char *script_filename = "";
static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */
{
- php_size_t len;
+ size_t len;
char *docroot = "";
/* In CGI mode, we consider the environment to be a part of the server
@@ -425,7 +425,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
- ZVAL_NEW_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\
+ ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value)-1, 1));\
zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\
static void sapi_cli_ini_defaults(HashTable *configuration_hash)
@@ -581,19 +581,19 @@ static void cli_register_file_handles(TSRMLS_D) /* {{{ */
ZVAL_COPY_VALUE(&ic.value, &zin);
ic.flags = CONST_CS;
- ic.name = STR_INIT("STDIN", sizeof("STDIN")-1, 1);
+ ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
ic.module_number = 0;
zend_register_constant(&ic TSRMLS_CC);
ZVAL_COPY_VALUE(&oc.value, &zout);
oc.flags = CONST_CS;
- oc.name = STR_INIT("STDOUT", sizeof("STDOUT")-1, 1);
+ oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
oc.module_number = 0;
zend_register_constant(&oc TSRMLS_CC);
ZVAL_COPY_VALUE(&ec.value, &zerr);
ec.flags = CONST_CS;
- ec.name = STR_INIT("STDERR", sizeof("STDERR")-1, 1);
+ ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
ec.module_number = 0;
zend_register_constant(&ec TSRMLS_CC);
}
@@ -627,8 +627,8 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file,
/* handle situations where line is terminated by \r\n */
if (c == '\r') {
if (fgetc(file_handle->handle.fp) != '\n') {
- long pos = ftell(file_handle->handle.fp);
- fseek(file_handle->handle.fp, pos - 1, SEEK_SET);
+ zend_long pos = zend_ftell(file_handle->handle.fp);
+ zend_fseek(file_handle->handle.fp, pos - 1, SEEK_SET);
}
}
*lineno = 2;
@@ -902,8 +902,6 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
fflush(stdout);
}
- CG(interactive) = interactive;
-
/* only set script_file if not set already and not in direct mode and not at end of parameter list */
if (argc > php_optind
&& !script_file
@@ -963,9 +961,9 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
}
}
- key = STR_INIT("_SERVER", sizeof("_SERVER")-1, 0);
+ key = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0);
zend_is_auto_global(key TSRMLS_CC);
- STR_RELEASE(key);
+ zend_string_release(key);
PG(during_request_startup) = 0;
switch (behavior) {
@@ -1033,7 +1031,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1 TSRMLS_CC) == FAILURE) {
exit_status=254;
}
- ZVAL_INT(&argi, index);
+ ZVAL_LONG(&argi, index);
zend_hash_str_update(&EG(symbol_table).ht, "argi", sizeof("argi")-1, &argi);
while (exit_status == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) {
len = strlen(input);
@@ -1042,7 +1040,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
}
ZVAL_STRINGL(&argn, input, len);
zend_hash_str_update(&EG(symbol_table).ht, "argn", sizeof("argn")-1, &argn);
- Z_IVAL(argi) = ++index;
+ Z_LVAL(argi) = ++index;
if (exec_run) {
if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1 TSRMLS_CC) == FAILURE) {
exit_status=254;
@@ -1122,7 +1120,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
}
case PHP_MODE_REFLECTION_EXT_INFO:
{
- int len = strlen(reflection_what);
+ int len = (int)strlen(reflection_what);
char *lcname = zend_str_tolower_dup(reflection_what, len);
zend_module_entry *module;
@@ -1260,7 +1258,7 @@ int main(int argc, char *argv[])
break;
case 'd': {
/* define ini entries on command line */
- int len = strlen(php_optarg);
+ int len = (int)strlen(php_optarg);
char *val;
if ((val = strchr(php_optarg, '='))) {
@@ -1268,11 +1266,11 @@ int main(int argc, char *argv[])
if (!isalnum(*val) && *val != '"' && *val != '\'' && *val != '\0') {
ini_entries = realloc(ini_entries, ini_entries_len + len + sizeof("\"\"\n\0"));
memcpy(ini_entries + ini_entries_len, php_optarg, (val - php_optarg));
- ini_entries_len += (val - php_optarg);
+ ini_entries_len += (int)(val - php_optarg);
memcpy(ini_entries + ini_entries_len, "\"", 1);
ini_entries_len++;
memcpy(ini_entries + ini_entries_len, val, len - (val - php_optarg));
- ini_entries_len += len - (val - php_optarg);
+ ini_entries_len += len - (int)(val - php_optarg);
memcpy(ini_entries + ini_entries_len, "\"\n\0", sizeof("\"\n\0"));
ini_entries_len += sizeof("\n\0\"") - 2;
} else {
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index 298300f065..28fbdfb518 100644
--- a/sapi/cli/php_cli_process_title.c
+++ b/sapi/cli/php_cli_process_title.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -31,7 +31,7 @@
PHP_FUNCTION(cli_set_process_title)
{
char *title = NULL;
- int title_len;
+ size_t title_len;
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &title, &title_len) == FAILURE) {
diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
index bd44d99111..b93947a81f 100644
--- a/sapi/cli/php_cli_process_title.h
+++ b/sapi/cli/php_cli_process_title.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index f381e4ba2b..19a94218ff 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -96,7 +96,7 @@
#endif
#include "ext/standard/file.h" /* for php_set_sock_blocking() :-( */
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "ext/standard/html.h"
#include "ext/standard/url.h" /* for php_url_decode() */
#include "ext/standard/php_string.h" /* for php_dirname() */
@@ -139,7 +139,7 @@ typedef struct php_cli_server_request {
size_t content_len;
const char *ext;
size_t ext_len;
- php_stat_t sb;
+ zend_stat_t sb;
} php_cli_server_request;
typedef struct php_cli_server_chunk {
@@ -380,11 +380,11 @@ static void append_http_status_line(smart_str *buffer, int protocol_version, int
}
smart_str_appendl_ex(buffer, "HTTP", 4, persistent);
smart_str_appendc_ex(buffer, '/', persistent);
- smart_str_append_generic_ex(buffer, protocol_version / 100, persistent, int, _unsigned);
+ smart_str_append_long_ex(buffer, protocol_version / 100, persistent);
smart_str_appendc_ex(buffer, '.', persistent);
- smart_str_append_generic_ex(buffer, protocol_version % 100, persistent, int, _unsigned);
+ smart_str_append_long_ex(buffer, protocol_version % 100, persistent);
smart_str_appendc_ex(buffer, ' ', persistent);
- smart_str_append_generic_ex(buffer, response_code, persistent, int, _unsigned);
+ smart_str_append_long_ex(buffer, response_code, persistent);
smart_str_appendc_ex(buffer, ' ', persistent);
smart_str_appends_ex(buffer, get_status_string(response_code), persistent);
smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
@@ -453,7 +453,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS
do {
p++;
} while (*p == ' ' || *p == '\t');
- add_assoc_stringl_ex(return_value, s, len, p, h->header_len - (p - h->header));
+ add_assoc_stringl_ex(return_value, s, (uint)len, p, h->header_len - (p - h->header));
free_alloca(s, use_heap);
}
}
@@ -539,7 +539,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */
return SUCCESS;
} /* }}} */
-static php_size_t sapi_cli_server_ub_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */
+static size_t sapi_cli_server_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */
{
php_cli_server_client *client = SG(server_context);
if (!client) {
@@ -619,7 +619,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */
return val;
} /* }}} */
-static php_size_t sapi_cli_server_read_post(char *buf, php_size_t count_bytes TSRMLS_DC) /* {{{ */
+static size_t sapi_cli_server_read_post(char *buf, size_t count_bytes TSRMLS_DC) /* {{{ */
{
php_cli_server_client *client = SG(server_context);
if (client->request.content) {
@@ -635,7 +635,7 @@ static php_size_t sapi_cli_server_read_post(char *buf, php_size_t count_bytes TS
static void sapi_cli_server_register_variable(zval *track_vars_array, const char *key, const char *val TSRMLS_DC) /* {{{ */
{
char *new_val = (char *)val;
- php_size_t new_val_len;
+ size_t new_val_len;
if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) {
php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC);
}
@@ -1027,12 +1027,20 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
size_t _nbytes_sent_total = 0;
for (chunk = sender->buffer.first; chunk; chunk = next) {
+#ifdef PHP_WIN32
+ int nbytes_sent;
+#else
ssize_t nbytes_sent;
+#endif
next = chunk->next;
switch (chunk->type) {
case PHP_CLI_SERVER_CHUNK_HEAP:
+#ifdef PHP_WIN32
+ nbytes_sent = send(fd, chunk->data.heap.p, (int)chunk->data.heap.len, 0);
+#else
nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0);
+#endif
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
@@ -1051,7 +1059,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
break;
case PHP_CLI_SERVER_CHUNK_IMMORTAL:
+#ifdef PHP_WIN32
+ nbytes_sent = send(fd, chunk->data.immortal.p, (int)chunk->data.immortal.len, 0);
+#else
nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0);
+#endif
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
@@ -1076,10 +1088,18 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
static int php_cli_server_content_sender_pull(php_cli_server_content_sender *sender, int fd, size_t *nbytes_read TSRMLS_DC) /* {{{ */
{
+#ifdef PHP_WIN32
+ int _nbytes_read;
+#else
ssize_t _nbytes_read;
+#endif
php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(131072);
+#ifdef PHP_WIN32
+ _nbytes_read = read(fd, chunk->data.heap.p, (unsigned int)chunk->data.heap.len);
+#else
_nbytes_read = read(fd, chunk->data.heap.p, chunk->data.heap.len);
+#endif
if (_nbytes_read < 0) {
char *errstr = get_last_error();
php_cli_server_logf("%s" TSRMLS_CC, errstr);
@@ -1207,7 +1227,7 @@ static void php_cli_server_logf(const char *format TSRMLS_DC, ...) /* {{{ */
efree(buf);
} /* }}} */
-static int php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, zend_string **errstr TSRMLS_DC) /* {{{ */
+static php_socket_t php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, zend_string **errstr TSRMLS_DC) /* {{{ */
{
php_socket_t retval = SOCK_ERR;
int err = 0;
@@ -1377,7 +1397,7 @@ static void php_cli_server_request_dtor(php_cli_server_request *req) /* {{{ */
static void php_cli_server_request_translate_vpath(php_cli_server_request *request, const char *document_root, size_t document_root_len) /* {{{ */
{
- php_stat_t sb;
+ zend_stat_t sb;
static const char *index_files[] = { "index.php", "index.html", NULL };
char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1);
char *p = buf, *prev_path = NULL, *q, *vpath;
@@ -1414,7 +1434,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque
*p = '\0';
q = p;
while (q > buf) {
- if (!php_stat_fn(buf, &sb)) {
+ if (!zend_stat(buf, &sb)) {
if (sb.st_mode & S_IFDIR) {
const char **file = index_files;
if (q[-1] != DEFAULT_SLASH) {
@@ -1423,7 +1443,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque
while (*file) {
size_t l = strlen(*file);
memmove(q, *file, l + 1);
- if (!php_stat_fn(buf, &sb) && (sb.st_mode & S_IFREG)) {
+ if (!zend_stat(buf, &sb) && (sb.st_mode & S_IFREG)) {
q += l;
break;
}
@@ -1496,7 +1516,7 @@ static void normalize_vpath(char **retval, size_t *retval_len, const char *vpath
return;
}
- decoded_vpath_end = decoded_vpath + php_url_decode(decoded_vpath, vpath_len);
+ decoded_vpath_end = decoded_vpath + php_url_decode(decoded_vpath, (int)vpath_len);
p = decoded_vpath;
@@ -1613,12 +1633,12 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
}
{
/* strip off the colon */
- zend_string *orig_header_name = STR_INIT(client->current_header_name, client->current_header_name_len, 1);
+ zend_string *orig_header_name = zend_string_init(client->current_header_name, client->current_header_name_len, 1);
char *lc_header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len);
zend_hash_str_add_ptr(&client->request.headers, lc_header_name, client->current_header_name_len, value);
zend_hash_add_ptr(&client->request.headers_original_case, orig_header_name, value);
efree(lc_header_name);
- STR_RELEASE(orig_header_name);
+ zend_string_release(orig_header_name);
}
if (client->current_header_name_allocated) {
@@ -1736,9 +1756,19 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
static size_t php_cli_server_client_send_through(php_cli_server_client *client, const char *str, size_t str_len) /* {{{ */
{
struct timeval tv = { 10, 0 };
- ssize_t nbytes_left = str_len;
+#ifdef PHP_WIN32
+ int nbytes_left = (int)str_len;
+#else
+ ssize_t nbytes_left = (ssize_t)str_len;
+#endif
do {
- ssize_t nbytes_sent = send(client->sock, str + str_len - nbytes_left, nbytes_left, 0);
+#ifdef PHP_WIN32
+ int nbytes_sent;
+#else
+ ssize_t nbytes_sent;
+#endif
+
+ nbytes_sent = send(client->sock, str + str_len - nbytes_left, nbytes_left, 0);
if (nbytes_sent < 0) {
int err = php_socket_errno();
if (err == SOCK_EAGAIN) {
@@ -1797,7 +1827,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser
php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, NULL, 0 TSRMLS_CC);
client->addr_str = pestrndup(addr_str->val, addr_str->len, 1);
client->addr_str_len = addr_str->len;
- STR_RELEASE(addr_str);
+ zend_string_release(addr_str);
}
php_http_parser_init(&client->parser, PHP_HTTP_REQUEST);
client->request_read = 0;
@@ -1902,13 +1932,13 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
append_essential_headers(&buffer, client, 1);
smart_str_appends_ex(&buffer, "Content-Type: text/html; charset=UTF-8\r\n", 1);
smart_str_appends_ex(&buffer, "Content-Length: ", 1);
- smart_str_append_generic_ex(&buffer, php_cli_server_buffer_size(&client->content_sender.buffer), 1, size_t, _unsigned);
+ smart_str_append_unsigned_ex(&buffer, php_cli_server_buffer_size(&client->content_sender.buffer), 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len);
if (!chunk) {
- smart_str_free_ex(&buffer, 1);
+ smart_str_free(&buffer);
goto fail;
}
php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk);
@@ -1919,14 +1949,14 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
if (errstr) {
pefree(errstr, 1);
}
- STR_FREE(escaped_request_uri);
+ zend_string_free(escaped_request_uri);
return SUCCESS;
fail:
if (errstr) {
pefree(errstr, 1);
}
- STR_FREE(escaped_request_uri);
+ zend_string_free(escaped_request_uri);
return FAILURE;
} /* }}} */
@@ -1993,12 +2023,12 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
}
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
smart_str_appends_ex(&buffer, "Content-Length: ", 1);
- smart_str_append_generic_ex(&buffer, client->request.sb.st_size, 1, size_t, _unsigned);
+ smart_str_append_unsigned_ex(&buffer, client->request.sb.st_size, 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
smart_str_appendl_ex(&buffer, "\r\n", 2, 1);
chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len);
if (!chunk) {
- smart_str_free_ex(&buffer, 1);
+ smart_str_free(&buffer);
php_cli_server_log_response(client, 500, NULL TSRMLS_CC);
return FAILURE;
}
@@ -2233,7 +2263,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c
if (server_sock == SOCK_ERR) {
php_cli_server_logf("Failed to listen on %s:%d (reason: %s)" TSRMLS_CC, host, port, errstr ? errstr->val : "?");
if (errstr) {
- STR_RELEASE(errstr);
+ zend_string_release(errstr);
}
retval = FAILURE;
goto out;
@@ -2487,9 +2517,9 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
}
if (document_root) {
- php_stat_t sb;
+ zend_stat_t sb;
- if (php_stat_fn(document_root, &sb)) {
+ if (zend_stat(document_root, &sb)) {
fprintf(stderr, "Directory %s does not exist.\n", document_root);
return 1;
}
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index a8d7f46e7c..476ee2919c 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index d3bc496f4e..cc649af79a 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -1431,7 +1431,9 @@ size_t php_http_parser_execute (php_http_parser *parser,
}
case s_body_identity:
- to_read = MIN(pe - p, (size_t)parser->content_length);
+ assert(pe >= p);
+
+ to_read = MIN((size_t)(pe - p), (size_t)parser->content_length);
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
p += to_read - 1;
@@ -1515,8 +1517,9 @@ size_t php_http_parser_execute (php_http_parser *parser,
case s_chunk_data:
{
assert(parser->flags & F_CHUNKED);
+ assert(pe >= p);
- to_read = MIN(pe - p, (size_t)(parser->content_length));
+ to_read = MIN((size_t)(pe - p), (size_t)(parser->content_length));
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c
index 53cd5fc9a0..97eec86e5b 100644
--- a/sapi/cli/ps_title.c
+++ b/sapi/cli/ps_title.c
@@ -311,7 +311,7 @@ const char* ps_title_errno(int rc)
#ifdef PS_USE_WIN32
case PS_TITLE_WINDOWS_ERROR:
- sprintf(windows_error_details, "Windows error code: %d", GetLastError());
+ sprintf(windows_error_details, "Windows error code: %u", GetLastError());
return windows_error_details;
#endif
}
@@ -386,7 +386,7 @@ int get_ps_title(int *displen, const char** string)
return rc;
#ifdef PS_USE_WIN32
- if (!(ps_buffer_cur_len = GetConsoleTitle(ps_buffer, ps_buffer_size)))
+ if (!(ps_buffer_cur_len = GetConsoleTitle(ps_buffer, (DWORD)ps_buffer_size)))
return PS_TITLE_WINDOWS_ERROR;
#endif
*displen = (int)ps_buffer_cur_len;
diff --git a/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
index 09650fed08..30a16b5a0c 100644
--- a/sapi/cli/ps_title.h
+++ b/sapi/cli/ps_title.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt
index 31c1a40e4a..9c28d15a30 100644
--- a/sapi/cli/tests/016.phpt
+++ b/sapi/cli/tests/016.phpt
@@ -59,8 +59,6 @@ foreach ($codes as $key => $code) {
echo "\nDone\n";
?>
---XFAIL--
-https://bugs.php.net/bug.php?id=55496
--EXPECTF--
--------------
Snippet no. 1:
diff --git a/sapi/continuity/capi.c b/sapi/continuity/capi.c
index 30d10ed0a0..aebfb9f671 100644
--- a/sapi/continuity/capi.c
+++ b/sapi/continuity/capi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/embed/php5embed.dsp b/sapi/embed/php5embed.dsp
deleted file mode 100644
index 8564b11797..0000000000
--- a/sapi/embed/php5embed.dsp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5embed" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=php5embed - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5embed.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5embed.mak" CFG="php5embed - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5embed - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "php5embed - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5embed - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x406 /d "_DEBUG"
-# ADD RSC /l 0x406 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\Debug_TS\php5embed.lib"
-
-!ELSEIF "$(CFG)" == "php5embed - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\Release_TS\php5embed.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5embed - Win32 Debug_TS"
-# Name "php5embed - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=php_embed.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=php_embed.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 2f2f31fb85..e0df666108 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -44,10 +44,10 @@ static int php_embed_deactivate(TSRMLS_D)
return SUCCESS;
}
-static inline size_t php_embed_single_write(const char *str, php_size_t str_length)
+static inline size_t php_embed_single_write(const char *str, size_t str_length)
{
#ifdef PHP_WRITE_STDOUT
- php_int_t ret;
+ zend_long ret;
ret = write(STDOUT_FILENO, str, str_length);
if (ret <= 0) return 0;
@@ -61,10 +61,10 @@ static inline size_t php_embed_single_write(const char *str, php_size_t str_leng
}
-static php_size_t php_embed_ub_write(const char *str, php_size_t str_length TSRMLS_DC)
+static size_t php_embed_ub_write(const char *str, size_t str_length TSRMLS_DC)
{
const char *ptr = str;
- php_size_t remaining = str_length;
+ size_t remaining = str_length;
size_t ret;
while (remaining > 0) {
diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
index 84c0e36336..b62fd9fe24 100644
--- a/sapi/embed/php_embed.h
+++ b/sapi/embed/php_embed.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/devpoll.c b/sapi/fpm/fpm/events/devpoll.c
index 3fa7cd4545..c843940638 100644
--- a/sapi/fpm/fpm/events/devpoll.c
+++ b/sapi/fpm/fpm/events/devpoll.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/devpoll.h b/sapi/fpm/fpm/events/devpoll.h
index 2753cb5abe..3cb744c023 100644
--- a/sapi/fpm/fpm/events/devpoll.h
+++ b/sapi/fpm/fpm/events/devpoll.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c
index b55cb44b15..aa4881649b 100644
--- a/sapi/fpm/fpm/events/epoll.c
+++ b/sapi/fpm/fpm/events/epoll.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/epoll.h b/sapi/fpm/fpm/events/epoll.h
index f89e59a5f5..965fe4dc4e 100644
--- a/sapi/fpm/fpm/events/epoll.h
+++ b/sapi/fpm/fpm/events/epoll.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c
index 9fde33842b..df0724c3d4 100644
--- a/sapi/fpm/fpm/events/kqueue.c
+++ b/sapi/fpm/fpm/events/kqueue.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/kqueue.h b/sapi/fpm/fpm/events/kqueue.h
index 16f8046529..4b52faba21 100644
--- a/sapi/fpm/fpm/events/kqueue.h
+++ b/sapi/fpm/fpm/events/kqueue.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/poll.c b/sapi/fpm/fpm/events/poll.c
index d49661413c..a97c64c2d0 100644
--- a/sapi/fpm/fpm/events/poll.c
+++ b/sapi/fpm/fpm/events/poll.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/poll.h b/sapi/fpm/fpm/events/poll.h
index 4a05755d07..6378074a14 100644
--- a/sapi/fpm/fpm/events/poll.h
+++ b/sapi/fpm/fpm/events/poll.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/port.c b/sapi/fpm/fpm/events/port.c
index 0e6a880554..faf67343c7 100644
--- a/sapi/fpm/fpm/events/port.c
+++ b/sapi/fpm/fpm/events/port.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/port.h b/sapi/fpm/fpm/events/port.h
index f127b8cdad..1e57feb194 100644
--- a/sapi/fpm/fpm/events/port.h
+++ b/sapi/fpm/fpm/events/port.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/select.c b/sapi/fpm/fpm/events/select.c
index cf3331c04b..1be074c43c 100644
--- a/sapi/fpm/fpm/events/select.c
+++ b/sapi/fpm/fpm/events/select.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/events/select.h b/sapi/fpm/fpm/events/select.h
index 74f7be2bc1..cd3652e4bd 100644
--- a/sapi/fpm/fpm/events/select.h
+++ b/sapi/fpm/fpm/events/select.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
index e5018591ee..4f7f5eab9c 100644
--- a/sapi/fpm/fpm/fastcgi.c
+++ b/sapi/fpm/fpm/fastcgi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -611,7 +611,7 @@ static int fcgi_read_request(fcgi_request *req)
if (!value) {
continue;
}
- zlen = Z_STRSIZE_P(value);
+ zlen = Z_STRLEN_P(value);
if ((p + 4 + 4 + key->len + zlen) >= (buf + sizeof(buf))) {
break;
}
@@ -1064,13 +1064,13 @@ char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len)
{
zval zvalue;
- ZVAL_STR(&zvalue, STR_INIT(value, value_len, 1));
+ ZVAL_NEW_STR(&zvalue, zend_string_init(value, value_len, 1));
zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue);
}
void fcgi_free_mgmt_var_cb(zval *zv)
{
- STR_FREE(Z_STR_P(zv));
+ zend_string_free(Z_STR_P(zv));
}
char *fcgi_get_last_client_ip() /* {{{ */
diff --git a/sapi/fpm/fpm/fastcgi.h b/sapi/fpm/fpm/fastcgi.h
index 5a8aa0e70e..6d1bb38dba 100644
--- a/sapi/fpm/fpm/fastcgi.h
+++ b/sapi/fpm/fpm/fastcgi.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 5e9fa89cc8..2552f9afe0 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -298,7 +298,7 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint str_length T
#endif
}
-static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC)
+static size_t sapi_cgibin_ub_write(const char *str, size_t str_length TSRMLS_DC)
{
const char *ptr = str;
uint remaining = str_length;
@@ -497,7 +497,7 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
# define STDIN_FILENO 0
#endif
-static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
+static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
{
uint read_bytes = 0;
int tmp_read_bytes;
@@ -598,7 +598,7 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
? PARSE_ENV : PARSE_SERVER;
ZEND_HASH_FOREACH_STR_KEY_PTR(request->env, var, val) {
- unsigned int new_val_len;
+ size_t new_val_len;
if (var && sapi_module.input_filter(filter_arg, var->val, &val, strlen(val), &new_val_len TSRMLS_CC)) {
php_register_variable_safe(var->val, val, new_val_len, array_ptr TSRMLS_CC);
@@ -608,7 +608,7 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
{
- unsigned int php_self_len;
+ size_t php_self_len;
char *php_self;
/* In CGI mode, we consider the environment to be a part of the server
@@ -1226,6 +1226,17 @@ static void init_request_info(TSRMLS_D)
SG(request_info).request_uri = orig_script_name;
}
path_info[0] = old;
+ } else if (apache_was_here && env_script_name) {
+ /* Using mod_proxy_fcgi and ProxyPass, apache cannot set PATH_INFO
+ * As we can extract PATH_INFO from PATH_TRANSLATED
+ * it is probably also in SCRIPT_NAME and need to be removed
+ */
+ int snlen = strlen(env_script_name);
+ if (snlen>slen && !strcmp(env_script_name+snlen-slen, path_info)) {
+ _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
+ env_script_name[snlen-slen] = 0;
+ SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC);
+ }
}
env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC);
}
@@ -1866,7 +1877,6 @@ consult the installation file that came with this distribution, or visit \n\
request_body_fd = -1;
SG(server_context) = (void *) &request;
init_request_info(TSRMLS_C);
- CG(interactive) = 0;
char *primary_script = NULL;
fpm_request_info();
diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c
index 7112cb923b..e0de217c00 100644
--- a/sapi/fpm/fpm/fpm_php.c
+++ b/sapi/fpm/fpm/fpm_php.c
@@ -26,22 +26,21 @@ static char **limit_extensions = NULL;
static int fpm_php_zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int mode, int stage TSRMLS_DC) /* {{{ */
{
zend_ini_entry *ini_entry;
- char *duplicate;
+ zend_string *duplicate;
if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length))) {
return FAILURE;
}
- duplicate = strdup(new_value);
+ duplicate = zend_string_init(new_value, new_value_length, 1);
if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length,
+ || ini_entry->on_modify(ini_entry, duplicate,
ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) {
ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
ini_entry->modifiable = mode;
} else {
- free(duplicate);
+ zend_string_release(duplicate);
}
return SUCCESS;
@@ -92,7 +91,7 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
return Z_TYPE(zv) == IS_TRUE;
}
- if (fpm_php_zend_ini_alter_master(name, name_len+1, value, value_len, mode, PHP_INI_STAGE_ACTIVATE TSRMLS_CC) == FAILURE) {
+ if (fpm_php_zend_ini_alter_master(name, name_len, value, value_len, mode, PHP_INI_STAGE_ACTIVATE TSRMLS_CC) == FAILURE) {
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index e056565ea4..da14d63d8c 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -39,29 +39,6 @@ struct listening_socket_s {
static struct fpm_array_s sockets_list;
-static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockaddr_in *addr) /* {{{ */
-{
- struct addrinfo *res;
- struct addrinfo hints;
- int ret;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET;
- ret = getaddrinfo(node, service, &hints, &res);
-
- if (ret != 0) {
- zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
- node, service ? ":" : "", service ? service : "",
- gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : "");
- return -1;
- }
-
- *addr = *(struct sockaddr_in *) res->ai_addr;
- freeaddrinfo(res);
- return 0;
-}
-/* }}} */
-
enum { FPM_GET_USE_SOCKET = 1, FPM_STORE_SOCKET = 2, FPM_STORE_USE_SOCKET = 3 };
static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
@@ -98,14 +75,23 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
}
/* }}} */
+static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */
+{
+ if (sa->sa_family == AF_INET) {
+ return &(((struct sockaddr_in*)sa)->sin_addr);
+ }
+
+ return &(((struct sockaddr_in6*)sa)->sin6_addr);
+}
+/* }}} */
+
static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */
{
if (key == NULL) {
switch (type) {
case FPM_AF_INET : {
- struct sockaddr_in *sa_in = (struct sockaddr_in *) sa;
- key = alloca(sizeof("xxx.xxx.xxx.xxx:ppppp"));
- sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port));
+ key = alloca(INET6_ADDRSTRLEN);
+ inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key);
break;
}
@@ -254,11 +240,14 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *address) /* {{{ */
static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* {{{ */
{
- struct sockaddr_in sa_in;
+ struct addrinfo hints, *servinfo, *p;
char *dup_address = strdup(wp->config->listen_address);
- char *port_str = strchr(dup_address, ':');
+ char *port_str = strrchr(dup_address, ':');
char *addr = NULL;
+ int addr_len;
int port = 0;
+ int sock;
+ int status;
if (port_str) { /* this is host:port pair */
*port_str++ = '\0';
@@ -274,23 +263,35 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
return -1;
}
- memset(&sa_in, 0, sizeof(sa_in));
-
- if (addr) {
- sa_in.sin_addr.s_addr = inet_addr(addr);
- if (sa_in.sin_addr.s_addr == INADDR_NONE) { /* do resolve */
- if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) {
- return -1;
- }
- zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
+ // strip brackets from address for getaddrinfo
+ if (addr != NULL) {
+ addr_len = strlen(addr);
+ if (addr[0] == '[' && addr[addr_len - 1] == ']') {
+ addr[addr_len - 1] = '\0';
+ addr++;
}
- } else {
- sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
}
- sa_in.sin_family = AF_INET;
- sa_in.sin_port = htons(port);
+
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+
+ if ((status = getaddrinfo(addr, port_str, &hints, &servinfo)) != 0) {
+ zlog(ZLOG_ERROR, "getaddrinfo: %s\n", gai_strerror(status));
+ return -1;
+ }
+
free(dup_address);
- return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
+
+ for (p = servinfo; p != NULL; p = p->ai_next) {
+ if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
+ break;
+ }
+ }
+
+ freeaddrinfo(servinfo);
+
+ return sock;
}
/* }}} */
diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
index 121c016a7b..446c78e410 100644
--- a/sapi/fpm/fpm/fpm_sockets.h
+++ b/sapi/fpm/fpm/fpm_sockets.h
@@ -45,10 +45,4 @@ static inline int fd_set_blocked(int fd, int blocked) /* {{{ */
}
/* }}} */
-#define IPQUAD(sin_addr) \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[0], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[1], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[2], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3]
-
#endif
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index e447648462..fa3fc763a5 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -127,7 +127,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
}
/* full status ? */
- _GET_str = STR_INIT("_GET", sizeof("_GET")-1, 0);
+ _GET_str = zend_string_init("_GET", sizeof("_GET")-1, 0);
full = (fpm_php_get_string_from_table(_GET_str, "full" TSRMLS_CC) != NULL);
short_syntax = short_post = NULL;
full_separator = full_pre = full_syntax = full_post = NULL;
@@ -378,7 +378,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
PUTS(buffer);
efree(buffer);
- STR_RELEASE(_GET_str);
+ zend_string_release(_GET_str);
if (short_post) {
PUTS(short_post);
@@ -463,7 +463,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
efree(buffer);
if (tmp_query_string) {
- STR_FREE(tmp_query_string);
+ zend_string_free(tmp_query_string);
}
}
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index c5f4abc59c..106689f0a7 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -152,6 +152,8 @@ group = @php_fpm_group@
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
+; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
+; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
@@ -490,7 +492,7 @@ pm.max_spare_servers = 3
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
-;security.limit_extensions = .php .php3 .php4 .php5
+;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt
new file mode 100644
index 0000000000..389cb2401e
--- /dev/null
+++ b/sapi/fpm/tests/003.phpt
@@ -0,0 +1,53 @@
+--TEST--
+FPM: Test IPv6 support
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+[unconfined]
+listen = [::1]:9000
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+EOT;
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ var_dump(fgets($tail));
+ var_dump(fgets($tail));
+ $i = 0;
+ while (($i++ < 30) && !($fp = fsockopen('[::1]', 9000))) {
+ usleep(10000);
+ }
+ if ($fp) {
+ echo "Done\n";
+ fclose($fp);
+ }
+ proc_terminate($fpm);
+ stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+}
+
+?>
+--EXPECTF--
+string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
+"
+string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
+"
+Done
+--CLEAN--
+<?php
+ $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
+ @unlink($logfile);
+?>
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
index 6014bab09f..4073173eaf 100644
--- a/sapi/isapi/config.m4
+++ b/sapi/isapi/config.m4
@@ -15,7 +15,7 @@ if test "$PHP_ISAPI" != "no"; then
PHP_BUILD_THREAD_SAFE
AC_DEFINE(WITH_ZEUS, 1, [ ])
PHP_ADD_INCLUDE($ZEUSPATH/web/include)
- PHP_SELECT_SAPI(isapi, shared, php5isapi.c)
+ PHP_SELECT_SAPI(isapi, shared, php7isapi.c)
INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/"
fi
diff --git a/sapi/isapi/config.w32 b/sapi/isapi/config.w32
index 8012352744..5a359f11b2 100644
--- a/sapi/isapi/config.w32
+++ b/sapi/isapi/config.w32
@@ -7,7 +7,7 @@ if (PHP_ISAPI == "yes") {
if (PHP_ZTS == "no") {
WARNING("ISAPI module requires an --enable-zts build of PHP");
} else {
- SAPI('isapi', 'php5isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP5ISAPI_EXPORTS');
- ADD_FLAG('LDFLAGS_ISAPI', '/DEF:sapi\\isapi\\php5isapi.def');
+ SAPI('isapi', 'php7isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP7ISAPI_EXPORTS');
+ ADD_FLAG('LDFLAGS_ISAPI', '/DEF:sapi\\isapi\\php7isapi.def');
}
}
diff --git a/sapi/isapi/php5isapi.dsp b/sapi/isapi/php5isapi.dsp
deleted file mode 100644
index 3dbab11eff..0000000000
--- a/sapi/isapi/php5isapi.dsp
+++ /dev/null
@@ -1,165 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5isapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5isapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5isapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5isapi.mak" CFG="php5isapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5isapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5isapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5isapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5isapi - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5isapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5isapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5isapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5isapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5isapi___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5isapi - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5isapi___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php5isapi___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5isapi - Win32 Debug_TS"
-# Name "php5isapi - Win32 Release_TS"
-# Name "php5isapi - Win32 Release_TS_inline"
-# Name "php5isapi - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php5isapi.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php5isapi.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/isapi/php5isapi.c b/sapi/isapi/php7isapi.c
index d83c81ad9e..27eb1c9353 100644
--- a/sapi/isapi/php5isapi.c
+++ b/sapi/isapi/php7isapi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/isapi/php5isapi.def b/sapi/isapi/php7isapi.def
index 596023ef55..596023ef55 100644
--- a/sapi/isapi/php5isapi.def
+++ b/sapi/isapi/php7isapi.def
diff --git a/sapi/isapi/stresstest/notes.txt b/sapi/isapi/stresstest/notes.txt
index f58ab3c0e9..e6d10dd486 100644
--- a/sapi/isapi/stresstest/notes.txt
+++ b/sapi/isapi/stresstest/notes.txt
@@ -44,7 +44,7 @@ Run: stresstest L files.txt
supply the path to the parent of the "tests" directory (expect a couple
long pauses for a couple of the larger tests)
-Run: stresstest T c:\php5-source
+Run: stresstest T c:\php7-source
diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp
index 9a5964a6ba..8ad414fab6 100644
--- a/sapi/isapi/stresstest/stresstest.cpp
+++ b/sapi/isapi/stresstest/stresstest.cpp
@@ -529,7 +529,7 @@ int main(int argc, char* argv[])
0,
NULL
);
- fprintf(stderr,"Error: Dll 'php5isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf);
+ fprintf(stderr,"Error: Dll 'php7isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf);
free (module);
free(filelist);
LocalFree( lpMsgBuf );
diff --git a/sapi/isapi/stresstest/stresstest.dsp b/sapi/isapi/stresstest/stresstest.dsp
deleted file mode 100644
index fb82303e3d..0000000000
--- a/sapi/isapi/stresstest/stresstest.dsp
+++ /dev/null
@@ -1,108 +0,0 @@
-# Microsoft Developer Studio Project File - Name="stresstest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=stresstest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak" CFG="stresstest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "stresstest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "stresstest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "stresstest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "stresstest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "stresstest - Win32 Release"
-# Name "stresstest - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\getopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stresstest.cpp
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\notes.txt
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index cf26ba8ad5..13439460ae 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -69,7 +69,7 @@
#define SAPI_LSAPI_MAX_HEADER_LENGTH 2048
-static int lsapi_mode = 1;
+static int lsapi_mode = 0;
static char *php_self = "";
static char *script_filename = "";
static int source_highlight = 0;
@@ -104,7 +104,7 @@ static int php_lsapi_startup(sapi_module_struct *sapi_module)
#define INI_DEFAULT(name,value)\
ZVAL_STRING(tmp, value, 0);\
zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry))
+ Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry))
static void sapi_lsapi_ini_defaults(HashTable *configuration_hash)
{
@@ -195,15 +195,22 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC )
/* }}} */
-/*
+
+
static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen,
void * arg )
{
- php_register_variable_safe((char *)pKey, (char *)pValue, valLen, (zval *)arg TSRMLS_CC);
- return 1;
+ int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
+ char * new_val = (char *) pValue;
+ unsigned int new_val_len;
+
+ if (sapi_module.input_filter(filter_arg, (char *)pKey, &new_val, valLen, &new_val_len TSRMLS_CC)) {
+ php_register_variable_safe((char *)pKey, new_val, new_val_len, (zval *)arg );
+ }
+ return 1;
}
-*/
+/*
static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen,
void * arg )
{
@@ -212,7 +219,7 @@ static int add_variable( const char * pKey, int keyLen, const char * pValue, int
register char * pKey1 = (char *)pKey;
MAKE_STD_ZVAL(gpc_element);
- Z_STRSIZE_P( gpc_element ) = valLen;
+ Z_STRLEN_P( gpc_element ) = valLen;
Z_STRVAL_P( gpc_element ) = estrndup(pValue, valLen);
Z_TYPE_P( gpc_element ) = IS_STRING;
#if PHP_MAJOR_VERSION > 4
@@ -222,6 +229,55 @@ static int add_variable( const char * pKey, int keyLen, const char * pValue, int
#endif
return 1;
}
+*/
+
+static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
+{
+ char buf[128];
+ char **env, *p, *t = buf;
+ size_t alloc_size = sizeof(buf);
+ unsigned long nlen; /* ptrdiff_t is not portable */
+
+ if (PG(http_globals)[TRACK_VARS_ENV] &&
+ array_ptr != PG(http_globals)[TRACK_VARS_ENV] &&
+ Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY &&
+ zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0
+ ) {
+ zval_dtor(array_ptr);
+ *array_ptr = *PG(http_globals)[TRACK_VARS_ENV];
+ INIT_PZVAL(array_ptr);
+ zval_copy_ctor(array_ptr);
+ return;
+ } else if (PG(http_globals)[TRACK_VARS_SERVER] &&
+ array_ptr != PG(http_globals)[TRACK_VARS_SERVER] &&
+ Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
+ zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0
+ ) {
+ zval_dtor(array_ptr);
+ *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER];
+ INIT_PZVAL(array_ptr);
+ zval_copy_ctor(array_ptr);
+ return;
+ }
+
+ for (env = environ; env != NULL && *env != NULL; env++) {
+ p = strchr(*env, '=');
+ if (!p) { /* malformed entry? */
+ continue;
+ }
+ nlen = p - *env;
+ if (nlen >= alloc_size) {
+ alloc_size = nlen + 64;
+ t = (t == buf ? emalloc(alloc_size): erealloc(t, alloc_size));
+ }
+ memcpy(t, *env, nlen);
+ t[nlen] = '\0';
+ add_variable(t, nlen, p + 1, strlen( p + 1 ), array_ptr TSRMLS_CC);
+ }
+ if (t != buf && t != NULL) {
+ efree(t);
+ }
+}
#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5)
@@ -233,8 +289,8 @@ static int add_variable_magic_quote( const char * pKey, int keyLen, const char *
register char * pKey1 = (char *)pKey;
MAKE_STD_ZVAL(gpc_element);
- Z_STRSIZE_P( gpc_element ) = valLen;
- Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRSIZE_P( gpc_element ), 0 );
+ Z_STRLEN_P( gpc_element ) = valLen;
+ Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRLEN_P( gpc_element ), 0 );
Z_TYPE_P( gpc_element ) = IS_STRING;
#if PHP_MAJOR_VERSION > 4
zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p );
@@ -255,6 +311,8 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC)
if ( (SG(request_info).request_uri ) )
php_self = (SG(request_info).request_uri );
+ litespeed_php_import_environment_variables(track_vars_array TSRMLS_CC);
+
#if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || PHP_MAJOR_VERSION < 5)
if (!PG(magic_quotes_gpc)) {
#endif
@@ -268,7 +326,6 @@ static void sapi_lsapi_register_variables(zval *track_vars_array TSRMLS_DC)
add_variable_magic_quote("PHP_SELF", 8, php_self, strlen( php_self ), track_vars_array );
}
#endif
- php_import_environment_variables(track_vars_array TSRMLS_CC);
} else {
php_import_environment_variables(track_vars_array TSRMLS_CC);
@@ -370,7 +427,7 @@ static void sapi_lsapi_log_message(char *message TSRMLS_DC)
static sapi_module_struct lsapi_sapi_module =
{
"litespeed",
- "LiteSpeed V6.6",
+ "LiteSpeed V6.7",
php_lsapi_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
@@ -996,6 +1053,7 @@ int main( int argc, char * argv[] )
LSAPI_Init();
LSAPI_Init_Env_Parameters( NULL );
+ lsapi_mode = 1;
slow_script_msec = LSAPI_Get_Slow_Req_Msecs();
diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index fb75d01a17..5c604a57c4 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 786a3bd20b..cf63f6ab1c 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1912,9 +1912,13 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq,
int ret;
int count = 0;
struct _headerInfo headers[512];
+
if ( !pReq || !fn )
return -1;
-
+
+ if ( !pReq->m_pHeaderIndex )
+ return 0;
+
for( i = 0; i < H_TRANSFER_ENCODING; ++i )
{
if ( pReq->m_pHeaderIndex->m_headerOff[i] )
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index cae1863c79..cacf7d97b8 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c
index 443fee9dfd..d82089ca1f 100644
--- a/sapi/milter/php_milter.c
+++ b/sapi/milter/php_milter.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -1134,8 +1134,6 @@ int main(int argc, char *argv[])
exit(1);
}
- CG(interactive) = interactive;
-
/* only set script_file if not set already and not in direct mode and not at end of parameter list */
if (argc > ap_php_optind && !filename) {
filename=argv[ap_php_optind];
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
index 54980bf0e0..812507957e 100644
--- a/sapi/nsapi/nsapi-readme.txt
+++ b/sapi/nsapi/nsapi-readme.txt
@@ -1,4 +1,4 @@
-Configuration of your Netscape/iPlanet/Sun Webserver for PHP5
+Configuration of your Netscape/iPlanet/Sun Webserver for PHP7
-----------------------------------------------------------------
These instructions are targetted at Netscape Enterprise Web Server and
@@ -28,13 +28,13 @@ Place the following two lines after mime.types init in
for iPlanet/Sun Webserver 6.0 and above however at the end of the
<path-to-server>/https-servername/config/magnus.conf file:
- Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="/path/to/phplibrary"
- Init fn=php5_init errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
+ Init fn="load-modules" funcs="php7_init,php7_execute,php7_auth_trans" shlib="/path/to/phplibrary"
+ Init fn=php7_init errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
The "shlib" will vary depending on your OS:
- Unix: "<path-to-server>/bin/libphp5.so".
- Windows: "c:/path/to/php5/php5nsapi.dll"
+ Unix: "<path-to-server>/bin/libphp7.so".
+ Windows: "c:/path/to/php7/php7nsapi.dll"
In obj.conf (for virtual server classes [Sun 6.0+] in their vserver.obj.conf):
@@ -50,7 +50,7 @@ In obj.conf (for virtual server classes [Sun 6.0+] in their vserver.obj.conf):
# For boolean ini-keys please use 0/1 as value, NOT "On","Off",... (this will not work
# correctly), e.g. zlib.output_compression=1 instead of zlib.output_compression="On"
- Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value ...]
+ Service fn="php7_execute" type="magnus-internal/x-httpd-php" [inikey=value ...]
.
.
.
@@ -61,7 +61,7 @@ PHP scripts (same like a cgi-bin directory):
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
- Service fn="php5_execute" [inikey=value ...]
+ Service fn="php7_execute" [inikey=value ...]
</Object>
After that you can configure a directory in the Administration server and assign it
@@ -81,7 +81,7 @@ AUTHENTICATION IS PASSED TO YOUR PHP SCRIPT. To configure PHP
Authentication for the entire server, add the following line:
<Object name="default">
- AuthTrans fn=php5_auth_trans
+ AuthTrans fn=php7_auth_trans
.
.
.
@@ -92,7 +92,7 @@ Authentication for the entire server, add the following line:
To use PHP Authentication on a single directory, add the following:
<Object ppath="d:\path\to\authenticated\dir\*">
- AuthTrans fn=php5_auth_trans
+ AuthTrans fn=php7_auth_trans
</Object>
@@ -103,7 +103,7 @@ You can use PHP to generate the error pages for "404 Not Found"
or similar. Add the following line to the object in obj.conf for
every error page you want to overwrite:
- Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
+ Error fn="php7_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
where XXX ist the HTTP error code. Please delete any other Error
directives which could interfere with yours.
@@ -116,7 +116,7 @@ Just generate a PHP script which displays a directory listing and
replace the corresponding default Service line for
type="magnus-internal/directory" in obj.conf with the following:
- Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
+ Service fn="php7_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
For both error and directory listing pages the original URI and
translated URI are in the variables $_SERVER['PATH_INFO'] and
@@ -141,9 +141,9 @@ till version 6.1. If a newer version of the Sun server is used, the detection
fails and nsapi_virtual() is disabled.
If this is the case, try the following:
-Add the following parameter to php5_init in magnus.conf:
+Add the following parameter to php7_init in magnus.conf:
- Init fn=php5_init ... server_lib="ns-httpdXX.dll"
+ Init fn=php7_init ... server_lib="ns-httpdXX.dll"
where XX is the correct DLL version number. To get it, look in the server-root
for the correct DLL name. The DLL with the biggest filesize is the right one.
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index 496596d773..bb99c31652 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -251,7 +251,7 @@ static void php_nsapi_init_dynamic_symbols(void)
/* try user specified server_lib */
module = GetModuleHandle(nsapi_dll);
if (!module) {
- log_error(LOG_WARN, "php5_init", NULL, NULL, "Cannot find DLL specified by server_lib parameter: %s", nsapi_dll);
+ log_error(LOG_WARN, "php7_init", NULL, NULL, "Cannot find DLL specified by server_lib parameter: %s", nsapi_dll);
}
} else {
/* find a LOADED dll module from nsapi_dlls */
@@ -781,7 +781,7 @@ static void nsapi_log_message(char *message TSRMLS_DC)
if (rc) {
log_error(LOG_INFORM, pblock_findval("fn", rc->pb), rc->sn, rc->rq, "%s", message);
} else {
- log_error(LOG_INFORM, "php5", NULL, NULL, "%s", message);
+ log_error(LOG_INFORM, "php7", NULL, NULL, "%s", message);
}
}
@@ -868,7 +868,7 @@ static void nsapi_php_ini_entries(NSLS_D TSRMLS_DC)
}
}
-void NSAPI_PUBLIC php5_close(void *vparam)
+void NSAPI_PUBLIC php7_close(void *vparam)
{
if (nsapi_sapi_module.shutdown) {
nsapi_sapi_module.shutdown(&nsapi_sapi_module);
@@ -888,13 +888,13 @@ void NSAPI_PUBLIC php5_close(void *vparam)
sapi_shutdown();
tsrm_shutdown();
- log_error(LOG_INFORM, "php5_close", NULL, NULL, "Shutdown PHP Module");
+ log_error(LOG_INFORM, "php7_close", NULL, NULL, "Shutdown PHP Module");
}
/*********************************************************
/ init SAF
/
-/ Init fn="php5_init" [php_ini="/path/to/php.ini"] [server_lib="ns-httpdXX.dll"]
+/ Init fn="php7_init" [php_ini="/path/to/php.ini"] [server_lib="ns-httpdXX.dll"]
/ Initialize the NSAPI module in magnus.conf
/
/ php_ini: gives path to php.ini file
@@ -902,7 +902,7 @@ void NSAPI_PUBLIC php5_close(void *vparam)
/ servact_* functions
/
/*********************************************************/
-int NSAPI_PUBLIC php5_init(pblock *pb, Session *sn, Request *rq)
+int NSAPI_PUBLIC php7_init(pblock *pb, Session *sn, Request *rq)
{
php_core_globals *core_globals;
char *strval;
@@ -917,13 +917,13 @@ int NSAPI_PUBLIC php5_init(pblock *pb, Session *sn, Request *rq)
core_globals = ts_resource(core_globals_id);
- /* look if php_ini parameter is given to php5_init */
+ /* look if php_ini parameter is given to php7_init */
if (strval = pblock_findval("php_ini", pb)) {
nsapi_sapi_module.php_ini_path_override = strdup(strval);
}
#ifdef PHP_WIN32
- /* look if server_lib parameter is given to php5_init
+ /* look if server_lib parameter is given to php7_init
* (this disables the automatic search for the newest ns-httpdXX.dll) */
if (strval = pblock_findval("server_lib", pb)) {
nsapi_dll = strdup(strval);
@@ -934,7 +934,7 @@ int NSAPI_PUBLIC php5_init(pblock *pb, Session *sn, Request *rq)
sapi_startup(&nsapi_sapi_module);
nsapi_sapi_module.startup(&nsapi_sapi_module);
- daemon_atrestart(&php5_close, NULL);
+ daemon_atrestart(&php7_close, NULL);
log_error(LOG_INFORM, pblock_findval("fn", pb), sn, rq, "Initialized PHP Module (%d threads expected)", threads);
return REQ_PROCEED;
@@ -943,19 +943,19 @@ int NSAPI_PUBLIC php5_init(pblock *pb, Session *sn, Request *rq)
/*********************************************************
/ normal use in Service directive:
/
-/ Service fn="php5_execute" type=... method=... [inikey=inivalue inikey=inivalue...]
+/ Service fn="php7_execute" type=... method=... [inikey=inivalue inikey=inivalue...]
/
/ use in Service for a directory to supply a php-made directory listing instead of server default:
/
-/ Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
+/ Service fn="php7_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
/
/ use in Error SAF to display php script as error page:
/
-/ Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
-/ Error fn="php5_execute" reason="Reason" script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
+/ Error fn="php7_execute" code=XXX script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
+/ Error fn="php7_execute" reason="Reason" script="/path/to/script.php" [inikey=inivalue inikey=inivalue...]
/
/*********************************************************/
-int NSAPI_PUBLIC php5_execute(pblock *pb, Session *sn, Request *rq)
+int NSAPI_PUBLIC php7_execute(pblock *pb, Session *sn, Request *rq)
{
int retval;
nsapi_request_context *request_context;
@@ -1076,15 +1076,15 @@ int NSAPI_PUBLIC php5_execute(pblock *pb, Session *sn, Request *rq)
/ will pass authentication through to php, and allow us to
/ check authentication with our scripts.
/
-/ php5_auth_trans
+/ php7_auth_trans
/ main function called from netscape server to authenticate
/ a line in obj.conf:
-/ funcs=php5_auth_trans shlib="path/to/this/phpnsapi.dll"
+/ funcs=php7_auth_trans shlib="path/to/this/phpnsapi.dll"
/ and:
/ <Object ppath="path/to/be/authenticated/by/php/*">
-/ AuthTrans fn="php5_auth_trans"
+/ AuthTrans fn="php7_auth_trans"
/*********************************************************/
-int NSAPI_PUBLIC php5_auth_trans(pblock * pb, Session * sn, Request * rq)
+int NSAPI_PUBLIC php7_auth_trans(pblock * pb, Session * sn, Request * rq)
{
/* This is a DO NOTHING function that allows authentication
* information
diff --git a/sapi/nsapi/php5nsapi.dsp b/sapi/nsapi/php5nsapi.dsp
deleted file mode 100644
index 6cd0079b43..0000000000
--- a/sapi/nsapi/php5nsapi.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5nsapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5nsapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5nsapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5nsapi.mak" CFG="php5nsapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5nsapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5nsapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5nsapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5nsapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5nsapi___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "php5nsapi___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5nsapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5nsapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5nsapi___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5nsapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "php5nsapi___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "php5nsapi___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_DEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ns-httpd30.lib php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5nsapi - Win32 Release_TS"
-# Name "php5nsapi - Win32 Release_TS_inline"
-# Name "php5nsapi - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\nsapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/phpdbg/.travis.yml b/sapi/phpdbg/.travis.yml
index d5b492e7cf..2e777fbe13 100644
--- a/sapi/phpdbg/.travis.yml
+++ b/sapi/phpdbg/.travis.yml
@@ -4,7 +4,6 @@ env:
- PHP="PHP-5.4"
- PHP="PHP-5.5"
- PHP="PHP-5.6"
-- PHP="master"
before_script: ./travis/ci.sh
diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md
index e7e5c731a8..a2a84deb7b 100644
--- a/sapi/phpdbg/README.md
+++ b/sapi/phpdbg/README.md
@@ -1,7 +1,7 @@
The interactive PHP debugger
============================
-Implemented as a SAPI module, phpdbg can excert complete control over the environment without impacting the functionality or performance of your code.
+Implemented as a SAPI module, phpdbg can exert complete control over the environment without impacting the functionality or performance of your code.
phpdbg aims to be a lightweight, powerful, easy to use debugging platform for PHP 5.4+
diff --git a/sapi/phpdbg/phpdbg.1 b/sapi/phpdbg/phpdbg.1
index 5e4d144c83..b6c26df565 100644
--- a/sapi/phpdbg/phpdbg.1
+++ b/sapi/phpdbg/phpdbg.1
@@ -7,7 +7,7 @@ phpdbg \- The interactive PHP debugger
[\fB\-e\fIFILE\fR]
.SH DESCRIPTION
.B phpdbg
-a lightweight, powerful, easy to use debugging platform for PHP5.
+a lightweight, powerful, easy to use debugging platform for PHP7.
.SH OPTIONS
The following switches are implemented (just like cli SAPI):
.TP
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index aaed7a3a88..4388b4f86d 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -87,14 +87,14 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
REGISTER_STRINGL_CONSTANT("PHPDBG_VERSION", PHPDBG_VERSION, sizeof(PHPDBG_VERSION)-1, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_FILE", FILE_PARAM, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_METHOD", METHOD_PARAM, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_FILE", FILE_PARAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_METHOD", METHOD_PARAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_COLOR_PROMPT", PHPDBG_COLOR_PROMPT, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_COLOR_NOTICE", PHPDBG_COLOR_NOTICE, CONST_CS|CONST_PERSISTENT);
- REGISTER_INT_CONSTANT("PHPDBG_COLOR_ERROR", PHPDBG_COLOR_ERROR, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_COLOR_PROMPT", PHPDBG_COLOR_PROMPT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_COLOR_NOTICE", PHPDBG_COLOR_NOTICE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PHPDBG_COLOR_ERROR", PHPDBG_COLOR_ERROR, CONST_CS|CONST_PERSISTENT);
return SUCCESS;
} /* }}} */
@@ -308,7 +308,7 @@ static PHP_FUNCTION(phpdbg_color)
{
long element = 0L;
char *color = NULL;
- int color_len = 0;
+ size_t color_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element, &color, &color_len) == FAILURE) {
return;
@@ -329,7 +329,7 @@ static PHP_FUNCTION(phpdbg_color)
static PHP_FUNCTION(phpdbg_prompt)
{
char *prompt = NULL;
- int prompt_len = 0;
+ size_t prompt_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &prompt, &prompt_len) == FAILURE) {
return;
@@ -1296,14 +1296,14 @@ phpdbg_main:
/* do not install sigint handlers for remote consoles */
/* sending SIGINT then provides a decent way of shutting down the server */
-#if defined(ZEND_SIGNALS) && !defined(_WIN32)
- if (listen[0] < 0) {
- zend_try { zend_signal(SIGINT, phpdbg_sigint_handler TSRMLS_CC); } zend_end_try();
- }
-#elif !defined(_WIN32)
+#ifndef _WIN32
if (listen[0] < 0) {
#endif
+#if defined(ZEND_SIGNALS) && !defined(_WIN32)
+ zend_try { zend_signal(SIGINT, phpdbg_sigint_handler TSRMLS_CC); } zend_end_try();
+#else
signal(SIGINT, phpdbg_sigint_handler);
+#endif
#ifndef _WIN32
}
#endif
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index eb4faf1f94..364ef7d176 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -180,7 +180,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
HashTable registered; /* registered */
HashTable seek; /* seek oplines */
phpdbg_frame_t frame; /* frame */
- zend_uint last_line; /* last executed line */
+ uint32_t last_line; /* last executed line */
phpdbg_lexer_data lexer; /* lexer data */
phpdbg_param_t *parser_stack; /* param stack during lexer / parser phase */
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 35273554f8..e30b87c313 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -700,7 +700,7 @@ PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRML
static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, const phpdbg_param_t *param, const char *expr, size_t expr_len, zend_ulong hash TSRMLS_DC) /* {{{ */
{
phpdbg_breakcond_t new_break;
- zend_uint cops = CG(compiler_options);
+ uint32_t cops = CG(compiler_options);
zval pv;
PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_COND);
@@ -721,12 +721,12 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
new_break.code = estrndup(expr, expr_len);
new_break.code_len = expr_len;
- Z_STRSIZE(pv) = expr_len + sizeof("return ;") - 1;
- Z_STRVAL(pv) = emalloc(Z_STRSIZE(pv) + 1);
+ Z_STRLEN(pv) = expr_len + sizeof("return ;") - 1;
+ Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1);
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len);
- Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';';
- Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0';
+ Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
+ Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
Z_TYPE(pv) = IS_STRING;
new_break.ops = zend_compile_string(
@@ -970,7 +970,6 @@ static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execut
zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], (void*)&bp, &position) == SUCCESS;
zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], &position)) {
zval *retval = NULL;
- int orig_interactive = CG(interactive);
zval **orig_retval = EG(return_value_ptr_ptr);
zend_op_array *orig_ops = EG(active_op_array);
zend_op **orig_opline = EG(opline_ptr);
@@ -995,8 +994,6 @@ static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execut
zend_rebuild_symbol_table(TSRMLS_C);
}
- CG(interactive) = 0;
-
zend_try {
PHPDBG_G(flags) |= PHPDBG_IN_COND_BP;
zend_execute(EG(active_op_array) TSRMLS_CC);
@@ -1008,8 +1005,6 @@ static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execut
breakpoint = SUCCESS;
}
} zend_catch {
- CG(interactive) = orig_interactive;
-
EG(no_extensions)=1;
EG(return_value_ptr_ptr) = orig_retval;
EG(active_op_array) = orig_ops;
@@ -1017,8 +1012,6 @@ static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execut
PHPDBG_G(flags) &= ~PHPDBG_IN_COND_BP;
} zend_end_try();
- CG(interactive) = orig_interactive;
-
EG(no_extensions)=1;
EG(return_value_ptr_ptr) = orig_retval;
EG(active_op_array) = orig_ops;
@@ -1092,7 +1085,7 @@ PHPDBG_API void phpdbg_delete_breakpoint(zend_ulong num TSRMLS_DC) /* {{{ */
if ((brake = phpdbg_find_breakbase_ex(num, &table, &position TSRMLS_CC))) {
char *key;
- zend_uint klen;
+ uint32_t klen;
zend_ulong idx;
int type = brake->type;
char *name = NULL;
@@ -1370,7 +1363,7 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
HashPosition position[2];
HashTable *class_table;
char *class_name = NULL;
- zend_uint class_len = 0;
+ uint32_t class_len = 0;
zend_ulong class_idx = 0L;
phpdbg_writeln(SEPARATE);
@@ -1449,7 +1442,7 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
HashPosition position[3];
HashTable *class_table, *method_table;
char *class_name = NULL, *method_name = NULL;
- zend_uint class_len = 0, method_len = 0;
+ uint32_t class_len = 0, method_len = 0;
zend_ulong class_idx = 0L, method_idx = 0L;
phpdbg_writeln(SEPARATE);
@@ -1488,7 +1481,7 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
HashPosition position[2];
HashTable *function_table;
char *function_name = NULL;
- zend_uint function_len = 0;
+ uint32_t function_len = 0;
zend_ulong function_idx = 0L;
phpdbg_writeln(SEPARATE);
@@ -1518,7 +1511,7 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
HashPosition position[2];
HashTable *file_table;
char *file_name = NULL;
- zend_uint file_len = 0;
+ uint32_t file_len = 0;
zend_ulong file_idx = 0L;
phpdbg_writeln(SEPARATE);
diff --git a/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h
index 97980e7ed7..9c3f097d78 100644
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_break.c b/sapi/phpdbg/phpdbg_break.c
index be76b22b05..d04f2f8bb4 100644
--- a/sapi/phpdbg/phpdbg_break.c
+++ b/sapi/phpdbg/phpdbg_break.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_break.h b/sapi/phpdbg/phpdbg_break.h
index dc06da62b7..de1eff1b56 100644
--- a/sapi/phpdbg/phpdbg_break.h
+++ b/sapi/phpdbg/phpdbg_break.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index 491445399b..a155efbf9a 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_btree.h b/sapi/phpdbg/phpdbg_btree.h
index af2a6ac314..c714d8dc4c 100644
--- a/sapi/phpdbg/phpdbg_btree.h
+++ b/sapi/phpdbg/phpdbg_btree.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index a45513bee6..0437455054 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -699,7 +699,7 @@ PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *
default: {
char *list = NULL;
- zend_uint it = 0;
+ uint32_t it = 0;
size_t pos = 0;
while (it < matches) {
diff --git a/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index 571d065f59..08b50de39e 100644
--- a/sapi/phpdbg/phpdbg_cmd.h
+++ b/sapi/phpdbg/phpdbg_cmd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index 67fa6a267f..5678534005 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -114,7 +114,7 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
(void **)&class);
} else {
zend_get_object_classname(*class, (const char **)&Z_STRVAL_PP(class),
- (zend_uint *)&Z_STRSIZE_PP(class) TSRMLS_CC);
+ (uint32_t *)&Z_STRLEN_PP(class) TSRMLS_CC);
}
if (is_class == SUCCESS) {
@@ -186,14 +186,14 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */
if (zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace),
(void**)&tmp, &position) == FAILURE) {
- phpdbg_write("frame #%d: {main} at %s:%ld", i, Z_STRVAL_PP(file), Z_IVAL_PP(line));
+ phpdbg_write("frame #%d: {main} at %s:%ld", i, Z_STRVAL_PP(file), Z_LVAL_PP(line));
break;
}
if (user_defined == SUCCESS) {
phpdbg_write("frame #%d: ", i++);
phpdbg_dump_prototype(tmp TSRMLS_CC);
- phpdbg_writeln(" at %s:%ld", Z_STRVAL_PP(file), Z_IVAL_PP(line));
+ phpdbg_writeln(" at %s:%ld", Z_STRVAL_PP(file), Z_LVAL_PP(line));
} else {
phpdbg_write(" => ");
phpdbg_dump_prototype(tmp TSRMLS_CC);
diff --git a/sapi/phpdbg/phpdbg_frame.h b/sapi/phpdbg/phpdbg_frame.h
index 7c4574ed28..757f98fd71 100644
--- a/sapi/phpdbg/phpdbg_frame.h
+++ b/sapi/phpdbg/phpdbg_frame.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index c552529930..3421f7ebeb 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 16a1e771e3..c7af5c894b 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index 851e93b3c7..5911185300 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -159,7 +159,7 @@ PHPDBG_INFO(vars) /* {{{ */
switch (Z_TYPE_PP(data)) {
case IS_STRING: phpdbg_write("(string)\t"); break;
- case IS_INT: phpdbg_write("(integer)\t"); break;
+ case IS_LONG: phpdbg_write("(integer)\t"); break;
case IS_DOUBLE: phpdbg_write("(float)\t"); break;
case IS_RESOURCE: phpdbg_write("(resource)\t"); break;
case IS_ARRAY: phpdbg_write("(array)\t"); break;
diff --git a/sapi/phpdbg/phpdbg_info.h b/sapi/phpdbg/phpdbg_info.h
index c36e6bebd6..fcdc131fd5 100644
--- a/sapi/phpdbg/phpdbg_info.h
+++ b/sapi/phpdbg/phpdbg_info.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_lexer.h b/sapi/phpdbg/phpdbg_lexer.h
index ab51e7daa8..d0e259f453 100644
--- a/sapi/phpdbg/phpdbg_lexer.h
+++ b/sapi/phpdbg/phpdbg_lexer.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index e8db4e605c..eac17ba6a7 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_list.h b/sapi/phpdbg/phpdbg_list.h
index 14905f6567..84f6b63195 100644
--- a/sapi/phpdbg/phpdbg_list.h
+++ b/sapi/phpdbg/phpdbg_list.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 6b13625fc1..f33b1378bf 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -26,7 +26,7 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
-static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zend_literal *literal TSRMLS_DC) /* {{{ */
+static inline uint32_t phpdbg_decode_literal(zend_op_array *ops, zend_literal *literal TSRMLS_DC) /* {{{ */
{
int iter = 0;
@@ -40,7 +40,7 @@ static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zend_literal *
return 0;
} /* }}} */
-static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, zend_uint type, HashTable *vars TSRMLS_DC) /* {{{ */
+static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t type, HashTable *vars TSRMLS_DC) /* {{{ */
{
char *decode = NULL;
@@ -104,9 +104,6 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars TSRM
#ifdef ZEND_JMP_SET
case ZEND_JMP_SET:
#endif
-#ifdef ZEND_JMP_SET_VAR
- case ZEND_JMP_SET_VAR:
-#endif
decode[1] = phpdbg_decode_op(ops, &op->op1, op->op1_type, vars TSRMLS_CC);
asprintf(
&decode[2], "J%ld", op->op2.jmp_addr - ops->opcodes);
@@ -235,7 +232,6 @@ const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
CASE(ZEND_JMPZ_EX);
CASE(ZEND_JMPNZ_EX);
CASE(ZEND_CASE);
- CASE(ZEND_SWITCH_FREE);
CASE(ZEND_BRK);
CASE(ZEND_CONT);
CASE(ZEND_BOOL);
@@ -284,7 +280,7 @@ const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
CASE(ZEND_FETCH_UNSET);
CASE(ZEND_FETCH_DIM_UNSET);
CASE(ZEND_FETCH_OBJ_UNSET);
- CASE(ZEND_FETCH_DIM_TMP_VAR);
+ CASE(ZEND_FETCH_LIST);
CASE(ZEND_FETCH_CONSTANT);
CASE(ZEND_GOTO);
CASE(ZEND_EXT_STMT);
@@ -333,12 +329,6 @@ const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
#ifdef ZEND_SEPARATE
CASE(ZEND_SEPARATE);
#endif
-#ifdef ZEND_QM_ASSIGN_VAR
- CASE(ZEND_QM_ASSIGN_VAR);
-#endif
-#ifdef ZEND_JMP_SET_VAR
- CASE(ZEND_JMP_SET_VAR);
-#endif
#ifdef ZEND_DISCARD_EXCEPTION
CASE(ZEND_DISCARD_EXCEPTION);
#endif
diff --git a/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h
index 144442981d..647237119c 100644
--- a/sapi/phpdbg/phpdbg_opcode.h
+++ b/sapi/phpdbg/phpdbg_opcode.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index 76321a5042..eba7ed7666 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -59,7 +59,7 @@ static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC)
if (op_array) {
zend_op *opline = &(op_array->opcodes[0]);
- zend_uint opcode = 0,
+ uint32_t opcode = 0,
end = op_array->last-1;
if (method->common.scope) {
diff --git a/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index ed85e965c1..7bd096bf4e 100644
--- a/sapi/phpdbg/phpdbg_print.h
+++ b/sapi/phpdbg/phpdbg_print.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 69ad49ecc6..134ef33f6d 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -118,7 +118,7 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ *
break;
case NUMERIC_PARAM:
- add_next_index_int(&params, next->num);
+ add_next_index_long(&params, next->num);
break;
case METHOD_PARAM:
@@ -430,7 +430,7 @@ PHPDBG_COMMAND(until) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IN_UNTIL;
{
- zend_uint next = 0,
+ uint32_t next = 0,
self = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
zend_op *opline = &EG(active_op_array)->opcodes[self];
@@ -458,7 +458,7 @@ PHPDBG_COMMAND(finish) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IN_FINISH;
{
- zend_uint next = 0,
+ uint32_t next = 0,
self = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
for (next = self; next < EG(active_op_array)->last; next++) {
@@ -491,7 +491,7 @@ PHPDBG_COMMAND(leave) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IN_LEAVE;
{
- zend_uint next = 0,
+ uint32_t next = 0,
self = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
for (next = self; next < EG(active_op_array)->last; next++) {
@@ -534,7 +534,7 @@ static inline void phpdbg_handle_exception(TSRMLS_D) /* }}} */
/* get filename and linenumber before unsetting exception */
const char *filename = zend_get_executed_filename(TSRMLS_C);
- zend_uint lineno = zend_get_executed_lineno(TSRMLS_C);
+ uint32_t lineno = zend_get_executed_lineno(TSRMLS_C);
/* copy exception */
exception = *EG(exception);
@@ -1134,7 +1134,7 @@ static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_ar
}
}
- EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
+ EX(opline) = op_array->opcodes;
EG(opline_ptr) = &EX(opline);
EX(function_state).function = (zend_function *) op_array;
diff --git a/sapi/phpdbg/phpdbg_prompt.h b/sapi/phpdbg/phpdbg_prompt.h
index ef648aabeb..0bd03f03bb 100644
--- a/sapi/phpdbg/phpdbg_prompt.h
+++ b/sapi/phpdbg/phpdbg_prompt.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c
index 54269a8193..3d3eced705 100644
--- a/sapi/phpdbg/phpdbg_set.c
+++ b/sapi/phpdbg/phpdbg_set.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_set.h b/sapi/phpdbg/phpdbg_set.h
index dea61ed382..18618cd007 100644
--- a/sapi/phpdbg/phpdbg_set.h
+++ b/sapi/phpdbg/phpdbg_set.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 3ce2fade17..b57986b55c 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index 83474cd7ad..0edc40a262 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -136,10 +136,10 @@ static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, Ha
} else if (p->nKeyLength) {
Z_TYPE_P(key) = IS_STRING;
Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char*)p->arKey : estrndup(p->arKey, p->nKeyLength - 1);
- Z_STRSIZE_P(key) = p->nKeyLength - 1;
+ Z_STRLEN_P(key) = p->nKeyLength - 1;
} else {
- Z_TYPE_P(key) = IS_INT;
- Z_IVAL_P(key) = p->h;
+ Z_TYPE_P(key) = IS_LONG;
+ Z_LVAL_P(key) = p->h;
}
}
#endif
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index 10834fa9a6..054bea6d00 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -182,11 +182,11 @@ static int phpdbg_create_recursive_watchpoint(phpdbg_watchpoint_t *watch TSRMLS_
zend_hash_get_current_key_zval_ex(ht, &key, &position);
if (Z_TYPE(key) == IS_STRING) {
- new_watch->name_in_parent = zend_strndup(Z_STRVAL(key), Z_STRSIZE(key));
- new_watch->name_in_parent_len = Z_STRSIZE(key);
+ new_watch->name_in_parent = zend_strndup(Z_STRVAL(key), Z_STRLEN(key));
+ new_watch->name_in_parent_len = Z_STRLEN(key);
} else {
new_watch->name_in_parent = NULL;
- new_watch->name_in_parent_len = asprintf(&new_watch->name_in_parent, "%ld", Z_IVAL(key));
+ new_watch->name_in_parent_len = asprintf(&new_watch->name_in_parent, "%ld", Z_LVAL(key));
}
new_watch->str = NULL;
@@ -238,7 +238,7 @@ static int phpdbg_delete_watchpoint_recursive(phpdbg_watchpoint_t *watch, zend_b
if (Z_TYPE(key) == IS_STRING) {
str_len = asprintf(&str, "%.*s%s%s%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", phpdbg_get_property_key(Z_STRVAL(key)), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":"");
} else {
- str_len = asprintf(&str, "%.*s%s%li%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", Z_IVAL(key), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":"");
+ str_len = asprintf(&str, "%.*s%s%li%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", Z_LVAL(key), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":"");
}
if (zend_hash_find(&PHPDBG_G(watchpoints), str, str_len, (void **) &watchpoint) == SUCCESS) {
@@ -338,7 +338,7 @@ static int phpdbg_watchpoint_parse_input(char *input, size_t len, HashTable *par
watch->flags = 0;
zend_hash_get_current_key_zval_ex(parent, key, &position);
convert_to_string(key);
- watch->str = malloc(i + Z_STRSIZE_P(key) + 2);
+ watch->str = malloc(i + Z_STRLEN_P(key) + 2);
watch->str_len = sprintf(watch->str, "%.*s%s%s", (int)i, input, phpdbg_get_property_key(Z_STRVAL_P(key)), input[len - 1] == ']'?"]":"");
efree(key);
watch->name_in_parent = zend_strndup(last_index, index_len);
diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index d00bcff77e..7a4e49ec8f 100644
--- a/sapi/phpdbg/phpdbg_watch.h
+++ b/sapi/phpdbg/phpdbg_watch.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c
index b0cbdf267a..b55abd9e1b 100644
--- a/sapi/phpdbg/phpdbg_win.c
+++ b/sapi/phpdbg/phpdbg_win.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h
index 68c3052790..3f87c216f6 100644
--- a/sapi/phpdbg/phpdbg_win.h
+++ b/sapi/phpdbg/phpdbg_win.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phttpd/php_phttpd.h b/sapi/phttpd/php_phttpd.h
index 92409ac905..73c76cec0b 100644
--- a/sapi/phttpd/php_phttpd.h
+++ b/sapi/phttpd/php_phttpd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
index 60fc48ba35..ba8dfe3838 100644
--- a/sapi/phttpd/phttpd.c
+++ b/sapi/phttpd/phttpd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/pi3web/README b/sapi/pi3web/README
index e3e523e940..e7726edcf4 100644
--- a/sapi/pi3web/README
+++ b/sapi/pi3web/README
@@ -1,36 +1,36 @@
-PHP5 Module
+PHP7 Module
==========
-This module requires PHP5 as thread safe shared library. Have a look
+This module requires PHP7 as thread safe shared library. Have a look
into the INSTALL file which accompanies that distribution.
If you distribute this software bundled with the PHP software in source
or binary form, then you must adhere to the PHP copyright conditions -
the terms are reasonable.
-You should have checked out and built the PHP5 source package from the
-PHP CVS tree into the Pi3Web source directory called 'PHP5' first. Then
-build PHP5 as Pi3Web module and after that build the Pi3Web PHP5 wrapper:
+You should have checked out and built the PHP7 source package from the
+PHP CVS tree into the Pi3Web source directory called 'PHP7' first. Then
+build PHP7 as Pi3Web module and after that build the Pi3Web PHP7 wrapper:
-1. Checkout PHP5
+1. Checkout PHP7
================
cvs -d :pserver:cvsread@cvs.php.net:/repository login
The required password is phpfi
-cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php5
+cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php7
You must also checkout the TSRM and the ZEND module from the ZEND cvs tree
-into the PHP5 root directory
+into the PHP7 root directory
cvs -d :pserver:cvsread@cvs.zend.com:/repository login
The required password is zend
cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository co Zend TSRM
-2. Build PHP5
+2. Build PHP7
=============
2.1 POSIX
---------
-cd ./php5
+cd ./php7
./buildconf
./configure --with-pi3web
make
@@ -41,10 +41,10 @@ other required downloads from the php website
- bison 1.25
- bindlib32
- number4.tar.gz
-nmake php5dllts.mak
+nmake php7dllts.mak
-3. Build Pi3Web PHP5 wrapper
+3. Build Pi3Web PHP7 wrapper
============================
-Run make in the Pi3Web /Source/PHP5 directory.
+Run make in the Pi3Web /Source/PHP7 directory.
For further information refer to http://www.php.net/version4/
diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4
index 347a74ca06..42ff164394 100644
--- a/sapi/pi3web/config.m4
+++ b/sapi/pi3web/config.m4
@@ -17,7 +17,7 @@ if test "$PHP_PI3WEB" != "no"; then
PHP_ADD_INCLUDE($PI3PATH/PiAPI)
PHP_ADD_INCLUDE($PI3PATH/Pi2API)
PHP_ADD_INCLUDE($PI3PATH/Pi3API)
- PHP_ADD_INCLUDE($PI3PATH/PHP5)
+ PHP_ADD_INCLUDE($PI3PATH/PHP7)
PHP_SELECT_SAPI(pi3web, shared, pi3web_sapi.c)
INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/"
fi
diff --git a/sapi/pi3web/config.w32 b/sapi/pi3web/config.w32
index a5393e621b..9441784468 100644
--- a/sapi/pi3web/config.w32
+++ b/sapi/pi3web/config.w32
@@ -8,7 +8,7 @@ if (PHP_PI3WEB != "no") {
CHECK_LIB('piapi.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB) &&
CHECK_LIB('pi2api.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB) &&
CHECK_LIB('pi3api.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB)) {
- SAPI('pi3web', 'pi3web_sapi.c', 'php' + PHP_VERSION + 'pi3web.dll', '/D PHP5PI3WEB_EXPORTS');
+ SAPI('pi3web', 'pi3web_sapi.c', 'php' + PHP_VERSION + 'pi3web.dll', '/D PHP7PI3WEB_EXPORTS');
AC_DEFINE('WITH_PI3WEB', 1);
} else {
WARNING('Pi3Web not enabled; headers/libraries not found');
diff --git a/sapi/pi3web/php5pi3web.dsp b/sapi/pi3web/php5pi3web.dsp
deleted file mode 100644
index bb5a248802..0000000000
--- a/sapi/pi3web/php5pi3web.dsp
+++ /dev/null
@@ -1,136 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5pi3web" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5pi3web - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5pi3web.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5pi3web.mak" CFG="php5pi3web - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5pi3web - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5pi3web - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5pi3web - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5pi3web - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5pi3web_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /I "..\..\..\..\PIAPI" /I "..\..\..\..\PI2API" /I "..\..\..\..\PI3API" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\..\PIAPI" /libpath:"..\..\..\..\PI2API" /libpath:"..\..\..\..\PI3API"
-
-!ELSEIF "$(CFG)" == "php5pi3web - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5pi3web_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /I "..\..\..\..\PIAPI" /I "..\..\..\..\PI2API" /I "..\..\..\..\PI3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS" /libpath:"..\..\..\..\PIAPI" /libpath:"..\..\..\..\PI2API" /libpath:"..\..\..\..\PI3API"
-
-!ELSEIF "$(CFG)" == "php5pi3web - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5pi3web___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5pi3web___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\..\..\PiAPI" /I "..\..\..\Pi2API" /I "..\..\..\Pi3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /I "..\..\..\..\PIAPI" /I "..\..\..\..\PI2API" /I "..\..\..\..\PI3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\..\PiAPI" /libpath:"..\..\..\Pi2API" /libpath:"..\..\..\Pi3API"
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\..\..\PIAPI" /libpath:"..\..\..\..\PI2API" /libpath:"..\..\..\..\PI3API"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5pi3web - Win32 Debug_TS"
-# Name "php5pi3web - Win32 Release_TS"
-# Name "php5pi3web - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
index 0e17c0e029..d92526cf5e 100644
--- a/sapi/pi3web/pi3web_sapi.c
+++ b/sapi/pi3web/pi3web_sapi.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -342,7 +342,7 @@ static sapi_module_struct pi3web_sapi_module = {
STANDARD_SAPI_MODULE_PROPERTIES
};
-MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB)
+MODULE_API DWORD PHP7_wrapper(LPCONTROL_BLOCK lpCB)
{
zend_file_handle file_handle = {0};
int iRet = PIAPI_COMPLETED;
@@ -411,7 +411,7 @@ MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB)
return iRet;
}
-MODULE_API BOOL PHP5_startup() {
+MODULE_API BOOL PHP7_startup() {
tsrm_startup(1, 1, 0, NULL);
sapi_startup(&pi3web_sapi_module);
if (pi3web_sapi_module.startup) {
@@ -421,7 +421,7 @@ MODULE_API BOOL PHP5_startup() {
return IWasLoaded;
};
-MODULE_API BOOL PHP5_shutdown() {
+MODULE_API BOOL PHP7_shutdown() {
if (pi3web_sapi_module.shutdown) {
pi3web_sapi_module.shutdown(&pi3web_sapi_module);
};
diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h
index d229fec53f..83f483d924 100644
--- a/sapi/pi3web/pi3web_sapi.h
+++ b/sapi/pi3web/pi3web_sapi.h
@@ -3,7 +3,7 @@
#ifdef PHP_WIN32
# include <windows.h>
-# ifdef PHP5PI3WEB_EXPORTS
+# ifdef PHP7PI3WEB_EXPORTS
# define MODULE_API __declspec(dllexport)
# else
# define MODULE_API __declspec(dllimport)
@@ -86,9 +86,9 @@ typedef struct _CONTROL_BLOCK {
} CONTROL_BLOCK, *LPCONTROL_BLOCK;
-MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB);
-MODULE_API BOOL PHP5_startup();
-MODULE_API BOOL PHP5_shutdown();
+MODULE_API DWORD PHP7_wrapper(LPCONTROL_BLOCK lpCB);
+MODULE_API BOOL PHP7_startup();
+MODULE_API BOOL PHP7_shutdown();
// the following type declaration is for the server side
typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB );
diff --git a/sapi/roxen/README b/sapi/roxen/README
index d834a0000e..59c215cba0 100644
--- a/sapi/roxen/README
+++ b/sapi/roxen/README
@@ -8,9 +8,9 @@ script is executed at any one time). The second option is using ZTS
(Zend Thread Safe mode). Unless --enable-roxen-zts is specified, this
won't be used.
-This solution now works fine and is recommended. Multiple PHP5
+This solution now works fine and is recommended. Multiple PHP7
requests will be run in parallell. The maximum number of parallell
-PHP5-execution is limited to the number of handle threads Roxen is
+PHP7-execution is limited to the number of handle threads Roxen is
started with.
Support for this module is lacking. Please contact Roxen Internet
diff --git a/sapi/roxen/TODO b/sapi/roxen/TODO
index 248f36f52e..47143f1be1 100644
--- a/sapi/roxen/TODO
+++ b/sapi/roxen/TODO
@@ -10,18 +10,18 @@ BUGS:
And another error (when trying to include a class)
Recursive mutex locks!
- /Usr/local/pike/7.0.54/lib/modules/PHP5.so.Interpreter:
- run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php5.pike.PHPScript(),modules/scripting/php5.pike.PHPScript.done)
- modules/scripting/php5.pike:169: run()
+ /Usr/local/pike/7.0.54/lib/modules/PHP7.so.Interpreter:
+ run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php7.pike.PHPScript(),modules/scripting/php7.pike.PHPScript.done)
+ modules/scripting/php7.pike:169: run()
base_server/roxen.pike:569: handler_thread(3).
And after this every access to any php script (on other virtual sites
also) ends (of course there is no proper output) with this error:
Php4.Interpreter->run: Tried to run a PHP-script from a PHP
- callback!/usr/local/pike/7.0.54/lib/modules/PHP5.so.Interpreter:
- run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php5.pike.PHPScript(),modules/scripting/php5.pike.PHPScript.done)
- modules/scripting/php5.pike:169: run()
+ callback!/usr/local/pike/7.0.54/lib/modules/PHP7.so.Interpreter:
+ run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php7.pike.PHPScript(),modules/scripting/php7.pike.PHPScript.done)
+ modules/scripting/php7.pike:169: run()
base_server/roxen.pike:569: handler_thread(3).
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
index 7601b0c1ed..d536ac571b 100644
--- a/sapi/roxen/config.m4
+++ b/sapi/roxen/config.m4
@@ -36,7 +36,7 @@ if test "$PHP_ROXEN" != "no"; then
PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
AC_DEFINE(HAVE_ROXEN, 1, [Whether you use Roxen])
PHP_SELECT_SAPI(roxen, shared, roxen.c)
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP5.so"
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP7.so"
RESULT="yes
Pike binary used: $PIKE
Pike include dir: $PIKE_INCLUDE_DIR
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
index 14456477b0..756f7353e9 100644
--- a/sapi/roxen/roxen.c
+++ b/sapi/roxen/roxen.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -616,12 +616,12 @@ void f_php_roxen_request_handler(INT32 args)
TSRMLS_FETCH();
if(current_thread == th_self())
- php_error(E_WARNING, "PHP5.Interpreter->run: Tried to run a PHP-script from a PHP "
+ php_error(E_WARNING, "PHP7.Interpreter->run: Tried to run a PHP-script from a PHP "
"callback!");
- get_all_args("PHP5.Interpreter->run", args, "%S%m%O%*", &script,
+ get_all_args("PHP7.Interpreter->run", args, "%S%m%O%*", &script,
&request_data, &my_fd_obj, &done_callback);
if(done_callback->type != PIKE_T_FUNCTION)
- php_error(E_WARNING, "PHP5.Interpreter->run: Bad argument 4, expected function.\n");
+ php_error(E_WARNING, "PHP7.Interpreter->run: Bad argument 4, expected function.\n");
PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause
* problems in changing stuff in that object */
#ifndef ROXEN_USE_ZTS
@@ -657,7 +657,7 @@ void f_php_roxen_request_handler(INT32 args)
{
int fd = fd_from_object(raw_fd->u.object);
if(fd == -1)
- php_error(E_WARNING, "PHP5.Interpreter->run: my_fd object not open or not an FD.\n");
+ php_error(E_WARNING, "PHP7.Interpreter->run: my_fd object not open or not an FD.\n");
THIS->my_fd = fd;
} else
THIS->my_fd = 0;
diff --git a/sapi/thttpd/config.m4 b/sapi/thttpd/config.m4
index 371edaee84..fddb709d92 100644
--- a/sapi/thttpd/config.m4
+++ b/sapi/thttpd/config.m4
@@ -25,10 +25,10 @@ if test "$PHP_THTTPD" != "no"; then
fi
PHP_TARGET_RDYNAMIC
INSTALL_IT="\
- echo 'PHP_LIBS = -L. -lphp5 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \
+ echo 'PHP_LIBS = -L. -lphp7 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \
echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $THTTPD/php_makefile; \
echo 'PHP_CFLAGS = \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(CPPFLAGS) \$(EXTRA_CFLAGS)' >> $THTTPD/php_makefile; \
- rm -f $THTTPD/php_thttpd.c $THTTPD/php_thttpd.h $THTTPD/libphp5.a; \
+ rm -f $THTTPD/php_thttpd.c $THTTPD/php_thttpd.h $THTTPD/libphp7.a; \
\$(LN_S) $abs_srcdir/sapi/thttpd/thttpd.c $THTTPD/php_thttpd.c; \
\$(LN_S) $abs_srcdir/sapi/thttpd/php_thttpd.h $abs_builddir/$SAPI_STATIC $THTTPD/;\
$patch"
diff --git a/sapi/thttpd/php_thttpd.h b/sapi/thttpd/php_thttpd.h
index 75e79b4054..df7fb455e1 100644
--- a/sapi/thttpd/php_thttpd.h
+++ b/sapi/thttpd/php_thttpd.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index f6ba8585b9..7c03454f58 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -27,7 +27,7 @@
#include "php_ini.h"
#include "zend_highlight.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include <sys/time.h>
#include <sys/types.h>
@@ -181,7 +181,7 @@ static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
if (!SG(sapi_headers).http_status_line) {
ADD_VEC_S("HTTP/1.1 ");
- p = smart_str_print_long(buf+sizeof(buf)-1,
+ p = zend_print_long_to_buf(buf+sizeof(buf)-1,
SG(sapi_headers).http_response_code);
ADD_VEC(p, strlen(p));
ADD_VEC_S(" HTTP\r\n");
@@ -293,7 +293,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC)
ADD_STRING_EX("REMOTE_HOST", p);
ADD_STRING_EX("SERVER_PORT",
- smart_str_print_long(buf + sizeof(buf) - 1,
+ zend_print_long_to_buf(buf + sizeof(buf) - 1,
TG(hc)->hs->port));
buf[0] = '/';
@@ -323,7 +323,7 @@ static void sapi_thttpd_register_variables(zval *track_vars_array TSRMLS_DC)
if (TG(hc)->contentlength != -1) {
ADD_STRING_EX("CONTENT_LENGTH",
- smart_str_print_long(buf + sizeof(buf) - 1,
+ zend_print_long_to_buf(buf + sizeof(buf) - 1,
TG(hc)->contentlength));
}
@@ -468,7 +468,7 @@ static void thttpd_request_ctor(TSRMLS_D)
static void thttpd_request_dtor(TSRMLS_D)
{
- smart_str_free_ex(&TG(sbuf), 1);
+ smart_str_free(&TG(sbuf));
if (SG(request_info).query_string)
free(SG(request_info).query_string);
free(SG(request_info).request_uri);
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
index 33de921489..1a9ed29d60 100644
--- a/sapi/thttpd/thttpd_patch
+++ b/sapi/thttpd/thttpd_patch
@@ -34,7 +34,7 @@ diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in
this: $(ALL)
-thttpd: $(OBJ)
-+thttpd: $(OBJ) libphp5.a
++thttpd: $(OBJ) libphp7.a
@rm -f $@
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(NETLIBS)
@@ -240,7 +240,7 @@ diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c
+
+#define SMART_STR_USE_REALLOC
+
-+#include "ext/standard/php_smart_str.h"
++#include "zend_smart_str.h"
static void
-send_mime( httpd_conn* hc, int status, char* title, char* encodings, char* extraheads, char* type, int length, time_t mod )
diff --git a/sapi/tux/README b/sapi/tux/README
index 92c021123f..3c5ebc56ba 100644
--- a/sapi/tux/README
+++ b/sapi/tux/README
@@ -56,31 +56,31 @@ BUILD INSTRUCTIONS
$ ./configure --help
- 3. Touch a file in your web-root 'php5.tux'. This will
- cause requests to '/php5.tux' to be redirected to the
- userspace module php5.tux.
+ 3. Touch a file in your web-root 'php7.tux'. This will
+ cause requests to '/php7.tux' to be redirected to the
+ userspace module php7.tux.
4. Start TUX with something like
- # tux -d -t 8 -r /www -m /tux-modules php5.tux
+ # tux -d -t 8 -r /www -m /tux-modules php7.tux
(daemon mode, eight threads, web-root /www, modules in
- /tux-modules, load php5.tux)
+ /tux-modules, load php7.tux)
BEFORE running this command, the kernel side of TUX has to
be properly setup.
5. Try to access
- http://yourserver/php5.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
+ http://yourserver/php7.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
It should display the PHP credits page.
To access a script /foo/bar.php, use
- http://yourserver/php5.tux?/foo/bar.php
+ http://yourserver/php7.tux?/foo/bar.php
Parameters can be appended:
- http://yourserver/php5.tux?/foo/bar.php&var=value
+ http://yourserver/php7.tux?/foo/bar.php&var=value
diff --git a/sapi/tux/config.m4 b/sapi/tux/config.m4
index 06788be757..db4be82cf1 100644
--- a/sapi/tux/config.m4
+++ b/sapi/tux/config.m4
@@ -7,7 +7,7 @@ PHP_ARG_WITH(tux,,
AC_MSG_CHECKING([for TUX])
if test "$PHP_TUX" != "no"; then
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_TUX/php5.tux.so"
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PHP_TUX/php7.tux.so"
AC_CHECK_HEADERS(tuxmodule.h,[:],[AC_MSG_ERROR([Cannot find tuxmodule.h])])
PHP_SELECT_SAPI(tux, shared, php_tux.c)
AC_MSG_RESULT([$PHP_TUX])
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
index 9dba8efbfe..783fe852bc 100644
--- a/sapi/tux/php_tux.c
+++ b/sapi/tux/php_tux.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -21,7 +21,7 @@
#include "php_main.h"
#include "php_variables.h"
-#include "ext/standard/php_smart_str.h"
+#include "zend_smart_str.h"
#include "tuxmodule.h"
diff --git a/sapi/webjames/README b/sapi/webjames/README
index 746a7762fb..15a7be3de0 100644
--- a/sapi/webjames/README
+++ b/sapi/webjames/README
@@ -16,7 +16,7 @@ http://www.webjames.alexwaugh.com/
BUILDING
-$ cd php5
+$ cd php7
$ ./configure \
--host=arm-riscos-aof \
--with-webjames=../webjames/src \
diff --git a/sapi/webjames/php_webjames.h b/sapi/webjames/php_webjames.h
index dcb6cdb911..08f4a11442 100644
--- a/sapi/webjames/php_webjames.h
+++ b/sapi/webjames/php_webjames.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c
index 264f910af4..2978131ac1 100644
--- a/sapi/webjames/webjames.c
+++ b/sapi/webjames/webjames.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/scripts/dev/check_parameters.php b/scripts/dev/check_parameters.php
index c9f5169eec..658471ef2a 100644
--- a/scripts/dev/check_parameters.php
+++ b/scripts/dev/check_parameters.php
@@ -1,7 +1,7 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/scripts/dev/credits b/scripts/dev/credits
index 801637cd19..5be84fda07 100755
--- a/scripts/dev/credits
+++ b/scripts/dev/credits
@@ -10,9 +10,9 @@ do
/*
DO NOT EDIT THIS FILE!
- it has been automaticaly created by php5/scripts/credits from
- the information found in the various php5/ext/.../CREDITS and
- php5/sapi/.../CREDITS files
+ it has been automaticaly created by php7/scripts/credits from
+ the information found in the various php7/ext/.../CREDITS and
+ php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
diff --git a/scripts/dev/search_underscores.php b/scripts/dev/search_underscores.php
index 445228b8c5..67ed02f160 100755
--- a/scripts/dev/search_underscores.php
+++ b/scripts/dev/search_underscores.php
@@ -3,7 +3,7 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/server-tests.php b/server-tests.php
index 688fee485a..8666895a96 100755
--- a/server-tests.php
+++ b/server-tests.php
@@ -1,7 +1,7 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/tests/classes/constants_error_005.phpt b/tests/classes/constants_error_005.phpt
index 1283783de7..25f36460b7 100644
--- a/tests/classes/constants_error_005.phpt
+++ b/tests/classes/constants_error_005.phpt
@@ -8,5 +8,4 @@ Error case: class constant as an encapsed containing a variable
}
?>
--EXPECTF--
-
-Parse error: %s in %s on line %d
+Fatal error: Constant expression contains invalid operations in %s on line %d
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
index cca528e29c..0b8cf2650e 100644
--- a/tests/classes/inheritance_002.phpt
+++ b/tests/classes/inheritance_002.phpt
@@ -17,13 +17,13 @@ class Child_php4 extends Base_php4 {
}
}
-class Base_php5 {
+class Base_php7 {
function __construct() {
var_dump('Base constructor');
}
}
-class Child_php5 extends Base_php5 {
+class Child_php7 extends Base_php7 {
function __construct() {
var_dump('Child constructor');
parent::__construct();
@@ -37,7 +37,7 @@ class Child_mx1 extends Base_php4 {
}
}
-class Child_mx2 extends Base_php5 {
+class Child_mx2 extends Base_php7 {
function Child_mx2() {
var_dump('Child constructor');
parent::__construct();
@@ -47,8 +47,8 @@ class Child_mx2 extends Base_php5 {
echo "### PHP 4 style\n";
$c4= new Child_php4();
-echo "### PHP 5 style\n";
-$c5= new Child_php5();
+echo "### PHP 7 style\n";
+$c5= new Child_php7();
echo "### Mixed style 1\n";
$cm= new Child_mx1();
@@ -60,7 +60,7 @@ $cm= new Child_mx2();
### PHP 4 style
string(17) "Child constructor"
string(16) "Base constructor"
-### PHP 5 style
+### PHP 7 style
string(17) "Child constructor"
string(16) "Base constructor"
### Mixed style 1
diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt
index 3570b35928..f80bd756f3 100644
--- a/tests/classes/interface_method.phpt
+++ b/tests/classes/interface_method.phpt
@@ -6,7 +6,7 @@ ZE2 An interface method must be abstract
<?php
interface if_a {
- function err() {};
+ function err() {}
}
?>
diff --git a/tests/classes/method_call_variation_001.phpt b/tests/classes/method_call_variation_001.phpt
index dd43cfd1cb..7950b7deb3 100644
--- a/tests/classes/method_call_variation_001.phpt
+++ b/tests/classes/method_call_variation_001.phpt
@@ -1,37 +1,27 @@
--TEST--
-In $a->$b[Y](), $b[Y] represents a method name on $a. But in $a->X[Y](), $a->X[Y] represents a global function name.
+In $a->$b[Y]() and $a->X[Y]() both $a->$b[Y] and $a->X[Y] represent a global function name
--FILE--
<?php
- class C
- {
- function foo($a, $b)
- {
- echo "Called C::foo($a, $b)\n";
- }
- }
-
- $c = new C;
-
- $functions[0] = 'foo';
- $functions[1][2][3][4] = 'foo';
-
- $c->$functions[0](1, 2);
- $c->$functions[1][2][3][4](3, 4);
-
-
- function foo($a, $b)
- {
+ class C {}
+
+ function foo($a, $b) {
echo "Called global foo($a, $b)\n";
}
-
+
+ $name = 'functions';
+
+ $c = new C;
$c->functions[0] = 'foo';
$c->functions[1][2][3][4] = 'foo';
+ $c->$name[0](1, 2);
+ $c->$name[1][2][3][4](3, 4);
+
$c->functions[0](5, 6);
$c->functions[1][2][3][4](7, 8);
?>
--EXPECTF--
-Called C::foo(1, 2)
-Called C::foo(3, 4)
+Called global foo(1, 2)
+Called global foo(3, 4)
Called global foo(5, 6)
Called global foo(7, 8)
diff --git a/tests/lang/bug24396.phpt b/tests/lang/bug24396.phpt
index b78e4b8757..80862191de 100644
--- a/tests/lang/bug24396.phpt
+++ b/tests/lang/bug24396.phpt
@@ -6,7 +6,7 @@ Bug #24396 (global $$variable broken)
$arr = array('a' => 1, 'b' => 2, 'c' => 3);
foreach($arr as $k=>$v) {
- global $$k; // comment this out and it works in PHP 5 too..
+ global $$k; // comment this out and it works in PHP 7 too..
echo "($k => $v)\n";
diff --git a/tests/lang/engine_assignExecutionOrder_002.phpt b/tests/lang/engine_assignExecutionOrder_002.phpt
index ba88150dd4..c090a452c3 100644
--- a/tests/lang/engine_assignExecutionOrder_002.phpt
+++ b/tests/lang/engine_assignExecutionOrder_002.phpt
@@ -26,7 +26,7 @@ $g1 = array(10,10);
$g2 = array(20,20);
$g3 = array(30,30);
$g = array($g1,$g2,$g3);
-list($e[$f++],$e[$f++]) = $g[$f];
+list($e[$f++],$e[$f++]) = $g[2];
// expect 30,30
var_dump($e);
@@ -39,7 +39,7 @@ $i = array($i1,$i2,$i3,$i4);
$j = array(0,0,0);
$h = 0;
// a list of lists
-list(list($j[$h++],$j[$h++]),$j[$h++]) = $i[$h];
+list(list($j[$h++],$j[$h++]),$j[$h++]) = $i[3];
var_dump($j);
@@ -116,9 +116,9 @@ L=100 M=200 N=300
O= and P=
10 20 40 50 60 70 80
-Notice: Undefined offset: 1 in %s on line %d
-
Notice: Undefined offset: 0 in %s on line %d
+
+Notice: Undefined offset: 1 in %s on line %d
Y=,Z=
Notice: Undefined offset: 1 in %s on line %d
diff --git a/tests/lang/engine_assignExecutionOrder_004.phpt b/tests/lang/engine_assignExecutionOrder_004.phpt
index 86bc87f9c7..9471b7f063 100644
--- a/tests/lang/engine_assignExecutionOrder_004.phpt
+++ b/tests/lang/engine_assignExecutionOrder_004.phpt
@@ -18,15 +18,8 @@ function i3() {
return 3;
}
-function i4() {
- global $a;
- $a = array(10, 11, 12, 13, 14);
- echo "i4\n";
- return 4;
-}
-
-$a = 0; // $a should not be indexable till the i4 has been executed
-list($a[i1()+i2()], , list($a[i3()], $a[i4()]), $a[]) = array (0, 1, array(30, 40), 3, 4);
+$a = array(10, 11, 12, 13);
+list($a[i1()+i2()], , list($a[i3()], $a[])) = array(0, 1, array(30, 40), 3);
var_dump($a);
@@ -35,8 +28,7 @@ var_dump($a);
i1
i2
i3
-i4
-array(6) {
+array(5) {
[0]=>
int(10)
[1]=>
@@ -47,6 +39,4 @@ array(6) {
int(30)
[4]=>
int(40)
- [5]=>
- int(3)
}
diff --git a/tests/lang/foreachLoop.013.phpt b/tests/lang/foreachLoop.013.phpt
index 3dec1194ff..b0c5e8dcf5 100644
--- a/tests/lang/foreachLoop.013.phpt
+++ b/tests/lang/foreachLoop.013.phpt
@@ -1,5 +1,7 @@
--TEST--
Directly modifying an unreferenced array when foreach'ing over it while using &$value syntax.
+--XFAIL--
+Needs major foreach changes to get sane behavior
--FILE--
<?php
diff --git a/tests/lang/foreachLoop.014.phpt b/tests/lang/foreachLoop.014.phpt
index ab3c657715..d32ea635fd 100644
--- a/tests/lang/foreachLoop.014.phpt
+++ b/tests/lang/foreachLoop.014.phpt
@@ -1,5 +1,7 @@
--TEST--
Directly modifying a REFERENCED array when foreach'ing over it.
+--XFAIL--
+Needs major foreach changes to get sane behavior
--FILE--
<?php
@@ -553,4 +555,4 @@ array(10) {
string(3) "v.2"
[9]=>
string(3) "v.3"
-} \ No newline at end of file
+}
diff --git a/tests/lang/foreachLoop.015.phpt b/tests/lang/foreachLoop.015.phpt
index dfba159153..5b12a2b0c2 100644
--- a/tests/lang/foreachLoop.015.phpt
+++ b/tests/lang/foreachLoop.015.phpt
@@ -1,5 +1,7 @@
--TEST--
Directly modifying a REFERENCED array when foreach'ing over it while using &$value syntax.
+--XFAIL--
+Needs major foreach changes to get sane behavior
--FILE--
<?php
diff --git a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
index 24da2d0dc4..d784ed6601 100644
--- a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
@@ -44,25 +44,25 @@ int(9223372036854775807)
--- testing: 9223372036854775807 << 1 ---
int(-2)
--- testing: 9223372036854775807 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 9223372036854775807 << 7 ---
int(-128)
--- testing: 9223372036854775807 << 9 ---
int(-512)
--- testing: 9223372036854775807 << 65 ---
-int(-2)
+int(0)
--- testing: 9223372036854775807 << -44 ---
-int(-1048576)
+bool(false)
--- testing: 9223372036854775807 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9223372036854775807 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: -9223372036854775808 << 0 ---
int(-9223372036854775808)
--- testing: -9223372036854775808 << 1 ---
int(0)
--- testing: -9223372036854775808 << -1 ---
-int(0)
+bool(false)
--- testing: -9223372036854775808 << 7 ---
int(0)
--- testing: -9223372036854775808 << 9 ---
@@ -70,7 +70,7 @@ int(0)
--- testing: -9223372036854775808 << 65 ---
int(0)
--- testing: -9223372036854775808 << -44 ---
-int(0)
+bool(false)
--- testing: -9223372036854775808 << 2147483647 ---
int(0)
--- testing: -9223372036854775808 << 9223372036854775807 ---
@@ -80,33 +80,33 @@ int(2147483647)
--- testing: 2147483647 << 1 ---
int(4294967294)
--- testing: 2147483647 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 2147483647 << 7 ---
int(274877906816)
--- testing: 2147483647 << 9 ---
int(1099511627264)
--- testing: 2147483647 << 65 ---
-int(4294967294)
+int(0)
--- testing: 2147483647 << -44 ---
-int(2251799812636672)
+bool(false)
--- testing: 2147483647 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 2147483647 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: -2147483648 << 0 ---
int(-2147483648)
--- testing: -2147483648 << 1 ---
int(-4294967296)
--- testing: -2147483648 << -1 ---
-int(0)
+bool(false)
--- testing: -2147483648 << 7 ---
int(-274877906944)
--- testing: -2147483648 << 9 ---
int(-1099511627776)
--- testing: -2147483648 << 65 ---
-int(-4294967296)
+int(0)
--- testing: -2147483648 << -44 ---
-int(-2251799813685248)
+bool(false)
--- testing: -2147483648 << 2147483647 ---
int(0)
--- testing: -2147483648 << 9223372036854775807 ---
@@ -116,15 +116,15 @@ int(9223372034707292160)
--- testing: 9223372034707292160 << 1 ---
int(-4294967296)
--- testing: 9223372034707292160 << -1 ---
-int(0)
+bool(false)
--- testing: 9223372034707292160 << 7 ---
int(-274877906944)
--- testing: 9223372034707292160 << 9 ---
int(-1099511627776)
--- testing: 9223372034707292160 << 65 ---
-int(-4294967296)
+int(0)
--- testing: 9223372034707292160 << -44 ---
-int(-2251799813685248)
+bool(false)
--- testing: 9223372034707292160 << 2147483647 ---
int(0)
--- testing: 9223372034707292160 << 9223372036854775807 ---
@@ -134,15 +134,15 @@ int(-9223372034707292160)
--- testing: -9223372034707292160 << 1 ---
int(4294967296)
--- testing: -9223372034707292160 << -1 ---
-int(0)
+bool(false)
--- testing: -9223372034707292160 << 7 ---
int(274877906944)
--- testing: -9223372034707292160 << 9 ---
int(1099511627776)
--- testing: -9223372034707292160 << 65 ---
-int(4294967296)
+int(0)
--- testing: -9223372034707292160 << -44 ---
-int(2251799813685248)
+bool(false)
--- testing: -9223372034707292160 << 2147483647 ---
int(0)
--- testing: -9223372034707292160 << 9223372036854775807 ---
@@ -152,15 +152,15 @@ int(2147483648)
--- testing: 2147483648 << 1 ---
int(4294967296)
--- testing: 2147483648 << -1 ---
-int(0)
+bool(false)
--- testing: 2147483648 << 7 ---
int(274877906944)
--- testing: 2147483648 << 9 ---
int(1099511627776)
--- testing: 2147483648 << 65 ---
-int(4294967296)
+int(0)
--- testing: 2147483648 << -44 ---
-int(2251799813685248)
+bool(false)
--- testing: 2147483648 << 2147483647 ---
int(0)
--- testing: 2147483648 << 9223372036854775807 ---
@@ -170,33 +170,33 @@ int(-2147483649)
--- testing: -2147483649 << 1 ---
int(-4294967298)
--- testing: -2147483649 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: -2147483649 << 7 ---
int(-274877907072)
--- testing: -2147483649 << 9 ---
int(-1099511628288)
--- testing: -2147483649 << 65 ---
-int(-4294967298)
+int(0)
--- testing: -2147483649 << -44 ---
-int(-2251799814733824)
+bool(false)
--- testing: -2147483649 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: -2147483649 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 4294967294 << 0 ---
int(4294967294)
--- testing: 4294967294 << 1 ---
int(8589934588)
--- testing: 4294967294 << -1 ---
-int(0)
+bool(false)
--- testing: 4294967294 << 7 ---
int(549755813632)
--- testing: 4294967294 << 9 ---
int(2199023254528)
--- testing: 4294967294 << 65 ---
-int(8589934588)
+int(0)
--- testing: 4294967294 << -44 ---
-int(4503599625273344)
+bool(false)
--- testing: 4294967294 << 2147483647 ---
int(0)
--- testing: 4294967294 << 9223372036854775807 ---
@@ -206,51 +206,51 @@ int(4294967295)
--- testing: 4294967295 << 1 ---
int(8589934590)
--- testing: 4294967295 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 4294967295 << 7 ---
int(549755813760)
--- testing: 4294967295 << 9 ---
int(2199023255040)
--- testing: 4294967295 << 65 ---
-int(8589934590)
+int(0)
--- testing: 4294967295 << -44 ---
-int(4503599626321920)
+bool(false)
--- testing: 4294967295 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 4294967295 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 4294967293 << 0 ---
int(4294967293)
--- testing: 4294967293 << 1 ---
int(8589934586)
--- testing: 4294967293 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 4294967293 << 7 ---
int(549755813504)
--- testing: 4294967293 << 9 ---
int(2199023254016)
--- testing: 4294967293 << 65 ---
-int(8589934586)
+int(0)
--- testing: 4294967293 << -44 ---
-int(4503599624224768)
+bool(false)
--- testing: 4294967293 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 4294967293 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9223372036854775806 << 0 ---
int(9223372036854775806)
--- testing: 9223372036854775806 << 1 ---
int(-4)
--- testing: 9223372036854775806 << -1 ---
-int(0)
+bool(false)
--- testing: 9223372036854775806 << 7 ---
int(-256)
--- testing: 9223372036854775806 << 9 ---
int(-1024)
--- testing: 9223372036854775806 << 65 ---
-int(-4)
+int(0)
--- testing: 9223372036854775806 << -44 ---
-int(-2097152)
+bool(false)
--- testing: 9223372036854775806 << 2147483647 ---
int(0)
--- testing: 9223372036854775806 << 9223372036854775807 ---
@@ -260,7 +260,7 @@ int(-9223372036854775808)
--- testing: 9.2233720368548E+18 << 1 ---
int(0)
--- testing: 9.2233720368548E+18 << -1 ---
-int(0)
+bool(false)
--- testing: 9.2233720368548E+18 << 7 ---
int(0)
--- testing: 9.2233720368548E+18 << 9 ---
@@ -268,7 +268,7 @@ int(0)
--- testing: 9.2233720368548E+18 << 65 ---
int(0)
--- testing: 9.2233720368548E+18 << -44 ---
-int(0)
+bool(false)
--- testing: 9.2233720368548E+18 << 2147483647 ---
int(0)
--- testing: 9.2233720368548E+18 << 9223372036854775807 ---
@@ -278,25 +278,25 @@ int(-9223372036854775807)
--- testing: -9223372036854775807 << 1 ---
int(2)
--- testing: -9223372036854775807 << -1 ---
-int(-9223372036854775808)
+bool(false)
--- testing: -9223372036854775807 << 7 ---
int(128)
--- testing: -9223372036854775807 << 9 ---
int(512)
--- testing: -9223372036854775807 << 65 ---
-int(2)
+int(0)
--- testing: -9223372036854775807 << -44 ---
-int(1048576)
+bool(false)
--- testing: -9223372036854775807 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: -9223372036854775807 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: -9.2233720368548E+18 << 0 ---
int(-9223372036854775808)
--- testing: -9.2233720368548E+18 << 1 ---
int(0)
--- testing: -9.2233720368548E+18 << -1 ---
-int(0)
+bool(false)
--- testing: -9.2233720368548E+18 << 7 ---
int(0)
--- testing: -9.2233720368548E+18 << 9 ---
@@ -304,7 +304,7 @@ int(0)
--- testing: -9.2233720368548E+18 << 65 ---
int(0)
--- testing: -9.2233720368548E+18 << -44 ---
-int(0)
+bool(false)
--- testing: -9.2233720368548E+18 << 2147483647 ---
int(0)
--- testing: -9.2233720368548E+18 << 9223372036854775807 ---
@@ -312,19 +312,19 @@ int(0)
--- testing: 0 << 9223372036854775807 ---
int(0)
--- testing: 0 << -9223372036854775808 ---
-int(0)
+bool(false)
--- testing: 0 << 2147483647 ---
int(0)
--- testing: 0 << -2147483648 ---
-int(0)
+bool(false)
--- testing: 0 << 9223372034707292160 ---
int(0)
--- testing: 0 << -9223372034707292160 ---
-int(0)
+bool(false)
--- testing: 0 << 2147483648 ---
int(0)
--- testing: 0 << -2147483649 ---
-int(0)
+bool(false)
--- testing: 0 << 4294967294 ---
int(0)
--- testing: 0 << 4294967295 ---
@@ -334,250 +334,249 @@ int(0)
--- testing: 0 << 9223372036854775806 ---
int(0)
--- testing: 0 << 9.2233720368548E+18 ---
-int(0)
+bool(false)
--- testing: 0 << -9223372036854775807 ---
-int(0)
+bool(false)
--- testing: 0 << -9.2233720368548E+18 ---
-int(0)
+bool(false)
--- testing: 1 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 1 << -9223372036854775808 ---
-int(1)
+bool(false)
--- testing: 1 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 1 << -2147483648 ---
-int(1)
+bool(false)
--- testing: 1 << 9223372034707292160 ---
-int(1)
+int(0)
--- testing: 1 << -9223372034707292160 ---
-int(1)
+bool(false)
--- testing: 1 << 2147483648 ---
-int(1)
+int(0)
--- testing: 1 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 1 << 4294967294 ---
-int(4611686018427387904)
+int(0)
--- testing: 1 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 1 << 4294967293 ---
-int(2305843009213693952)
+int(0)
--- testing: 1 << 9223372036854775806 ---
-int(4611686018427387904)
+int(0)
--- testing: 1 << 9.2233720368548E+18 ---
-int(1)
+bool(false)
--- testing: 1 << -9223372036854775807 ---
-int(2)
+bool(false)
--- testing: 1 << -9.2233720368548E+18 ---
-int(1)
+bool(false)
--- testing: -1 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: -1 << -9223372036854775808 ---
-int(-1)
+bool(false)
--- testing: -1 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: -1 << -2147483648 ---
-int(-1)
+bool(false)
--- testing: -1 << 9223372034707292160 ---
-int(-1)
+int(0)
--- testing: -1 << -9223372034707292160 ---
-int(-1)
+bool(false)
--- testing: -1 << 2147483648 ---
-int(-1)
+int(0)
--- testing: -1 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: -1 << 4294967294 ---
-int(-4611686018427387904)
+int(0)
--- testing: -1 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: -1 << 4294967293 ---
-int(-2305843009213693952)
+int(0)
--- testing: -1 << 9223372036854775806 ---
-int(-4611686018427387904)
+int(0)
--- testing: -1 << 9.2233720368548E+18 ---
-int(-1)
+bool(false)
--- testing: -1 << -9223372036854775807 ---
-int(-2)
+bool(false)
--- testing: -1 << -9.2233720368548E+18 ---
-int(-1)
+bool(false)
--- testing: 7 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 7 << -9223372036854775808 ---
-int(7)
+bool(false)
--- testing: 7 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 7 << -2147483648 ---
-int(7)
+bool(false)
--- testing: 7 << 9223372034707292160 ---
-int(7)
+int(0)
--- testing: 7 << -9223372034707292160 ---
-int(7)
+bool(false)
--- testing: 7 << 2147483648 ---
-int(7)
+int(0)
--- testing: 7 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 7 << 4294967294 ---
-int(-4611686018427387904)
+int(0)
--- testing: 7 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 7 << 4294967293 ---
-int(-2305843009213693952)
+int(0)
--- testing: 7 << 9223372036854775806 ---
-int(-4611686018427387904)
+int(0)
--- testing: 7 << 9.2233720368548E+18 ---
-int(7)
+bool(false)
--- testing: 7 << -9223372036854775807 ---
-int(14)
+bool(false)
--- testing: 7 << -9.2233720368548E+18 ---
-int(7)
+bool(false)
--- testing: 9 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9 << -9223372036854775808 ---
-int(9)
+bool(false)
--- testing: 9 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9 << -2147483648 ---
-int(9)
+bool(false)
--- testing: 9 << 9223372034707292160 ---
-int(9)
+int(0)
--- testing: 9 << -9223372034707292160 ---
-int(9)
+bool(false)
--- testing: 9 << 2147483648 ---
-int(9)
+int(0)
--- testing: 9 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 9 << 4294967294 ---
-int(4611686018427387904)
+int(0)
--- testing: 9 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9 << 4294967293 ---
-int(2305843009213693952)
+int(0)
--- testing: 9 << 9223372036854775806 ---
-int(4611686018427387904)
+int(0)
--- testing: 9 << 9.2233720368548E+18 ---
-int(9)
+bool(false)
--- testing: 9 << -9223372036854775807 ---
-int(18)
+bool(false)
--- testing: 9 << -9.2233720368548E+18 ---
-int(9)
+bool(false)
--- testing: 65 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 65 << -9223372036854775808 ---
-int(65)
+bool(false)
--- testing: 65 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 65 << -2147483648 ---
-int(65)
+bool(false)
--- testing: 65 << 9223372034707292160 ---
-int(65)
+int(0)
--- testing: 65 << -9223372034707292160 ---
-int(65)
+bool(false)
--- testing: 65 << 2147483648 ---
-int(65)
+int(0)
--- testing: 65 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 65 << 4294967294 ---
-int(4611686018427387904)
+int(0)
--- testing: 65 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 65 << 4294967293 ---
-int(2305843009213693952)
+int(0)
--- testing: 65 << 9223372036854775806 ---
-int(4611686018427387904)
+int(0)
--- testing: 65 << 9.2233720368548E+18 ---
-int(65)
+bool(false)
--- testing: 65 << -9223372036854775807 ---
-int(130)
+bool(false)
--- testing: 65 << -9.2233720368548E+18 ---
-int(65)
+bool(false)
--- testing: -44 << 9223372036854775807 ---
int(0)
--- testing: -44 << -9223372036854775808 ---
-int(-44)
+bool(false)
--- testing: -44 << 2147483647 ---
int(0)
--- testing: -44 << -2147483648 ---
-int(-44)
+bool(false)
--- testing: -44 << 9223372034707292160 ---
-int(-44)
+int(0)
--- testing: -44 << -9223372034707292160 ---
-int(-44)
+bool(false)
--- testing: -44 << 2147483648 ---
-int(-44)
---- testing: -44 << -2147483649 ---
int(0)
+--- testing: -44 << -2147483649 ---
+bool(false)
--- testing: -44 << 4294967294 ---
int(0)
--- testing: -44 << 4294967295 ---
int(0)
--- testing: -44 << 4294967293 ---
-int(-9223372036854775808)
+int(0)
--- testing: -44 << 9223372036854775806 ---
int(0)
--- testing: -44 << 9.2233720368548E+18 ---
-int(-44)
+bool(false)
--- testing: -44 << -9223372036854775807 ---
-int(-88)
+bool(false)
--- testing: -44 << -9.2233720368548E+18 ---
-int(-44)
+bool(false)
--- testing: 2147483647 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 2147483647 << -9223372036854775808 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 2147483647 << -2147483648 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 << 9223372034707292160 ---
-int(2147483647)
+int(0)
--- testing: 2147483647 << -9223372034707292160 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 << 2147483648 ---
-int(2147483647)
+int(0)
--- testing: 2147483647 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 2147483647 << 4294967294 ---
-int(-4611686018427387904)
+int(0)
--- testing: 2147483647 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 2147483647 << 4294967293 ---
-int(-2305843009213693952)
+int(0)
--- testing: 2147483647 << 9223372036854775806 ---
-int(-4611686018427387904)
+int(0)
--- testing: 2147483647 << 9.2233720368548E+18 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 << -9223372036854775807 ---
-int(4294967294)
+bool(false)
--- testing: 2147483647 << -9.2233720368548E+18 ---
-int(2147483647)
+bool(false)
--- testing: 9223372036854775807 << 9223372036854775807 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9223372036854775807 << -9223372036854775808 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 << 2147483647 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9223372036854775807 << -2147483648 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 << 9223372034707292160 ---
-int(9223372036854775807)
+int(0)
--- testing: 9223372036854775807 << -9223372034707292160 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 << 2147483648 ---
-int(9223372036854775807)
+int(0)
--- testing: 9223372036854775807 << -2147483649 ---
-int(-9223372036854775808)
+bool(false)
--- testing: 9223372036854775807 << 4294967294 ---
-int(-4611686018427387904)
+int(0)
--- testing: 9223372036854775807 << 4294967295 ---
-int(-9223372036854775808)
+int(0)
--- testing: 9223372036854775807 << 4294967293 ---
-int(-2305843009213693952)
+int(0)
--- testing: 9223372036854775807 << 9223372036854775806 ---
-int(-4611686018427387904)
+int(0)
--- testing: 9223372036854775807 << 9.2233720368548E+18 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 << -9223372036854775807 ---
-int(-2)
+bool(false)
--- testing: 9223372036854775807 << -9.2233720368548E+18 ---
-int(9223372036854775807)
-===DONE===
- \ No newline at end of file
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
index e13fc3bc1b..d507577777 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
@@ -3,7 +3,6 @@ Test << operator : various numbers as strings
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-if ((65<<65)==0) die("skip this test is for Intel only");
?>
--FILE--
<?php
@@ -18,7 +17,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
echo "--- testing: '$strVal' << '$otherVal' ---\n";
- var_dump(bin2hex($strVal<<$otherVal));
+ var_dump(strVal<<$otherVal);
}
}
@@ -26,396 +25,395 @@ foreach ($strVals as $strVal) {
===DONE===
--EXPECT--
--- testing: '0' << '0' ---
-string(2) "30"
+int(0)
--- testing: '0' << '65' ---
-string(2) "30"
+int(0)
--- testing: '0' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: '0' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: '0' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '0' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '0' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '0' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: '0' << 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '65' << '0' ---
-string(4) "3635"
+int(0)
--- testing: '65' << '65' ---
-string(6) "313330"
+int(0)
--- testing: '65' << '-44' ---
-string(16) "3638313537343430"
+bool(false)
--- testing: '65' << '1.2' ---
-string(6) "313330"
+int(0)
--- testing: '65' << '-7.7' ---
-string(22) "2d32313133393239323136"
+bool(false)
--- testing: '65' << 'abc' ---
-string(4) "3635"
+int(0)
--- testing: '65' << '123abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << '123e5' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << '123e5xyz' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << ' 123abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << '123 abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << '123abc ' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '65' << '3.4a' ---
-string(6) "353230"
+int(0)
--- testing: '65' << 'a5.9' ---
-string(4) "3635"
+int(0)
--- testing: '-44' << '0' ---
-string(6) "2d3434"
+int(0)
--- testing: '-44' << '65' ---
-string(6) "2d3838"
+int(0)
--- testing: '-44' << '-44' ---
-string(18) "2d3436313337333434"
+bool(false)
--- testing: '-44' << '1.2' ---
-string(6) "2d3838"
+int(0)
--- testing: '-44' << '-7.7' ---
-string(22) "2d31343736333935303038"
+bool(false)
--- testing: '-44' << 'abc' ---
-string(6) "2d3434"
+int(0)
--- testing: '-44' << '123abc' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << '123e5' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << '123e5xyz' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << ' 123abc' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << '123 abc' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << '123abc ' ---
-string(22) "2d31363130363132373336"
+int(0)
--- testing: '-44' << '3.4a' ---
-string(8) "2d333532"
+int(0)
--- testing: '-44' << 'a5.9' ---
-string(6) "2d3434"
+int(0)
--- testing: '1.2' << '0' ---
-string(2) "31"
+int(0)
--- testing: '1.2' << '65' ---
-string(2) "32"
+int(0)
--- testing: '1.2' << '-44' ---
-string(14) "31303438353736"
+bool(false)
--- testing: '1.2' << '1.2' ---
-string(2) "32"
+int(0)
--- testing: '1.2' << '-7.7' ---
-string(16) "3333353534343332"
+bool(false)
--- testing: '1.2' << 'abc' ---
-string(2) "31"
+int(0)
--- testing: '1.2' << '123abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << '123e5' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << '123e5xyz' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << ' 123abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << '123 abc' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << '123abc ' ---
-string(18) "313334323137373238"
+int(0)
--- testing: '1.2' << '3.4a' ---
-string(2) "38"
+int(0)
--- testing: '1.2' << 'a5.9' ---
-string(2) "31"
+int(0)
--- testing: '-7.7' << '0' ---
-string(4) "2d37"
+int(0)
--- testing: '-7.7' << '65' ---
-string(6) "2d3134"
+int(0)
--- testing: '-7.7' << '-44' ---
-string(16) "2d37333430303332"
+bool(false)
--- testing: '-7.7' << '1.2' ---
-string(6) "2d3134"
+int(0)
--- testing: '-7.7' << '-7.7' ---
-string(20) "2d323334383831303234"
+bool(false)
--- testing: '-7.7' << 'abc' ---
-string(4) "2d37"
+int(0)
--- testing: '-7.7' << '123abc' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << '123e5' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << '123e5xyz' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << ' 123abc' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << '123 abc' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << '123abc ' ---
-string(20) "2d393339353234303936"
+int(0)
--- testing: '-7.7' << '3.4a' ---
-string(6) "2d3536"
+int(0)
--- testing: '-7.7' << 'a5.9' ---
-string(4) "2d37"
+int(0)
--- testing: 'abc' << '0' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '65' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '123abc' << '0' ---
-string(6) "313233"
+int(0)
--- testing: '123abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123abc' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: '123abc' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: '123abc' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: '123abc' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: '123abc' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: '123e5' << '0' ---
-string(6) "313233"
+int(0)
--- testing: '123e5' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123e5' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123e5' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: '123e5' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: '123e5' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: '123e5' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: '123e5' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: '123e5xyz' << '0' ---
-string(6) "313233"
+int(0)
--- testing: '123e5xyz' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123e5xyz' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123e5xyz' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: '123e5xyz' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: '123e5xyz' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: '123e5xyz' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123e5xyz' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: '123e5xyz' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: ' 123abc' << '0' ---
-string(6) "313233"
+int(0)
--- testing: ' 123abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: ' 123abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: ' 123abc' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: ' 123abc' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: ' 123abc' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: ' 123abc' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: ' 123abc' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: ' 123abc' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: '123 abc' << '0' ---
-string(6) "313233"
+int(0)
--- testing: '123 abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123 abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123 abc' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: '123 abc' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: '123 abc' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: '123 abc' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123 abc' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: '123 abc' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: '123abc ' << '0' ---
-string(6) "313233"
+int(0)
--- testing: '123abc ' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123abc ' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123abc ' << '1.2' ---
-string(6) "323436"
+int(0)
--- testing: '123abc ' << '-7.7' ---
-string(20) "2d313637373732313630"
+bool(false)
--- testing: '123abc ' << 'abc' ---
-string(6) "313233"
+int(0)
--- testing: '123abc ' << '123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << '123e5' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << '123e5xyz' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << ' 123abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << '123 abc' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << '123abc ' ---
-string(20) "2d363731303838363430"
+int(0)
--- testing: '123abc ' << '3.4a' ---
-string(6) "393834"
+int(0)
--- testing: '123abc ' << 'a5.9' ---
-string(6) "313233"
+int(0)
--- testing: '3.4a' << '0' ---
-string(2) "33"
+int(0)
--- testing: '3.4a' << '65' ---
-string(2) "36"
+int(0)
--- testing: '3.4a' << '-44' ---
-string(14) "33313435373238"
+bool(false)
--- testing: '3.4a' << '1.2' ---
-string(2) "36"
+int(0)
--- testing: '3.4a' << '-7.7' ---
-string(18) "313030363633323936"
+bool(false)
--- testing: '3.4a' << 'abc' ---
-string(2) "33"
+int(0)
--- testing: '3.4a' << '123abc' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << '123e5' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << '123e5xyz' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << ' 123abc' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << '123 abc' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << '123abc ' ---
-string(18) "343032363533313834"
+int(0)
--- testing: '3.4a' << '3.4a' ---
-string(4) "3234"
+int(0)
--- testing: '3.4a' << 'a5.9' ---
-string(2) "33"
+int(0)
--- testing: 'a5.9' << '0' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '65' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << 'a5.9' ---
-string(2) "30"
-===DONE===
-
+int(0)
+===DONE=== \ No newline at end of file
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
index 0b697c8579..655d72545d 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
@@ -17,7 +17,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
echo "--- testing: '$strVal' << '$otherVal' ---\n";
- var_dump(bin2hex($strVal<<$otherVal));
+ var_dump($strVal<<$otherVal);
}
}
@@ -26,395 +26,395 @@ foreach ($strVals as $strVal) {
===DONE===
--EXPECT--
--- testing: '0' << '0' ---
-string(2) "30"
+int(0)
--- testing: '0' << '65' ---
-string(2) "30"
+int(0)
--- testing: '0' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: '0' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: '0' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '0' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '0' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '0' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '0' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: '0' << 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '65' << '0' ---
-string(4) "3635"
+int(65)
--- testing: '65' << '65' ---
-string(6) "313330"
+int(0)
--- testing: '65' << '-44' ---
-string(16) "3638313537343430"
+bool(false)
--- testing: '65' << '1.2' ---
-string(6) "313330"
+int(130)
--- testing: '65' << '-7.7' ---
-string(40) "2d39303739323536383438373738393139393336"
+bool(false)
--- testing: '65' << 'abc' ---
-string(4) "3635"
+int(65)
--- testing: '65' << '123abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << '123e5' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << '123e5xyz' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << ' 123abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << '123 abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << '123abc ' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '65' << '3.4a' ---
-string(6) "353230"
+int(520)
--- testing: '65' << 'a5.9' ---
-string(4) "3635"
+int(65)
--- testing: '-44' << '0' ---
-string(6) "2d3434"
+int(-44)
--- testing: '-44' << '65' ---
-string(6) "2d3838"
+int(0)
--- testing: '-44' << '-44' ---
-string(18) "2d3436313337333434"
+bool(false)
--- testing: '-44' << '1.2' ---
-string(6) "2d3838"
+int(-88)
--- testing: '-44' << '-7.7' ---
-string(40) "2d36333431303638323735333337363538333638"
+bool(false)
--- testing: '-44' << 'abc' ---
-string(6) "2d3434"
+int(-44)
--- testing: '-44' << '123abc' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << '123e5' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << '123e5xyz' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << ' 123abc' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << '123 abc' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << '123abc ' ---
-string(40) "2d36393137353239303237363431303831383536"
+int(0)
--- testing: '-44' << '3.4a' ---
-string(8) "2d333532"
+int(-352)
--- testing: '-44' << 'a5.9' ---
-string(6) "2d3434"
+int(-44)
--- testing: '1.2' << '0' ---
-string(2) "31"
+int(1)
--- testing: '1.2' << '65' ---
-string(2) "32"
+int(0)
--- testing: '1.2' << '-44' ---
-string(14) "31303438353736"
+bool(false)
--- testing: '1.2' << '1.2' ---
-string(2) "32"
+int(2)
--- testing: '1.2' << '-7.7' ---
-string(36) "313434313135313838303735383535383732"
+bool(false)
--- testing: '1.2' << 'abc' ---
-string(2) "31"
+int(1)
--- testing: '1.2' << '123abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << '123e5' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << '123e5xyz' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << ' 123abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << '123 abc' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << '123abc ' ---
-string(36) "353736343630373532333033343233343838"
+int(0)
--- testing: '1.2' << '3.4a' ---
-string(2) "38"
+int(8)
--- testing: '1.2' << 'a5.9' ---
-string(2) "31"
+int(1)
--- testing: '-7.7' << '0' ---
-string(4) "2d37"
+int(-7)
--- testing: '-7.7' << '65' ---
-string(6) "2d3134"
+int(0)
--- testing: '-7.7' << '-44' ---
-string(16) "2d37333430303332"
+bool(false)
--- testing: '-7.7' << '1.2' ---
-string(6) "2d3134"
+int(-14)
--- testing: '-7.7' << '-7.7' ---
-string(40) "2d31303038383036333136353330393931313034"
+bool(false)
--- testing: '-7.7' << 'abc' ---
-string(4) "2d37"
+int(-7)
--- testing: '-7.7' << '123abc' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << '123e5' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << '123e5xyz' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << ' 123abc' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << '123 abc' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << '123abc ' ---
-string(40) "2d34303335323235323636313233393634343136"
+int(0)
--- testing: '-7.7' << '3.4a' ---
-string(6) "2d3536"
+int(-56)
--- testing: '-7.7' << 'a5.9' ---
-string(4) "2d37"
+int(-7)
--- testing: 'abc' << '0' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '65' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'abc' << 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '123abc' << '0' ---
-string(6) "313233"
+int(123)
--- testing: '123abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123abc' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: '123abc' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: '123abc' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123abc' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: '123abc' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' << '0' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123e5' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123e5' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: '123e5' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: '123e5' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: '123e5' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' << '0' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123e5xyz' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123e5xyz' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: '123e5xyz' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: '123e5xyz' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123e5xyz' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: '123e5xyz' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' << '0' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: ' 123abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: ' 123abc' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: ' 123abc' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: ' 123abc' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: ' 123abc' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: ' 123abc' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' << '0' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123 abc' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123 abc' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: '123 abc' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: '123 abc' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123 abc' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: '123 abc' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' << '0' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' << '65' ---
-string(6) "323436"
+int(0)
--- testing: '123abc ' << '-44' ---
-string(18) "313238393734383438"
+bool(false)
--- testing: '123abc ' << '1.2' ---
-string(6) "323436"
+int(246)
--- testing: '123abc ' << '-7.7' ---
-string(38) "2d373230353735393430333739323739333630"
+bool(false)
--- testing: '123abc ' << 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' << '123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << '123e5' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << '123e5xyz' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << ' 123abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << '123 abc' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << '123abc ' ---
-string(40) "2d32383832333033373631353137313137343430"
+int(0)
--- testing: '123abc ' << '3.4a' ---
-string(6) "393834"
+int(984)
--- testing: '123abc ' << 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '3.4a' << '0' ---
-string(2) "33"
+int(3)
--- testing: '3.4a' << '65' ---
-string(2) "36"
+int(0)
--- testing: '3.4a' << '-44' ---
-string(14) "33313435373238"
+bool(false)
--- testing: '3.4a' << '1.2' ---
-string(2) "36"
+int(6)
--- testing: '3.4a' << '-7.7' ---
-string(36) "343332333435353634323237353637363136"
+bool(false)
--- testing: '3.4a' << 'abc' ---
-string(2) "33"
+int(3)
--- testing: '3.4a' << '123abc' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << '123e5' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << '123e5xyz' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << ' 123abc' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << '123 abc' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << '123abc ' ---
-string(38) "31373239333832323536393130323730343634"
+int(0)
--- testing: '3.4a' << '3.4a' ---
-string(4) "3234"
+int(24)
--- testing: '3.4a' << 'a5.9' ---
-string(2) "33"
+int(3)
--- testing: 'a5.9' << '0' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '65' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' << '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' << 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' << 'a5.9' ---
-string(2) "30"
-===DONE===
+int(0)
+===DONE=== \ No newline at end of file
diff --git a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
index 1029d1942a..1747bc66fe 100644
--- a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
@@ -44,15 +44,15 @@ int(9223372036854775807)
--- testing: 9223372036854775807 >> 1 ---
int(4611686018427387903)
--- testing: 9223372036854775807 >> -1 ---
-int(0)
+bool(false)
--- testing: 9223372036854775807 >> 7 ---
int(72057594037927935)
--- testing: 9223372036854775807 >> 9 ---
int(18014398509481983)
--- testing: 9223372036854775807 >> 65 ---
-int(4611686018427387903)
+int(0)
--- testing: 9223372036854775807 >> -44 ---
-int(8796093022207)
+bool(false)
--- testing: 9223372036854775807 >> 2147483647 ---
int(0)
--- testing: 9223372036854775807 >> 9223372036854775807 ---
@@ -62,15 +62,15 @@ int(-9223372036854775808)
--- testing: -9223372036854775808 >> 1 ---
int(-4611686018427387904)
--- testing: -9223372036854775808 >> -1 ---
-int(-1)
+bool(false)
--- testing: -9223372036854775808 >> 7 ---
int(-72057594037927936)
--- testing: -9223372036854775808 >> 9 ---
int(-18014398509481984)
--- testing: -9223372036854775808 >> 65 ---
-int(-4611686018427387904)
+int(-1)
--- testing: -9223372036854775808 >> -44 ---
-int(-8796093022208)
+bool(false)
--- testing: -9223372036854775808 >> 2147483647 ---
int(-1)
--- testing: -9223372036854775808 >> 9223372036854775807 ---
@@ -80,15 +80,15 @@ int(2147483647)
--- testing: 2147483647 >> 1 ---
int(1073741823)
--- testing: 2147483647 >> -1 ---
-int(0)
+bool(false)
--- testing: 2147483647 >> 7 ---
int(16777215)
--- testing: 2147483647 >> 9 ---
int(4194303)
--- testing: 2147483647 >> 65 ---
-int(1073741823)
+int(0)
--- testing: 2147483647 >> -44 ---
-int(2047)
+bool(false)
--- testing: 2147483647 >> 2147483647 ---
int(0)
--- testing: 2147483647 >> 9223372036854775807 ---
@@ -98,15 +98,15 @@ int(-2147483648)
--- testing: -2147483648 >> 1 ---
int(-1073741824)
--- testing: -2147483648 >> -1 ---
-int(-1)
+bool(false)
--- testing: -2147483648 >> 7 ---
int(-16777216)
--- testing: -2147483648 >> 9 ---
int(-4194304)
--- testing: -2147483648 >> 65 ---
-int(-1073741824)
+int(-1)
--- testing: -2147483648 >> -44 ---
-int(-2048)
+bool(false)
--- testing: -2147483648 >> 2147483647 ---
int(-1)
--- testing: -2147483648 >> 9223372036854775807 ---
@@ -116,15 +116,15 @@ int(9223372034707292160)
--- testing: 9223372034707292160 >> 1 ---
int(4611686017353646080)
--- testing: 9223372034707292160 >> -1 ---
-int(0)
+bool(false)
--- testing: 9223372034707292160 >> 7 ---
int(72057594021150720)
--- testing: 9223372034707292160 >> 9 ---
int(18014398505287680)
--- testing: 9223372034707292160 >> 65 ---
-int(4611686017353646080)
+int(0)
--- testing: 9223372034707292160 >> -44 ---
-int(8796093020160)
+bool(false)
--- testing: 9223372034707292160 >> 2147483647 ---
int(0)
--- testing: 9223372034707292160 >> 9223372036854775807 ---
@@ -134,15 +134,15 @@ int(-9223372034707292160)
--- testing: -9223372034707292160 >> 1 ---
int(-4611686017353646080)
--- testing: -9223372034707292160 >> -1 ---
-int(-1)
+bool(false)
--- testing: -9223372034707292160 >> 7 ---
int(-72057594021150720)
--- testing: -9223372034707292160 >> 9 ---
int(-18014398505287680)
--- testing: -9223372034707292160 >> 65 ---
-int(-4611686017353646080)
+int(-1)
--- testing: -9223372034707292160 >> -44 ---
-int(-8796093020160)
+bool(false)
--- testing: -9223372034707292160 >> 2147483647 ---
int(-1)
--- testing: -9223372034707292160 >> 9223372036854775807 ---
@@ -152,15 +152,15 @@ int(2147483648)
--- testing: 2147483648 >> 1 ---
int(1073741824)
--- testing: 2147483648 >> -1 ---
-int(0)
+bool(false)
--- testing: 2147483648 >> 7 ---
int(16777216)
--- testing: 2147483648 >> 9 ---
int(4194304)
--- testing: 2147483648 >> 65 ---
-int(1073741824)
+int(0)
--- testing: 2147483648 >> -44 ---
-int(2048)
+bool(false)
--- testing: 2147483648 >> 2147483647 ---
int(0)
--- testing: 2147483648 >> 9223372036854775807 ---
@@ -170,15 +170,15 @@ int(-2147483649)
--- testing: -2147483649 >> 1 ---
int(-1073741825)
--- testing: -2147483649 >> -1 ---
-int(-1)
+bool(false)
--- testing: -2147483649 >> 7 ---
int(-16777217)
--- testing: -2147483649 >> 9 ---
int(-4194305)
--- testing: -2147483649 >> 65 ---
-int(-1073741825)
+int(-1)
--- testing: -2147483649 >> -44 ---
-int(-2049)
+bool(false)
--- testing: -2147483649 >> 2147483647 ---
int(-1)
--- testing: -2147483649 >> 9223372036854775807 ---
@@ -188,15 +188,15 @@ int(4294967294)
--- testing: 4294967294 >> 1 ---
int(2147483647)
--- testing: 4294967294 >> -1 ---
-int(0)
+bool(false)
--- testing: 4294967294 >> 7 ---
int(33554431)
--- testing: 4294967294 >> 9 ---
int(8388607)
--- testing: 4294967294 >> 65 ---
-int(2147483647)
+int(0)
--- testing: 4294967294 >> -44 ---
-int(4095)
+bool(false)
--- testing: 4294967294 >> 2147483647 ---
int(0)
--- testing: 4294967294 >> 9223372036854775807 ---
@@ -206,15 +206,15 @@ int(4294967295)
--- testing: 4294967295 >> 1 ---
int(2147483647)
--- testing: 4294967295 >> -1 ---
-int(0)
+bool(false)
--- testing: 4294967295 >> 7 ---
int(33554431)
--- testing: 4294967295 >> 9 ---
int(8388607)
--- testing: 4294967295 >> 65 ---
-int(2147483647)
+int(0)
--- testing: 4294967295 >> -44 ---
-int(4095)
+bool(false)
--- testing: 4294967295 >> 2147483647 ---
int(0)
--- testing: 4294967295 >> 9223372036854775807 ---
@@ -224,15 +224,15 @@ int(4294967293)
--- testing: 4294967293 >> 1 ---
int(2147483646)
--- testing: 4294967293 >> -1 ---
-int(0)
+bool(false)
--- testing: 4294967293 >> 7 ---
int(33554431)
--- testing: 4294967293 >> 9 ---
int(8388607)
--- testing: 4294967293 >> 65 ---
-int(2147483646)
+int(0)
--- testing: 4294967293 >> -44 ---
-int(4095)
+bool(false)
--- testing: 4294967293 >> 2147483647 ---
int(0)
--- testing: 4294967293 >> 9223372036854775807 ---
@@ -242,15 +242,15 @@ int(9223372036854775806)
--- testing: 9223372036854775806 >> 1 ---
int(4611686018427387903)
--- testing: 9223372036854775806 >> -1 ---
-int(0)
+bool(false)
--- testing: 9223372036854775806 >> 7 ---
int(72057594037927935)
--- testing: 9223372036854775806 >> 9 ---
int(18014398509481983)
--- testing: 9223372036854775806 >> 65 ---
-int(4611686018427387903)
+int(0)
--- testing: 9223372036854775806 >> -44 ---
-int(8796093022207)
+bool(false)
--- testing: 9223372036854775806 >> 2147483647 ---
int(0)
--- testing: 9223372036854775806 >> 9223372036854775807 ---
@@ -260,15 +260,15 @@ int(-9223372036854775808)
--- testing: 9.2233720368548E+18 >> 1 ---
int(-4611686018427387904)
--- testing: 9.2233720368548E+18 >> -1 ---
-int(-1)
+bool(false)
--- testing: 9.2233720368548E+18 >> 7 ---
int(-72057594037927936)
--- testing: 9.2233720368548E+18 >> 9 ---
int(-18014398509481984)
--- testing: 9.2233720368548E+18 >> 65 ---
-int(-4611686018427387904)
+int(-1)
--- testing: 9.2233720368548E+18 >> -44 ---
-int(-8796093022208)
+bool(false)
--- testing: 9.2233720368548E+18 >> 2147483647 ---
int(-1)
--- testing: 9.2233720368548E+18 >> 9223372036854775807 ---
@@ -278,15 +278,15 @@ int(-9223372036854775807)
--- testing: -9223372036854775807 >> 1 ---
int(-4611686018427387904)
--- testing: -9223372036854775807 >> -1 ---
-int(-1)
+bool(false)
--- testing: -9223372036854775807 >> 7 ---
int(-72057594037927936)
--- testing: -9223372036854775807 >> 9 ---
int(-18014398509481984)
--- testing: -9223372036854775807 >> 65 ---
-int(-4611686018427387904)
+int(-1)
--- testing: -9223372036854775807 >> -44 ---
-int(-8796093022208)
+bool(false)
--- testing: -9223372036854775807 >> 2147483647 ---
int(-1)
--- testing: -9223372036854775807 >> 9223372036854775807 ---
@@ -296,15 +296,15 @@ int(-9223372036854775808)
--- testing: -9.2233720368548E+18 >> 1 ---
int(-4611686018427387904)
--- testing: -9.2233720368548E+18 >> -1 ---
-int(-1)
+bool(false)
--- testing: -9.2233720368548E+18 >> 7 ---
int(-72057594037927936)
--- testing: -9.2233720368548E+18 >> 9 ---
int(-18014398509481984)
--- testing: -9.2233720368548E+18 >> 65 ---
-int(-4611686018427387904)
+int(-1)
--- testing: -9.2233720368548E+18 >> -44 ---
-int(-8796093022208)
+bool(false)
--- testing: -9.2233720368548E+18 >> 2147483647 ---
int(-1)
--- testing: -9.2233720368548E+18 >> 9223372036854775807 ---
@@ -312,19 +312,19 @@ int(-1)
--- testing: 0 >> 9223372036854775807 ---
int(0)
--- testing: 0 >> -9223372036854775808 ---
-int(0)
+bool(false)
--- testing: 0 >> 2147483647 ---
int(0)
--- testing: 0 >> -2147483648 ---
-int(0)
+bool(false)
--- testing: 0 >> 9223372034707292160 ---
int(0)
--- testing: 0 >> -9223372034707292160 ---
-int(0)
+bool(false)
--- testing: 0 >> 2147483648 ---
int(0)
--- testing: 0 >> -2147483649 ---
-int(0)
+bool(false)
--- testing: 0 >> 4294967294 ---
int(0)
--- testing: 0 >> 4294967295 ---
@@ -334,27 +334,27 @@ int(0)
--- testing: 0 >> 9223372036854775806 ---
int(0)
--- testing: 0 >> 9.2233720368548E+18 ---
-int(0)
+bool(false)
--- testing: 0 >> -9223372036854775807 ---
-int(0)
+bool(false)
--- testing: 0 >> -9.2233720368548E+18 ---
-int(0)
+bool(false)
--- testing: 1 >> 9223372036854775807 ---
int(0)
--- testing: 1 >> -9223372036854775808 ---
-int(1)
+bool(false)
--- testing: 1 >> 2147483647 ---
int(0)
--- testing: 1 >> -2147483648 ---
-int(1)
+bool(false)
--- testing: 1 >> 9223372034707292160 ---
-int(1)
+int(0)
--- testing: 1 >> -9223372034707292160 ---
-int(1)
+bool(false)
--- testing: 1 >> 2147483648 ---
-int(1)
---- testing: 1 >> -2147483649 ---
int(0)
+--- testing: 1 >> -2147483649 ---
+bool(false)
--- testing: 1 >> 4294967294 ---
int(0)
--- testing: 1 >> 4294967295 ---
@@ -364,27 +364,27 @@ int(0)
--- testing: 1 >> 9223372036854775806 ---
int(0)
--- testing: 1 >> 9.2233720368548E+18 ---
-int(1)
+bool(false)
--- testing: 1 >> -9223372036854775807 ---
-int(0)
+bool(false)
--- testing: 1 >> -9.2233720368548E+18 ---
-int(1)
+bool(false)
--- testing: -1 >> 9223372036854775807 ---
int(-1)
--- testing: -1 >> -9223372036854775808 ---
-int(-1)
+bool(false)
--- testing: -1 >> 2147483647 ---
int(-1)
--- testing: -1 >> -2147483648 ---
-int(-1)
+bool(false)
--- testing: -1 >> 9223372034707292160 ---
int(-1)
--- testing: -1 >> -9223372034707292160 ---
-int(-1)
+bool(false)
--- testing: -1 >> 2147483648 ---
int(-1)
--- testing: -1 >> -2147483649 ---
-int(-1)
+bool(false)
--- testing: -1 >> 4294967294 ---
int(-1)
--- testing: -1 >> 4294967295 ---
@@ -394,27 +394,27 @@ int(-1)
--- testing: -1 >> 9223372036854775806 ---
int(-1)
--- testing: -1 >> 9.2233720368548E+18 ---
-int(-1)
+bool(false)
--- testing: -1 >> -9223372036854775807 ---
-int(-1)
+bool(false)
--- testing: -1 >> -9.2233720368548E+18 ---
-int(-1)
+bool(false)
--- testing: 7 >> 9223372036854775807 ---
int(0)
--- testing: 7 >> -9223372036854775808 ---
-int(7)
+bool(false)
--- testing: 7 >> 2147483647 ---
int(0)
--- testing: 7 >> -2147483648 ---
-int(7)
+bool(false)
--- testing: 7 >> 9223372034707292160 ---
-int(7)
+int(0)
--- testing: 7 >> -9223372034707292160 ---
-int(7)
+bool(false)
--- testing: 7 >> 2147483648 ---
-int(7)
---- testing: 7 >> -2147483649 ---
int(0)
+--- testing: 7 >> -2147483649 ---
+bool(false)
--- testing: 7 >> 4294967294 ---
int(0)
--- testing: 7 >> 4294967295 ---
@@ -424,27 +424,27 @@ int(0)
--- testing: 7 >> 9223372036854775806 ---
int(0)
--- testing: 7 >> 9.2233720368548E+18 ---
-int(7)
+bool(false)
--- testing: 7 >> -9223372036854775807 ---
-int(3)
+bool(false)
--- testing: 7 >> -9.2233720368548E+18 ---
-int(7)
+bool(false)
--- testing: 9 >> 9223372036854775807 ---
int(0)
--- testing: 9 >> -9223372036854775808 ---
-int(9)
+bool(false)
--- testing: 9 >> 2147483647 ---
int(0)
--- testing: 9 >> -2147483648 ---
-int(9)
+bool(false)
--- testing: 9 >> 9223372034707292160 ---
-int(9)
+int(0)
--- testing: 9 >> -9223372034707292160 ---
-int(9)
+bool(false)
--- testing: 9 >> 2147483648 ---
-int(9)
---- testing: 9 >> -2147483649 ---
int(0)
+--- testing: 9 >> -2147483649 ---
+bool(false)
--- testing: 9 >> 4294967294 ---
int(0)
--- testing: 9 >> 4294967295 ---
@@ -454,27 +454,27 @@ int(0)
--- testing: 9 >> 9223372036854775806 ---
int(0)
--- testing: 9 >> 9.2233720368548E+18 ---
-int(9)
+bool(false)
--- testing: 9 >> -9223372036854775807 ---
-int(4)
+bool(false)
--- testing: 9 >> -9.2233720368548E+18 ---
-int(9)
+bool(false)
--- testing: 65 >> 9223372036854775807 ---
int(0)
--- testing: 65 >> -9223372036854775808 ---
-int(65)
+bool(false)
--- testing: 65 >> 2147483647 ---
int(0)
--- testing: 65 >> -2147483648 ---
-int(65)
+bool(false)
--- testing: 65 >> 9223372034707292160 ---
-int(65)
+int(0)
--- testing: 65 >> -9223372034707292160 ---
-int(65)
+bool(false)
--- testing: 65 >> 2147483648 ---
-int(65)
---- testing: 65 >> -2147483649 ---
int(0)
+--- testing: 65 >> -2147483649 ---
+bool(false)
--- testing: 65 >> 4294967294 ---
int(0)
--- testing: 65 >> 4294967295 ---
@@ -484,27 +484,27 @@ int(0)
--- testing: 65 >> 9223372036854775806 ---
int(0)
--- testing: 65 >> 9.2233720368548E+18 ---
-int(65)
+bool(false)
--- testing: 65 >> -9223372036854775807 ---
-int(32)
+bool(false)
--- testing: 65 >> -9.2233720368548E+18 ---
-int(65)
+bool(false)
--- testing: -44 >> 9223372036854775807 ---
int(-1)
--- testing: -44 >> -9223372036854775808 ---
-int(-44)
+bool(false)
--- testing: -44 >> 2147483647 ---
int(-1)
--- testing: -44 >> -2147483648 ---
-int(-44)
+bool(false)
--- testing: -44 >> 9223372034707292160 ---
-int(-44)
+int(-1)
--- testing: -44 >> -9223372034707292160 ---
-int(-44)
+bool(false)
--- testing: -44 >> 2147483648 ---
-int(-44)
---- testing: -44 >> -2147483649 ---
int(-1)
+--- testing: -44 >> -2147483649 ---
+bool(false)
--- testing: -44 >> 4294967294 ---
int(-1)
--- testing: -44 >> 4294967295 ---
@@ -514,27 +514,27 @@ int(-1)
--- testing: -44 >> 9223372036854775806 ---
int(-1)
--- testing: -44 >> 9.2233720368548E+18 ---
-int(-44)
+bool(false)
--- testing: -44 >> -9223372036854775807 ---
-int(-22)
+bool(false)
--- testing: -44 >> -9.2233720368548E+18 ---
-int(-44)
+bool(false)
--- testing: 2147483647 >> 9223372036854775807 ---
int(0)
--- testing: 2147483647 >> -9223372036854775808 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 >> 2147483647 ---
int(0)
--- testing: 2147483647 >> -2147483648 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 >> 9223372034707292160 ---
-int(2147483647)
+int(0)
--- testing: 2147483647 >> -9223372034707292160 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 >> 2147483648 ---
-int(2147483647)
---- testing: 2147483647 >> -2147483649 ---
int(0)
+--- testing: 2147483647 >> -2147483649 ---
+bool(false)
--- testing: 2147483647 >> 4294967294 ---
int(0)
--- testing: 2147483647 >> 4294967295 ---
@@ -544,40 +544,39 @@ int(0)
--- testing: 2147483647 >> 9223372036854775806 ---
int(0)
--- testing: 2147483647 >> 9.2233720368548E+18 ---
-int(2147483647)
+bool(false)
--- testing: 2147483647 >> -9223372036854775807 ---
-int(1073741823)
+bool(false)
--- testing: 2147483647 >> -9.2233720368548E+18 ---
-int(2147483647)
+bool(false)
--- testing: 9223372036854775807 >> 9223372036854775807 ---
int(0)
--- testing: 9223372036854775807 >> -9223372036854775808 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 >> 2147483647 ---
int(0)
--- testing: 9223372036854775807 >> -2147483648 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 >> 9223372034707292160 ---
-int(9223372036854775807)
+int(0)
--- testing: 9223372036854775807 >> -9223372034707292160 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 >> 2147483648 ---
-int(9223372036854775807)
---- testing: 9223372036854775807 >> -2147483649 ---
int(0)
+--- testing: 9223372036854775807 >> -2147483649 ---
+bool(false)
--- testing: 9223372036854775807 >> 4294967294 ---
-int(1)
+int(0)
--- testing: 9223372036854775807 >> 4294967295 ---
int(0)
--- testing: 9223372036854775807 >> 4294967293 ---
-int(3)
+int(0)
--- testing: 9223372036854775807 >> 9223372036854775806 ---
-int(1)
+int(0)
--- testing: 9223372036854775807 >> 9.2233720368548E+18 ---
-int(9223372036854775807)
+bool(false)
--- testing: 9223372036854775807 >> -9223372036854775807 ---
-int(4611686018427387903)
+bool(false)
--- testing: 9223372036854775807 >> -9.2233720368548E+18 ---
-int(9223372036854775807)
-===DONE===
- \ No newline at end of file
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
index ad53fea9d1..35ca0a618d 100644
--- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
@@ -1,9 +1,5 @@
--TEST--
Test >> operator : various numbers as strings
---SKIPIF--
-<?php
-if ((65<<65)==0) die("skip this test is for Intel only");
-?>
--FILE--
<?php
@@ -17,7 +13,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
echo "--- testing: '$strVal' >> '$otherVal' ---\n";
- var_dump(bin2hex($strVal>>$otherVal));
+ var_dump($strVal>>$otherVal);
}
}
@@ -26,395 +22,395 @@ foreach ($strVals as $strVal) {
===DONE===
--EXPECT--
--- testing: '0' >> '0' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '65' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '0' >> '1.2' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '0' >> 'abc' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '0' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '0' >> '3.4a' ---
-string(2) "30"
+int(0)
--- testing: '0' >> 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '0' ---
-string(4) "3635"
+int(65)
--- testing: '65' >> '65' ---
-string(4) "3332"
+int(0)
--- testing: '65' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '65' >> '1.2' ---
-string(4) "3332"
+int(32)
--- testing: '65' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '65' >> 'abc' ---
-string(4) "3635"
+int(65)
--- testing: '65' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '65' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '65' >> '3.4a' ---
-string(2) "38"
+int(8)
--- testing: '65' >> 'a5.9' ---
-string(4) "3635"
+int(65)
--- testing: '-44' >> '0' ---
-string(6) "2d3434"
+int(-44)
--- testing: '-44' >> '65' ---
-string(6) "2d3232"
+int(-1)
--- testing: '-44' >> '-44' ---
-string(4) "2d31"
+bool(false)
--- testing: '-44' >> '1.2' ---
-string(6) "2d3232"
+int(-22)
--- testing: '-44' >> '-7.7' ---
-string(4) "2d31"
+bool(false)
--- testing: '-44' >> 'abc' ---
-string(6) "2d3434"
+int(-44)
--- testing: '-44' >> '123abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> '123e5' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> '123e5xyz' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> ' 123abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> '123 abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> '123abc ' ---
-string(4) "2d31"
+int(-1)
--- testing: '-44' >> '3.4a' ---
-string(4) "2d36"
+int(-6)
--- testing: '-44' >> 'a5.9' ---
-string(6) "2d3434"
+int(-44)
--- testing: '1.2' >> '0' ---
-string(2) "31"
+int(1)
--- testing: '1.2' >> '65' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '1.2' >> '1.2' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '1.2' >> 'abc' ---
-string(2) "31"
+int(1)
--- testing: '1.2' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> '3.4a' ---
-string(2) "30"
+int(0)
--- testing: '1.2' >> 'a5.9' ---
-string(2) "31"
+int(1)
--- testing: '-7.7' >> '0' ---
-string(4) "2d37"
+int(-7)
--- testing: '-7.7' >> '65' ---
-string(4) "2d34"
+int(-1)
--- testing: '-7.7' >> '-44' ---
-string(4) "2d31"
+bool(false)
--- testing: '-7.7' >> '1.2' ---
-string(4) "2d34"
+int(-4)
--- testing: '-7.7' >> '-7.7' ---
-string(4) "2d31"
+bool(false)
--- testing: '-7.7' >> 'abc' ---
-string(4) "2d37"
+int(-7)
--- testing: '-7.7' >> '123abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> '123e5' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> '123e5xyz' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> ' 123abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> '123 abc' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> '123abc ' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> '3.4a' ---
-string(4) "2d31"
+int(-1)
--- testing: '-7.7' >> 'a5.9' ---
-string(4) "2d37"
+int(-7)
--- testing: 'abc' >> '0' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '65' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' >> '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'abc' >> 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'abc' >> 'a5.9' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: '123abc' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: '123abc' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '123abc' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: '123abc' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '123abc' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123abc' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '123abc' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: '123abc' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: '123e5' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '123e5' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: '123e5' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '123e5' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123e5' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '123e5' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: '123e5' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: '123e5xyz' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '123e5xyz' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: '123e5xyz' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '123e5xyz' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123e5xyz' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '123e5xyz' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: '123e5xyz' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: ' 123abc' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: ' 123abc' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: ' 123abc' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: ' 123abc' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: ' 123abc' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: ' 123abc' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: ' 123abc' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: '123 abc' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '123 abc' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: '123 abc' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '123 abc' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123 abc' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '123 abc' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: '123 abc' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' >> '0' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' >> '65' ---
-string(4) "3631"
+int(0)
--- testing: '123abc ' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '123abc ' >> '1.2' ---
-string(4) "3631"
+int(61)
--- testing: '123abc ' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '123abc ' >> 'abc' ---
-string(6) "313233"
+int(123)
--- testing: '123abc ' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '123abc ' >> '3.4a' ---
-string(4) "3135"
+int(15)
--- testing: '123abc ' >> 'a5.9' ---
-string(6) "313233"
+int(123)
--- testing: '3.4a' >> '0' ---
-string(2) "33"
+int(3)
--- testing: '3.4a' >> '65' ---
-string(2) "31"
+int(0)
--- testing: '3.4a' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: '3.4a' >> '1.2' ---
-string(2) "31"
+int(1)
--- testing: '3.4a' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: '3.4a' >> 'abc' ---
-string(2) "33"
+int(3)
--- testing: '3.4a' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> '3.4a' ---
-string(2) "30"
+int(0)
--- testing: '3.4a' >> 'a5.9' ---
-string(2) "33"
+int(3)
--- testing: 'a5.9' >> '0' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '65' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '-44' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' >> '1.2' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '-7.7' ---
-string(2) "30"
+bool(false)
--- testing: 'a5.9' >> 'abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '123e5' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '123e5xyz' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> ' 123abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '123 abc' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '123abc ' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> '3.4a' ---
-string(2) "30"
+int(0)
--- testing: 'a5.9' >> 'a5.9' ---
-string(2) "30"
-===DONE===
+int(0)
+===DONE=== \ No newline at end of file
diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt
new file mode 100644
index 0000000000..2ee54c5276
--- /dev/null
+++ b/tests/lang/operators/coalesce.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test ?? operator
+--FILE--
+<?php
+
+$var = 7;
+$var2 = NULL;
+
+$obj = new StdClass;
+$obj->boo = 7;
+
+$arr = [
+ 2 => 7,
+ "foo" => "bar",
+ "foobar" => NULL,
+ "qux" => $obj,
+ "bing" => [
+ "bang"
+ ]
+];
+
+function foobar() {
+ echo "called\n";
+ return ['a'];
+}
+
+var_dump($nonexistant_variable ?? 3);
+echo PHP_EOL;
+var_dump($var ?? 3);
+var_dump($var2 ?? 3);
+echo PHP_EOL;
+var_dump($obj->boo ?? 3);
+var_dump($obj->bing ?? 3);
+var_dump($arr["qux"]->boo ?? 3);
+var_dump($arr["qux"]->bing ?? 3);
+echo PHP_EOL;
+var_dump($arr[2] ?? 3);
+var_dump($arr["foo"] ?? 3);
+var_dump($arr["foobar"] ?? 3);
+var_dump($arr["qux"] ?? 3);
+var_dump($arr["bing"][0] ?? 3);
+var_dump($arr["bing"][1] ?? 3);
+echo PHP_EOL;
+var_dump(foobar()[0] ?? false);
+echo PHP_EOL;
+function f($x)
+{
+ printf("%s(%d)\n", __FUNCTION__, $x);
+ return $x;
+}
+
+$a = f(null) ?? f(1) ?? f(2);
+?>
+--EXPECTF--
+int(3)
+
+int(7)
+int(3)
+
+int(7)
+int(3)
+int(7)
+int(3)
+
+int(7)
+string(3) "bar"
+int(3)
+object(stdClass)#%d (%d) {
+ ["boo"]=>
+ int(7)
+}
+string(4) "bang"
+int(3)
+
+called
+string(1) "a"
+
+f(0)
+f(1) \ No newline at end of file
diff --git a/tests/lang/operators/preinc_variationStr.phpt b/tests/lang/operators/preinc_variationStr.phpt
index 010a237034..4e607057f7 100644
--- a/tests/lang/operators/preinc_variationStr.phpt
+++ b/tests/lang/operators/preinc_variationStr.phpt
@@ -1,22 +1,23 @@
---TEST--
-Test ++N operator : various numbers as strings
---FILE--
-<?php
-
-$strVals = array(
- "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
- "a5.9"
-);
-
-
-foreach ($strVals as $strVal) {
- echo "--- testing: '$strVal' ---\n";
- var_dump(++$strVal);
-}
-
-?>
-===DONE===
---EXPECT--
+--TEST--
+Test ++N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7",
+ "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a", "a5.9",
+ "z", "az", "zz", "Z", "AZ", "ZZ", "9z", "19z", "99z",
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(++$strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
--- testing: '0' ---
int(1)
--- testing: '65' ---
@@ -44,5 +45,23 @@ string(7) "123abc "
--- testing: '3.4a' ---
string(4) "3.4b"
--- testing: 'a5.9' ---
-string(4) "a5.0"
-===DONE===
+string(4) "a5.0"
+--- testing: 'z' ---
+string(2) "aa"
+--- testing: 'az' ---
+string(2) "ba"
+--- testing: 'zz' ---
+string(3) "aaa"
+--- testing: 'Z' ---
+string(2) "AA"
+--- testing: 'AZ' ---
+string(2) "BA"
+--- testing: 'ZZ' ---
+string(3) "AAA"
+--- testing: '9z' ---
+string(3) "10a"
+--- testing: '19z' ---
+string(3) "20a"
+--- testing: '99z' ---
+string(4) "100a"
+===DONE===
diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt
index 52ddeebd1c..b90f0ce912 100644
--- a/tests/lang/passByReference_005.phpt
+++ b/tests/lang/passByReference_005.phpt
@@ -144,7 +144,7 @@ var_dump($u1, $u2);
?>
--EXPECTF--
- ---- Pass by ref / pass by val: functions ----
+---- Pass by ref / pass by val: functions ----
Notice: Undefined variable: u1 in %s on line 72
@@ -179,40 +179,40 @@ string(12) "Ref2 changed"
---- Pass by ref / pass by val: static method calls ----
-Notice: Undefined variable: u1 in %s on line 95
-
Strict Standards: Non-static method C::v() should not be called statically in %s on line 95
+Notice: Undefined variable: u1 in %s on line 95
+
Strict Standards: Non-static method C::r() should not be called statically in %s on line 96
Notice: Undefined variable: u1 in %s on line 97
NULL
string(11) "Ref changed"
+Strict Standards: Non-static method C::vv() should not be called statically in %s on line 100
+
Notice: Undefined variable: u1 in %s on line 100
Notice: Undefined variable: u2 in %s on line 100
-Strict Standards: Non-static method C::vv() should not be called statically in %s on line 100
-
Notice: Undefined variable: u1 in %s on line 101
Notice: Undefined variable: u2 in %s on line 101
NULL
NULL
-Notice: Undefined variable: u1 in %s on line 104
-
Strict Standards: Non-static method C::vr() should not be called statically in %s on line 104
+Notice: Undefined variable: u1 in %s on line 104
+
Notice: Undefined variable: u1 in %s on line 105
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u2 in %s on line 108
-
Strict Standards: Non-static method C::rv() should not be called statically in %s on line 108
+Notice: Undefined variable: u2 in %s on line 108
+
Notice: Undefined variable: u2 in %s on line 109
string(11) "Ref changed"
NULL
@@ -258,4 +258,4 @@ Notice: Undefined variable: u2 in %s on line 135
string(11) "Ref changed"
NULL
string(12) "Ref1 changed"
-string(12) "Ref2 changed" \ No newline at end of file
+string(12) "Ref2 changed"
diff --git a/tests/lang/script_tag.phpt b/tests/lang/script_tag.phpt
deleted file mode 100644
index 1b5c696295..0000000000
--- a/tests/lang/script_tag.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-<script> tag
---FILE--
-<script language=php> echo "ola\n";</script>
-<script language="php"> echo "ola2\n";</script>
-<script language='php'> echo "ola3\n";</script>
-texto <sc <s <script> <script language> <script language=>
-<script language=php>
-#comment
-echo "oi\n"; //ignore here
-# 2nd comment
---EXPECT--
-ola
-ola2
-ola3
-texto <sc <s <script> <script language> <script language=>
-oi
diff --git a/tests/lang/short_tags.003.phpt b/tests/lang/short_tags.003.phpt
deleted file mode 100644
index 8894bf5029..0000000000
--- a/tests/lang/short_tags.003.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-short_open_tag: On, asp_tags: On
---INI--
-short_open_tag=on
-asp_tags=on
---FILE--
-<?='this should get echoed'?>
-
-<%= 'so should this' %>
-
-<?php
-$a = 'This gets echoed twice';
-?>
-
-<?= $a?>
-
-<%= $a%>
-
-<? $b=3; ?>
-
-<?php
- echo "{$b}";
-?>
---EXPECT--
-this should get echoed
-so should this
-
-This gets echoed twice
-This gets echoed twice
-
-3
-
diff --git a/tests/lang/short_tags.004.phpt b/tests/lang/short_tags.004.phpt
index ff3308733a..6df8af1c2a 100644
--- a/tests/lang/short_tags.004.phpt
+++ b/tests/lang/short_tags.004.phpt
@@ -1,8 +1,7 @@
--TEST--
-short_open_tag: Off, asp_tags: Off
+short_open_tag: Off
--INI--
short_open_tag=off
-asp_tags=off
--FILE--
<%= 'so should this' %>
diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt
index 3d51531ed9..5dcb650444 100644
--- a/tests/run-test/test005.phpt
+++ b/tests/run-test/test005.phpt
@@ -19,7 +19,8 @@ var_dump(ini_get('track_errors'));
ini_set('display_errors', 0);
var_dump(ini_get('display_errors'));
var_dump($php_errormsg);
-$error = 1 / 0;
+$zero = 0;
+$error = 1 / $zero;
var_dump($php_errormsg);
?>
--EXPECTF--
diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt
index 27da085e04..ff2a93be0f 100644
--- a/tests/run-test/test008a.phpt
+++ b/tests/run-test/test008a.phpt
@@ -19,7 +19,8 @@ var_dump(ini_get('track_errors'));
ini_set('display_errors', 0);
var_dump(ini_get('display_errors'));
var_dump($php_errormsg);
-$error = 1 / 0;
+$zero = 0;
+$error = 1 / $zero;
var_dump($php_errormsg);
?>
--EXPECTF--
diff --git a/win32/EngineSelect.dsp b/win32/EngineSelect.dsp
deleted file mode 100644
index 4aee213c29..0000000000
--- a/win32/EngineSelect.dsp
+++ /dev/null
@@ -1,85 +0,0 @@
-# Microsoft Developer Studio Project File - Name="EngineSelect" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) External Target" 0x0106
-
-CFG=EngineSelect - Win32 Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "EngineSelect.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "EngineSelect.mak" CFG="EngineSelect - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "EngineSelect - Win32 Release" (based on "Win32 (x86) External Target")
-!MESSAGE "EngineSelect - Win32 Debug" (based on "Win32 (x86) External Target")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-
-!IF "$(CFG)" == "EngineSelect - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Cmd_Line "NMAKE /f EngineSelect.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "EngineSelect.exe"
-# PROP BASE Bsc_Name "EngineSelect.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Cmd_Line "EngineSelect.bat"
-# PROP Rebuild_Opt "/a"
-# PROP Target_File "EngineSelect.exe"
-# PROP Bsc_Name ""
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "EngineSelect - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Cmd_Line "NMAKE /f EngineSelect.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "EngineSelect.exe"
-# PROP BASE Bsc_Name "EngineSelect.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Cmd_Line "EngineSelect.bat"
-# PROP Rebuild_Opt "/a"
-# PROP Target_File "EngineSelect.exe"
-# PROP Bsc_Name ""
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "EngineSelect - Win32 Release"
-# Name "EngineSelect - Win32 Debug"
-
-!IF "$(CFG)" == "EngineSelect - Win32 Release"
-
-!ELSEIF "$(CFG)" == "EngineSelect - Win32 Debug"
-
-!ENDIF
-
-# End Target
-# End Project
diff --git a/win32/build/DSP.README b/win32/build/DSP.README
deleted file mode 100644
index c6736578cf..0000000000
--- a/win32/build/DSP.README
+++ /dev/null
@@ -1,37 +0,0 @@
-MSVC++ project file generation
-==============================
-
-These files are only intended for use in debugging and profiling,
-but can be used to create working binaries. However, they are very
-unlikely to match the official PHP distributed binaries.
-
-With this in mind, the script will only generate basic .dsp files
-for the modules that are currently configured.
-
-The switch for project file generation is a buildconf switch and
-not a configure switch:
-
-> buildconf --add-project-files
-> configure ...
-
-The resulting workspace files should appear at /win32/phpdll[ts].dsw
-and (if any shared modules are configured) at /win32/php_modules.dsw,
-after configure is run.
-
-If the .dsw files haven't generated in a sane way, the most likely reason
-will be that the template files have become corrupted. They need DOS
-line endings (CR/LF) in order to function. The affected files are:
-
-/win32/build/block.template.dsw
-/win32/build/template.dsp
-/win32/build/template.dsw
-
-Simply save them with DOS line endings, and bug it to me if basic
-project file generation still fails (as in, you ran the command and
-configure again after saving, and you have a working copy of MSVS
-installed, but clicking on the workspace(s) doesn't give you anything).
-
-- Steph
-sfox@php.net
-
-July 2008
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 7a3be93e87..b2918b7117 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -1,5 +1,5 @@
# +----------------------------------------------------------------------+
-# | PHP Version 5 |
+# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2008 The PHP Group |
# +----------------------------------------------------------------------+
@@ -62,9 +62,9 @@ Zend\zend_language_scanner.c: Zend\zend_language_scanner.l
!endif
!if $(PGOMGR) != ""
-PHP5_PGD_OPTION=/PGD:$(PGOPGD_DIR)\php5.pgd
+PHP7_PGD_OPTION=/PGD:$(PGOPGD_DIR)\php7.pgd
!else
-PHP5_PGD_OPTION=
+PHP7_PGD_OPTION=
!endif
PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res
@@ -89,7 +89,7 @@ $(PHPDLL_RES): win32\build\template.rc
win32\build\template.rc
$(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE)
- @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
+ @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
-@$(_VC_MANIFEST_EMBED_DLL)
$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw
deleted file mode 100644
index 2f2682dc71..0000000000
--- a/win32/build/block.template.dsw
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Project: "EXTNAME"=..\ADDRESS - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5ts
- End Project Dependency
-}}}
-
-###############################################################################
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
index b4194ad203..a3a4f1e9aa 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -23,7 +23,6 @@ WScript.StdOut.WriteLine("Rebuilding configure.js");
var FSO = WScript.CreateObject("Scripting.FileSystemObject");
var C = FSO.CreateTextFile("configure.js", true);
var B = FSO.CreateTextFile("configure.bat", true);
-var DSP = false;
var modules = "";
var MODULES = WScript.CreateObject("Scripting.Dictionary");
@@ -197,11 +196,6 @@ function buildconf_process_args()
WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");
module_dirs[module_dirs.length] = argval;
}
-
- if (argname == '--add-project-files') {
- WScript.StdOut.WriteLine("Adding dsp templates into the mix");
- DSP = true;
- }
}
}
@@ -212,16 +206,6 @@ C.WriteLine("/* This file automatically generated from win32/build/confutils.js
C.WriteLine("MODE_PHPIZE=false;");
C.Write(file_get_contents("win32/build/confutils.js"));
-// If project files were requested, pull in the code to generate them
-if (DSP == true) {
- C.WriteLine('PHP_DSP="yes"');
- C.WriteBlankLines(1);
- C.Write(file_get_contents("win32/build/projectgen.js"));
-} else {
- C.WriteLine('PHP_DSP="no"');
- C.WriteBlankLines(1);
-}
-
// Pull in code from sapi and extensions
modules = file_get_contents("win32/build/config.w32");
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 564cea2dcc..358ff4e0ce 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -131,7 +131,7 @@ DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
// CFLAGS for building the PHP dll
-DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
@@ -166,14 +166,17 @@ if (VCVERS >= 1400) {
}
}
-ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
+ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
+var PHP_MP_DISABLED = true;
if (VCVERS >= 1500 && PHP_MP != 'disable') {
// no from disable-all
if(PHP_MP == 'auto' || PHP_MP == 'no') {
ADD_FLAG('CFLAGS', ' /MP ');
+ PHP_MP_DISABLED = false;
} else {
if(parseInt(PHP_MP) != 0) {
ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ PHP_MP_DISABLED = false;
} else {
STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
}
@@ -353,7 +356,7 @@ STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PH
ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
- zend_constants.c zend_dynamic_array.c zend_exceptions.c \
+ zend_constants.c zend_exceptions.c \
zend_execute_API.c zend_highlight.c \
zend_llist.c zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
@@ -362,7 +365,8 @@ ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
zend_object_handlers.c zend_objects_API.c \
zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
- zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c");
+ zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c \
+ zend_inheritance.c");
if (VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
@@ -430,13 +434,6 @@ if (PHP_SNAPSHOT_TEMPLATE == "no") {
DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
-if (PHP_DSP != "no") {
- if (FSO.FolderExists("tmp")) {
- FSO.DeleteFolder("tmp");
- }
- FSO.CreateFolder("tmp");
-}
-
ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes");
if (PHP_SECURITY_FLAGS == "yes") {
ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
index 9efdfdea3e..e74108ce96 100644
--- a/win32/build/config.w32.h.in
+++ b/win32/build/config.w32.h.in
@@ -174,3 +174,8 @@
# define _USE_32BIT_TIME_T 1
#endif
#define HAVE_STDLIB_H 1
+
+#define _REENTRANT 1
+#define HAVE_MBRLEN 1
+#define HAVE_MBSTATE_T 1
+
diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in
index cfec2a28f1..9b28352c8f 100644
--- a/win32/build/config.w32.phpize.in
+++ b/win32/build/config.w32.phpize.in
@@ -115,7 +115,7 @@ DEFINE('PHP_PREFIX', PHP_PREFIX);
DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
// CFLAGS for building the PHP dll
-DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
@@ -151,14 +151,17 @@ if (VCVERS >= 1400) {
}
ARG_WITH('prefix', 'PHP installation prefix', '');
-ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
+ARG_WITH('mp', 'Tell Visual Studio use up to [n,auto,disable] processes for compilation', 'auto');
+var PHP_MP_DISABLED = true;
if (VCVERS >= 1500 && PHP_MP != 'disable') {
// no from disable-all
if(PHP_MP == 'auto' || PHP_MP == 'no') {
ADD_FLAG('CFLAGS', ' /MP ');
+ PHP_MP_DISABLED = false;
} else {
if(parseInt(PHP_MP) != 0) {
ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ PHP_MP_DISABLED = false;
} else {
STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
}
@@ -352,12 +355,5 @@ if (PHP_SNAPSHOT_TEMPLATE == "no") {
DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
-if (PHP_DSP != "no") {
- if (FSO.FolderExists("tmp")) {
- FSO.DeleteFolder("tmp");
- }
- FSO.CreateFolder("tmp");
-}
-
AC_DEFINE("PHP_DIR", PHP_DIR);
DEFINE("PHP_DIR", PHP_DIR);
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index d8155bbaa8..a394c52ad9 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -1,7 +1,7 @@
// Utils for configure script
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -28,7 +28,6 @@ var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive");
var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles");
var PROGRAM_FILESx86 = WshShell.Environment("Process").Item("ProgramFiles(x86)");
var VCINSTALLDIR = WshShell.Environment("Process").Item("VCINSTALLDIR");
-var DSP_FLAGS = new Array();
var PHP_SRC_DIR=FSO.GetParentFolderName(WScript.ScriptFullName);
/* Store the enabled extensions (summary + QA check) */
@@ -1130,10 +1129,6 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
ADD_FLAG("SAPI_TARGETS", makefiletarget);
}
- if (PHP_DSP != "no") {
- generate_dsp_file(sapiname, configure_module_dirname, file_list, false);
- }
-
MFO.WriteBlankLines(1);
sapi_enabled[sapi_enabled.length] = [sapiname];
}
@@ -1366,10 +1361,6 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
}
ADD_FLAG("CFLAGS_" + EXT, cflags);
- if (PHP_DSP != "no") {
- generate_dsp_file(extname, configure_module_dirname, file_list, shared);
- }
-
extensions_enabled[extensions_enabled.length] = [extname, shared ? 'shared' : 'static'];
}
@@ -1438,7 +1429,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
obj = src.replace(re, ".obj");
tv += " " + sub_build + obj;
- if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
+ if (!PHP_MP_DISABLED) {
if (i > 0) {
objs_line += " " + sub_build + obj;
srcs_line += " " + dir + "\\" + src;
@@ -1457,7 +1448,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
}
}
- if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
+ if (!PHP_MP_DISABLED) {
MFO.WriteLine(objs_line + ": " + srcs_line);
MFO.WriteLine("\t$(CC) $(" + flags + ") $(CFLAGS) /Fo" + sub_build + " $(" + bd_flags_name + ") /c " + srcs_line);
}
@@ -1665,15 +1656,6 @@ function generate_files()
}
}
- if (PHP_DSP != "no") {
- generate_dsp_file("TSRM", "TSRM", null, false);
- generate_dsp_file("Zend", "Zend", null, false);
- generate_dsp_file("win32", "win32", null, false);
- generate_dsp_file("main", "main", null, false);
- generate_dsp_file("streams", "main\\streams", null, false);
- copy_dsp_files();
- }
-
STDOUT.WriteLine("Generating files...");
generate_makefile();
if (!MODE_PHPIZE) {
@@ -1887,6 +1869,14 @@ function generate_config_h()
outfile.WriteLine("#define " + keys[i] + " " + pieces);
}
+
+ if (VCVERS >= 1800) {
+ outfile.WriteLine("");
+ outfile.WriteLine("#define HAVE_ACOSH 1");
+ outfile.WriteLine("#define HAVE_ASINH 1");
+ outfile.WriteLine("#define HAVE_ATANH 1");
+ }
+
outfile.Close();
}
@@ -2035,12 +2025,6 @@ function ADD_FLAG(name, flags, target)
configure_subst.Remove(name);
}
configure_subst.Add(name, flags);
-
- if (PHP_DSP != "no") {
- if (flags && (name.substr(name.length-3) != "PHP") && (name.substr(0, 7) == "CFLAGS_")) {
- DSP_FLAGS[DSP_FLAGS.length] = new Array(name, flags);
- }
- }
}
function get_define(name)
diff --git a/win32/build/deplister.c b/win32/build/deplister.c
index 31f1f07e67..bae6d031f6 100644
--- a/win32/build/deplister.c
+++ b/win32/build/deplister.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in
index c99dece618..1302cf7065 100644
--- a/win32/build/phpize.js.in
+++ b/win32/build/phpize.js.in
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
@@ -24,7 +24,6 @@ var STDOUT = WScript.StdOut;
var FSO = WScript.CreateObject("Scripting.FileSystemObject");
var C = FSO.CreateTextFile("configure.js", true);
var B = FSO.CreateTextFile("configure.bat", true);
-var DSP = false;
re = /\\script/i;
var PHP_DIR=FSO.GetParentFolderName(WScript.ScriptFullName).replace(re,"");
@@ -214,6 +213,11 @@ C.WriteLine("var MODE_PHPIZE = true;");
C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
C.WriteLine("var PHP_PREFIX = " + '"' + PHP_PREFIX.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+/* XXX this needs to be implemented for the phpize mode yet, a quick fix just to disable it for now */
+C.WriteLine("var PHP_ANALYZER = 'disabled';");
+C.WriteLine("var PHP_PGO = 'no';");
+C.WriteLine("var PHP_PGI = 'no';");
+
C.Write(file_get_contents(PHP_DIR + "//script//ext_deps.js"));
if (FSO.FileExists(PHP_DIR + "/script/ext_pickle.js")) {
C.Write(file_get_contents(PHP_DIR + "//script//ext_pickle.js"));
@@ -222,16 +226,6 @@ if (FSO.FileExists(PHP_DIR + "/script/ext_pickle.js")) {
C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));
C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.js"));
-// If project files were requested, pull in the code to generate them
-if (DSP == true) {
- C.WriteLine('PHP_DSP="yes"');
- C.WriteBlankLines(1);
- C.Write(file_get_contents(PHP_DIR + "win32/build/projectgen.js"));
-} else {
- C.WriteLine('PHP_DSP="no"');
- C.WriteBlankLines(1);
-}
-
// Pull in code for the base detection
modules = file_get_contents(PHP_DIR + "/script/config.w32.phpize.in");
diff --git a/win32/build/projectgen.js b/win32/build/projectgen.js
deleted file mode 100644
index 390a303fb4..0000000000
--- a/win32/build/projectgen.js
+++ /dev/null
@@ -1,625 +0,0 @@
-/* check for duplicate entries */
-function check_duplicates(local, core)
-{
- if (!local) {
- return core;
- }
-
- arr = local.split(" ");
-
- for(i = 0; i < arr.length; i++) {
- if (core.match(arr[i])) {
- continue;
- }
- core += " " + arr[i];
- }
-
- return core;
-}
-
-/* read .dsp source blocks */
-function read_src_files(ext, tmpl, path)
-{
- sources = file_get_contents("tmp\\src\\" + ext + ".sources.tmp");
- sources = (path ? sources.replace(/\.\//g, path) : sources);
- tmpl = tmpl.replace("SOURCEFILES", sources);
- FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp");
-
- headers = file_get_contents("tmp\\src\\" + ext + ".headers.tmp");
- headers = (path ? headers.replace(/\.\//g, path) : headers);
- tmpl = tmpl.replace("HEADERFILES", headers);
- FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp");
-
- return tmpl;
-}
-
-/* write a .dsp source block */
-function write_src_file(fname, path, intpath, arr)
-{
- FSO.FolderExists("tmp\\src") ? "" : FSO.CreateFolder("tmp\\src");
- var src = FSO.CreateTextFile("tmp\\src\\" + fname, true);
- var out = get_define("BUILD_DIR");
- var libpath = "";
-
- for (i = 0; i < arr.length; i++) {
- if (arr[i].length > 1) {
- if (arr[i].match('alloca.c') ||
- arr[i].match(/internal_functions_(nw|win32)\.c/) ||
- arr[i].match(/flock\.(c|h)/) ||
- arr[i].match(/zend_static_allocator\.(c|h)/) ||
- arr[i].match(/zend_(ini|language)_scanner_defs\.h/)) {
- continue;
- }
-
- libpath = arr[i].substr(2, arr[i].lastIndexOf("\\") - 2);
- if (libpath) {
- libpath = "\\" + libpath;
- }
-
- src.WriteLine("# Begin Source File");
- src.WriteLine("SOURCE=" + arr[i]);
- src.WriteLine('# PROP Intermediate_Dir "' + intpath + out + '\\' + path + libpath + '"');
- src.WriteLine("# End Source File");
- src.WriteBlankLines(1);
- }
- }
-
- src.Close();
- return;
-}
-
-/* generate list of text files */
-function generate_text_filelist(ext, ext_dir)
-{
- var txtdir = FSO.GetFolder(ext_dir);
-
- block = '# Begin Group "Text Files"\r\n\# PROP Default_Filter ""\r\n\r\n';
- txt = new Enumerator(txtdir.Files);
-
- for (; !txt.atEnd(); txt.moveNext()) {
- fname = FSO.GetFileName(txt.item());
- munged = fname.replace(ext, ""); /* TSRM...! */
-
- if (munged.match(/[A-Z]{4}/)){
- block += "# Begin Source File\r\n";
- block += "SOURCE=./" + fname + "\r\n";
- block += "# End Source File\r\n\r\n";
- }
- }
-
- block += "# End Group\r\n";
- return block;
-}
-
-/* generate list of resource files */
-function generate_resource_filelist(ext, ext_dir)
-{
- var resdir = FSO.GetFolder(ext_dir);
- res = new Enumerator(resdir.Files);
- block = "";
-
- for (; !res.atEnd(); res.moveNext()) {
- fname = FSO.GetFileName(res.item());
-
- if (fname.match(/\.(ico|rc)/)) {
- block += "# Begin Source File\r\n";
- block += "SOURCE=./" + fname + "\r\n";
- block += "# End Source File\r\n\r\n";
- }
- }
-
- return block;
-}
-
-/* generate parser and scanner files for Zend */
-function generate_parsers_or_scanners(arr, type)
-{
- var filter = (type.match("Parsers") ? "y" : "l");
-
- ret = '# Begin Group "' + type + '"\r\n# PROP Default_Filter "' + filter + '"\r\n\r\n';
-
- for (i = 0; i < arr.length; i++) {
-
- fl = "zend_" + arr[i] + "_" + type.toLowerCase().substr(0, type.length - 1);
- ret += "# Begin Source File\r\n";
- ret += "SOURCE=.\\" + fl + "." + filter + "\r\n\r\n";
- ret += '# Begin Custom Build\r\n\r\n';
-
- if (type.match("Parsers")) {
- pre = (arr[i].match(/ini/) ? "ini_ " : "zend ");
- ret += fl + ".c " + fl + ".h: " + fl + ".y\r\n";
- ret += "\tbison --output=" + fl + ".c -v -d -p " + pre + fl + ".y\r\n\r\n";
- } else {
- ret += fl + ".c: " + fl + ".l\r\n";
- ret += "\tre2c --case-inverted -cbdFt " + fl + "_defs.h -o" + fl + ".c " + fl + ".l\r\n\r\n";
- }
-
- ret += "# End Custom Build\r\n";
- ret += "# End Source File\r\n";
- }
-
- ret += "# End Group\r\n\r\n";
- return ret;
-}
-
-/* generate .defs file for php5[ts].dll */
-function generate_php_defs()
-{
- var defs = get_define("PHP_DLL_DEF_SOURCES").split(" ");
- var bdir = get_define("BUILD_DIR") + "\\";
- var file = get_define("PHPLIB").replace("lib", "def");
- var path = "..\\" + bdir + file;
- var deps = "USERDEP__PHP5TS=";
- var cmds = "BuildCmds= \\\r\n";
- var cmd = '$(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n\t$(BuildCmds)\r\n';
-
- for (i = 0; i < defs.length; i++) {
- deps += '"..\\' + defs[i] + '" ';
- cmds += "\ttype ..\\" + defs[i] + (i == 0 ? " > " : " >> ") + path + " \\\r\n";
- }
-
- ret = '# Begin Group "Defs Files"\r\n\r\n';
- ret += "# Begin Source File\r\nSOURCE=" + path + "\r\n\r\n";
- ret += deps.substr(0, deps.length-1) + "\r\n# Begin Custom Build - ";
- ret += "Generating $(InputPath)\r\nInputPath=" + path + "\r\n\r\n";
- ret += cmds + '\r\n\"' + path + '" : ' + cmd + "\r\n";
- ret += "# End Custom Build\r\n# End Source File\r\n\r\n";
- ret += "# End Group\r\n";
- return ret;
-}
-
-/* generate win32\wsyslog.h for php5[ts].dll */
-function generate_wsyslog()
-{
- var path = ".\\build\\wsyslog.mc\r\n\r\n";
- var intdir = "..\\" + get_define("BUILD_DIR");
-
- ret = "# Begin Source File\r\nSOURCE=" + path;
- ret += "# Begin Custom Build\r\nInputDir=.\\build\r\n";
- ret += "IntDir=" + intdir + "\r\nInputPath=" + path;
- ret += '"wsyslog.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n';
- ret += "\tmc -h $(InputDir)/.. -r $(InputDir) -x $(IntDir) $(InputPath)\r\n\r\n";
- ret += "# End Custom Build\r\n# End Source File\r\n";
- return ret;
-}
-
-/* generate ext\date\lib\timelib_config.h for php5[ts].dll */
-function generate_timelib_conf(headers)
-{
- var file = "timelib_config.h";
- var path = "..\\ext\\date\\lib\\timelib_config.h";
- var pos = headers.search(file);
- var entry = headers.slice(pos, pos + 64);
-
- replace = entry.replace(file, file + ".win32");
- replace += "\r\n\r\n# Begin Custom Build\r\nInputDir=..\\ext\\date\\lib\r\n";
- replace += "InputPath=" + path + ".win32\r\n\r\n";
- replace += '"' + path + '" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n';
- replace += "\tcopy $(InputPath) $(InputDir)\\" + file + "\r\n\r\n";
- replace += "# End Custom Build";
-
- headers = headers.replace(entry, replace);
- return headers;
-}
-
-/* generate php5[ts].dsp */
-function generate_core_dsp(core_headers, core_sources, headers, sources, cflags, ldflags, libs)
-{
- var ts = (PHP_ZTS != "no" ? "ts" : "");
- var extname = "php5" + ts;
- var tmpl = generate_dsp_file(extname, ".", false, false);
-
- cflags += get_define("CFLAGS_PHP").replace("/D _USRDLL", "");
- cflags = cflags.replace(/\/(I|D)(\S)/g, "/$1 $2");
- ldflags += get_define("LDFLAGS_PHP");
- libs += get_define("LIBS_PHP");
-
- tmpl = tmpl.replace(/LOCALCPP/, cflags.replace(/\"ext/g, '"../ext') + " /c");
- tmpl = tmpl.replace(/LOCALLIBS/, libs);
- tmpl = tmpl.replace(/LOCALLDFLAGS/, ldflags);
- tmpl = tmpl.replace(extname + ".dll", get_define("PHPDLL"));
-
- wsyslog = (core_headers.match("wsyslog.h") ? "" : generate_wsyslog(core_headers));
- core_sources = '# Begin Group "CORE"\r\n' + core_sources + "# End Group\r\n";
- tmpl = tmpl.replace(/CORESOURCES/, core_sources);
- core_headers = '# Begin Group "CORE "\r\n' + core_headers + "# End Group\r\n";
- tmpl = tmpl.replace(/COREHEADERS/, core_headers + wsyslog);
-
- headers = generate_timelib_conf(headers);
- tmpl = tmpl.replace(/SOURCEFILES/, sources);
- tmpl = tmpl.replace(/HEADERFILES/, headers);
-
- defs = generate_php_defs();
- tmpl = tmpl.replace(/DEFS/, defs);
-
- dsp = FSO.CreateTextFile("win32\\php5" + ts + ".dsp", true);
- STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsp");
- dsp.Write(tmpl);
- dsp.Close();
-
- return;
-}
-
-/* generate .dsw files */
-function generate_dsw_files(sblocks, mblocks)
-{
- var stmpl = file_get_contents("win32\\build\\template.dsw");
- var mtmpl = file_get_contents("win32\\build\\template.dsw");
- var ts = (PHP_ZTS != "no" ? "ts" : "");
-
- /* push all the sapi blocks to the same tag */
- stmpl = stmpl.replace("INSERT", sblocks);
- stmpl = (PHP_ZTS != "no" ? stmpl : stmpl.replace(/dllts/g, "dll"));
- sdsw = FSO.CreateTextFile("win32\\php5" + ts + ".dsw", true);
- STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsw");
- sdsw.Write(stmpl);
- sdsw.Close();
-
- /* same for shared modules - except that nothing else goes in here */
- garbage = mtmpl.slice(200, mtmpl.search("INSERT"));
- mtmpl = mtmpl.replace(garbage, "\r\n");
- mtmpl = mtmpl.replace("INSERT", mblocks);
- mtmpl = (PHP_ZTS != "no" ? mtmpl : mtmpl.replace(/dllts/g, "dll"));
- mdsw = FSO.CreateTextFile("win32\\php_modules.dsw", true);
- STDOUT.WriteLine("\tGenerating win32\\php_modules.dsw");
- mdsw.Write(mtmpl);
- mdsw.Close();
-
- return;
-}
-
-/* finalize .dsp files and copy to final destination */
-function copy_dsp_files()
-{
- var tmp = FSO.GetFolder("tmp");
- var CORE_HEADERS = "";
- var CORE_SOURCES = "";
- var EXT_HEADERS = "";
- var EXT_SOURCES = "";
- var EXT_CFLAGS = "";
- var EXT_LDFLAGS = "";
- var EXT_LIBS = "";
- var sblocks = ""; /* for sapis */
- var mblocks = ""; /* for modules */
-
- f = new Enumerator(tmp.Files);
-
- for (; !f.atEnd(); f.moveNext()) {
- /* retrieve the path */
- contents = file_get_contents(f.item());
- address = contents.slice(0, contents.indexOf("#"));
- contents = contents.slice(contents.indexOf("#")+1);
- shared = contents.slice(0, contents.indexOf("#"));
- contents = contents.slice(contents.indexOf("#"));
-
- /* pick up module name and path */
- path = address.slice(0, address.lastIndexOf("\\")+1);
- ext = address.slice(address.lastIndexOf("\\")+1, address.length-4);
- EXT = ext.toUpperCase();
-
- if (path.match(/(sapi|ext)/)) {
- rel = "..\\..\\";
- } else {
- rel = "..\\";
- }
-
- /* pick up local flags and libs */
- cflags = get_define("CFLAGS_" + EXT);
- cflags += (ext.match(/(TSRM|Zend)/) ? "/D TSRM_EXPORTS " : "");
- cflags += (ext.match(/Zend/) ? "/D LIBZEND_EXPORTS " : "");
- libs = get_define("LIBS_" + EXT);
- ldflags = get_define("LDFLAGS_" + EXT);
- ldflags = ldflags.replace(/(\.\.\\)/g, rel + "$1");
- contents = contents.replace(/LOCALCPP/, cflags + " /c");
- contents = contents.replace(/LOCALLIBS/, libs);
- contents = contents.replace(/LOCALLDFLAGS/, ldflags);
-
- if (ext.match("Zend")) {
- arr = new Array("ini", "language");
- parsers = generate_parsers_or_scanners(arr, "Parsers");
- scanners = generate_parsers_or_scanners(arr, "Scanners");
- contents = contents.replace(/DEFS/, parsers + scanners);
- }
-
- /* none of these are core... */
- contents = contents.replace(/\r\n(CORESOURCES|COREHEADERS|EXTSOURCES|EXTHEADERS|DEFS)\r\n/g, "");
-
- if (address.match("sapi")) {
- /* most sapis are .dlls, just not cgi, cli, embed */
-
- if (ext == "cli") {
-
- /* change of address: php.dsp */
- newext = "cli";
- address = "win32\\php.dsp";
- srcpath = "..\\" + path;
- contents = contents.replace(/cli\.exe/g, "php.exe");
-
- } else if (ext == "cgi") {
-
- /* change of address: php-cgi.dsp */
- newext = "cgi";
- address = "win32\\php-cgi.dsp";
- srcpath = "..\\" + path;
- contents = contents.replace(/cgi\.exe/g, "php-cgi.exe");
-
- } else {
-
- /* there's always one... most sapis just get a 'php5' prefix */
- newext = (ext.match(/apache2handler/) ? "php5apache2" : "php5" + ext);
- address = address.replace(ext + ".dsp", newext + ".dsp");
- srcpath = ".\\";
- oldext = new RegExp(('[^=\\\\]'+ext), "g");
- contents = contents.replace(oldext, newext);
- contents = contents.replace(ext + ".dll", newext + ".dll");
- contents = contents.replace("CFG=" + ext, "CFG=" + newext);
- }
-
- contents = read_src_files(ext, contents, (srcpath ? srcpath : false));
- dsp = FSO.CreateTextFile(address, true);
- STDOUT.WriteLine("\tGenerating " + address);
- dsp.Write(contents);
- dsp.Close();
-
- /* add all configured sapis to the list in php5ts.dsw */
- sblocks += file_get_contents("win32\\build\\block.template.dsw");
- sblocks = sblocks.replace("ADDRESS", address);
- sblocks = sblocks.replace("EXTNAME", newext);
-
- } else if (address.match("ext") && shared == "true") {
-
- /* independent modules with their own .dsp */
- contents = read_src_files(ext, contents, false);
- dsp = FSO.CreateTextFile(address, true);
- STDOUT.WriteLine("\tGenerating " + address);
- dsp.Write(contents);
- dsp.Close();
-
- mblocks += file_get_contents("win32\\build\\block.template.dsw");
- mblocks = mblocks.replace("ADDRESS", address);
- mblocks = mblocks.replace("EXTNAME", ext);
-
- } else if (ext.match(/(TSRM|Zend)/)) {
-
- contents = read_src_files(ext, contents, false);
- dsp = FSO.CreateTextFile(address, true);
- STDOUT.WriteLine("\tGenerating " + address);
- dsp.Write(contents);
- dsp.Close();
-
- } else {
-
- /* bound for php5[ts].dsp */
- cflags = get_define("CFLAGS_" + EXT);
- cflags = cflags ? cflags.replace(/-(I|D)/g, " /$1") : "";
- cflags = cflags? cflags.replace(/\/(I|D)\s+/g, "/$1") : "";
- cflags = cflags ? cflags.replace(/\/I(?!\")(\S+)/g, '/I"$1"') : "";
-
- EXT_CFLAGS = check_duplicates(cflags, EXT_CFLAGS);
- EXT_LDFLAGS = check_duplicates(ldflags, EXT_LDFLAGS);
- EXT_LIBS = check_duplicates(libs, EXT_LIBS);
-
- beginh = '# Begin Group "' + ext + ' "\r\n';
- begins = '# Begin Group "' + ext + '"\r\n';
-
- hdr = file_get_contents("tmp\\src\\" + ext + ".headers.tmp");
- hdr = hdr.replace(/\.\//g, "..\\" + path);
- hdr = hdr.replace(/\.\.\\\.\.\\/g, "..\\");
-
- src = file_get_contents("tmp\\src\\" + ext + ".sources.tmp");
- src = src.replace(/\.\//g, "..\\" + path);
- src = src.replace(/\.\.\\\.\.\\/g, "..\\");
-
- if (ext.match(/(main|standard|streams|win32)/)) {
- CORE_HEADERS += beginh + hdr + "# End Group\r\n";
- CORE_SOURCES += begins + src + "# End Group\r\n";
- } else {
- EXT_HEADERS += beginh + hdr + "# End Group\r\n";
- EXT_SOURCES += begins + src + "# End Group\r\n";
- }
-
- FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp");
- FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp");
- }
-
- FSO.DeleteFile(f.item());
- }
-
- generate_core_dsp(CORE_HEADERS, CORE_SOURCES, EXT_HEADERS, EXT_SOURCES, EXT_CFLAGS, EXT_LDFLAGS, EXT_LIBS);
- generate_dsw_files(sblocks, mblocks);
-
- /* goodnight vienna */
- FSO.DeleteFolder("tmp\\src");
- FSO.DeleteFolder("tmp");
-}
-
-/* generate source and header entries for .dsp files */
-function generate_dsp_filelist(ext, ext_dir, files, intpath)
-{
- var EXT = ext.toUpperCase();
- var tabs = new RegExp("[\t\r\n\'\"]", "gm");
- var ws = new RegExp("\\s+", "g");
- var dir = FSO.GetFolder(ext_dir);
- var configfile = FSO.BuildPath(ext_dir, "config.w32");
- var headers = "";
- var path = "";
-
- if (!files) {
- /* module either lacks a config.w32 or is core
- * either way, we know nothing about its sources
- */
- files = "";
- f = new Enumerator(dir.Files);
-
- for (; !f.atEnd(); f.moveNext()) {
- name = FSO.GetFileName(f.item());
-
- if (name.substr(name.length-2) == ".c") {
- files += " ./" + name;
- }
- }
- } else {
- files = files.replace(tabs, "");
- files = "./" + files.replace(/ /g, " ./");
- }
-
- DSP_SOURCES = files.split(" ");
-
- /* pick up headers (all modules) */
- f = new Enumerator(dir.Files);
-
- for (; !f.atEnd(); f.moveNext()) {
- name = FSO.GetFileName(f.item());
-
- if (name.substr(name.length-2) == ".h") {
- headers += " ./" + name;
- }
- }
-
- DSP_HEADERS = headers.split(" ");
-
- /* check for bundled library paths and sourcefiles */
- if (FSO.FileExists(configfile)) {
- config = file_get_contents(configfile);
-
- if (config.match("ADD_SOURCES")) {
- sources = new RegExp("ADD_SOURCES\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
- arr = config.match(sources);
- line = arr[0].replace(tabs, "");
- line = line.replace(/ADD_SOURCES\((.+)\)/, "$1");
- newarr = line.split(',');
- orig_path = newarr[0].replace(/\//g, "\\");
- orig_path = orig_path.replace(/configure_module_dirname(\s?\+\s?)?/, ext_dir);
- path = orig_path.replace(ext_dir + '\\', "");
-
- if (path.length > 0 && path != ext_dir) {
- subdir = FSO.GetFolder(orig_path);
- lib = new Enumerator(subdir.Files);
- libheaders = "";
-
- for (; !lib.atEnd(); lib.moveNext()) {
- name = FSO.GetFileName(lib.item());
-
- if (name.substr(name.length-2) == ".h") {
- libheaders += " ./" + path + "\\" + name;
- }
- }
-
- DSP_HEADERS = DSP_HEADERS.concat(libheaders.split(" "));
-
- } else {
- path = "";
- }
-
- sources = newarr[1].replace(/\\/g, ""); /* continuation lines */
- sources = sources.replace(ws, " ");
- sources = sources.replace(/\s/g, (path ? " ./" + path + "\\" : " ./"));
- sources = check_duplicates(DSP_SOURCES.join(" "), sources);
- DSP_SOURCES = sources.split(" ");
- }
- }
-
- /* store the array contents in temp files for now */
- write_src_file(ext + ".headers.tmp", ext_dir, intpath, DSP_HEADERS);
- write_src_file(ext + ".sources.tmp", ext_dir, intpath, DSP_SOURCES);
-
- return;
-}
-
-/* entry point. Called from EXTENSION(), SAPI() and generate_files() (confutils.js) */
-function generate_dsp_file(ext, ext_dir, files, shared)
-{
- var dsp = FSO.CreateTextFile("tmp\\" + ext + ".dsp", true);
- var tmpl = file_get_contents("win32\\build\\template.dsp");
- var ts = (PHP_ZTS != "no" ? "ts" : "");
- var debug = (PHP_DEBUG != "no" ? " /debug" : "");
- var ld = (debug ? "/LDd" : "/LD");
- var status = (PHP_DEBUG == "no" ? 'Release' : 'Debug');
- var statusts = status + (ts ? "_" + ts.toUpperCase() : "");
- var baseflags = "";
-
- /* store the final path and value of shared in the tmp file */
- if (!ext.match("php5")) {
- tmpl = ext_dir + "\\" + ext + ".dsp#" + shared + tmpl;
- }
-
- tmpl = tmpl.replace(/extname/g, ext);
- tmpl = tmpl.replace(/Status_TS/g, statusts);
-
- if (debug) {
- tmpl = tmpl.replace(/Use_Debug_Libraries 0/g, "Use_Debug_Libraries 1");
- tmpl = tmpl.replace(/NDEBUG/g, "_DEBUG");
- }
-
- if (ext == "cli" || ext == "cgi") {
- tmpl = tmpl.replace(/Dynamic-Link Library/g, "Console Application");
- tmpl = tmpl.replace(/0x0102/, "0x0103");
- path = "..\\";
- type = ".exe";
- } else if (ext == "embed" || ext == "TSRM" || ext == "Zend") {
- tmpl = tmpl.replace(/Dynamic-Link/g, "Static");
- tmpl = tmpl.replace(/0x0102/, "0x0104");
- tmpl = tmpl.replace(/LINK32/g, "LIB32");
- tmpl = tmpl.replace("link.exe", "link.exe -lib");
- tmpl = tmpl.replace(/BASELIBS/g, "/nologo");
- tmpl = tmpl.replace(/\s(LOCALLIBS|BASELDFLAGS|LOCALLDFLAGS|OUTPATH)/g, "");
- path = "..\\";
- if (ext == "embed") {
- path += "..\\";
- }
- type = ".lib";
- } else if (ext.match("php5")) {
- path = "..\\";
- type = ".dll";
- } else {
- path = "..\\..\\";
- type = ".dll";
- }
-
- outpath = path + get_define("BUILD_DIR");
- tmpl = tmpl.replace(/OUTPUTDIR/g, outpath);
-
- /* populate the baseline CFLAGS and libs */
- cflags = get_define("CFLAGS").replace(/\s+/g, " ");
- cflags = cflags.replace('/I "..\\bindlib_w32" ', "");
- bcflags = (cflags.replace(/\/([A-Z])\s/g, "/$1")).split(" ");
-
- for (i= 0; i < bcflags.length; i++) {
- baseflags += (bcflags[i].match(/(PHP|ZEND|ZTS|BASE|FD|WINDOWS)/) ? "" : bcflags[i]);
- }
-
- baseflags = baseflags.replace(/\//g, " /");
- baseflags = baseflags.substr(1).replace(/(\/D)/g, "$1 ") + " /c";
- tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? baseflags : baseflags.replace(ld + " ", "")));
-
- tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS").replace(/\sresolv.lib/, ""));
-
- /* now populate the bases in the 'local' lines */
- incs = get_define("BASE_INCLUDES").replace(/\/I (\S+)/g, '/I "' + path + '$1"');
- incs = incs.replace('"' + path + '."', '".."');
- lcflags = cflags.replace(/\$\(BASE_INCLUDES\)/, incs + (type == ".exe" ? '/I "..\\sapi" ' : "") + '/I "' + path + '..\\bindlib_w32"');
- tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? lcflags : lcflags.replace(ld + " ", "")));
- tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS") + " " + (ext.match("php5") ? "" : get_define("PHPLIB")));
- ldflags = get_define("LDFLAGS").replace(/\s?(\/nologo|\/libpath:\S+)\s?/g, "");
- tmpl = tmpl.replace(/BASELDFLAGS/, ldflags + (type == ".dll" ? " " + get_define("DLL_LDFLAGS") : "") + (debug ? ' /nodefaultlib:"msvcrt"' : ""));
- out = '/out:"' + outpath + "\\" + ext + type + '"' + ' /libpath:"' + outpath + '"' + ' /libpath:"..\\' + path + 'bindlib_w32\\' + status + '"';
- tmpl = tmpl.replace(/OUTPATH/, out);
-
- txt = generate_text_filelist(ext, ext_dir);
- res = generate_resource_filelist(ext, ext_dir);
-
- tmpl = tmpl.replace(/TEXTFILES/, txt);
- tmpl = tmpl.replace(/RESOURCEFILES/, res);
-
- if (ext.match("php5")) {
- return tmpl;
- }
-
- /* generate source and header blocks for .dsp */
- generate_dsp_filelist(ext, ext_dir, files, path);
-
- dsp.Write(tmpl);
- dsp.Close();
-
- return;
-}
diff --git a/win32/build/template.dsp b/win32/build/template.dsp
deleted file mode 100644
index ce1b070d5a..0000000000
--- a/win32/build/template.dsp
+++ /dev/null
@@ -1,81 +0,0 @@
-# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=extname - Win32 Status_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Status_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "extname - Win32 Status_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-RE2C=re2c.exe
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "OUTPUTDIR"
-# PROP BASE Intermediate_Dir "OUTPUTDIR"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "OUTPUTDIR"
-# PROP Intermediate_Dir "OUTPUTDIR"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP BASECPP
-# ADD CPP BASECPP LOCALCPP
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 BASELIBS
-# ADD LINK32 BASELIBS LOCALLIBS BASELDFLAGS LOCALLDFLAGS OUTPATH
-
-# Begin Target
-# Name "extname - Win32 Status_TS"
-
-# Begin Group "Source Files"
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-
-CORESOURCES
-SOURCEFILES
-# End Group
-
-# Begin Group "Header Files"
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-
-COREHEADERS
-HEADERFILES
-# End Group
-
-DEFS
-
-TEXTFILES
-
-# Begin Group "Resource Files"
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-
-RESOURCEFILES
-# End Group
-# End Target
-# End Project
diff --git a/win32/build/template.dsw b/win32/build/template.dsw
deleted file mode 100644
index ac781664ff..0000000000
--- a/win32/build/template.dsw
+++ /dev/null
@@ -1,63 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5ts"=..\win32\php5ts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
-}}}
-
-###############################################################################
-INSERT
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/build/template.rc b/win32/build/template.rc
index f36f2c041c..b28645822f 100644
--- a/win32/build/template.rc
+++ b/win32/build/template.rc
@@ -23,7 +23,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
# ifdef FILE_DESCRIPTION
#define INTERNAL_NAME FILE_DESCRIPTION /* e.g. 'PHP Script Interpreter', 'GD imaging' */
# else
-#define INTERNAL_NAME FILE_NAME /* e.g. 'php5ts.dll', 'php_bz2.dll' */
+#define INTERNAL_NAME FILE_NAME /* e.g. 'php7ts.dll', 'php_bz2.dll' */
# endif
#endif
diff --git a/win32/glob.c b/win32/glob.c
index 95160f9963..74882ac7d6 100644
--- a/win32/glob.c
+++ b/win32/glob.c
@@ -146,10 +146,10 @@ typedef char Char;
static int compare(const void *, const void *);
static int g_Ctoc(const Char *, char *, u_int);
-static int g_lstat(Char *, php_stat_t *, glob_t *);
+static int g_lstat(Char *, zend_stat_t *, glob_t *);
static DIR *g_opendir(Char *, glob_t *);
static Char *g_strchr(Char *, int);
-static int g_stat(Char *, php_stat_t *, glob_t *);
+static int g_stat(Char *, zend_stat_t *, glob_t *);
static int glob0(const Char *, glob_t *);
static int glob1(Char *, Char *, glob_t *, size_t *);
static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
@@ -559,7 +559,7 @@ glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern,
glob_t *pglob;
size_t *limitp;
{
- php_stat_t sb;
+ zend_stat_t sb;
Char *p, *q;
int anymeta;
@@ -856,7 +856,7 @@ g_opendir(str, pglob)
static int
g_lstat(fn, sb, pglob)
register Char *fn;
- php_stat_t *sb;
+ zend_stat_t *sb;
glob_t *pglob;
{
char buf[MAXPATHLEN];
@@ -871,7 +871,7 @@ g_lstat(fn, sb, pglob)
static int
g_stat(fn, sb, pglob)
register Char *fn;
- php_stat_t *sb;
+ zend_stat_t *sb;
glob_t *pglob;
{
char buf[MAXPATHLEN];
diff --git a/win32/glob.h b/win32/glob.h
index a03fda9199..63b8fc2f67 100644
--- a/win32/glob.h
+++ b/win32/glob.h
@@ -47,7 +47,7 @@
# include <sys/cdefs.h>
#endif
-php_stat_t;
+zend_stat_t;
typedef struct {
int gl_pathc; /* Count of total paths so far. */
int gl_matchc; /* Count of paths matching pattern. */
@@ -65,8 +65,8 @@ typedef struct {
void (*gl_closedir)(void *);
struct dirent *(*gl_readdir)(void *);
void *(*gl_opendir)(const char *);
- int (*gl_lstat)(const char *, php_stat_t *);
- int (*gl_stat)(const char *, php_stat_t *);
+ int (*gl_lstat)(const char *, zend_stat_t *);
+ int (*gl_stat)(const char *, zend_stat_t *);
} glob_t;
/* Flags */
diff --git a/win32/globals.c b/win32/globals.c
index 0f88e4cc63..ec4180db38 100644
--- a/win32/globals.c
+++ b/win32/globals.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/grp.h b/win32/grp.h
index 899d3ac0cd..71454fc3b6 100644
--- a/win32/grp.h
+++ b/win32/grp.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/install.txt b/win32/install.txt
index b240ad2723..3c91aeafd7 100644
--- a/win32/install.txt
+++ b/win32/install.txt
@@ -283,7 +283,7 @@ Manual Installation Steps
Extract the distribution file into a directory of your choice. If you
are installing PHP 4, extract to C:\, as the zip file expands to a
- foldername like php-4.3.7-Win32. If you are installing PHP 5, extract
+ foldername like php-4.3.7-Win32. If you are installing PHP 7, extract
to C:\php as the zip file doesn't expand as in PHP 4. You may choose a
different location but do not have spaces in the path (like C:\Program
Files\PHP) as some web servers will crash if you do.
@@ -291,12 +291,12 @@ Manual Installation Steps
The directory structure extracted from the zip is different for PHP
versions 4 and 5 and look like as follows:
- Example 2-2. PHP 5 package structure
+ Example 2-2. PHP 7 package structure
c:\php
|
+--dev
| |
- | |-php5ts.lib
+ | |-php7ts.lib
|
+--ext -- extension DLLs for PHP
| |
@@ -385,7 +385,7 @@ c:\php
other server modules failing, such as ASP.
The CGI and CLI binaries, and the web server modules all require the
- php5ts.dll file to be available to them. You have to make
+ php7ts.dll file to be available to them. You have to make
sure that this file can be found by your PHP installation. The search
order for this DLL is as follows:
@@ -394,7 +394,7 @@ c:\php
Files\Apache Group\Apache2\bin).
* Any directory in your Windows PATH environment variable.
- To make php5ts.dll available you have three options: copy
+ To make php7ts.dll available you have three options: copy
the file to the Windows system directory, copy the file to the web
server's directory, or add your PHP directory, C:\php to the PATH. For
better maintenance, we advise you to follow the last option, add C:\php
@@ -463,13 +463,13 @@ ActiveScript
Note: You should read the manual installation steps first!
After installing PHP, you should download the ActiveScript DLL
- (php5activescript.dll) and place it in the main PHP folder (e.g.
+ (php7activescript.dll) and place it in the main PHP folder (e.g.
C:\php).
After having all the files needed, you must register the DLL on your
system. To achieve this, open a Command Prompt window (located in the
Start Menu). Then go to your PHP directory by typing something like cd
- C:\php. To register the DLL just type regsvr32 php5activescript.dll.
+ C:\php. To register the DLL just type regsvr32 php7activescript.dll.
To test if ActiveScript is working, create a new file, named test.wsf
(the extension is very important) and type:
@@ -516,8 +516,8 @@ General considerations for all installations of PHP with IIS
Also, CGI users may want to set the cgi.redirect_status_env
directive. When using directives, be sure these directives aren't
commented out inside php.ini.
- * The PHP 4 CGI is named php.exe while in PHP 5 it's php-cgi.exe. In
- PHP 5, php.exe is the CLI, and not the CGI.
+ * The PHP 4 CGI is named php.exe while in PHP 7 it's php-cgi.exe. In
+ PHP 7, php.exe is the CLI, and not the CGI.
* Modify the Windows PATH environment variable to include the PHP
directory. This way the PHP DLL files and PHP executables can all
remain in the PHP directory without cluttering up the Windows
@@ -529,12 +529,12 @@ General considerations for all installations of PHP with IIS
* Be sure the extension_dir and doc_root PHP directives are
appropriately set in php.ini. These directives depend on the system
that PHP is being installed on. In PHP 4, the extension_dir is
- extensions while with PHP 5 it's ext. So, an example PHP 5
+ extensions while with PHP 7 it's ext. So, an example PHP 7
extensions_dir value is "c:\php\ext" and an example IIS doc_root
value is "c:\Inetpub\wwwroot".
* PHP extension DLL files, such as php_mysql.dll and php_curl.dll,
are found in the zip package of the PHP download (not the PHP
- installer). In PHP 5, many extensions are part of PECL and can be
+ installer). In PHP 7, many extensions are part of PECL and can be
downloaded in the "Collection of PECL modules" package. Files such
as php_zip.dll and php_ssh2.dll. Download PHP files here.
* When defining the executable, the 'check that file exists' box may
@@ -561,7 +561,7 @@ Windows NT/200x/XP and IIS 4 or newer
* Change the Execute Permissions to 'Scripts only'
* Click on the 'Configuration' button, and choose the Application
Mappings tab. Click Add and set the Executable path to the
- appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe
+ appropriate CGI file. An example PHP 7 value is: C:\php\php-cgi.exe
Supply .php as the extension. Leave 'Method exclusions' blank, and
check the 'Script engine' checkbox. Now, click OK a few times.
* Set up the appropriate security. (This is done in Internet Service
@@ -574,14 +574,14 @@ Windows NT/200x/XP and IIS 4 or newer
* If you don't want to perform HTTP Authentication using PHP, you can
(and should) skip this step. Under ISAPI Filters, add a new ISAPI
filter. Use PHP as the filter name, and supply a path to the
- php5isapi.dll.
+ php7isapi.dll.
* Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
following:
* Change the Execute Permissions to 'Scripts only'
* Click on the 'Configuration' button, and choose the Application
Mappings tab. Click Add and set the Executable path to the
- appropriate ISAPI DLL. An example PHP 5 value is:
- C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method
+ appropriate ISAPI DLL. An example PHP 7 value is:
+ C:\php\php7isapi.dll Supply .php as the extension. Leave 'Method
exclusions' blank, and check the 'Script engine' checkbox. Now,
click OK a few times.
* Stop IIS completely (NET STOP iisadmin)
@@ -590,7 +590,7 @@ Windows NT/200x/XP and IIS 4 or newer
With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
Extensions, choose "Add a new Web service extension", enter in a name
such as PHP, choose the Add button and for the value browse to either
- the ISAPI file (php5isapi.dll) or CGI (php.exe or
+ the ISAPI file (php7isapi.dll) or CGI (php.exe or
php-cgi.exe) then check "Set extension status to Allowed" and click OK.
In order to use index.php as a default content page, do the following:
@@ -653,12 +653,12 @@ Installing as an Apache module
This assumes PHP is installed to c:\php. Adjust the path if this is not
the case.
- For PHP 5:
+ For PHP 7:
# Add to the end of the LoadModule section
-LoadModule php5_module "C:/php/php5apache.dll"
+LoadModule php7_module "C:/php/php7apache.dll"
# Add to the end of the AddModule section
-AddModule mod_php5.c
+AddModule mod_php7.c
For both:
# Add this line inside the <IfModule mod_mime.c> conditional brace
@@ -681,7 +681,7 @@ AddType application/x-httpd-php .php
# For PHP 4
Action application/x-httpd-php "/php/php.exe"
-# For PHP 5
+# For PHP 7
Action application/x-httpd-php "/php/php-cgi.exe"
# specify the directory where php.ini is
@@ -715,7 +715,7 @@ Apache 2.0.x on Microsoft Windows
Apache 2.2.x Support: Users of Apache 2.2.x may use the
documentation below except the appropriate DLL file is named
- php5apache2_2.dll and it only exists as of PHP 5.2.0. See also
+ php7apache2_2.dll and it only exists as of PHP 7.2.0. See also
http://snaps.php.net/
Warning
@@ -734,8 +734,8 @@ Apache 2.0.x on Microsoft Windows
* PHP 4.3.0 or later available at http://www.php.net/downloads.php.
* the latest stable development version. Get the source code
- http://snaps.php.net/php5-latest.tar.gz or download binaries for
- Windows http://snaps.php.net/win32/php5-win32-latest.zip.
+ http://snaps.php.net/php7-latest.tar.gz or download binaries for
+ Windows http://snaps.php.net/win32/php7-win32-latest.zip.
* a prerelease version downloadable from http://qa.php.net/.
* you have always the option to obtain PHP through SVN.
@@ -782,7 +782,7 @@ AddType application/x-httpd-php .php
# For PHP 4
Action application/x-httpd-php "/php/php.exe"
-# For PHP 5
+# For PHP 7
Action application/x-httpd-php "/php/php-cgi.exe"
Warning
@@ -799,8 +799,8 @@ Installing as an Apache module
Example 2-6. PHP and Apache 2.0 as Module
-# For PHP 5 do something like this:
-LoadModule php5_module "c:/php/php5apache2.dll"
+# For PHP 7 do something like this:
+LoadModule php7_module "c:/php/php7apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
@@ -836,7 +836,7 @@ CGI setup on Sun, iPlanet and Netscape servers
To install PHP as a CGI handler, do the following:
- * Copy php5ts.dll to your systemroot (the directory where you
+ * Copy php7ts.dll to your systemroot (the directory where you
installed Windows)
* Make a file association from the command line. Type the following
two lines:
@@ -861,7 +861,7 @@ NSAPI setup on Sun, iPlanet and Netscape servers
To install PHP with NSAPI, do the following:
- * Copy php5ts.dll to your systemroot (the directory where you
+ * Copy php7ts.dll to your systemroot (the directory where you
installed Windows)
* Make a file association from the command line. Type the following
two lines:
@@ -876,9 +876,9 @@ ftype PHPScript=c:\php\php.exe %1 %*
and add the following: You should place the lines after mime types
init.
-Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="c:/
-php/sapi/php5nsapi.dll"
-Init fn="php5_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_
+Init fn="load-modules" funcs="php7_init,php7_execute,php7_auth_trans" shlib="c:/
+php/sapi/php7nsapi.dll"
+Init fn="php7_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_
ini="c:/path/to/php.ini"]
The php_ini parameter is optional but with it you
@@ -888,12 +888,12 @@ ini="c:/path/to/php.ini"]
<Object name="default"> section, place this line necessarily after
all 'ObjectType' and before all 'AddLog' lines:
-Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value inike
+Service fn="php7_execute" type="magnus-internal/x-httpd-php" [inikey=value inike
y=value ...]
As additional parameters you can add some special
php.ini-values, for example you can set a
- docroot="/path/to/docroot" specific to the context php5_execute is
+ docroot="/path/to/docroot" specific to the context php7_execute is
called. For boolean ini-keys please use 0/1 as value, not
"On","Off",... (this will not work correctly), e.g.
zlib.output_compression=1 instead of zlib.output_compression="On"
@@ -902,7 +902,7 @@ y=value ...]
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
-Service fn=php5_execute [inikey=value inikey=value ...]
+Service fn=php7_execute [inikey=value inikey=value ...]
</Object>
After that you can configure a directory in the Administration
@@ -949,7 +949,7 @@ Special use for error pages or self-made directory listings (PHP >= 4.3.3)
You can use PHP to generate the error pages for "404 Not Found" or
similar. Add the following line to the object in obj.conf for every
error page you want to overwrite:
-Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inik
+Error fn="php7_execute" code=XXX script="/path/to/script.php" [inikey=value inik
ey=value...]
where XXX is the HTTP error code. Please delete any other Error
@@ -961,7 +961,7 @@ ey=value...]
create a PHP script which displays a directory listing and replace the
corresponding default Service line for type="magnus-internal/directory"
in obj.conf with the following:
-Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/scri
+Service fn="php7_execute" type="magnus-internal/directory" script="/path/to/scri
pt.php" [inikey=value inikey=value...]
For both error and directory listing pages the original URI and
@@ -986,8 +986,8 @@ Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
server is used, the detection fails and nsapi_virtual() is disabled.
If this is the case, try the following: Add the following parameter to
- php5_init in magnus.conf/obj.conf:
- Init fn=php5_init ... server_lib="ns-httpdXX.dll"
+ php7_init in magnus.conf/obj.conf:
+ Init fn=php7_init ... server_lib="ns-httpdXX.dll"
where XX is the correct DLL version number. To get it, look in the
server-root for the correct DLL name. The DLL with the biggest filesize
@@ -1023,7 +1023,7 @@ OmniHTTPd Server
select Properties
3. Click on Web Server Global Settings
4. On the 'External' tab, enter: virtual = .php | actual =
- c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
+ c:\php\php.exe (use php-cgi.exe if installing PHP 7), and use the
Add button.
5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php,
and use the Add button.
@@ -1080,11 +1080,11 @@ Installation of extensions on Windows
that require, or used to require, additional PHP DLL files. Here's a
list of built in extensions:
- In PHP 5 (updated PHP 5.0.4), the following changes exist. Built in:
+ In PHP 7 (updated PHP 5.0.4), the following changes exist. Built in:
DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no
longer built in: MySQL and Overload.
- The default location PHP searches for extensions is C:\php5 in PHP 5.
+ The default location PHP searches for extensions is C:\php7 in PHP 7.
To change this setting to reflect your setup of PHP edit your php.ini
file:
@@ -1446,7 +1446,7 @@ Running PHP as an Apache module
(e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
Options" or "AllowOverride All" privileges to do so.
- With PHP 4 and PHP 5, there are several Apache directives that allow
+ With PHP 4 and PHP 7, there are several Apache directives that allow
you to change the PHP configuration from within the Apache
configuration files. For a listing of which directives are PHP_INI_ALL,
PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini
@@ -1481,7 +1481,7 @@ Running PHP as an Apache module
directives.
Example 5-2. Apache configuration example
-<IfModule mod_php5.c>
+<IfModule mod_php7.c>
php_value include_path ".:/usr/local/lib/php"
php_admin_flag engine on
</IfModule>
@@ -1558,7 +1558,7 @@ Chapter 6. Installation FAQ
9. Some operating systems: I have installed PHP without errors, but
when I try to start apache I get undefined symbol errors:
-[mybox:user /src/php5] root# apachectl configtest
+[mybox:user /src/php7] root# apachectl configtest
apachectl: /usr/local/apache/bin/httpd Undefined symbols:
_compress
_uncompress
@@ -1769,7 +1769,7 @@ rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
9. Some operating systems: I have installed PHP without errors, but
when I try to start apache I get undefined symbol errors:
-[mybox:user /src/php5] root# apachectl configtest
+[mybox:user /src/php7] root# apachectl configtest
apachectl: /usr/local/apache/bin/httpd Undefined symbols:
_compress
_uncompress
@@ -1797,7 +1797,7 @@ cgi error:
the browser again. If it still fails then it could be one of the
following:
- * File permissions on your PHP script, php.exe, php5ts.dll, php.ini
+ * File permissions on your PHP script, php.exe, php7ts.dll, php.ini
or any PHP extensions you are trying to load are such that the
anonymous internet user ISUR_<machinename> cannot access them.
* The script file does not exist (or possibly isn't where you think
@@ -1917,8 +1917,8 @@ cgi error:
AddHandler php-script php
AddType text/html php
-# PHP 5
-AddHandler php5-script php
+# PHP 7
+AddHandler php7-script php
AddType text/html php
This solution doesn't work for Apache 1 as PHP module doesn't catch
diff --git a/win32/php5.dsp b/win32/php5.dsp
deleted file mode 100644
index 0b5b9a6d6b..0000000000
--- a/win32/php5.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php5 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5.mak" CFG="php5 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5 - Win32 Release_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release"
-
-!ELSEIF "$(CFG)" == "php5 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5nts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"c:\php-fcgi\php.exe" /pdbtype:sept /libpath:"..\Debug"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php5 - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php5___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex\\" /I "..\bindlib_w32" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release\php.exe" /libpath:"Release"
-# ADD LINK32 php5nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5 - Win32 Release"
-# Name "php5 - Win32 Debug"
-# Name "php5 - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# End Group
-# End Target
-# End Project
diff --git a/win32/php5.dsw b/win32/php5.dsw
deleted file mode 100644
index d6efc98ee2..0000000000
--- a/win32/php5.dsw
+++ /dev/null
@@ -1,107 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "fastcgi"=..\sapi\fastcgi\fastcgi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5"=.\php5.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5dll"=.\php5dll.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp
deleted file mode 100644
index cc56f538af..0000000000
--- a/win32/php5dll.dsp
+++ /dev/null
@@ -1,1643 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5dll.mak" CFG="php5dll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5dll - Win32 Release_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\php-fcgi\"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D "MSVC5" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D "ZEND_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib TSRM.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"c:\php-fcgi\php5nts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug" /libpath:"..\Zend\Debug" /libpath:"..\..\bindlib_w32\Debug"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib tsrm.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php5nts.dll" /libpath:"..\Zend\Release" /libpath:"..\TSRM\Release_TS" /libpath:"..\..\bindlib_w32\Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5dll___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php5dll___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D ZEND_DEBUG=0 /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/php5nts.dll" /libpath:"TSRM\Release" /libpath:"Zend\Release" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib tsrm.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php5nts.dll" /libpath:"..\Zend\Release_inline" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\..\bindlib_w32\Release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5dll - Win32 Debug"
-# Name "php5dll - Win32 Release"
-# Name "php5dll - Win32 Release_inline"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\css.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\proc_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\memory_streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\user_streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\user_filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_realpath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var_unserializer.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\versioning.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_metaphone.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\chartables.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\get.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\maketables.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\study.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ctype\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\overload\overload.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\tokenizer\tokenizer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\compat.c
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-
-!IF "$(CFG)" == "php5dll - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php5dll - Win32 Release_inline"
-
-# PROP Intermediate_Dir "..\Release_inline_bcmath"
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\COM.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\VARIANT.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\com.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_COM.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_VARIANT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_versioning.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\variant.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# End Group
-# Begin Group "Support"
-
-# PROP Default_Filter ""
-# End Target
-# End Project
diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp
deleted file mode 100644
index 3755ea79f9..0000000000
--- a/win32/php5dllts.dsp
+++ /dev/null
@@ -1,2719 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5dllts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php5dllts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5dllts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5dllts.mak" CFG="php5dllts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5dllts - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5dllts - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5dllts - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php5dllts - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"msvcrt" /out:"..\Debug_TS\php5ts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug_TS" /libpath:"..\Zend\Debug_TS" /libpath:"..\..\bindlib_w32\Debug" /libpath:"Debug_TS" /libpath:"..\..\zlib\Debug" /libpath:"..\..\libxml\lib\Debug" /libpath:"..\ext\sqlite\Debug_TS" /libpath:"..\..\libiconv\lib"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_STATIC" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"Release_TS" /libpath:"..\ext\sqlite\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5dllts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5dllts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"Release_TS/php5ts.dll" /libpath:"TSRM\Release_TS" /libpath:"Zend\Release_TS" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TS_inline\php5ts.dll" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\Zend\Release_TS_inline" /libpath:"Release_TS_Inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib" /libpath:"..\ext\sqlite\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5dllts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php5dllts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\..\zlib" /I "..\Zend" /I "..\TSRM" /I "..\..\libxml\include" /I "..\ext\sqlite\libsqlite\src" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "LIBXML_THREAD_ENABLED" /D "LIBXML_STATIC" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ws2_32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib zlib.lib libxml2_a.lib Urlmon.lib libsqlite.lib iconv_a.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\Release_TSDbg\php5ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"Release_TSDbg" /libpath:"..\ext\sqlite\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\..\zlib\Release" /libpath:"..\..\libxml\lib\Release" /libpath:"..\..\libiconv\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5dllts - Win32 Debug_TS"
-# Name "php5dllts - Win32 Release_TS"
-# Name "php5dllts - Win32 Release_TS_inline"
-# Name "php5dllts - Win32 Release_TSDbg"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\css.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filters.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\globals.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_scandir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_sprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\proc_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\main\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\css.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_regex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_scandir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_streams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\snprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\spprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_chartables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_compile.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_exec.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_fullinfo.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_get.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_globals.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_info.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_maketables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_ord2utf8.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_study.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_tables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_try_flipped.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_ucp_searchfuncs.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_valid_utf8.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_version.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre_xclass.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "DOM"
-
-# PROP Default_Filter ""
-# Begin Group "DOM Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\dom\attr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\cdatasection.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\characterdata.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\comment.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\document.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\documentfragment.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\documenttype.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\dom_iterators.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domconfiguration.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domerrorhandler.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domexception.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domimplementation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domimplementationlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domimplementationsource.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domlocator.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\domstringlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\element.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\entity.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\entityreference.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\namednodemap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\namelist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\node.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\nodelist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\notation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\php_dom.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\processinginstruction.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\string_extend.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\text.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\typeinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\userdatahandler.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\xpath.c
-# End Source File
-# End Group
-# Begin Group "DOM Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\dom\dom_ce.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\dom_fe.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\dom_properties.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\php_dom.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\dom\xml_common.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Group
-# Begin Group "SimpleXML"
-
-# PROP Default_Filter ""
-# Begin Group "SimpleXML Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\simplexml\simplexml.c
-# End Source File
-# End Group
-# Begin Group "SimpleXML Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\simplexml\php_simplexml.h
-# End Source File
-# End Group
-# Begin Group "Resource Files No. 1"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\xml\compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ctype\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\tokenizer\tokenizer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx_api.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "SPL"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 11"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\spl\php_spl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_directory.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_engine.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_exceptions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_iterators.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_observer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_sxe.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 12"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\spl\php_spl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_directory.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_engine.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_exceptions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_iterators.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_observer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_sxe.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Reflection"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 12"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\reflection\php_reflection.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 13"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\reflection\php_reflection.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "XMLReader"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 13"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\xmlreader\php_xmlreader.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 14"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\xmlreader\php_xmlreader.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "XMLwriter"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 14"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\xmlwriter\php_xmlwriter.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 15"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\xmlwriter\php_xmlwriter.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "IConv"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 15"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\iconv\iconv.c
-# ADD CPP /D "PHP_ICONV_EXPORTS"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 16"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\iconv\php_iconv.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Group
-# Begin Group "zlib"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 10 Nr. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\zlib\zlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\zlib\zlib_filter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\zlib\zlib_fopen_wrapper.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 10 Nr. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\zlib\php_zlib.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Standard"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\sha1.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\streamsfuncs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uuencode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var_unserializer.c
-# ADD CPP /W2
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\versioning.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_http.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_lcg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc_includes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_rand.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\php_session.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_sunfuncs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\sha1.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "SQLite"
-
-# PROP Default_Filter ""
-# Begin Group "Header Files No. 5"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\sqlite\php_sqlite.h
-# End Source File
-# End Group
-# Begin Group "Source Files No. 5"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\sqlite\sess_sqlite.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\sqlite\sqlite.c
-# End Source File
-# End Group
-# End Group
-# Begin Group "LIBXML"
-
-# PROP Default_Filter ""
-# Begin Group "Header Files No. 10"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\libxml\php_libxml.h
-# End Source File
-# End Group
-# Begin Group "Source Files No. 9"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\libxml\libxml.c
-# End Source File
-# End Group
-# End Group
-# Begin Group "Date"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 10"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\date\lib\astro.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\parse_date.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\parse_tz.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\php_date.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timelib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timelib_config.h.win32
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-# Begin Custom Build
-InputDir=\Projects\php-5.2\ext\date\lib
-InputPath=..\ext\date\lib\timelib_config.h.win32
-
-"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\timelib_config.h
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-# Begin Custom Build
-InputDir=\Projects\php-5.2\ext\date\lib
-InputPath=..\ext\date\lib\timelib_config.h.win32
-
-"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\timelib_config.h
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputDir=\Projects\php-5.2\ext\date\lib
-InputPath=..\ext\date\lib\timelib_config.h.win32
-
-"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\timelib_config.h
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=\Projects\php-5.2\ext\date\lib
-InputPath=..\ext\date\lib\timelib_config.h.win32
-
-"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) $(InputDir)\timelib_config.h
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\tm2unixtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\unixtime2tm.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 11"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\date\lib\astro.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\fallbackmap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\php_date.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timelib.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timezonedb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timezonemap.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\crypt_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\glob.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\md5crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\select.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\build\wsyslog.mc
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputDir=.\build
-IntDir=.\Release_TSDbg
-InputPath=.\build\wsyslog.mc
-
-"wsyslog.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- mc -h $(InputDir)/.. -r $(InputDir) -x $(IntDir) $(InputPath)
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\crypt_win32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\glob.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\select.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\winutil.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=..\NEWS
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-dist"
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-recommended"
-# End Source File
-# Begin Source File
-
-SOURCE="..\README.CVS-RULES"
-# End Source File
-# Begin Source File
-
-SOURCE=..\TODO
-# End Source File
-# End Group
-# Begin Group "Support"
-
-# PROP Default_Filter ""
-# End Group
-# Begin Group "Streams"
-
-# PROP Default_Filter ""
-# Begin Group "streams headers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_context.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_filter_api.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_mmap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_plain_wrapper.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_transport.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_stream_userspace.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\php_streams_int.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\main\streams\cast.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\filter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\memory.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\mmap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\plain_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\streams.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\transports.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\user_filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\userspace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\streams\xp_socket.c
-# End Source File
-# End Group
-# Begin Group "COM and DotNet"
-
-# PROP Default_Filter ""
-# Begin Group "Header Files No. 9"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_saproxy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\php_com_dotnet.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\php_com_dotnet_internal.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_com.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_dotnet.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_extension.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_handlers.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_iterator.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_olechar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_persist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_typeinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com_dotnet\com_variant.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php5dllts.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php5dllts.rc2
-# End Source File
-# Begin Source File
-
-SOURCE=.\phpts.def
-
-!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
-# Begin Custom Build - Generating $(InputPath)
-InputPath=.\phpts.def
-
-"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- builddef.bat > phpts.def
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
-# Begin Custom Build - Generating $(InputPath)
-InputPath=.\phpts.def
-
-"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- builddef.bat > phpts.def
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
-# Begin Custom Build - Generating $(InputPath)
-InputPath=.\phpts.def
-
-"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- builddef.bat > phpts.def
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
-# Begin Custom Build - Generating $(InputPath)
-InputPath=.\phpts.def
-
-"phpts.def" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- builddef.bat > phpts.def
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php5ts.dsp b/win32/php5ts.dsp
deleted file mode 100644
index 3736815127..0000000000
--- a/win32/php5ts.dsp
+++ /dev/null
@@ -1,191 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5ts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php5ts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5ts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5ts.mak" CFG="php5ts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5ts - Win32 Release_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5ts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php5ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5ts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib netapi32.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS/php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php5ts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5ts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
-# ADD LINK32 php5ts.lib winmm.lib ws2_32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\php.exe" /libpath:"..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5ts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5ts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\sapi\cgi\libfcgi\include" /D FCGI_STATIC=1 /D PHP_FASTCGI=1 /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5ts - Win32 Release_TS"
-# Name "php5ts - Win32 Debug_TS"
-# Name "php5ts - Win32 Release_TS_inline"
-# Name "php5ts - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\fastcgi.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\php_getopt.h
-# End Source File
-# End Group
-# Begin Group "libfcgi"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\sapi\cgi\libfcgi\fcgiapp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\libfcgi\os_win32.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php5ts.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php5ts.rc2
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php5ts.dsw b/win32/php5ts.dsw
deleted file mode 100644
index 61ccd1c24b..0000000000
--- a/win32/php5ts.dsw
+++ /dev/null
@@ -1,227 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "EngineSelect"=.\EngineSelect.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ZendTS"=..\Zend\ZendTS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name EngineSelect
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libsqlite"=..\ext\sqlite\libsqlite\src\libsqlite.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php5aolserver"=..\sapi\aolserver\php5aolserver.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5apache"=..\sapi\apache\php5apache.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5apache2"=..\SAPI\APACHE2HANDLER\php5apache2.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5dllts"=.\php5dllts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ZendTS
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libsqlite
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5isapi"=..\sapi\isapi\php5isapi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5nsapi"=..\sapi\nsapi\php5nsapi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5pi3web"=..\sapi\pi3web\php5pi3web.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5ts"=.\php5ts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5ts_cli"=.\php5ts_cli.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "testsuite"=.\testsuite.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5ts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php5ts_cli.dsp b/win32/php5ts_cli.dsp
deleted file mode 100644
index 37a4113ad4..0000000000
--- a/win32/php5ts_cli.dsp
+++ /dev/null
@@ -1,175 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php5ts_cli" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php5ts_cli - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php5ts_cli.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php5ts_cli.mak" CFG="php5ts_cli - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php5ts_cli - Win32 Release_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts_cli - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts_cli - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE "php5ts_cli - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php5ts_cli - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\cli\php.exe" /libpath:"..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib netapi32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS\cli\php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5ts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
-# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\cli\php.exe" /libpath:"..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php5ts_cli - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php5ts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php5ts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-# ADD LINK32 php5ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php5ts_cli - Win32 Release_TS"
-# Name "php5ts_cli - Win32 Debug_TS"
-# Name "php5ts_cli - Win32 Release_TS_inline"
-# Name "php5ts_cli - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cli\getopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cli\php_cli.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\sapi\cli\php_getopt.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\php5ts_cli.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\php5ts_cli.rc2
-# End Source File
-# End Target
-# End Project
diff --git a/win32/php5dllts.rc b/win32/php7dllts.rc
index 2e01037eee..27ec635e25 100644
--- a/win32/php5dllts.rc
+++ b/win32/php7dllts.rc
@@ -70,7 +70,7 @@ END
BEGIN
- "#include ""php5dllts.rc2""\r\n"
+ "#include ""php7dllts.rc2""\r\n"
"\0"
@@ -114,7 +114,7 @@ END
//
-#include "php5dllts.rc2"
+#include "php7dllts.rc2"
diff --git a/win32/php5dllts.rc2 b/win32/php7dllts.rc2
index b05f0af0dc..6bcc652a72 100644
--- a/win32/php5dllts.rc2
+++ b/win32/php7dllts.rc2
@@ -1,5 +1,5 @@
//
-// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+// php7dllts.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
@@ -42,7 +42,7 @@ BEGIN
VALUE "InternalName", "php\0"
VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php5ts.dll\0"
+ VALUE "OriginalFilename", "php7ts.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "PHP Thread Safe\0"
VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
diff --git a/win32/php5ts.rc b/win32/php7ts.rc
index d9a4aa541b..b725155809 100644
--- a/win32/php5ts.rc
+++ b/win32/php7ts.rc
@@ -70,7 +70,7 @@ END
BEGIN
- "#include ""php5ts.rc2""\r\n"
+ "#include ""php7ts.rc2""\r\n"
"\0"
@@ -114,7 +114,7 @@ END
//
-#include "php5ts.rc2"
+#include "php7ts.rc2"
diff --git a/win32/php5ts.rc2 b/win32/php7ts.rc2
index 3a53a900ec..6c813de23c 100644
--- a/win32/php5ts.rc2
+++ b/win32/php7ts.rc2
@@ -1,5 +1,5 @@
//
-// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+// php7dllts.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
diff --git a/win32/php5ts_cli.rc b/win32/php7ts_cli.rc
index 0053e0c7f2..3478b94bd7 100644
--- a/win32/php5ts_cli.rc
+++ b/win32/php7ts_cli.rc
@@ -70,7 +70,7 @@ END
BEGIN
- "#include ""php5ts_cli.rc2""\r\n"
+ "#include ""php7ts_cli.rc2""\r\n"
"\0"
@@ -114,7 +114,7 @@ END
//
-#include "php5ts_cli.rc2"
+#include "php7ts_cli.rc2"
diff --git a/win32/php5ts_cli.rc2 b/win32/php7ts_cli.rc2
index 517bd4ab34..004808c16b 100644
--- a/win32/php5ts_cli.rc2
+++ b/win32/php7ts_cli.rc2
@@ -1,5 +1,5 @@
//
-// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+// php7dllts.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
diff --git a/win32/php_modules.dsw b/win32/php_modules.dsw
deleted file mode 100644
index 81f22fa44f..0000000000
--- a/win32/php_modules.dsw
+++ /dev/null
@@ -1,473 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bz2"=..\ext\bz2\bz2.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ctype"=..\ext\ctype\ctype.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "curl"=..\ext\curl\curl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dba"=..\ext\dba\dba.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbase"=..\ext\dbase\dbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbx"=..\ext\dbx\dbx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "exif"=..\ext\exif\exif.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fbsql"=..\ext\fbsql\fbsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fdf"=..\ext\fdf\fdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "filepro"=..\ext\filepro\filepro.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gd"=..\ext\gd\gd.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gettext"=..\ext\gettext\gettext.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "iconv"=..\ext\iconv\iconv.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ifx"=..\ext\informix\ifx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "imap"=..\ext\imap\imap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ingres"=..\ext\ingres_ii\ingres.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "interbase"=..\ext\interbase\interbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldap"=..\ext\ldap\ldap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mbstring"=..\ext\mbstring\mbstring.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mcrypt"=..\ext\mcrypt\mcrypt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mcve"=..\ext\mcve\mcve.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mhash"=..\ext\mhash\mhash.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mime_magic"=..\ext\mime_magic\mime_magic.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ming"=..\ext\ming\ming.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "msql"=..\ext\msql\msql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mssql"=..\ext\mssql\mssql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mysql"=..\ext\mysql\mysql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oci8"=..\ext\oci8\oci8.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "openssl"=..\ext\openssl\openssl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oracle"=..\ext\oracle\oracle.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pgsql"=..\ext\pgsql\pgsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "shmop"=..\ext\shmop\shmop.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "snmp"=..\ext\snmp\snmp.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sockets"=..\ext\sockets\sockets.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sybase_ct"=..\ext\sybase_ct\sybase_ct.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "tokenizer"=..\ext\tokenizer\tokenizer.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "xmlrpc"=..\ext\xmlrpc\xmlrpc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "xsl"=..\ext\xsl\xsl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php_stdint.h b/win32/php_stdint.h
index 858dcb5c33..71aec2a358 100644
--- a/win32/php_stdint.h
+++ b/win32/php_stdint.h
@@ -116,13 +116,8 @@ typedef uint32_t u_int32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
-#ifdef _WIN64 // [
- typedef __int64 intptr_t;
- typedef unsigned __int64 uintptr_t;
-#else // _WIN64 ][
- typedef _W64 int intptr_t;
- typedef _W64 unsigned int uintptr_t;
-#endif // _WIN64 ]
+/* intptr_t and uintptr_t are available from stddef.h */
+#include <stddef.h>
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h
index 6bf9ba5b71..42f5ec9411 100644
--- a/win32/php_win32_globals.h
+++ b/win32/php_win32_globals.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/registry.c b/win32/registry.c
index 75854910e0..10372cd624 100644
--- a/win32/registry.c
+++ b/win32/registry.c
@@ -240,18 +240,18 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
if (pht != NULL) {
HashTable *ht = pht;
zend_string *index;
- php_uint_t num;
+ zend_ulong num;
zval *data;
ZEND_HASH_FOREACH_KEY_VAL(ht, num, index, data) {
- zend_alter_ini_entry(index, Z_STRVAL_P(data), Z_STRSIZE_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ zend_alter_ini_entry(index, Z_STR_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
} ZEND_HASH_FOREACH_END();
/*
for (zend_hash_internal_pointer_reset_ex(ht, &pos);
zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS &&
zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING;
zend_hash_move_forward_ex(ht, &pos)) {
- zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRSIZE_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
}
break;
*/
diff --git a/win32/resource.h b/win32/resource.h
index 3e7e4c0ed1..13760d4962 100644
--- a/win32/resource.h
+++ b/win32/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
-// Used by php5dllts.rc
+// Used by php7dllts.rc
//
// Next default values for new objects
diff --git a/win32/select.c b/win32/select.c
index 8e44636945..636c84364a 100644
--- a/win32/select.c
+++ b/win32/select.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/select.h b/win32/select.h
index a8d8496295..dafe76c1bc 100644
--- a/win32/select.h
+++ b/win32/select.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 85a2e5b4c5..3e81ecd4bc 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -87,9 +87,9 @@ char LocalHost[HOST_NAME_LEN];
#endif
char seps[] = " ,\t\n";
#ifndef NETWARE
-char *php_mailer = "PHP 5 WIN32";
+char *php_mailer = "PHP 7 WIN32";
#else
-char *php_mailer = "PHP 5 NetWare";
+char *php_mailer = "PHP 7 NetWare";
#endif /* NETWARE */
/* Error messages */
@@ -165,7 +165,7 @@ static zend_string *php_win32_mail_trim_header(char *header TSRMLS_DC)
}
ZVAL_STRINGL(&replace, PHP_WIN32_MAIL_UNIFY_REPLACE, strlen(PHP_WIN32_MAIL_UNIFY_REPLACE));
- regex = STR_INIT(PHP_WIN32_MAIL_UNIFY_REPLACE, sizeof(PHP_WIN32_MAIL_UNIFY_REPLACE)-1, 0);
+ regex = zend_string_init(PHP_WIN32_MAIL_UNIFY_REPLACE, sizeof(PHP_WIN32_MAIL_UNIFY_REPLACE)-1, 0);
//zend_string *php_pcre_replace(zend_string *regex, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int limit, int *replace_count TSRMLS_DC);
@@ -178,12 +178,12 @@ static zend_string *php_win32_mail_trim_header(char *header TSRMLS_DC)
if (NULL == result) {
zval_ptr_dtor(&replace);
- STR_FREE(regex);
+ zend_string_free(regex);
return NULL;
}
ZVAL_STRING(&replace, PHP_WIN32_MAIL_RMVDBL_PATTERN);
- regex = STR_INIT(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0);
+ regex = zend_string_init(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0);
result2 = php_pcre_replace(regex,
result->val, result->len,
@@ -247,7 +247,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
/* Create a lowercased header for all the searches so we're finally case
* insensitive when searching for a pattern. */
- if (NULL == (headers_lc = STR_COPY(headers_trim))) {
+ if (NULL == (headers_lc = zend_string_copy(headers_trim))) {
*error = OUT_OF_MEMORY;
return FAILURE;
}
@@ -276,7 +276,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
}
} else {
if (headers_lc) {
- STR_FREE(headers_lc);
+ zend_string_free(headers_lc);
}
*error = W32_SM_SENDMAIL_FROM_NOT_SET;
return FAILURE;
@@ -360,8 +360,8 @@ PHPAPI char *GetSMErrorText(int index)
}
}
-PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle,
- int needle_len, char *str, int str_len);
+PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle,
+ size_t needle_len, char *str, size_t str_len);
/*********************************************************************
@@ -638,19 +638,19 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
c = *e2;
*e2 = '\0';
if ((res = Post(p)) != SUCCESS) {
- STR_FREE(data_cln);
+ zend_string_free(data_cln);
return(res);
}
*e2 = c;
p = e2;
}
if ((res = Post(p)) != SUCCESS) {
- STR_FREE(data_cln);
+ zend_string_free(data_cln);
return(res);
}
}
- STR_FREE(data_cln);
+ zend_string_free(data_cln);
/*send termination dot */
if ((res = Post("\r\n.\r\n")) != SUCCESS)
@@ -709,7 +709,7 @@ static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders T
zend_string *dt = php_format_date("r", 1, tNow, 1 TSRMLS_CC);
snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", dt->val);
- STR_FREE(dt);
+ zend_string_free(dt);
}
if (!headers_lc || !strstr(headers_lc, "from:")) {
diff --git a/win32/sockets.c b/win32/sockets.c
index 8b3898bb3c..1fceabb90a 100644
--- a/win32/sockets.c
+++ b/win32/sockets.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/sockets.h b/win32/sockets.h
index 78a0d3a967..c5cd4d19ed 100644
--- a/win32/sockets.h
+++ b/win32/sockets.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/syslog.h b/win32/syslog.h
index 06397d0f90..5274f64c44 100644
--- a/win32/syslog.h
+++ b/win32/syslog.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/syslog.reg b/win32/syslog.reg
index cb12d6e6b9..2974bfbd48 100644
--- a/win32/syslog.reg
+++ b/win32/syslog.reg
@@ -2,4 +2,4 @@ REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.3.99-dev]
"TypesSupported"=dword:00000007
-"EventMessageFile"="g:\\test\\srctrunkinstall\\php5ts.dll"
+"EventMessageFile"="g:\\test\\srctrunkinstall\\php7ts.dll"
diff --git a/win32/testsuite.dsp b/win32/testsuite.dsp
deleted file mode 100644
index 5cd65622f5..0000000000
--- a/win32/testsuite.dsp
+++ /dev/null
@@ -1,150 +0,0 @@
-# Microsoft Developer Studio Project File - Name="testsuite" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Generic Project" 0x010a
-
-CFG=testsuite - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak" CFG="testsuite - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "testsuite - Win32 Release_TS_Inline" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TSDbg" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Debug_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-MTL=midl.exe
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_Inline"
-# PROP BASE Intermediate_Dir "Release_TS_Inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_Inline"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TSDbg"
-# PROP BASE Intermediate_Dir "Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "testsuite - Win32 Release_TS_Inline"
-# Name "testsuite - Win32 Release_TS"
-# Name "testsuite - Win32 Release_TSDbg"
-# Name "testsuite - Win32 Debug_TS"
-# Begin Source File
-
-SOURCE=..\results.txt
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP Intermediate_Dir "..\Release_TS_Inline"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS_Inline
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS_inline
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP Intermediate_Dir "..\Release_TS"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP Intermediate_Dir "..\Release_TSDbg"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TSDbg
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TSDbg
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "..\Debug_TS"
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
diff --git a/win32/winutil.c b/win32/winutil.c
index 9984d3addc..5203fb4e66 100644
--- a/win32/winutil.c
+++ b/win32/winutil.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/win32/winutil.h b/win32/winutil.h
index e0193d33f3..74d72062c4 100644
--- a/win32/winutil.h
+++ b/win32/winutil.h
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+